]> git.ipfire.org Git - thirdparty/curl.git/blame - configure.in
As Andrés García reported we need to fflush() the data->err so that 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 ;;
308 *)
4ac7a087
DS
309 dnl check the given spot right away!
310 EXTRA_SSL=$OPT_SSL
311 LDFLAGS="$LDFLAGS -L$EXTRA_SSL/lib"
312 CPPFLAGS="$CPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
313 ;;
4836154c
DS
314 esac
315
316 AC_CHECK_LIB(crypto, CRYPTO_lock,[
317 HAVECRYPTO="yes"
318 ],[
319 OLDLDFLAGS="$LDFLAGS"
320 OLDCPPFLAGS="$CPPFLAGS"
4ac7a087
DS
321 LDFLAGS="$CLEANLDFLAGS -L$EXTRA_SSL/lib"
322 CPPFLAGS="$CLEANCPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
4836154c
DS
323 AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
324 HAVECRYPTO="yes" ], [
325 LDFLAGS="$OLDLDFLAGS"
326 CPPFLAGS="$OLDCPPFLAGS"
327 ])
328 ])
ae1912cb 329
ae1912cb 330
4836154c 331 if test "$HAVECRYPTO" = "yes"; then
ae1912cb
DS
332 dnl This is only reasonable to do if crypto actually is there: check for
333 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
4836154c 334
1b9e26a2 335 AC_CHECK_LIB(crypto, CRYPTO_add_lock)
ae1912cb
DS
336 AC_CHECK_LIB(ssl, SSL_connect)
337
b32bf427
DS
338 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
339 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
340 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
341 OLIBS=$LIBS
342 LIBS="$LIBS -lRSAglue -lrsaref"
343 AC_CHECK_LIB(ssl, SSL_connect)
344 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
345 dnl still no SSL_connect
346 AC_MSG_RESULT(no)
347 LIBS=$OLIBS
348 else
349 AC_MSG_RESULT(yes)
350 fi
351 fi
352
353
ae1912cb 354 dnl Check for SSLeay headers
1ee7f92c 355 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
23903306
DS
356 openssl/pem.h openssl/ssl.h openssl/err.h,
357 OPENSSL_ENABLED=1)
ae1912cb
DS
358
359 if test $ac_cv_header_openssl_x509_h = no; then
23903306
DS
360 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
361 OPENSSL_ENABLED=1)
1ee7f92c
DS
362 fi
363
364 AC_SUBST(OPENSSL_ENABLED)
365
ae1912cb 366 fi
00505c92 367
1ee7f92c
DS
368 if test X"$OPT_SSL" != Xoff &&
369 test "$OPENSSL_ENABLED" != "1"; then
370 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
371 fi
372
373
00505c92
DS
374 dnl these can only exist if openssl exists
375
376 AC_CHECK_FUNCS( RAND_status \
2ef13230
DS
377 RAND_screen \
378 RAND_egd )
00505c92 379
ae1912cb
DS
380fi
381
382dnl **********************************************************************
383dnl Check for the presence of ZLIB libraries and headers
384dnl **********************************************************************
385
386dnl Default to compiler & linker defaults for files & libraries.
387dnl OPT_ZLIB=no
388dnl AC_ARG_WITH(zlib,dnl
389dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
390dnl DIR points to the ZLIB installation prefix [/usr/local]],
391dnl OPT_ZLIB=$withval,
392dnl )
393
394dnl Check for & handle argument to --with-zlib.
395dnl
396dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
397dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
398dnl
399
400dnl AC_MSG_CHECKING(where to look for ZLIB)
401dnl if test X"$OPT_ZLIB" = Xno
402dnl then
403dnl AC_MSG_RESULT([defaults (or given in environment)])
404dnl else
405dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
406dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
407dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
408dnl AC_MSG_RESULT([$OPT_ZLIB])
409dnl fi
410
411dnl z lib?
412dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
413
b174aeaa
DS
414
415dnl Default is to try the thread-safe versions of a few functions
416OPT_THREAD=on
417AC_ARG_ENABLE(thread,dnl
418[ --disable-thread tell configure to not look for thread-safe functions],
419 OPT_THREAD=off
420)
421
422if test X"$OPT_THREAD" = Xoff
423then
424 AC_MSG_WARN(libcurl will not get built using thread-safe functions)
425 AC_DEFINE(DISABLED_THREADSAFE, 1, \
426Set to explicitly specify we don't want to use thread-safe functions)
427else
428
116462a5
DS
429 dnl check that 'localhost' resolves first
430 CURL_CHECK_WORKING_RESOLVER
431
61fb8fea
DS
432 dnl dig around for gethostbyname_r()
433 CURL_CHECK_GETHOSTBYNAME_R()
d4731b70 434
61fb8fea
DS
435 dnl dig around for gethostbyaddr_r()
436 CURL_CHECK_GETHOSTBYADDR_R()
d4731b70 437
61fb8fea
DS
438 dnl poke around for inet_ntoa_r()
439 CURL_CHECK_INET_NTOA_R()
d4731b70 440
61fb8fea
DS
441 dnl is there a localtime_r()
442 CURL_CHECK_LOCALTIME_R()
d4731b70 443
b174aeaa
DS
444fi
445
ae1912cb
DS
446dnl **********************************************************************
447dnl Back to "normal" configuring
448dnl **********************************************************************
449
450dnl Checks for header files.
451AC_HEADER_STDC
452AC_CHECK_HEADERS( \
453 unistd.h \
8898ff9e
DS
454 malloc.h \
455 stdlib.h \
ae1912cb
DS
456 arpa/inet.h \
457 net/if.h \
458 netinet/in.h \
d4731b70 459 netinet/if_ether.h \
ae1912cb
DS
460 netdb.h \
461 sys/select.h \
462 sys/socket.h \
463 sys/sockio.h \
464 sys/stat.h \
465 sys/types.h \
d5bc98fc 466 sys/time.h \
ae1912cb
DS
467 getopt.h \
468 sys/param.h \
469 termios.h \
470 termio.h \
471 sgtty.h \
472 fcntl.h \
473 dlfcn.h \
474 alloca.h \
475 winsock.h \
476 time.h \
477 io.h \
92186dc3 478 pwd.h
ae1912cb
DS
479)
480
481dnl Check for libz header
482dnl AC_CHECK_HEADERS(zlib.h)
483
484dnl Checks for typedefs, structures, and compiler characteristics.
485AC_C_CONST
486AC_TYPE_SIZE_T
487AC_HEADER_TIME
488
489# mprintf() checks:
490
491# check for 'long double'
492AC_CHECK_SIZEOF(long double, 8)
493# check for 'long long'
494AC_CHECK_SIZEOF(long long, 4)
495
61e2a810
DS
496# check for ssize_t
497AC_CHECK_TYPE(ssize_t, int)
498
a1cec0e4 499TYPE_SOCKLEN_T
11693c0f 500
ae1912cb
DS
501dnl Checks for library functions.
502dnl AC_PROG_GCC_TRADITIONAL
503AC_TYPE_SIGNAL
f8e916db 504dnl AC_FUNC_VPRINTF
ae1912cb
DS
505AC_CHECK_FUNCS( socket \
506 select \
507 strdup \
508 strstr \
4e376a2f 509 strtok_r \
ae1912cb
DS
510 strftime \
511 uname \
512 strcasecmp \
95c2534a
DS
513 stricmp \
514 strcmpi \
ae1912cb
DS
515 gethostname \
516 gethostbyaddr \
517 getservbyname \
518 gettimeofday \
519 inet_addr \
520 inet_ntoa \
521 tcsetattr \
522 tcgetattr \
523 perror \
0e31dadf 524 closesocket \
3264ce04 525 setvbuf \
852b664e 526 sigaction \
1ff573c6 527 signal \
f6e2bfd4 528 getpass_r \
92186dc3
DS
529 strlcat \
530 getpwuid \
43d0d756
DS
531 geteuid \
532 dlopen
ae1912cb
DS
533)
534
cdfb83e0
DS
535dnl removed 'getpass' check on October 26, 2000
536
f8e916db 537if test "$ac_cv_func_select" != "yes"; then
4f255ffb
DS
538 AC_MSG_ERROR(Can't work without an existing select() function)
539fi
540if test "$ac_cv_func_socket" != "yes"; then
f8e916db
DS
541 AC_MSG_ERROR(Can't work without an existing socket() function)
542fi
543
7dc36344
DS
544AC_PATH_PROG( PERL, perl, ,
545 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
546AC_SUBST(PERL)
ae1912cb 547
90719eb3 548AC_PATH_PROGS( NROFF, gnroff nroff, ,
ae1912cb 549 $PATH:/usr/bin/:/usr/local/bin )
96dde76b 550AC_SUBST(NROFF)
ae1912cb 551
ae1912cb
DS
552AC_PROG_YACC
553
554dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
555dnl $PATH:/usr/bin/:/usr/local/bin )
556dnl AC_SUBST(RANLIB)
557
93c53424 558AC_CONFIG_FILES([Makefile \
f71a1485 559 docs/Makefile \
d54cdf29 560 docs/examples/Makefile \
c3c77398
DS
561 include/Makefile \
562 include/curl/Makefile \
ae1912cb 563 src/Makefile \
172f0ba1 564 lib/Makefile \
044ca343 565 tests/Makefile \
b915ca68 566 tests/data/Makefile \
9ade752f
DS
567 packages/Makefile \
568 packages/Win32/Makefile \
569 packages/Linux/Makefile \
570 packages/Linux/RPM/Makefile \
d54cdf29 571 packages/Linux/RPM/curl.spec \
aa860990 572 packages/Linux/RPM/curl-ssl.spec \
c503930b 573 packages/Solaris/Makefile \
aa860990
DS
574 perl/Makefile \
575 perl/Curl_easy/Makefile \
576 php/Makefile \
5ab751f5
DS
577 php/examples/Makefile \
578 curl-config
93c53424
DS
579])
580AC_OUTPUT
d54cdf29 581