2 dnl Process this file with autoconf to produce a configure script.
4 AM_CONFIG_HEADER(config.h src/config.h)
6 VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
7 AM_INIT_AUTOMAKE(curl,$VERSION)
11 dnl Detect the canonical host and target build environment
16 dnl Checks for programs.
19 dnl Check for AIX weirdos
22 dnl check for how to do large files
25 dnl The install stuff has already been taken care of by the automake stuff
29 AC_DEFUN(CURL_CHECK_LOCALTIME_R,
31 dnl check for a few thread-safe functions
32 AC_CHECK_FUNCS(localtime_r,[
33 AC_MSG_CHECKING(whether localtime_r is declared)
34 AC_EGREP_CPP(localtime_r,[
38 AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
39 AC_EGREP_CPP(localtime_r,[
42 AC_DEFINE(NEED_REENTRANT)
44 AC_MSG_RESULT(no))])])
47 AC_DEFUN(CURL_CHECK_INET_NTOA_R,
49 dnl determine if function definition for inet_ntoa_r exists.
50 AC_CHECK_FUNCS(inet_ntoa_r,[
51 AC_MSG_CHECKING(whether inet_ntoa_r is declared)
52 AC_EGREP_CPP(inet_ntoa_r,[
53 #include <arpa/inet.h>],[
54 AC_DEFINE(HAVE_INET_NTOA_R_DECL)
57 AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
58 AC_EGREP_CPP(inet_ntoa_r,[
60 #include <arpa/inet.h>],[
61 AC_DEFINE(HAVE_INET_NTOA_R_DECL)
62 AC_DEFINE(NEED_REENTRANT)
64 AC_MSG_RESULT(no))])])
68 AC_DEFUN(CURL_CHECK_GETHOSTBYADDR_R,
70 dnl check for number of arguments to gethostbyaddr_r. it might take
71 dnl either 5, 7, or 8 arguments.
72 AC_CHECK_FUNCS(gethostbyaddr_r,[
73 AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
75 #include <sys/types.h>
81 struct hostent_data hdata;
83 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
85 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
86 ac_cv_gethostbyaddr_args=5],[
88 AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
91 #include <sys/types.h>
97 struct hostent_data hdata;
99 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
101 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
102 AC_DEFINE(NEED_REENTRANT)
103 ac_cv_gethostbyaddr_args=5],[
105 AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
107 #include <sys/types.h>
108 #include <netdb.h>],[
117 hp = gethostbyaddr_r(address, length, type, &h,
118 buffer, 8192, &h_errnop);],[
120 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
121 ac_cv_gethostbyaddr_args=7],[
123 AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
125 #include <sys/types.h>
126 #include <netdb.h>],[
136 rc = gethostbyaddr_r(address, length, type, &h,
137 buffer, 8192, &hp, &h_errnop);],[
139 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
140 ac_cv_gethostbyaddr_args=8],[
142 have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
147 AC_DEFUN(CURL_CHECK_GETHOSTBYNAME_R,
149 dnl check for number of arguments to gethostbyname_r. it might take
150 dnl either 3, 5, or 6 arguments.
151 AC_CHECK_FUNCS(gethostbyname_r,[
152 AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments)
155 #include <sys/types.h>
161 struct hostent_data hdata;
162 char *name = "localhost";
164 memset(&h, 0, sizeof(struct hostent));
165 memset(&hdata, 0, sizeof(struct hostent_data));
166 rc = gethostbyname_r(name, &h, &hdata);
167 exit (rc != 0 ? 1 : 0); }],[
169 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
170 ac_cv_gethostbyname_args=3],[
172 AC_MSG_CHECKING(if gethostbyname_r with -D_REENTRANT takes 3 arguments)
177 #include <sys/types.h>
183 struct hostent_data hdata;
184 char *name = "localhost";
186 memset(&h, 0, sizeof(struct hostent));
187 memset(&hdata, 0, sizeof(struct hostent_data));
188 rc = gethostbyname_r(name, &h, &hdata);
189 exit (rc != 0 ? 1 : 0); }],[
191 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
192 AC_DEFINE(NEED_REENTRANT)
193 ac_cv_gethostbyname_args=3],[
195 AC_MSG_CHECKING(if gethostbyname_r takes 5 arguments)
197 #include <sys/types.h>
204 char *name = "localhost";
207 hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
208 exit (hp == NULL ? 1 : 0); }],[
210 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
211 ac_cv_gethostbyname_args=5],[
213 AC_MSG_CHECKING(if gethostbyname_r takes 6 arguments)
215 #include <sys/types.h>
222 char *name = "localhost";
226 rc = gethostbyname_r(name, &h, buf, 8192, &hp, &h_errno);
227 exit (rc != 0 ? 1 : 0); }],[
229 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
230 ac_cv_gethostbyname_args=6],[
232 have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"],
233 [ac_cv_gethostbyname_args=0])],
234 [ac_cv_gethostbyname_args=0])],
235 [ac_cv_gethostbyname_args=0])],
236 [ac_cv_gethostbyname_args=0])])
240 dnl **********************************************************************
242 dnl **********************************************************************
244 AC_MSG_CHECKING([whether to enable ipv6])
246 [ --enable-ipv6 Enable ipv6 (with ipv4) support
247 --disable-ipv6 Disable ipv6 support],
248 [ case "$enableval" in
253 *) AC_MSG_RESULT(yes)
254 AC_DEFINE(ENABLE_IPV6)
259 AC_TRY_RUN([ /* is AF_INET6 available? */
260 #include <sys/types.h>
261 #include <sys/socket.h>
264 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
271 AC_DEFINE(ENABLE_IPV6)
279 dnl **********************************************************************
280 dnl Checks for libraries.
281 dnl **********************************************************************
283 dnl gethostbyname in the nsl lib?
284 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
286 if test "$ac_cv_lib_nsl_gethostbyname" != "yes" -a "$ac_cv_func_gethostbyname" != "yes"; then
287 dnl gethostbyname in the socket lib?
288 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(socket, gethostbyname))
291 dnl At least one system has been identified to require BOTH nsl and
292 dnl socket libs to link properly.
293 if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname"; then
294 AC_MSG_CHECKING([trying both nsl and socket libs])
295 my_ac_save_LIBS=$LIBS
296 LIBS="-lnsl -lsocket $LIBS"
299 my_ac_link_result=success,
300 my_ac_link_result=failure )
302 if test "$my_ac_link_result" = "failure"; then
304 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
306 LIBS=$my_ac_save_LIBS
313 AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
315 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
316 AC_CHECK_LIB(resolve, strcasecmp,
317 [LIBS="-lresolve $LIBS"],
323 AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
326 AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
329 AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
331 dnl **********************************************************************
332 dnl Check for the presence of Kerberos4 libraries and headers
333 dnl **********************************************************************
335 AC_ARG_WITH(krb4-includes,
336 [ --with-krb4-includes[=DIR] Specify location of kerberos4 headers],[
337 CPPFLAGS="$CPPFLAGS -I$withval"
342 AC_ARG_WITH(krb4-libs,
343 [ --with-krb4-libs[=DIR] Specify location of kerberos4 libs],[
344 LDFLAGS="$LDFLAGS -L$withval"
352 [ --with-krb4[=DIR] where to look for Kerberos4],[
354 if test X"$OPT_KRB4" != Xyes
356 LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib"
357 KRB4LIB="$OPT_KRB4/lib"
358 CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
359 KRB4INC="$OPT_KRB4/include"
364 AC_MSG_CHECKING([if Kerberos4 support is requested])
366 if test "$want_krb4" = yes
370 dnl Check for & handle argument to --with-krb4
372 AC_MSG_CHECKING(where to look for Kerberos4)
373 if test X"$OPT_KRB4" = Xyes
375 AC_MSG_RESULT([defaults])
377 AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
380 dnl Check for DES library
381 AC_CHECK_LIB(des, des_pcbc_encrypt,
383 AC_CHECK_HEADERS(des.h)
386 AC_CHECK_FUNC(res_search, , AC_CHECK_LIB(resolv, res_search))
388 dnl Check for the Kerberos4 library
389 AC_CHECK_LIB(krb, krb_net_read,
391 dnl Check for header files
392 AC_CHECK_HEADERS(krb.h)
394 dnl we found the required libraries, add to LIBS
395 LIBS="-lkrb -ldes $LIBS"
397 dnl Check for function krb_get_our_ip_for_realm
398 dnl this is needed for NAT networks
399 AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
404 dnl the krb4 stuff needs a strlcpy()
405 AC_CHECK_FUNCS(strlcpy)
413 dnl **********************************************************************
414 dnl Check for the presence of SSL libraries and headers
415 dnl **********************************************************************
417 dnl Default to compiler & linker defaults for SSL files & libraries.
420 [ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths]
421 DIR points to the SSL installation [/usr/local/ssl]],
425 if test X"$OPT_SSL" = Xno
427 AC_MSG_WARN(SSL/https support disabled)
430 dnl Check for & handle argument to --with-ssl.
432 AC_MSG_CHECKING(where to look for SSL)
433 if test X"$OPT_SSL" = Xoff
435 AC_MSG_RESULT([defaults (or given in environment)])
437 test X"$OPT_SSL" = Xyes && OPT_SSL=/usr/local/ssl
438 dnl LIBS="$LIBS -L$OPT_SSL/lib"
439 LDFLAGS="$LDFLAGS -L$OPT_SSL/lib"
440 CPPFLAGS="$CPPFLAGS -I$OPT_SSL/include/openssl -I$OPT_SSL/include"
441 AC_MSG_RESULT([$OPT_SSL])
444 dnl check for crypto libs (part of SSLeay)
445 AC_CHECK_LIB(crypto, CRYPTO_lock)
447 if test $ac_cv_lib_crypto_CRYPTO_lock = yes; then
448 dnl This is only reasonable to do if crypto actually is there: check for
449 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
450 AC_CHECK_LIB(ssl, SSL_connect)
452 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
453 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
454 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
456 LIBS="$LIBS -lRSAglue -lrsaref"
457 AC_CHECK_LIB(ssl, SSL_connect)
458 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
459 dnl still no SSL_connect
469 dnl Check for SSLeay headers
470 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h openssl/pem.h openssl/ssl.h openssl/err.h)
472 if test $ac_cv_header_openssl_x509_h = no; then
473 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
478 dnl these can only exist if openssl exists
480 AC_CHECK_FUNCS( RAND_status \
485 dnl **********************************************************************
486 dnl Check for the presence of ZLIB libraries and headers
487 dnl **********************************************************************
489 dnl Default to compiler & linker defaults for files & libraries.
491 dnl AC_ARG_WITH(zlib,dnl
492 dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
493 dnl DIR points to the ZLIB installation prefix [/usr/local]],
494 dnl OPT_ZLIB=$withval,
497 dnl Check for & handle argument to --with-zlib.
499 dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
500 dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
503 dnl AC_MSG_CHECKING(where to look for ZLIB)
504 dnl if test X"$OPT_ZLIB" = Xno
506 dnl AC_MSG_RESULT([defaults (or given in environment)])
508 dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
509 dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
510 dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
511 dnl AC_MSG_RESULT([$OPT_ZLIB])
515 dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
518 dnl Default is to try the thread-safe versions of a few functions
520 AC_ARG_ENABLE(thread,dnl
521 [ --disable-thread tell configure to not look for thread-safe functions],
525 if test X"$OPT_THREAD" = Xoff
527 AC_MSG_WARN(libcurl will not get built using thread-safe functions)
528 AC_DEFINE(DISABLED_THREADSAFE, 1, \
529 Set to explicitly specify we don't want to use thread-safe functions)
532 dnl dig around for gethostbyname_r()
533 CURL_CHECK_GETHOSTBYNAME_R()
535 dnl dig around for gethostbyaddr_r()
536 CURL_CHECK_GETHOSTBYADDR_R()
538 dnl poke around for inet_ntoa_r()
539 CURL_CHECK_INET_NTOA_R()
541 dnl is there a localtime_r()
542 CURL_CHECK_LOCALTIME_R()
546 dnl **********************************************************************
547 dnl Back to "normal" configuring
548 dnl **********************************************************************
550 dnl Checks for header files.
580 dnl Check for libz header
581 dnl AC_CHECK_HEADERS(zlib.h)
583 dnl Checks for typedefs, structures, and compiler characteristics.
590 # check for 'long double'
591 AC_CHECK_SIZEOF(long double, 8)
592 # check for 'long long'
593 AC_CHECK_SIZEOF(long long, 4)
595 dnl Get system canonical name
597 AC_DEFINE_UNQUOTED(OS, "${host}")
599 dnl Checks for library functions.
600 dnl AC_PROG_GCC_TRADITIONAL
603 AC_CHECK_FUNCS( socket \
628 dnl removed 'getpass' check on October 26, 2000
630 if test "$ac_cv_func_select" != "yes"; then
631 AC_MSG_ERROR(Can't work without an existing select() function)
633 if test "$ac_cv_func_socket" != "yes"; then
634 AC_MSG_ERROR(Can't work without an existing socket() function)
637 AC_PATH_PROG( PERL, perl, ,
638 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
641 AC_PATH_PROGS( NROFF, gnroff nroff, ,
642 $PATH:/usr/bin/:/usr/local/bin )
647 dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
648 dnl $PATH:/usr/bin/:/usr/local/bin )
651 AC_OUTPUT( Makefile \
653 docs/examples/Makefile \
655 include/curl/Makefile \
659 tests/data/Makefile \
661 packages/Win32/Makefile \
662 packages/Linux/Makefile \
663 packages/Linux/RPM/Makefile \
664 packages/Linux/RPM/curl.spec \
665 packages/Linux/RPM/curl-ssl.spec )