2 dnl Process this file with autoconf to produce a configure script.
4 AM_CONFIG_HEADER(config.h src/config.h)
5 AM_INIT_AUTOMAKE(curl,"7.2")
9 dnl Detect the canonical host and target build environment
14 dnl Checks for programs.
17 dnl Check for AIX weirdos
20 dnl check for how to do large files
23 dnl The install stuff has already been taken care of by the automake stuff
28 dnl **********************************************************************
29 dnl Checks for libraries.
30 dnl **********************************************************************
33 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
35 dnl At least one system has been identified to require BOTH nsl and
36 dnl socket libs to link properly.
37 if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname"; then
38 AC_MSG_CHECKING([trying both nsl and socket libs])
40 LIBS="-lnsl -lsocket $LIBS"
43 my_ac_link_result=success,
44 my_ac_link_result=failure )
46 if test "$my_ac_link_result" = "failure"; then
48 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
57 AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
59 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
60 AC_CHECK_LIB(resolve, strcasecmp,
61 [LIBS="-lresolve $LIBS"],
67 AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
70 AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
73 AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
75 dnl **********************************************************************
76 dnl Check for the presence of SSL libraries and headers
77 dnl **********************************************************************
79 dnl Default to compiler & linker defaults for SSL files & libraries.
82 [ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths]
83 DIR points to the SSL installation [/usr/local/ssl]],
87 if test X"$OPT_SSL" = Xno
89 AC_MSG_WARN(SSL/https support disabled)
92 dnl Check for & handle argument to --with-ssl.
94 AC_MSG_CHECKING(where to look for SSL)
95 if test X"$OPT_SSL" = Xoff
97 AC_MSG_RESULT([defaults (or given in environment)])
99 test X"$OPT_SSL" = Xyes && OPT_SSL=/usr/local/ssl
100 LIBS="$LIBS -L$OPT_SSL/lib"
101 CPPFLAGS="$CPPFLAGS -I$OPT_SSL/include/openssl -I$OPT_SSL/include"
102 AC_MSG_RESULT([$OPT_SSL])
105 dnl check for crypto libs (part of SSLeay)
106 AC_CHECK_LIB(crypto, CRYPTO_lock)
108 if test $ac_cv_lib_crypto_CRYPTO_lock = yes; then
109 dnl This is only reasonable to do if crypto actually is there: check for
110 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
111 AC_CHECK_LIB(ssl, SSL_connect)
113 dnl Check for SSLeay headers
114 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h openssl/pem.h openssl/ssl.h openssl/err.h)
116 if test $ac_cv_header_openssl_x509_h = no; then
117 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
123 dnl **********************************************************************
124 dnl Check for the presence of ZLIB libraries and headers
125 dnl **********************************************************************
127 dnl Default to compiler & linker defaults for files & libraries.
129 dnl AC_ARG_WITH(zlib,dnl
130 dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
131 dnl DIR points to the ZLIB installation prefix [/usr/local]],
132 dnl OPT_ZLIB=$withval,
135 dnl Check for & handle argument to --with-zlib.
137 dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
138 dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
141 dnl AC_MSG_CHECKING(where to look for ZLIB)
142 dnl if test X"$OPT_ZLIB" = Xno
144 dnl AC_MSG_RESULT([defaults (or given in environment)])
146 dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
147 dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
148 dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
149 dnl AC_MSG_RESULT([$OPT_ZLIB])
153 dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
156 dnl Default is to try the thread-safe versions of a few functions
158 AC_ARG_ENABLE(thread,dnl
159 [ --disable-thread tell configure to not look for thread-safe functions],
163 if test X"$OPT_THREAD" = Xoff
165 AC_MSG_WARN(libcurl will not get built using thread-safe functions)
166 AC_DEFINE(DISABLED_THREADSAFE, 1, \
167 Set to explicitly specify we don't want to use thread-safe functions)
169 dnl check for number of arguments to gethostbyname_r. it might take
170 dnl either 3, 5, or 6 arguments.
171 AC_CHECK_FUNCS(gethostbyname_r,[
172 AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments)
175 #include <sys/types.h>
181 struct hostent_data hdata;
182 char *name = "localhost";
184 memset(&h, 0, sizeof(struct hostent));
185 memset(&hdata, 0, sizeof(struct hostent_data));
186 rc = gethostbyname_r(name, &h, &hdata);
187 exit (rc != 0 ? 1 : 0); }],[
189 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
190 ac_cv_gethostbyname_args=3],[
192 AC_MSG_CHECKING(if gethostbyname_r with -D_REENTRANT takes 3 arguments)
197 #include <sys/types.h>
203 struct hostent_data hdata;
204 char *name = "localhost";
206 memset(&h, 0, sizeof(struct hostent));
207 memset(&hdata, 0, sizeof(struct hostent_data));
208 rc = gethostbyname_r(name, &h, &hdata);
209 exit (rc != 0 ? 1 : 0); }],[
211 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
212 AC_DEFINE(NEED_REENTRANT)
213 ac_cv_gethostbyname_args=3],[
215 AC_MSG_CHECKING(if gethostbyname_r takes 5 arguments)
217 #include <sys/types.h>
224 char *name = "localhost";
227 hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
228 exit (hp == NULL ? 1 : 0); }],[
230 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
231 ac_cv_gethostbyname_args=5],[
233 AC_MSG_CHECKING(if gethostbyname_r takes 6 arguments)
235 #include <sys/types.h>
242 char *name = "localhost";
246 rc = gethostbyname_r(name, &h, buf, 8192, &hp, &h_errno);
247 exit (rc != 0 ? 1 : 0); }],[
249 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
250 ac_cv_gethostbyname_args=6],[
252 have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"],
253 [ac_cv_gethostbyname_args=0])],
254 [ac_cv_gethostbyname_args=0])],
255 [ac_cv_gethostbyname_args=0])],
256 [ac_cv_gethostbyname_args=0])])
258 dnl check for number of arguments to gethostbyaddr_r. it might take
259 dnl either 5, 7, or 8 arguments.
260 AC_CHECK_FUNCS(gethostbyaddr_r,[
261 AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
263 #include <sys/types.h>
264 #include <netdb.h>],[
269 struct hostent_data hdata;
271 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
273 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
274 ac_cv_gethostbyaddr_args=5],[
276 AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
279 #include <sys/types.h>
280 #include <netdb.h>],[
285 struct hostent_data hdata;
287 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
289 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
290 AC_DEFINE(NEED_REENTRANT)
291 ac_cv_gethostbyaddr_args=5],[
293 AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
295 #include <sys/types.h>
296 #include <netdb.h>],[
306 hp = gethostbyaddr_r(address, length, type, &h,
307 buffer, buflen, &h_errnop);],[
309 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
310 ac_cv_gethostbyaddr_args=7],[
312 AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
314 #include <sys/types.h>
315 #include <netdb.h>],[
326 rc = gethostbyaddr_r(address, length, type, &h,
327 buffer, buflen, &hp, &h_errnop);],[
329 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
330 ac_cv_gethostbyaddr_args=8],[
332 have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
334 dnl determine if function definition for inet_ntoa_r exists.
335 AC_CHECK_FUNCS(inet_ntoa_r,[
336 AC_MSG_CHECKING(whether inet_ntoa_r is declared)
337 AC_EGREP_CPP(inet_ntoa_r,[
338 #include <arpa/inet.h>],[
339 AC_DEFINE(HAVE_INET_NTOA_R_DECL)
340 AC_MSG_RESULT(yes)],[
342 AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
343 AC_EGREP_CPP(inet_ntoa_r,[
345 #include <arpa/inet.h>],[
346 AC_DEFINE(HAVE_INET_NTOA_R_DECL)
347 AC_DEFINE(NEED_REENTRANT)
349 AC_MSG_RESULT(no))])])
351 dnl check for a few thread-safe functions
352 AC_CHECK_FUNCS(localtime_r,[
353 AC_MSG_CHECKING(whether localtime_r is declared)
354 AC_EGREP_CPP(localtime_r,[
356 AC_MSG_RESULT(yes)],[
358 AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
359 AC_EGREP_CPP(localtime_r,[
362 AC_DEFINE(NEED_REENTRANT)
364 AC_MSG_RESULT(no))])])
367 dnl **********************************************************************
368 dnl Back to "normal" configuring
369 dnl **********************************************************************
371 dnl Checks for header files.
401 dnl Check for libz header
402 dnl AC_CHECK_HEADERS(zlib.h)
404 dnl Checks for typedefs, structures, and compiler characteristics.
411 # check for 'long double'
412 AC_CHECK_SIZEOF(long double, 8)
413 # check for 'long long'
414 AC_CHECK_SIZEOF(long long, 4)
416 dnl Get system canonical name
418 AC_DEFINE_UNQUOTED(OS, "${host}")
420 dnl Checks for library functions.
421 dnl AC_PROG_GCC_TRADITIONAL
424 AC_CHECK_FUNCS( socket \
449 if test "$ac_cv_func_select" != "yes"; then
450 AC_MSG_ERROR(Can't work without an existing socket() function)
453 AC_PATH_PROG( PERL, perl, ,
454 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
457 AC_PATH_PROGS( NROFF, gnroff nroff, ,
458 $PATH:/usr/bin/:/usr/local/bin )
463 dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
464 dnl $PATH:/usr/bin/:/usr/local/bin )
467 AC_OUTPUT( Makefile \
472 include/curl/Makefile \
475 dnl perl/checklinks.pl \
476 dnl perl/getlinks.pl \
477 dnl perl/formfind.pl \
478 dnl perl/recursiveftpget.pl )