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' 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
30 dnl **********************************************************************
31 dnl Checks for libraries.
32 dnl **********************************************************************
35 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
37 dnl At least one system has been identified to require BOTH nsl and
38 dnl socket libs to link properly.
39 if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname"; then
40 AC_MSG_CHECKING([trying both nsl and socket libs])
42 LIBS="-lnsl -lsocket $LIBS"
45 my_ac_link_result=success,
46 my_ac_link_result=failure )
48 if test "$my_ac_link_result" = "failure"; then
50 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
59 AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
61 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
62 AC_CHECK_LIB(resolve, strcasecmp,
63 [LIBS="-lresolve $LIBS"],
69 AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
72 AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
75 AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
77 dnl **********************************************************************
78 dnl Check for the presence of Kerberos4 libraries and headers
79 dnl **********************************************************************
81 AC_ARG_WITH(krb4-includes,
82 [ --with-krb4-includes[=DIR] Specify location of kerberos4 headers],[
83 CPPFLAGS="$CPPFLAGS -I$withval"
88 AC_ARG_WITH(krb4-libs,
89 [ --with-krb4-libs[=DIR] Specify location of kerberos4 libs],[
90 LDFLAGS="$LDFLAGS -L$withval"
98 [ --with-krb4[=DIR] where to look for Kerberos4],[
100 if test X"$OPT_KRB4" != Xyes
102 LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib"
103 KRB4LIB="$OPT_KRB4/lib"
104 CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
105 KRB4INC="$OPT_KRB4/include"
110 AC_MSG_CHECKING([if Kerberos4 support is requested])
112 if test "$want_krb4" = yes
116 dnl Check for & handle argument to --with-krb4
118 AC_MSG_CHECKING(where to look for Kerberos4)
119 if test X"$OPT_KRB4" = Xyes
121 AC_MSG_RESULT([defaults])
123 AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
126 dnl Check for DES library
127 AC_CHECK_LIB(des, des_pcbc_encrypt,
129 AC_CHECK_HEADERS(des.h)
132 AC_CHECK_FUNC(res_search, , AC_CHECK_LIB(resolv, res_search))
134 dnl Check for the Kerberos4 library
135 AC_CHECK_LIB(krb, krb_net_read,
137 dnl Check for header files
138 AC_CHECK_HEADERS(krb.h)
140 dnl we found the required libraries, add to LIBS
141 LIBS="-lkrb -ldes $LIBS"
143 dnl Check for function krb_get_our_ip_for_realm
144 dnl this is needed for NAT networks
145 AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
150 dnl the krb4 stuff needs a strlcpy()
151 AC_CHECK_FUNCS(strlcpy)
159 dnl **********************************************************************
160 dnl Check for the presence of SSL libraries and headers
161 dnl **********************************************************************
163 dnl Default to compiler & linker defaults for SSL files & libraries.
166 [ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths]
167 DIR points to the SSL installation [/usr/local/ssl]],
171 if test X"$OPT_SSL" = Xno
173 AC_MSG_WARN(SSL/https support disabled)
176 dnl Check for & handle argument to --with-ssl.
178 AC_MSG_CHECKING(where to look for SSL)
179 if test X"$OPT_SSL" = Xoff
181 AC_MSG_RESULT([defaults (or given in environment)])
183 test X"$OPT_SSL" = Xyes && OPT_SSL=/usr/local/ssl
184 LIBS="$LIBS -L$OPT_SSL/lib"
185 CPPFLAGS="$CPPFLAGS -I$OPT_SSL/include/openssl -I$OPT_SSL/include"
186 AC_MSG_RESULT([$OPT_SSL])
189 dnl check for crypto libs (part of SSLeay)
190 AC_CHECK_LIB(crypto, CRYPTO_lock)
192 if test $ac_cv_lib_crypto_CRYPTO_lock = yes; then
193 dnl This is only reasonable to do if crypto actually is there: check for
194 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
195 AC_CHECK_LIB(ssl, SSL_connect)
197 dnl Check for SSLeay headers
198 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h openssl/pem.h openssl/ssl.h openssl/err.h)
200 if test $ac_cv_header_openssl_x509_h = no; then
201 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
206 dnl these can only exist if openssl exists
208 AC_CHECK_FUNCS( RAND_status \
213 dnl **********************************************************************
214 dnl Check for the presence of ZLIB libraries and headers
215 dnl **********************************************************************
217 dnl Default to compiler & linker defaults for files & libraries.
219 dnl AC_ARG_WITH(zlib,dnl
220 dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
221 dnl DIR points to the ZLIB installation prefix [/usr/local]],
222 dnl OPT_ZLIB=$withval,
225 dnl Check for & handle argument to --with-zlib.
227 dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
228 dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
231 dnl AC_MSG_CHECKING(where to look for ZLIB)
232 dnl if test X"$OPT_ZLIB" = Xno
234 dnl AC_MSG_RESULT([defaults (or given in environment)])
236 dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
237 dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
238 dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
239 dnl AC_MSG_RESULT([$OPT_ZLIB])
243 dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
246 dnl Default is to try the thread-safe versions of a few functions
248 AC_ARG_ENABLE(thread,dnl
249 [ --disable-thread tell configure to not look for thread-safe functions],
253 if test X"$OPT_THREAD" = Xoff
255 AC_MSG_WARN(libcurl will not get built using thread-safe functions)
256 AC_DEFINE(DISABLED_THREADSAFE, 1, \
257 Set to explicitly specify we don't want to use thread-safe functions)
259 dnl check for number of arguments to gethostbyname_r. it might take
260 dnl either 3, 5, or 6 arguments.
261 AC_CHECK_FUNCS(gethostbyname_r,[
262 AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments)
265 #include <sys/types.h>
271 struct hostent_data hdata;
272 char *name = "localhost";
274 memset(&h, 0, sizeof(struct hostent));
275 memset(&hdata, 0, sizeof(struct hostent_data));
276 rc = gethostbyname_r(name, &h, &hdata);
277 exit (rc != 0 ? 1 : 0); }],[
279 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
280 ac_cv_gethostbyname_args=3],[
282 AC_MSG_CHECKING(if gethostbyname_r with -D_REENTRANT takes 3 arguments)
287 #include <sys/types.h>
293 struct hostent_data hdata;
294 char *name = "localhost";
296 memset(&h, 0, sizeof(struct hostent));
297 memset(&hdata, 0, sizeof(struct hostent_data));
298 rc = gethostbyname_r(name, &h, &hdata);
299 exit (rc != 0 ? 1 : 0); }],[
301 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
302 AC_DEFINE(NEED_REENTRANT)
303 ac_cv_gethostbyname_args=3],[
305 AC_MSG_CHECKING(if gethostbyname_r takes 5 arguments)
307 #include <sys/types.h>
314 char *name = "localhost";
317 hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
318 exit (hp == NULL ? 1 : 0); }],[
320 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
321 ac_cv_gethostbyname_args=5],[
323 AC_MSG_CHECKING(if gethostbyname_r takes 6 arguments)
325 #include <sys/types.h>
332 char *name = "localhost";
336 rc = gethostbyname_r(name, &h, buf, 8192, &hp, &h_errno);
337 exit (rc != 0 ? 1 : 0); }],[
339 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
340 ac_cv_gethostbyname_args=6],[
342 have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"],
343 [ac_cv_gethostbyname_args=0])],
344 [ac_cv_gethostbyname_args=0])],
345 [ac_cv_gethostbyname_args=0])],
346 [ac_cv_gethostbyname_args=0])])
348 dnl check for number of arguments to gethostbyaddr_r. it might take
349 dnl either 5, 7, or 8 arguments.
350 AC_CHECK_FUNCS(gethostbyaddr_r,[
351 AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
353 #include <sys/types.h>
354 #include <netdb.h>],[
359 struct hostent_data hdata;
361 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
363 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
364 ac_cv_gethostbyaddr_args=5],[
366 AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
369 #include <sys/types.h>
370 #include <netdb.h>],[
375 struct hostent_data hdata;
377 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
379 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
380 AC_DEFINE(NEED_REENTRANT)
381 ac_cv_gethostbyaddr_args=5],[
383 AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
385 #include <sys/types.h>
386 #include <netdb.h>],[
395 hp = gethostbyaddr_r(address, length, type, &h,
396 buffer, 8192, &h_errnop);],[
398 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
399 ac_cv_gethostbyaddr_args=7],[
401 AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
403 #include <sys/types.h>
404 #include <netdb.h>],[
414 rc = gethostbyaddr_r(address, length, type, &h,
415 buffer, 8192, &hp, &h_errnop);],[
417 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
418 ac_cv_gethostbyaddr_args=8],[
420 have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
422 dnl determine if function definition for inet_ntoa_r exists.
423 AC_CHECK_FUNCS(inet_ntoa_r,[
424 AC_MSG_CHECKING(whether inet_ntoa_r is declared)
425 AC_EGREP_CPP(inet_ntoa_r,[
426 #include <arpa/inet.h>],[
427 AC_DEFINE(HAVE_INET_NTOA_R_DECL)
428 AC_MSG_RESULT(yes)],[
430 AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
431 AC_EGREP_CPP(inet_ntoa_r,[
433 #include <arpa/inet.h>],[
434 AC_DEFINE(HAVE_INET_NTOA_R_DECL)
435 AC_DEFINE(NEED_REENTRANT)
437 AC_MSG_RESULT(no))])])
439 dnl check for a few thread-safe functions
440 AC_CHECK_FUNCS(localtime_r,[
441 AC_MSG_CHECKING(whether localtime_r is declared)
442 AC_EGREP_CPP(localtime_r,[
444 AC_MSG_RESULT(yes)],[
446 AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
447 AC_EGREP_CPP(localtime_r,[
450 AC_DEFINE(NEED_REENTRANT)
452 AC_MSG_RESULT(no))])])
455 dnl **********************************************************************
456 dnl Back to "normal" configuring
457 dnl **********************************************************************
459 dnl Checks for header files.
489 dnl Check for libz header
490 dnl AC_CHECK_HEADERS(zlib.h)
492 dnl Checks for typedefs, structures, and compiler characteristics.
499 # check for 'long double'
500 AC_CHECK_SIZEOF(long double, 8)
501 # check for 'long long'
502 AC_CHECK_SIZEOF(long long, 4)
504 dnl Get system canonical name
506 AC_DEFINE_UNQUOTED(OS, "${host}")
508 dnl Checks for library functions.
509 dnl AC_PROG_GCC_TRADITIONAL
512 AC_CHECK_FUNCS( socket \
536 dnl removed 'getpass' check on October 26, 2000
538 if test "$ac_cv_func_select" != "yes"; then
539 AC_MSG_ERROR(Can't work without an existing socket() function)
542 AC_PATH_PROG( PERL, perl, ,
543 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
546 AC_PATH_PROGS( NROFF, gnroff nroff, ,
547 $PATH:/usr/bin/:/usr/local/bin )
552 dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
553 dnl $PATH:/usr/bin/:/usr/local/bin )
556 AC_OUTPUT( Makefile \
559 include/curl/Makefile \
562 dnl perl/checklinks.pl \
563 dnl perl/getlinks.pl \
564 dnl perl/formfind.pl \
565 dnl perl/recursiveftpget.pl )