Generalize handling of modules. Generate position-independent code
authorChris Hanson <org/chris-hanson/cph>
Fri, 9 Mar 2001 16:13:02 +0000 (16:13 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 9 Mar 2001 16:13:02 +0000 (16:13 +0000)
for modules.

v7/src/microcode/configure.in
v7/src/microcode/prbfish.c
v7/src/microcode/prmcrypt.c
v7/src/microcode/prmd5.c
v7/src/microcode/prmhash.c

index 4288b6227c768ce9f52aaabcbbb6f48588d61cfc..458f77739584476153fc6287bb3a445515e32cec 100644 (file)
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License
 dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-AC_REVISION([$Id: configure.in,v 11.9 2001/03/09 15:49:03 cph Exp $])
+AC_REVISION([$Id: configure.in,v 11.10 2001/03/09 16:08:27 cph Exp $])
 AC_INIT(boot.c)
 AC_CONFIG_HEADER(config.h)
 
@@ -49,7 +49,7 @@ PRMD5_LIBS=
 SCHEME_DEFS=
 DLD_LDFLAGS=
 MODULE_BASES=
-MODULE_CFLAGS=
+MODULE_CFLAGS="-DCOMPILE_AS_MODULE"
 MODULE_LDFLAGS=
 
 dnl Checks for programs.
@@ -65,6 +65,16 @@ fi
 dnl Checks for libraries.
 AC_CHECK_LIB(dl, dlopen)
 AC_CHECK_LIB(m, exp)
+
+if test "${ac_cv_lib_dl_dlopen}" = "yes"; then
+    OPTIONAL_BASES="${OPTIONAL_BASES} pruxdld"
+    enable_dynamic_crypto="${enable_dynamic_crypto:-yes}"
+else
+    enable_dynamic_crypto=no
+fi
+
+dnl OK, now some complex logic to handle the crypto stuff.
+
 AC_CHECK_LIB(crypto, BF_set_key,
     [scheme_cv_lib_crypto=yes],
     [scheme_cv_lib_crypto=no])
@@ -75,48 +85,12 @@ AC_CHECK_LIB(mcrypt, mcrypt_generic_init,
     [scheme_cv_lib_mcrypt=yes],
     [scheme_cv_lib_mcrypt=no],
     [-lltdl])
-AC_CHECK_LIB(md5, MD5Init,
-    [scheme_cv_lib_md5=yes],
-    [scheme_cv_lib_md5=no])
-AC_CHECK_LIB(blowfish, BF_set_key,
-    [scheme_cv_lib_blowfish=yes],
-    [scheme_cv_lib_blowfish=no])
-AC_CHECK_LIB(gdbm, gdbm_open,
-    [scheme_cv_lib_gdbm=yes],
-    [scheme_cv_lib_gdbm=no])
-AC_CHECK_LIB(ncurses, tparm,
-    [scheme_cv_lib_ncurses=yes],
-    [scheme_cv_lib_ncurses=no])
-if test "${scheme_cv_lib_ncurses}" = "yes"; then
-    AC_CHECK_LIB(ncurses, tparam,
-       [scheme_cv_lib_ncurses_defines_tparam=yes],
-       [scheme_cv_lib_ncurses_defines_tparam=no])
-fi
-AC_CHECK_LIB(curses, tparm,
-    [scheme_cv_lib_curses=yes],
-    [scheme_cv_lib_curses=no])
-AC_CHECK_LIB(termcap, tparam,
-    [scheme_cv_lib_termcap=yes],
-    [scheme_cv_lib_termcap=no])
-
-if test "${ac_cv_lib_dl_dlopen}" = "yes"; then
-    OPTIONAL_BASES="${OPTIONAL_BASES} pruxdld"
-    enable_dynamic_crypto="${enable_dynamic_crypto:-yes}"
-else
-    enable_dynamic_crypto=no
-fi
-
-dnl OK, now some complex logic to handle the crypto stuff.
 
-dnl First, handle options to enable/disable use of some libraries.
+dnl Handle options to enable/disable use of some libraries.
 test "${with_openssl:-yes}" = "no" && scheme_cv_lib_crypto=no
 test "${with_mhash:-yes}" = "no" && scheme_cv_lib_mhash=no
 test "${with_mcrypt:-yes}" = "no" && scheme_cv_lib_mcrypt=no
 
-if test "${enable_dynamic_crypto}" = "yes"; then
-    SCHEME_DEFS="${SCHEME_DEFS} -DCRYPTO_MODULES"
-fi
-
 dnl Next, we decide which libraries to use.  We mostly want support
 dnl for Blowfish and MD5, each of which can come from multiple libraries.
 HAVE_BLOWFISH=no
@@ -167,6 +141,9 @@ dnl This is a stripped-down library that provides just Blowfish.  It
 dnl seems to be code that was extracted from OpenSSL long ago.  We
 dnl used this for a long time but no longer do.
 if test "${HAVE_BLOWFISH}" = "no"; then
+    AC_CHECK_LIB(blowfish, BF_set_key,
+       [scheme_cv_lib_blowfish=yes],
+       [scheme_cv_lib_blowfish=no])
     if test "${scheme_cv_lib_blowfish}" = "yes"; then
        AC_DEFINE(HAVE_LIBBLOWFISH)
        if test "${enable_dynamic_crypto}" = "yes"; then
@@ -182,6 +159,9 @@ fi
 dnl This is Phil Karn's MD5 implementation, which seems to have nearly
 dnl the same interface as that of OpenSSL.
 if test "${HAVE_MD5}" = "no"; then
+    AC_CHECK_LIB(md5, MD5Init,
+       [scheme_cv_lib_md5=yes],
+       [scheme_cv_lib_md5=no])
     if test "${scheme_cv_lib_md5}" = "yes"; then
        AC_DEFINE(HAVE_LIBMD5)
        if test "${enable_dynamic_crypto}" = "yes"; then
@@ -195,6 +175,10 @@ if test "${HAVE_MD5}" = "no"; then
 fi
 
 
+dnl gdbm support.
+AC_CHECK_LIB(gdbm, gdbm_open,
+    [scheme_cv_lib_gdbm=yes],
+    [scheme_cv_lib_gdbm=no])
 if test "${scheme_cv_lib_gdbm}" = "yes"; then
     AC_DEFINE(HAVE_LIBGDBM)
     QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lgdbm"
@@ -202,26 +186,44 @@ if test "${scheme_cv_lib_gdbm}" = "yes"; then
 fi
 
 
+dnl curses/termcap/terminfo support.
+AC_CHECK_LIB(ncurses, tparm,
+    [scheme_cv_lib_ncurses=yes],
+    [scheme_cv_lib_ncurses=no])
 if test "${scheme_cv_lib_ncurses}" = "yes"; then
     AC_DEFINE(HAVE_LIBNCURSES)
     QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lncurses"
+    AC_CHECK_LIB(ncurses, tparam,
+       [scheme_cv_lib_ncurses_defines_tparam=yes],
+       [scheme_cv_lib_ncurses_defines_tparam=no])
     if test "${scheme_cv_lib_ncurses_defines_tparam}" = "yes"; then
        AC_DEFINE(LIBNCURSES_DEFINES_TPARAM)
     else
        OPTIONAL_BASES="${OPTIONAL_BASES} terminfo"
     fi
-elif test "${scheme_cv_lib_curses}" = "yes"; then
-    AC_DEFINE(HAVE_LIBCURSES)
-    QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lcurses"
-    OPTIONAL_BASES="${OPTIONAL_BASES} terminfo"
-elif test "${scheme_cv_lib_termcap}" = "yes"; then
-    AC_DEFINE(HAVE_LIBTERMCAP)
-    QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -ltermcap"
-    OPTIONAL_BASES="${OPTIONAL_BASES} tparam"
 else
-    OPTIONAL_BASES="${OPTIONAL_BASES} termcap tparam"
+    AC_CHECK_LIB(curses, tparm,
+       [scheme_cv_lib_curses=yes],
+       [scheme_cv_lib_curses=no])
+    if test "${scheme_cv_lib_curses}" = "yes"; then
+       AC_DEFINE(HAVE_LIBCURSES)
+       QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lcurses"
+       OPTIONAL_BASES="${OPTIONAL_BASES} terminfo"
+    else
+       AC_CHECK_LIB(termcap, tparam,
+           [scheme_cv_lib_termcap=yes],
+           [scheme_cv_lib_termcap=no])
+       if test "${scheme_cv_lib_termcap}" = "yes"; then
+           AC_DEFINE(HAVE_LIBTERMCAP)
+           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -ltermcap"
+           OPTIONAL_BASES="${OPTIONAL_BASES} tparam"
+       else
+           OPTIONAL_BASES="${OPTIONAL_BASES} termcap tparam"
+       fi
+    fi
 fi
 
+dnl Decide whether we're using static or dynamic libraries.
 if test "${enable_static_libs:-no}" = "no"; then
     LIBS="${LIBS}${QUASI_STATIC_LIBS}"
 else
index ba920be45bbc85864d9998e3969144c9da9b1116..0bd429764ef32aa526c32d30ecd7d16b3ab8f3d8 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: prbfish.c,v 1.11 2001/03/08 06:28:22 cph Exp $
+$Id: prbfish.c,v 1.12 2001/03/09 16:12:53 cph Exp $
 
 Copyright (c) 1997-2001 Massachusetts Institute of Technology
 
@@ -230,7 +230,7 @@ Returned value is the new value of NUM.")
   PRIMITIVE_RETURN (long_to_integer (num));
 }
 
-#ifdef CRYPTO_MODULES
+#ifdef COMPILE_AS_MODULE
 
 char *
 DEFUN_VOID (dload_initialize_file)
@@ -291,4 +291,4 @@ Returned value is the new value of NUM.");
   return "#prbfish";
 }
 
-#endif
+#endif /* COMPILE_AS_MODULE */
index aab84d22ba0d80e044aa8b399082948c678a6df5..d46b71fbb0e7792663337d5c4d83dfdc5ee989c4 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: prmcrypt.c,v 1.2 2001/03/08 06:28:24 cph Exp $
+$Id: prmcrypt.c,v 1.3 2001/03/09 16:12:56 cph Exp $
 
 Copyright (c) 2001 Massachusetts Institute of Technology
 
@@ -330,7 +330,7 @@ DEFINE_PRIMITIVE ("MCRYPT_MODULE_GET_ALGO_SUPPORTED_KEY_SIZES", Prim_mcrypt_modu
   }
 }
 
-#ifdef CRYPTO_MODULES
+#ifdef COMPILE_AS_MODULE
 
 char *
 DEFUN_VOID (dload_initialize_file)
@@ -384,4 +384,4 @@ DEFUN_VOID (dload_initialize_file)
   return "#prmcrypt";
 }
 
-#endif
+#endif /* COMPILE_AS_MODULE */
index ddbf1e651644486573ef196231a94afdb3a1d4d0..7c5004000a41c2a3958b3a9e976256336fc82399 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: prmd5.c,v 1.6 2001/03/08 06:28:28 cph Exp $
+$Id: prmd5.c,v 1.7 2001/03/09 16:12:58 cph Exp $
 
 Copyright (c) 1997-2001 Massachusetts Institute of Technology
 
@@ -145,7 +145,7 @@ Finalize CONTEXT and return the digest as a 16-byte string.")
   }
 }
 
-#ifdef CRYPTO_MODULES
+#ifdef COMPILE_AS_MODULE
 
 char *
 DEFUN_VOID (dload_initialize_file)
@@ -173,4 +173,4 @@ Finalize CONTEXT and return the digest as a 16-byte string.");
   return "#prmd5";
 }
 
-#endif
+#endif /* COMPILE_AS_MODULE */
index 5db733acecb1a1b7686ebeb2c5f9fd6489283bd3..013ceba34093d9af81843beec5a785c6f6b60609 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: prmhash.c,v 11.2 2001/03/08 06:28:31 cph Exp $
+$Id: prmhash.c,v 11.3 2001/03/09 16:13:02 cph Exp $
 
 Copyright (c) 2000-2001 Massachusetts Institute of Technology
 
@@ -370,7 +370,7 @@ DEFINE_PRIMITIVE ("MHASH_KEYGEN", Prim_mhash_keygen, 4, 4, 0)
   }
 }
 
-#ifdef CRYPTO_MODULES
+#ifdef COMPILE_AS_MODULE
 
 char *
 DEFUN_VOID (dload_initialize_file)
@@ -412,4 +412,4 @@ DEFUN_VOID (dload_initialize_file)
   return "#prmd5";
 }
 
-#endif
+#endif /* COMPILE_AS_MODULE */