]> git.ipfire.org Git - thirdparty/curl.git/blame - configure.in
introducing -R/--remote-time which uses the remote file's time to set the
[thirdparty/curl.git] / configure.in
CommitLineData
ae1912cb
DS
1dnl $Id$
2dnl Process this file with autoconf to produce a configure script.
93c53424
DS
3AC_INIT
4AC_CONFIG_SRCDIR([lib/urldata.h])
f6163b37 5AM_CONFIG_HEADER(config.h src/config.h)
8f5ffd94 6
784f57f9 7VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
8f5ffd94 8AM_INIT_AUTOMAKE(curl,$VERSION)
caf8c01e 9
1e5e0f9a
DS
10dnl
11dnl we extract the numerical version for curl-config only
12VERSIONNUM=`sed -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curl.h`
13AC_SUBST(VERSIONNUM)
14
c503930b
CB
15dnl Solaris pkgadd support definitions
16PKGADD_PKG="HAXXcurl"
17PKGADD_NAME="cURL - a client that groks URLs"
18PKGADD_VENDOR="curl.haxx.se"
19AC_SUBST(PKGADD_PKG)
20AC_SUBST(PKGADD_NAME)
21AC_SUBST(PKGADD_VENDOR)
22
23
caf8c01e
DS
24dnl
25dnl Detect the canonical host and target build environment
26dnl
ae1912cb 27
c77f77a1 28AC_CANONICAL_HOST
93c53424
DS
29dnl Get system canonical name
30AC_DEFINE_UNQUOTED(OS, "${host}")
1b1f143c
DS
31
32dnl Check for AIX weirdos
33AC_AIX
34
93c53424
DS
35dnl Checks for programs.
36AC_PROG_CC
37
d4ffc5ef 38dnl check for how to do large files
1b1f143c 39AC_SYS_LARGEFILE
d4ffc5ef 40
93c53424
DS
41AM_PROG_LIBTOOL
42
d1a1fcc6
DS
43dnl The install stuff has already been taken care of by the automake stuff
44dnl AC_PROG_INSTALL
ae1912cb
DS
45AC_PROG_MAKE_SET
46
572c29a4
DS
47dnl ************************************************************
48dnl lame option to switch on debug options
49dnl
50AC_MSG_CHECKING([whether to enable debug options])
51AC_ARG_ENABLE(debug,
52[ --enable-debug Enable pedantic debug options
53 --disable-debug Disable debug options],
54[ case "$enableval" in
55 no)
56 AC_MSG_RESULT(no)
57 ;;
58 *) AC_MSG_RESULT(yes)
59
60 CPPFLAGS="$CPPFLAGS -DMALLOCDEBUG"
ccb3a13c 61 CFLAGS="-W -Wall -Wwrite-strings -pedantic -g"
572c29a4
DS
62 ;;
63 esac ],
64 AC_MSG_RESULT(no)
65)
c0c02833 66
65840f1f
DS
67dnl **********************************************************************
68dnl Checks for IPv6
69dnl **********************************************************************
70
71AC_MSG_CHECKING([whether to enable ipv6])
72AC_ARG_ENABLE(ipv6,
73[ --enable-ipv6 Enable ipv6 (with ipv4) support
74 --disable-ipv6 Disable ipv6 support],
75[ case "$enableval" in
76 no)
77 AC_MSG_RESULT(no)
78 ipv6=no
79 ;;
80 *) AC_MSG_RESULT(yes)
65840f1f
DS
81 ipv6=yes
82 ;;
83 esac ],
84
85 AC_TRY_RUN([ /* is AF_INET6 available? */
86#include <sys/types.h>
87#include <sys/socket.h>
88main()
89{
90 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
91 exit(1);
92 else
93 exit(0);
94}
95],
96 AC_MSG_RESULT(yes)
65840f1f
DS
97 ipv6=yes,
98 AC_MSG_RESULT(no)
99 ipv6=no,
100 AC_MSG_RESULT(no)
101 ipv6=no
102))
ae1912cb 103
c0c02833
DS
104if test "$ipv6" = "yes"; then
105 CURL_CHECK_WORKING_GETADDRINFO
106fi
107
108
ae1912cb
DS
109dnl **********************************************************************
110dnl Checks for libraries.
111dnl **********************************************************************
112
61fb8fea 113dnl gethostbyname in the nsl lib?
ae1912cb
DS
114AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
115
61fb8fea
DS
116if 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))
119fi
120
caf8c01e
DS
121dnl At least one system has been identified to require BOTH nsl and
122dnl socket libs to link properly.
123if 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"
127 AC_TRY_LINK( ,
128 [gethostbyname();],
129 my_ac_link_result=success,
130 my_ac_link_result=failure )
131
132 if test "$my_ac_link_result" = "failure"; then
133 AC_MSG_RESULT([no])
134 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
135 dnl restore LIBS
136 LIBS=$my_ac_save_LIBS
137 else
138 AC_MSG_RESULT([yes])
139 fi
140fi
141
ae1912cb
DS
142dnl resolve lib?
143AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
144
b174aeaa
DS
145if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
146 AC_CHECK_LIB(resolve, strcasecmp,
147 [LIBS="-lresolve $LIBS"],
148 ,
149 -lnsl)
150fi
151
ae1912cb
DS
152dnl socket lib?
153AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
154
155dnl ucb lib?
156AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
157
158dnl dl lib?
43d0d756 159AC_CHECK_FUNC(dlclose, , AC_CHECK_LIB(dl, dlopen))
ae1912cb 160
2ef13230
DS
161dnl **********************************************************************
162dnl Check for the random seed preferences
163dnl **********************************************************************
164
165AC_ARG_WITH(egd-socket,
166 [ --with-egd-socket=FILE Entropy Gathering Daemon socket pathname],
167 [ EGD_SOCKET="$withval" ]
168)
169if test -n "$EGD_SOCKET" ; then
170 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
171fi
172
173dnl Check for user-specified random device
174AC_ARG_WITH(random,
175 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
176 [ RANDOM_FILE="$withval" ],
177 [
178 dnl Check for random device
179 AC_CHECK_FILE("/dev/urandom",
180 [
181 RANDOM_FILE="/dev/urandom";
182 ]
183 )
184 ]
185)
186if test -n "$RANDOM_FILE" ; then
187 AC_SUBST(RANDOM_FILE)
188 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE")
189fi
190
00505c92
DS
191dnl **********************************************************************
192dnl Check for the presence of Kerberos4 libraries and headers
193dnl **********************************************************************
194
195AC_ARG_WITH(krb4-includes,
196 [ --with-krb4-includes[=DIR] Specify location of kerberos4 headers],[
197 CPPFLAGS="$CPPFLAGS -I$withval"
198 KRB4INC="$withval"
199 want_krb4=yes
200 ])
201
202AC_ARG_WITH(krb4-libs,
203 [ --with-krb4-libs[=DIR] Specify location of kerberos4 libs],[
204 LDFLAGS="$LDFLAGS -L$withval"
205 KRB4LIB="$withval"
206 want_krb4=yes
207 ])
208
209
210OPT_KRB4=off
211AC_ARG_WITH(krb4,dnl
212[ --with-krb4[=DIR] where to look for Kerberos4],[
213 OPT_KRB4="$withval"
214 if test X"$OPT_KRB4" != Xyes
215 then
216 LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib"
217 KRB4LIB="$OPT_KRB4/lib"
218 CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
219 KRB4INC="$OPT_KRB4/include"
220 fi
221 want_krb4="yes"
222 ])
223
224AC_MSG_CHECKING([if Kerberos4 support is requested])
225
226if test "$want_krb4" = yes
227then
f6e2bfd4
DS
228 if test "$ipv6" = "yes"; then
229 echo krb4 is not compatible with IPv6
230 exit 1
231 fi
00505c92
DS
232 AC_MSG_RESULT(yes)
233
234 dnl Check for & handle argument to --with-krb4
235
236 AC_MSG_CHECKING(where to look for Kerberos4)
237 if test X"$OPT_KRB4" = Xyes
238 then
239 AC_MSG_RESULT([defaults])
240 else
241 AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
242 fi
243
244 dnl Check for DES library
245 AC_CHECK_LIB(des, des_pcbc_encrypt,
246 [
247 AC_CHECK_HEADERS(des.h)
248
249 dnl resolv lib?
250 AC_CHECK_FUNC(res_search, , AC_CHECK_LIB(resolv, res_search))
251
252 dnl Check for the Kerberos4 library
253 AC_CHECK_LIB(krb, krb_net_read,
254 [
255 dnl Check for header files
256 AC_CHECK_HEADERS(krb.h)
257
258 dnl we found the required libraries, add to LIBS
259 LIBS="-lkrb -ldes $LIBS"
260
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)
264
265 dnl add define KRB4
266 AC_DEFINE(KRB4)
267
1ee7f92c
DS
268 dnl substitute it too!
269 KRB4_ENABLED=1
270 AC_SUBST(KRB4_ENABLED)
271
00505c92
DS
272 dnl the krb4 stuff needs a strlcpy()
273 AC_CHECK_FUNCS(strlcpy)
274
275 ])
276 ])
277else
278 AC_MSG_RESULT(no)
279fi
280
23903306 281
ae1912cb
DS
282dnl **********************************************************************
283dnl Check for the presence of SSL libraries and headers
284dnl **********************************************************************
285
286dnl Default to compiler & linker defaults for SSL files & libraries.
287OPT_SSL=off
288AC_ARG_WITH(ssl,dnl
289[ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths]
290 DIR points to the SSL installation [/usr/local/ssl]],
291 OPT_SSL=$withval
292)
293
294if test X"$OPT_SSL" = Xno
295then
296 AC_MSG_WARN(SSL/https support disabled)
297else
298
4836154c 299 dnl Check for and handle argument to --with-ssl.
4ac7a087
DS
300
301 dnl save the pre-ssl check flags for a while
302 CLEANLDFLAGS="$LDFLAGS"
303 CLEANCPPFLAGS="$CPPFLAGS"
4836154c
DS
304
305 case "$OPT_SSL" in
306 yes)
307 EXTRA_SSL=/usr/local/ssl ;;
4398151f
DS
308 off)
309 EXTRA_SSL= ;;
4836154c 310 *)
4ac7a087
DS
311 dnl check the given spot right away!
312 EXTRA_SSL=$OPT_SSL
313 LDFLAGS="$LDFLAGS -L$EXTRA_SSL/lib"
314 CPPFLAGS="$CPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
315 ;;
4836154c
DS
316 esac
317
318 AC_CHECK_LIB(crypto, CRYPTO_lock,[
319 HAVECRYPTO="yes"
320 ],[
321 OLDLDFLAGS="$LDFLAGS"
322 OLDCPPFLAGS="$CPPFLAGS"
4ac7a087
DS
323 LDFLAGS="$CLEANLDFLAGS -L$EXTRA_SSL/lib"
324 CPPFLAGS="$CLEANCPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
4836154c
DS
325 AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
326 HAVECRYPTO="yes" ], [
327 LDFLAGS="$OLDLDFLAGS"
328 CPPFLAGS="$OLDCPPFLAGS"
329 ])
330 ])
ae1912cb 331
ae1912cb 332
4836154c 333 if test "$HAVECRYPTO" = "yes"; then
ae1912cb
DS
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
4836154c 336
1b9e26a2 337 AC_CHECK_LIB(crypto, CRYPTO_add_lock)
ae1912cb
DS
338 AC_CHECK_LIB(ssl, SSL_connect)
339
b32bf427
DS
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);
343 OLIBS=$LIBS
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
348 AC_MSG_RESULT(no)
349 LIBS=$OLIBS
350 else
351 AC_MSG_RESULT(yes)
352 fi
353 fi
354
355
ae1912cb 356 dnl Check for SSLeay headers
1ee7f92c 357 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
23903306
DS
358 openssl/pem.h openssl/ssl.h openssl/err.h,
359 OPENSSL_ENABLED=1)
ae1912cb
DS
360
361 if test $ac_cv_header_openssl_x509_h = no; then
23903306
DS
362 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
363 OPENSSL_ENABLED=1)
1ee7f92c
DS
364 fi
365
366 AC_SUBST(OPENSSL_ENABLED)
367
ae1912cb 368 fi
00505c92 369
1ee7f92c
DS
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!])
373 fi
374
375
00505c92
DS
376 dnl these can only exist if openssl exists
377
378 AC_CHECK_FUNCS( RAND_status \
2ef13230
DS
379 RAND_screen \
380 RAND_egd )
00505c92 381
ae1912cb
DS
382fi
383
384dnl **********************************************************************
385dnl Check for the presence of ZLIB libraries and headers
386dnl **********************************************************************
387
388dnl Default to compiler & linker defaults for files & libraries.
389dnl OPT_ZLIB=no
390dnl AC_ARG_WITH(zlib,dnl
391dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
392dnl DIR points to the ZLIB installation prefix [/usr/local]],
393dnl OPT_ZLIB=$withval,
394dnl )
395
396dnl Check for & handle argument to --with-zlib.
397dnl
398dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
399dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
400dnl
401
402dnl AC_MSG_CHECKING(where to look for ZLIB)
403dnl if test X"$OPT_ZLIB" = Xno
404dnl then
405dnl AC_MSG_RESULT([defaults (or given in environment)])
406dnl else
407dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
408dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
409dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
410dnl AC_MSG_RESULT([$OPT_ZLIB])
411dnl fi
412
413dnl z lib?
414dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
415
b174aeaa
DS
416
417dnl Default is to try the thread-safe versions of a few functions
418OPT_THREAD=on
419AC_ARG_ENABLE(thread,dnl
420[ --disable-thread tell configure to not look for thread-safe functions],
421 OPT_THREAD=off
422)
423
424if test X"$OPT_THREAD" = Xoff
425then
426 AC_MSG_WARN(libcurl will not get built using thread-safe functions)
427 AC_DEFINE(DISABLED_THREADSAFE, 1, \
428Set to explicitly specify we don't want to use thread-safe functions)
429else
430
116462a5
DS
431 dnl check that 'localhost' resolves first
432 CURL_CHECK_WORKING_RESOLVER
433
61fb8fea
DS
434 dnl dig around for gethostbyname_r()
435 CURL_CHECK_GETHOSTBYNAME_R()
d4731b70 436
61fb8fea
DS
437 dnl dig around for gethostbyaddr_r()
438 CURL_CHECK_GETHOSTBYADDR_R()
d4731b70 439
61fb8fea
DS
440 dnl poke around for inet_ntoa_r()
441 CURL_CHECK_INET_NTOA_R()
d4731b70 442
61fb8fea
DS
443 dnl is there a localtime_r()
444 CURL_CHECK_LOCALTIME_R()
d4731b70 445
b174aeaa
DS
446fi
447
ae1912cb
DS
448dnl **********************************************************************
449dnl Back to "normal" configuring
450dnl **********************************************************************
451
452dnl Checks for header files.
453AC_HEADER_STDC
454AC_CHECK_HEADERS( \
455 unistd.h \
8898ff9e
DS
456 malloc.h \
457 stdlib.h \
ae1912cb
DS
458 arpa/inet.h \
459 net/if.h \
460 netinet/in.h \
d4731b70 461 netinet/if_ether.h \
ae1912cb
DS
462 netdb.h \
463 sys/select.h \
464 sys/socket.h \
465 sys/sockio.h \
466 sys/stat.h \
467 sys/types.h \
d5bc98fc 468 sys/time.h \
ae1912cb
DS
469 getopt.h \
470 sys/param.h \
471 termios.h \
472 termio.h \
473 sgtty.h \
474 fcntl.h \
475 dlfcn.h \
476 alloca.h \
477 winsock.h \
478 time.h \
479 io.h \
92186dc3 480 pwd.h
ae1912cb
DS
481)
482
483dnl Check for libz header
484dnl AC_CHECK_HEADERS(zlib.h)
485
486dnl Checks for typedefs, structures, and compiler characteristics.
487AC_C_CONST
488AC_TYPE_SIZE_T
489AC_HEADER_TIME
490
491# mprintf() checks:
492
493# check for 'long double'
494AC_CHECK_SIZEOF(long double, 8)
495# check for 'long long'
496AC_CHECK_SIZEOF(long long, 4)
497
61e2a810
DS
498# check for ssize_t
499AC_CHECK_TYPE(ssize_t, int)
500
a1cec0e4 501TYPE_SOCKLEN_T
11693c0f 502
ae1912cb
DS
503dnl Checks for library functions.
504dnl AC_PROG_GCC_TRADITIONAL
505AC_TYPE_SIGNAL
f8e916db 506dnl AC_FUNC_VPRINTF
ae1912cb
DS
507AC_CHECK_FUNCS( socket \
508 select \
509 strdup \
510 strstr \
4e376a2f 511 strtok_r \
ae1912cb
DS
512 strftime \
513 uname \
514 strcasecmp \
95c2534a
DS
515 stricmp \
516 strcmpi \
ae1912cb
DS
517 gethostname \
518 gethostbyaddr \
519 getservbyname \
520 gettimeofday \
521 inet_addr \
522 inet_ntoa \
523 tcsetattr \
524 tcgetattr \
525 perror \
0e31dadf 526 closesocket \
3264ce04 527 setvbuf \
852b664e 528 sigaction \
1ff573c6 529 signal \
f6e2bfd4 530 getpass_r \
92186dc3
DS
531 strlcat \
532 getpwuid \
43d0d756
DS
533 geteuid \
534 dlopen
ae1912cb
DS
535)
536
cdfb83e0
DS
537dnl removed 'getpass' check on October 26, 2000
538
f8e916db 539if test "$ac_cv_func_select" != "yes"; then
4f255ffb
DS
540 AC_MSG_ERROR(Can't work without an existing select() function)
541fi
542if test "$ac_cv_func_socket" != "yes"; then
f8e916db
DS
543 AC_MSG_ERROR(Can't work without an existing socket() function)
544fi
545
7dc36344
DS
546AC_PATH_PROG( PERL, perl, ,
547 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
548AC_SUBST(PERL)
ae1912cb 549
90719eb3 550AC_PATH_PROGS( NROFF, gnroff nroff, ,
ae1912cb 551 $PATH:/usr/bin/:/usr/local/bin )
96dde76b 552AC_SUBST(NROFF)
ae1912cb 553
ae1912cb
DS
554AC_PROG_YACC
555
556dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
557dnl $PATH:/usr/bin/:/usr/local/bin )
558dnl AC_SUBST(RANLIB)
559
93c53424 560AC_CONFIG_FILES([Makefile \
f71a1485 561 docs/Makefile \
d54cdf29 562 docs/examples/Makefile \
c3c77398
DS
563 include/Makefile \
564 include/curl/Makefile \
ae1912cb 565 src/Makefile \
172f0ba1 566 lib/Makefile \
044ca343 567 tests/Makefile \
b915ca68 568 tests/data/Makefile \
9ade752f
DS
569 packages/Makefile \
570 packages/Win32/Makefile \
571 packages/Linux/Makefile \
572 packages/Linux/RPM/Makefile \
d54cdf29 573 packages/Linux/RPM/curl.spec \
aa860990 574 packages/Linux/RPM/curl-ssl.spec \
c503930b 575 packages/Solaris/Makefile \
aa860990
DS
576 perl/Makefile \
577 perl/Curl_easy/Makefile \
578 php/Makefile \
5ab751f5
DS
579 php/examples/Makefile \
580 curl-config
93c53424
DS
581])
582AC_OUTPUT
d54cdf29 583