Restructure crypto, gdbm, and curses tests to depend on existence of
authorChris Hanson <org/chris-hanson/cph>
Mon, 2 Jul 2001 01:20:32 +0000 (01:20 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 2 Jul 2001 01:20:32 +0000 (01:20 +0000)
appropriate header files as well as the library files.  The presence
of the library file is no guarantee that we have the headers.

v7/src/microcode/configure.in

index 0b7ac606e5a8f889e129a2b9fede2c2bf2824529..d0814dfb71310ea2c833257b4e30fd2c758482db 100644 (file)
@@ -17,7 +17,7 @@ dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 dnl 02111-1307, USA.
 
-AC_REVISION([$Id: configure.in,v 11.12 2001/04/15 21:12:29 cph Exp $])
+AC_REVISION([$Id: configure.in,v 11.13 2001/07/02 01:20:32 cph Exp $])
 AC_INIT(boot.c)
 AC_CONFIG_HEADER(config.h)
 
@@ -71,15 +71,6 @@ 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])
@@ -90,150 +81,27 @@ AC_CHECK_LIB(mcrypt, mcrypt_generic_init,
     [scheme_cv_lib_mcrypt=yes],
     [scheme_cv_lib_mcrypt=no],
     [-lltdl])
-
-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
-
-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
-HAVE_MD5=no
-
-dnl The OpenSSL crypto library provides support for both, and is preferred.
-if test "${scheme_cv_lib_crypto}" = "yes"; then
-    AC_DEFINE(HAVE_LIBCRYPTO)
-    if test "${enable_dynamic_crypto}" = "yes"; then
-       MODULE_BASES="${MODULE_BASES} prbfish prmd5"
-       PRBFISH_LIBS="-lcrypto"
-       PRMD5_LIBS="-lcrypto"
-    else
-       QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lcrypto"
-       OPTIONAL_BASES="${OPTIONAL_BASES} prbfish prmd5"
-    fi
-    HAVE_BLOWFISH=yes
-    HAVE_MD5=yes
-fi
-
-dnl The mhash library provides md5 support.  It can be loaded in addition
-dnl to other MD5 libraries and provides a rich set of hashes.
-if test "${scheme_cv_lib_mhash}" = "yes"; then
-    AC_DEFINE(HAVE_LIBMHASH)
-    if test "${enable_dynamic_crypto}" = "yes"; then
-       MODULE_BASES="${MODULE_BASES} prmhash"
-    else
-       QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lmhash"
-       OPTIONAL_BASES="${OPTIONAL_BASES} prmhash"
-    fi
-    HAVE_MD5=yes
-fi
-
-dnl The mcrypt library provides blowfish, but its CFB mode is 8 bit.
-dnl We have been using 64-bit CFB, so this isn't really compatible.
-dnl But mcrypt provides many ciphers and can be loaded in addition.
-if test "${scheme_cv_lib_mcrypt}" = "yes"; then
-    AC_DEFINE(HAVE_LIBMCRYPT)
-    if test "${enable_dynamic_crypto}" = "yes"; then
-       MODULE_BASES="${MODULE_BASES} prmcrypt"
-    else
-       QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lmcrypt -lltdl"
-       OPTIONAL_BASES="${OPTIONAL_BASES} prmcrypt"
-    fi
-fi
-
-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
-           MODULE_BASES="${MODULE_BASES} prbfish"
-           PRBFISH_LIBS="-lblowfish"
-       else
-           STATIC_LIBS="${STATIC_LIBS} -lblowfish"
-           OPTIONAL_BASES="${OPTIONAL_BASES} prbfish"
-       fi
-    fi
-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
-           MODULE_BASES="${MODULE_BASES} prmd5"
-           PRMD5_LIBS="-lmd5"
-       else
-           STATIC_LIBS="${STATIC_LIBS} -lmd5"
-           OPTIONAL_BASES="${OPTIONAL_BASES} prmd5"
-       fi
-    fi
-fi
-
-
-dnl gdbm support.
+AC_CHECK_LIB(blowfish, BF_set_key,
+    [scheme_cv_lib_blowfish=yes],
+    [scheme_cv_lib_blowfish=no])
+AC_CHECK_LIB(md5, MD5Init,
+    [scheme_cv_lib_md5=yes],
+    [scheme_cv_lib_md5=no])
 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"
-    OPTIONAL_BASES="${OPTIONAL_BASES} prgdbm"
-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
-else
-    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
-    STATIC_LIBS="${STATIC_LIBS}${QUASI_STATIC_LIBS}"
-fi
+AC_CHECK_LIB(ncurses, tparam,
+    [scheme_cv_lib_ncurses_defines_tparam=yes],
+    [scheme_cv_lib_ncurses_defines_tparam=no])
+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])
 
 dnl Checks for header files.
 AC_HEADER_DIRENT
@@ -245,6 +113,7 @@ AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/poll.h)
 AC_CHECK_HEADERS(sys/ptyio.h sys/socket.h sys/time.h sys/un.h sys/vfs.h)
 AC_CHECK_HEADERS(termio.h termios.h unistd.h utime.h)
 AC_CHECK_HEADERS(openssl/blowfish.h openssl/md5.h blowfish.h md5.h)
+AC_CHECK_HEADERS(mhash.h mcrypt.h gdbm.h curses.h term.h)
 
 dnl Checks for typedefs
 AC_TYPE_MODE_T
@@ -531,6 +400,166 @@ AC_PATH_XTRA
 AC_SYS_LONG_FILE_NAMES
 AC_SYS_RESTARTABLE_SYSCALLS
 
+dnl OK, now some complex logic to handle the crypto stuff.
+
+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 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"
+
+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"
+HAVE_MD5="no"
+
+dnl The OpenSSL crypto library provides support for both, and is preferred.
+if test "${scheme_cv_lib_crypto}" = "yes"; then
+    AC_DEFINE(HAVE_LIBCRYPTO)
+    if test "${ac_cv_header_openssl_blowfish_h}" = "yes" \
+           || test "${ac_cv_header_blowfish_h}" = "yes"; then
+       if test "${enable_dynamic_crypto}" = "yes"; then
+           MODULE_BASES="${MODULE_BASES} prbfish"
+           PRBFISH_LIBS="-lcrypto"
+       else
+           OPTIONAL_BASES="${OPTIONAL_BASES} prbfish"
+       fi
+       HAVE_BLOWFISH="yes"
+    fi
+    if test "${ac_cv_header_openssl_md5_h}" = "yes" \
+           || test "${ac_cv_header_md5_h}" = "yes"; then
+       if test "${enable_dynamic_crypto}" = "yes"; then
+           MODULE_BASES="${MODULE_BASES} prmd5"
+           PRMD5_LIBS="-lcrypto"
+       else
+           OPTIONAL_BASES="${OPTIONAL_BASES} prmd5"
+       fi
+       HAVE_MD5="yes"
+    fi
+    if test "${enable_dynamic_crypto}" = "no"; then
+       if test "${HAVE_BLOWFISH}" = "yes" || test "${HAVE_MD5}" = "yes"; then
+           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lcrypto"
+       fi
+    fi
+fi
+
+dnl The mhash library provides md5 support.  It can be loaded in addition
+dnl to other MD5 libraries and provides a rich set of hashes.
+if test "${scheme_cv_lib_mhash}" = "yes"; then
+    AC_DEFINE(HAVE_LIBMHASH)
+    if test "${ac_cv_header_mhash_h}" = "yes"; then
+       if test "${enable_dynamic_crypto}" = "yes"; then
+           MODULE_BASES="${MODULE_BASES} prmhash"
+       else
+           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lmhash"
+           OPTIONAL_BASES="${OPTIONAL_BASES} prmhash"
+       fi
+       HAVE_MD5="yes"
+    fi
+fi
+
+dnl The mcrypt library provides blowfish, but its CFB mode is 8 bit.
+dnl We have been using 64-bit CFB, so this isn't really compatible.
+dnl But mcrypt provides many ciphers and can be loaded in addition.
+if test "${scheme_cv_lib_mcrypt}" = "yes"; then
+    AC_DEFINE(HAVE_LIBMCRYPT)
+    if test "${ac_cv_header_mcrypt_h}" = "yes"; then
+       if test "${enable_dynamic_crypto}" = "yes"; then
+           MODULE_BASES="${MODULE_BASES} prmcrypt"
+       else
+           QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lmcrypt -lltdl"
+           OPTIONAL_BASES="${OPTIONAL_BASES} prmcrypt"
+       fi
+    fi
+fi
+
+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
+    if test "${scheme_cv_lib_blowfish}" = "yes"; then
+       AC_DEFINE(HAVE_LIBBLOWFISH)
+       if test "${ac_cv_header_blowfish_h}" = "yes"; then
+           if test "${enable_dynamic_crypto}" = "yes"; then
+               MODULE_BASES="${MODULE_BASES} prbfish"
+               PRBFISH_LIBS="-lblowfish"
+           else
+               STATIC_LIBS="${STATIC_LIBS} -lblowfish"
+               OPTIONAL_BASES="${OPTIONAL_BASES} prbfish"
+           fi
+           HAVE_BLOWFISH="yes"
+       fi
+    fi
+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
+    if test "${scheme_cv_lib_md5}" = "yes"; then
+       AC_DEFINE(HAVE_LIBMD5)
+       if test "${ac_cv_header_md5_h}" = "yes"; then
+           if test "${enable_dynamic_crypto}" = "yes"; then
+               MODULE_BASES="${MODULE_BASES} prmd5"
+               PRMD5_LIBS="-lmd5"
+           else
+               STATIC_LIBS="${STATIC_LIBS} -lmd5"
+               OPTIONAL_BASES="${OPTIONAL_BASES} prmd5"
+           fi
+           HAVE_MD5="yes"
+       fi
+    fi
+fi
+
+dnl gdbm support.
+if test "${scheme_cv_lib_gdbm}" = "yes"; then
+    AC_DEFINE(HAVE_LIBGDBM)
+    if test "${ac_cv_header_gdbm_h}" = "yes"; then
+       QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lgdbm"
+       OPTIONAL_BASES="${OPTIONAL_BASES} prgdbm"
+    fi
+fi
+
+dnl curses/termcap/terminfo support.
+if test "${scheme_cv_lib_ncurses}" = "yes"; then
+    AC_DEFINE(HAVE_LIBNCURSES)
+    if test "${ac_cv_header_curses_h}" = "yes" \
+       && test "${ac_cv_header_term_h}" = "yes"; then
+       QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lncurses"
+       if test "${scheme_cv_lib_ncurses_defines_tparam}" = "yes"; then
+           AC_DEFINE(LIBNCURSES_DEFINES_TPARAM)
+       else
+           OPTIONAL_BASES="${OPTIONAL_BASES} terminfo"
+       fi
+    fi
+else
+    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
+       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
+    STATIC_LIBS="${STATIC_LIBS}${QUASI_STATIC_LIBS}"
+fi
+
 dnl Add support for X if present.
 if test "${no_x}" = "yes"; then
     LIB_X11=