aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac265
1 files changed, 135 insertions, 130 deletions
diff --git a/configure.ac b/configure.ac
index d9f9783f0..0ad654790 100644
--- a/configure.ac
+++ b/configure.ac
@@ -168,9 +168,10 @@ curl_verbose_msg="enabled (--disable-verbose)"
init_ssl_msg=${curl_ssl_msg}
dnl
-dnl Save anything in $LIBS for later
+dnl Save some initial values the user might have provided
dnl
-ALL_LIBS=$LIBS
+INITIAL_LDFLAGS=$LDFLAGS
+INITIAL_LIBS=$LIBS
dnl
dnl Detect the canonical host and target build environment
@@ -682,6 +683,20 @@ dnl **********************************************************************
dnl Checks for libraries.
dnl **********************************************************************
+AC_MSG_CHECKING([whether to use libgcc])
+AC_ARG_ENABLE(libgcc,
+AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
+[ case "$enableval" in
+ yes)
+ LIBS="-lgcc $LIBS"
+ AC_MSG_RESULT(yes)
+ ;;
+ *) AC_MSG_RESULT(no)
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
CURL_CHECK_LIB_XNET
dnl gethostbyname without lib or in the nsl lib?
@@ -690,7 +705,7 @@ AC_CHECK_FUNC(gethostbyname,
],
[ AC_CHECK_LIB(nsl, gethostbyname,
[HAVE_GETHOSTBYNAME="1"
- LIBS="$LIBS -lnsl"
+ LIBS="-lnsl $LIBS"
])
])
@@ -699,7 +714,7 @@ then
dnl gethostbyname in the socket lib?
AC_CHECK_LIB(socket, gethostbyname,
[HAVE_GETHOSTBYNAME="1"
- LIBS="$LIBS -lsocket"
+ LIBS="-lsocket $LIBS"
])
fi
@@ -710,7 +725,7 @@ then
[HAVE_GETHOSTBYNAME="1"
CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
LDFLAGS="-L/dev/env/WATT_ROOT/lib"
- LIBS="$LIBS -lwatt"
+ LIBS="-lwatt $LIBS"
])
fi
@@ -754,7 +769,7 @@ then
fi
if test ! -z "$winsock_LIB"; then
my_ac_save_LIBS=$LIBS
- LIBS="$LIBS $winsock_LIB"
+ LIBS="$winsock_LIB $LIBS"
AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
@@ -829,7 +844,7 @@ then
dnl gethostbyname in the network lib - for Haiku OS
AC_CHECK_LIB(network, gethostbyname,
[HAVE_GETHOSTBYNAME="1"
- LIBS="$LIBS -lnetwork"
+ LIBS="-lnetwork $LIBS"
])
fi
@@ -838,7 +853,7 @@ then
dnl gethostbyname in the net lib - for BeOS
AC_CHECK_LIB(net, gethostbyname,
[HAVE_GETHOSTBYNAME="1"
- LIBS="$LIBS -lnet"
+ LIBS="-lnet $LIBS"
])
fi
@@ -877,19 +892,101 @@ dnl **********************************************************************
CURL_NETWORK_AND_TIME_LIBS=$LIBS
dnl **********************************************************************
-AC_MSG_CHECKING([whether to use libgcc])
-AC_ARG_ENABLE(libgcc,
-AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
-[ case "$enableval" in
- yes)
- ALL_LIBS="$ALL_LIBS -lgcc"
- AC_MSG_RESULT(yes)
- ;;
- *) AC_MSG_RESULT(no)
- ;;
- esac ],
- AC_MSG_RESULT(no)
-)
+dnl Check for the presence of ZLIB libraries and headers
+dnl **********************************************************************
+
+dnl Check for & handle argument to --with-zlib.
+
+clean_CPPFLAGS=$CPPFLAGS
+clean_LDFLAGS=$LDFLAGS
+clean_LIBS=$LIBS
+ZLIB_LIBS=""
+AC_ARG_WITH(zlib,
+AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
+AC_HELP_STRING([--without-zlib],[disable use of zlib]),
+ [OPT_ZLIB="$withval"])
+
+if test "$OPT_ZLIB" = "no" ; then
+ AC_MSG_WARN([zlib disabled])
+else
+ if test "$OPT_ZLIB" = "yes" ; then
+ OPT_ZLIB=""
+ fi
+
+ if test -z "$OPT_ZLIB" ; then
+ dnl check for the lib first without setting any new path, since many
+ dnl people have it in the default path
+
+ AC_CHECK_LIB(z, inflateEnd,
+ dnl libz found, set the variable
+ [HAVE_LIBZ="1"
+ LIBS="-lz $LIBS"],
+ dnl if no lib found, try /usr/local
+ [OPT_ZLIB="/usr/local"])
+
+ fi
+
+ dnl Add a nonempty path to the compiler flags
+ if test -n "$OPT_ZLIB"; then
+ CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
+ LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
+ fi
+
+ AC_CHECK_HEADER(zlib.h,
+ [
+ dnl zlib.h was found
+ HAVE_ZLIB_H="1"
+ dnl if the lib wasn't found already, try again with the new paths
+ if test "$HAVE_LIBZ" != "1"; then
+ AC_CHECK_LIB(z, gzread,
+ [
+ dnl the lib was found!
+ HAVE_LIBZ="1"
+ LIBS="-lz $LIBS"
+ ],
+ [ CPPFLAGS=$clean_CPPFLAGS
+ LDFLAGS=$clean_LDFLAGS])
+ fi
+ ],
+ [
+ dnl zlib.h was not found, restore the flags
+ CPPFLAGS=$clean_CPPFLAGS
+ LDFLAGS=$clean_LDFLAGS]
+ )
+
+ if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
+ then
+ AC_MSG_WARN([configure found only the libz lib, not the header file!])
+ HAVE_LIBZ=""
+ CPPFLAGS=$clean_CPPFLAGS
+ LDFLAGS=$clean_LDFLAGS
+ LIBS=$clean_LIBS
+ elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
+ then
+ AC_MSG_WARN([configure found only the libz header file, not the lib!])
+ CPPFLAGS=$clean_CPPFLAGS
+ LDFLAGS=$clean_LDFLAGS
+ LIBS=$clean_LIBS
+ elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
+ then
+ dnl both header and lib were found!
+ AC_SUBST(HAVE_LIBZ)
+ AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
+ AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
+
+ ZLIB_LIBS="-lz"
+ LIBS="-lz $clean_LIBS"
+
+ dnl replace 'HAVE_LIBZ' in the automake makefile.ams
+ AMFIXLIB="1"
+ AC_MSG_NOTICE([found both libz and libz.h header])
+ curl_zlib_msg="enabled"
+ fi
+fi
+
+dnl set variable for use in automakefile(s)
+AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
+AC_SUBST(ZLIB_LIBS)
dnl **********************************************************************
dnl Check for LDAP
@@ -1315,29 +1412,29 @@ if test x"$want_gss" = xyes; then
if test -n "$gnu_gss"; then
curl_gss_msg="enabled (GNU GSS)"
LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
- LIBS="$LIBS -lgss"
+ LIBS="-lgss $LIBS"
elif test -z "$GSSAPI_LIB_DIR"; then
case $host in
*-*-darwin*)
- LIBS="$LIBS -lgssapi_krb5 -lresolv"
+ LIBS="-lgssapi_krb5 -lresolv $LIBS"
;;
*)
if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
dnl krb5-config doesn't have --libs-only-L or similar, put everything
dnl into LIBS
gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
- LIBS="$LIBS $gss_libs"
+ LIBS="$gss_libs $LIBS"
elif test "$GSSAPI_ROOT" != "yes"; then
LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
- LIBS="$LIBS -lgssapi"
+ LIBS="-lgssapi $LIBS"
else
- LIBS="$LIBS -lgssapi"
+ LIBS="-lgssapi $LIBS"
fi
;;
esac
else
LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
- LIBS="$LIBS -lgssapi"
+ LIBS="-lgssapi $LIBS"
fi
else
CPPFLAGS="$save_CPPFLAGS"
@@ -1484,7 +1581,7 @@ if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
dnl the argument to --with-ssl we don't know what
dnl additional libs may be necessary. Hope that we
dnl don't need any.
- LIBS="$LIBS $SSL_LIBS"
+ LIBS="$SSL_LIBS $LIBS"
fi
fi
@@ -1536,7 +1633,7 @@ if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
OLIBS=$LIBS
- LIBS="$LIBS -lRSAglue -lrsaref"
+ LIBS="-lRSAglue -lrsaref $LIBS"
AC_CHECK_LIB(ssl, SSL_connect)
if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
dnl still no SSL_connect
@@ -1652,92 +1749,6 @@ if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
fi
dnl **********************************************************************
-dnl Check for the presence of ZLIB libraries and headers
-dnl **********************************************************************
-
-dnl Check for & handle argument to --with-zlib.
-
-_cppflags=$CPPFLAGS
-_ldflags=$LDFLAGS
-AC_ARG_WITH(zlib,
-AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
-AC_HELP_STRING([--without-zlib],[disable use of zlib]),
- [OPT_ZLIB="$withval"])
-
-if test "$OPT_ZLIB" = "no" ; then
- AC_MSG_WARN([zlib disabled])
-else
- if test "$OPT_ZLIB" = "yes" ; then
- OPT_ZLIB=""
- fi
-
- if test -z "$OPT_ZLIB" ; then
- dnl check for the lib first without setting any new path, since many
- dnl people have it in the default path
-
- AC_CHECK_LIB(z, inflateEnd,
- dnl libz found, set the variable
- [HAVE_LIBZ="1"],
- dnl if no lib found, try /usr/local
- [OPT_ZLIB="/usr/local"])
-
- fi
-
- dnl Add a nonempty path to the compiler flags
- if test -n "$OPT_ZLIB"; then
- CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
- LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
- fi
-
- AC_CHECK_HEADER(zlib.h,
- [
- dnl zlib.h was found
- HAVE_ZLIB_H="1"
- dnl if the lib wasn't found already, try again with the new paths
- if test "$HAVE_LIBZ" != "1"; then
- AC_CHECK_LIB(z, gzread,
- [
- dnl the lib was found!
- HAVE_LIBZ="1"
- ],
- [ CPPFLAGS=$_cppflags
- LDFLAGS=$_ldflags])
- fi
- ],
- [
- dnl zlib.h was not found, restore the flags
- CPPFLAGS=$_cppflags
- LDFLAGS=$_ldflags]
- )
-
- if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
- then
- AC_MSG_WARN([configure found only the libz lib, not the header file!])
- HAVE_LIBZ=""
- elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
- then
- AC_MSG_WARN([configure found only the libz header file, not the lib!])
- elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
- then
- dnl both header and lib were found!
- AC_SUBST(HAVE_LIBZ)
- AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
- AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
-
- CURL_LIBS="$CURL_LIBS -lz"
- LIBS="$LIBS -lz"
-
- dnl replace 'HAVE_LIBZ' in the automake makefile.ams
- AMFIXLIB="1"
- AC_MSG_NOTICE([found both libz and libz.h header])
- curl_zlib_msg="enabled"
- fi
-fi
-
-dnl set variable for use in automakefile(s)
-AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
-
-dnl **********************************************************************
dnl Check for the random seed preferences
dnl **********************************************************************
@@ -1853,7 +1864,7 @@ if test "$curl_ssl_msg" = "$init_ssl_msg"; then
CLEANCPPFLAGS="$CPPFLAGS"
CLEADLDFLAGS="$LDFLAGS"
- LIBS="$LIBS $addlib"
+ LIBS="$addlib $LIBS"
LDFLAGS="$LDFLAGS $addld"
if test "$addcflags" != "-I/usr/include"; then
CPPFLAGS="$CPPFLAGS $addcflags"
@@ -1918,9 +1929,9 @@ if test "$GNUTLS_ENABLED" = "1"; then
if test "$USE_GNUTLS_NETTLE" = "1"; then
AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
AC_SUBST(USE_GNUTLS_NETTLE, [1])
- LIBS="$LIBS -lnettle"
+ LIBS="-lnettle $LIBS"
else
- LIBS="$LIBS -lgcrypt"
+ LIBS="-lgcrypt $LIBS"
fi
fi
@@ -1999,8 +2010,7 @@ if test "$curl_ssl_msg" = "$init_ssl_msg"; then
if test "x$USE_POLARSSL" = "xyes"; then
AC_MSG_NOTICE([detected PolarSSL])
- CURL_LIBS="$CURL_LIBS -lpolarssl"
- LIBS="$LIBS -lpolarssl"
+ LIBS="-lpolarssl $LIBS"
if test -n "$polarssllib"; then
dnl when shared libs were found in a path that the run-time
@@ -2083,8 +2093,7 @@ if test "$curl_ssl_msg" = "$init_ssl_msg"; then
if test "x$USE_CYASSL" = "xyes"; then
AC_MSG_NOTICE([detected CyaSSL])
- CURL_LIBS="$CURL_LIBS -lcyassl -lm"
- LIBS="$LIBS -lcyassl -lm"
+ LIBS="-lcyassl -lm $LIBS"
if test -n "$cyassllib"; then
dnl when shared libs were found in a path that the run-time
@@ -2156,7 +2165,7 @@ if test "$curl_ssl_msg" = "$init_ssl_msg"; then
CLEANLIBS="$LIBS"
CLEANCPPFLAGS="$CPPFLAGS"
- LIBS="$LIBS $addlib"
+ LIBS="$addlib $LIBS"
if test "$addcflags" != "-I/usr/include"; then
CPPFLAGS="$CPPFLAGS $addcflags"
fi
@@ -2410,7 +2419,7 @@ if test X"$OPT_LIBSSH2" != Xno; then
LDFLAGS="$LDFLAGS $LD_SSH2"
CPPFLAGS="$CPPFLAGS $CPP_SSH2"
- LIBS="$LIBS $LIB_SSH2"
+ LIBS="$LIB_SSH2 $LIBS"
AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
@@ -2506,7 +2515,7 @@ if test X"$OPT_LIBRTMP" != Xno; then
LDFLAGS="$LDFLAGS $LD_RTMP"
CPPFLAGS="$CPPFLAGS $CPP_RTMP"
- LIBS="$LIBS $LIB_RTMP"
+ LIBS="$LIB_RTMP $LIBS"
AC_CHECK_LIB(rtmp, RTMP_Init,
[
@@ -3329,16 +3338,13 @@ fi
dnl
dnl All the library dependencies put into $LIB apply to libcurl only.
-dnl Those in $CURL_LIBS apply to the curl command-line client only.
-dnl Those in $ALL_LIBS apply to all targets, including test targets.
dnl
LIBCURL_LIBS=$LIBS
AC_SUBST(LIBCURL_LIBS)
-AC_SUBST(CURL_LIBS)
AC_SUBST(CURL_NETWORK_LIBS)
AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
-LIBS=$ALL_LIBS dnl LIBS is a magic variable that's used for every link
+dnl LIBS is a magic variable that's used for every link
dnl BLANK_AT_MAKETIME might be used in some of our Makefile.am files to
dnl blank LIBS variable used in generated makefile at makefile processing
@@ -3478,7 +3484,6 @@ squeeze DEFS
squeeze LDFLAGS
squeeze LIBS
-squeeze CURL_LIBS
squeeze LIBCURL_LIBS
squeeze CURL_NETWORK_LIBS
squeeze CURL_NETWORK_AND_TIME_LIBS