2 dnl Process this file with autoconf to produce a configure script.
4 AC_CONFIG_SRCDIR([lib/urldata.h])
5 AM_CONFIG_HEADER(config.h src/config.h)
7 VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
8 AM_INIT_AUTOMAKE(curl,$VERSION)
11 dnl we extract the numerical version for curl-config only
12 VERSIONNUM=`sed -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curl.h`
15 dnl Solaris pkgadd support definitions
17 PKGADD_NAME="cURL - a client that groks URLs"
18 PKGADD_VENDOR="curl.haxx.se"
21 AC_SUBST(PKGADD_VENDOR)
25 dnl Detect the canonical host and target build environment
29 dnl Get system canonical name
30 AC_DEFINE_UNQUOTED(OS, "${host}")
32 dnl Check for AIX weirdos
35 dnl Checks for programs.
38 dnl check for how to do large files
43 dnl The install stuff has already been taken care of by the automake stuff
47 dnl ************************************************************
48 dnl lame option to switch on debug options
50 AC_MSG_CHECKING([whether to enable debug options])
52 [ --enable-debug Enable pedantic debug options
53 --disable-debug Disable debug options],
54 [ case "$enableval" in
60 CPPFLAGS="$CPPFLAGS -DMALLOCDEBUG"
61 CFLAGS="-W -Wall -Wwrite-strings -pedantic -g"
67 dnl **********************************************************************
69 dnl **********************************************************************
71 AC_MSG_CHECKING([whether to enable ipv6])
73 [ --enable-ipv6 Enable ipv6 (with ipv4) support
74 --disable-ipv6 Disable ipv6 support],
75 [ case "$enableval" in
85 AC_TRY_RUN([ /* is AF_INET6 available? */
86 #include <sys/types.h>
87 #include <sys/socket.h>
90 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
104 if test "$ipv6" = "yes"; then
105 CURL_CHECK_WORKING_GETADDRINFO
109 dnl **********************************************************************
110 dnl Checks for libraries.
111 dnl **********************************************************************
113 dnl gethostbyname in the nsl lib?
114 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
116 if test "$ac_cv_lib_nsl_gethostbyname" != "yes" -a "$ac_cv_func_gethostbyname" != "yes"; then
117 dnl gethostbyname in the socket lib?
118 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(socket, gethostbyname))
121 dnl At least one system has been identified to require BOTH nsl and
122 dnl socket libs to link properly.
123 if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname"; then
124 AC_MSG_CHECKING([trying both nsl and socket libs])
125 my_ac_save_LIBS=$LIBS
126 LIBS="-lnsl -lsocket $LIBS"
129 my_ac_link_result=success,
130 my_ac_link_result=failure )
132 if test "$my_ac_link_result" = "failure"; then
134 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
136 LIBS=$my_ac_save_LIBS
143 AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
145 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
146 AC_CHECK_LIB(resolve, strcasecmp,
147 [LIBS="-lresolve $LIBS"],
153 AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
156 AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
159 AC_CHECK_FUNC(dlclose, , AC_CHECK_LIB(dl, dlopen))
161 dnl **********************************************************************
162 dnl Check for the random seed preferences
163 dnl **********************************************************************
165 AC_ARG_WITH(egd-socket,
166 [ --with-egd-socket=FILE Entropy Gathering Daemon socket pathname],
167 [ EGD_SOCKET="$withval" ]
169 if test -n "$EGD_SOCKET" ; then
170 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
173 dnl Check for user-specified random device
175 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
176 [ RANDOM_FILE="$withval" ],
178 dnl Check for random device
179 AC_CHECK_FILE("/dev/urandom",
181 RANDOM_FILE="/dev/urandom";
186 if test -n "$RANDOM_FILE" ; then
187 AC_SUBST(RANDOM_FILE)
188 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE")
191 dnl **********************************************************************
192 dnl Check for the presence of Kerberos4 libraries and headers
193 dnl **********************************************************************
195 AC_ARG_WITH(krb4-includes,
196 [ --with-krb4-includes[=DIR] Specify location of kerberos4 headers],[
197 CPPFLAGS="$CPPFLAGS -I$withval"
202 AC_ARG_WITH(krb4-libs,
203 [ --with-krb4-libs[=DIR] Specify location of kerberos4 libs],[
204 LDFLAGS="$LDFLAGS -L$withval"
212 [ --with-krb4[=DIR] where to look for Kerberos4],[
214 if test X"$OPT_KRB4" != Xyes
216 LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib"
217 KRB4LIB="$OPT_KRB4/lib"
218 CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
219 KRB4INC="$OPT_KRB4/include"
224 AC_MSG_CHECKING([if Kerberos4 support is requested])
226 if test "$want_krb4" = yes
228 if test "$ipv6" = "yes"; then
229 echo krb4 is not compatible with IPv6
234 dnl Check for & handle argument to --with-krb4
236 AC_MSG_CHECKING(where to look for Kerberos4)
237 if test X"$OPT_KRB4" = Xyes
239 AC_MSG_RESULT([defaults])
241 AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
244 dnl Check for DES library
245 AC_CHECK_LIB(des, des_pcbc_encrypt,
247 AC_CHECK_HEADERS(des.h)
250 AC_CHECK_FUNC(res_search, , AC_CHECK_LIB(resolv, res_search))
252 dnl Check for the Kerberos4 library
253 AC_CHECK_LIB(krb, krb_net_read,
255 dnl Check for header files
256 AC_CHECK_HEADERS(krb.h)
258 dnl we found the required libraries, add to LIBS
259 LIBS="-lkrb -ldes $LIBS"
261 dnl Check for function krb_get_our_ip_for_realm
262 dnl this is needed for NAT networks
263 AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
268 dnl substitute it too!
270 AC_SUBST(KRB4_ENABLED)
272 dnl the krb4 stuff needs a strlcpy()
273 AC_CHECK_FUNCS(strlcpy)
282 dnl **********************************************************************
283 dnl Check for the presence of SSL libraries and headers
284 dnl **********************************************************************
286 dnl Default to compiler & linker defaults for SSL files & libraries.
289 [ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths]
290 DIR points to the SSL installation [/usr/local/ssl]],
294 if test X"$OPT_SSL" = Xno
296 AC_MSG_WARN(SSL/https support disabled)
299 dnl Check for and handle argument to --with-ssl.
301 dnl save the pre-ssl check flags for a while
302 CLEANLDFLAGS="$LDFLAGS"
303 CLEANCPPFLAGS="$CPPFLAGS"
307 EXTRA_SSL=/usr/local/ssl ;;
311 dnl check the given spot right away!
313 LDFLAGS="$LDFLAGS -L$EXTRA_SSL/lib"
314 CPPFLAGS="$CPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
318 AC_CHECK_LIB(crypto, CRYPTO_lock,[
321 OLDLDFLAGS="$LDFLAGS"
322 OLDCPPFLAGS="$CPPFLAGS"
323 LDFLAGS="$CLEANLDFLAGS -L$EXTRA_SSL/lib"
324 CPPFLAGS="$CLEANCPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
325 AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
326 HAVECRYPTO="yes" ], [
327 LDFLAGS="$OLDLDFLAGS"
328 CPPFLAGS="$OLDCPPFLAGS"
333 if test "$HAVECRYPTO" = "yes"; then
334 dnl This is only reasonable to do if crypto actually is there: check for
335 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
337 AC_CHECK_LIB(crypto, CRYPTO_add_lock)
338 AC_CHECK_LIB(ssl, SSL_connect)
340 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
341 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
342 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
344 LIBS="$LIBS -lRSAglue -lrsaref"
345 AC_CHECK_LIB(ssl, SSL_connect)
346 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
347 dnl still no SSL_connect
356 dnl Check for SSLeay headers
357 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
358 openssl/pem.h openssl/ssl.h openssl/err.h,
361 if test $ac_cv_header_openssl_x509_h = no; then
362 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
366 AC_SUBST(OPENSSL_ENABLED)
370 if test X"$OPT_SSL" != Xoff &&
371 test "$OPENSSL_ENABLED" != "1"; then
372 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
376 dnl these can only exist if openssl exists
378 AC_CHECK_FUNCS( RAND_status \
384 dnl **********************************************************************
385 dnl Check for the presence of ZLIB libraries and headers
386 dnl **********************************************************************
388 dnl Default to compiler & linker defaults for files & libraries.
390 dnl AC_ARG_WITH(zlib,dnl
391 dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
392 dnl DIR points to the ZLIB installation prefix [/usr/local]],
393 dnl OPT_ZLIB=$withval,
396 dnl Check for & handle argument to --with-zlib.
398 dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
399 dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
402 dnl AC_MSG_CHECKING(where to look for ZLIB)
403 dnl if test X"$OPT_ZLIB" = Xno
405 dnl AC_MSG_RESULT([defaults (or given in environment)])
407 dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
408 dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
409 dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
410 dnl AC_MSG_RESULT([$OPT_ZLIB])
414 dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
417 dnl Default is to try the thread-safe versions of a few functions
419 AC_ARG_ENABLE(thread,dnl
420 [ --disable-thread tell configure to not look for thread-safe functions],
424 if test X"$OPT_THREAD" = Xoff
426 AC_MSG_WARN(libcurl will not get built using thread-safe functions)
427 AC_DEFINE(DISABLED_THREADSAFE, 1, \
428 Set to explicitly specify we don't want to use thread-safe functions)
431 dnl check that 'localhost' resolves first
432 CURL_CHECK_WORKING_RESOLVER
434 dnl dig around for gethostbyname_r()
435 CURL_CHECK_GETHOSTBYNAME_R()
437 dnl dig around for gethostbyaddr_r()
438 CURL_CHECK_GETHOSTBYADDR_R()
440 dnl poke around for inet_ntoa_r()
441 CURL_CHECK_INET_NTOA_R()
443 dnl is there a localtime_r()
444 CURL_CHECK_LOCALTIME_R()
448 dnl **********************************************************************
449 dnl Back to "normal" configuring
450 dnl **********************************************************************
452 dnl Checks for header files.
485 dnl Check for libz header
486 dnl AC_CHECK_HEADERS(zlib.h)
488 dnl Checks for typedefs, structures, and compiler characteristics.
495 # check for 'long double'
496 AC_CHECK_SIZEOF(long double, 8)
497 # check for 'long long'
498 AC_CHECK_SIZEOF(long long, 4)
501 AC_CHECK_TYPE(ssize_t, int)
505 dnl Checks for library functions.
506 dnl AC_PROG_GCC_TRADITIONAL
509 AC_CHECK_FUNCS( socket \
540 dnl removed 'getpass' check on October 26, 2000
542 if test "$ac_cv_func_select" != "yes"; then
543 AC_MSG_ERROR(Can't work without an existing select() function)
545 if test "$ac_cv_func_socket" != "yes"; then
546 AC_MSG_ERROR(Can't work without an existing socket() function)
549 AC_PATH_PROG( PERL, perl, ,
550 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
553 AC_PATH_PROGS( NROFF, gnroff nroff, ,
554 $PATH:/usr/bin/:/usr/local/bin )
559 dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
560 dnl $PATH:/usr/bin/:/usr/local/bin )
563 AC_CONFIG_FILES([Makefile \
565 docs/examples/Makefile \
567 include/curl/Makefile \
571 tests/data/Makefile \
573 packages/Win32/Makefile \
574 packages/Linux/Makefile \
575 packages/Linux/RPM/Makefile \
576 packages/Linux/RPM/curl.spec \
577 packages/Linux/RPM/curl-ssl.spec \
578 packages/Solaris/Makefile \