1
dnl $Id: configure.in,v 1.97 2002/03/04 10:28:02 bagder Exp $
2
dnl Process this file with autoconf to produce a configure script.
4
dnl Ensure that this file is processed with autoconf 2.50 or newer
5
dnl Don't even think about removing this check!
8
dnl First some basic init macros
10
AC_CONFIG_SRCDIR([lib/urldata.h])
11
AM_CONFIG_HEADER(lib/config.h src/config.h tests/server/config.h)
13
dnl figure out the libcurl version
14
VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
15
AM_INIT_AUTOMAKE(curl,$VERSION)
18
dnl we extract the numerical version for curl-config only
19
VERSIONNUM=`sed -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curl.h`
22
dnl Solaris pkgadd support definitions
24
PKGADD_NAME="cURL - a client that groks URLs"
25
PKGADD_VENDOR="curl.haxx.se"
28
AC_SUBST(PKGADD_VENDOR)
32
dnl Detect the canonical host and target build environment
36
dnl Get system canonical name
37
AC_DEFINE_UNQUOTED(OS, "${host}")
39
dnl Check for AIX weirdos
42
dnl Checks for programs.
45
dnl check for how to do large files
48
dnl check for cygwin stuff
54
dnl The install stuff has already been taken care of by the automake stuff
58
dnl ************************************************************
59
dnl lame option to switch on debug options
61
AC_MSG_CHECKING([whether to enable debug options])
63
[ --enable-debug Enable pedantic debug options
64
--disable-debug Disable debug options],
65
[ case "$enableval" in
71
CPPFLAGS="$CPPFLAGS -DMALLOCDEBUG"
72
CFLAGS="-W -Wall -Wwrite-strings -pedantic -Wundef -Wpointer-arith -Wcast-align -Wnested-externs -g"
78
dnl **********************************************************************
80
dnl **********************************************************************
82
AC_MSG_CHECKING([whether to enable ipv6])
84
[ --enable-ipv6 Enable ipv6 (with ipv4) support
85
--disable-ipv6 Disable ipv6 support],
86
[ case "$enableval" in
96
AC_TRY_RUN([ /* is AF_INET6 available? */
97
#include <sys/types.h>
98
#include <sys/socket.h>
101
if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
115
if test "$ipv6" = "yes"; then
116
CURL_CHECK_WORKING_GETADDRINFO
120
dnl **********************************************************************
121
dnl Checks for libraries.
122
dnl **********************************************************************
124
dnl gethostbyname in the nsl lib?
125
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
127
if test "$ac_cv_lib_nsl_gethostbyname" != "yes" -a "$ac_cv_func_gethostbyname" != "yes"; then
128
dnl gethostbyname in the socket lib?
129
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(socket, gethostbyname))
132
dnl At least one system has been identified to require BOTH nsl and
133
dnl socket libs to link properly.
134
if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname"; then
135
AC_MSG_CHECKING([trying both nsl and socket libs])
136
my_ac_save_LIBS=$LIBS
137
LIBS="-lnsl -lsocket $LIBS"
140
my_ac_link_result=success,
141
my_ac_link_result=failure )
143
if test "$my_ac_link_result" = "failure"; then
145
AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
147
LIBS=$my_ac_save_LIBS
154
AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
156
if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
157
AC_CHECK_LIB(resolve, strcasecmp,
158
[LIBS="-lresolve $LIBS"],
164
AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
167
AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
170
AC_CHECK_FUNC(dlclose, , AC_CHECK_LIB(dl, dlopen))
172
dnl **********************************************************************
173
dnl Check how non-blocking sockets are set
174
dnl **********************************************************************
175
AC_ARG_ENABLE(nonblocking,
176
[ --enable-nonblocking Makes the script detect how to do it
177
--disable-nonblocking Makes the script disable non-blocking sockets],
179
if test "$enableval" = "no" ; then
180
AC_MSG_WARN([non-blocking sockets disabled])
181
AC_DEFINE(HAVE_DISABLED_NONBLOCKING)
183
CURL_CHECK_NONBLOCKING_SOCKET
187
CURL_CHECK_NONBLOCKING_SOCKET
190
dnl **********************************************************************
191
dnl Check for the random seed preferences
192
dnl **********************************************************************
194
AC_ARG_WITH(egd-socket,
195
[ --with-egd-socket=FILE Entropy Gathering Daemon socket pathname],
196
[ EGD_SOCKET="$withval" ]
198
if test -n "$EGD_SOCKET" ; then
199
AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
202
dnl Check for user-specified random device
204
[ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
205
[ RANDOM_FILE="$withval" ],
207
dnl Check for random device
208
AC_CHECK_FILE("/dev/urandom",
210
RANDOM_FILE="/dev/urandom";
215
if test -n "$RANDOM_FILE" ; then
216
AC_SUBST(RANDOM_FILE)
217
AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE")
220
dnl **********************************************************************
221
dnl Check for the presence of Kerberos4 libraries and headers
222
dnl **********************************************************************
224
AC_ARG_WITH(krb4-includes,
225
[ --with-krb4-includes[=DIR] Specify location of kerberos4 headers],[
226
CPPFLAGS="$CPPFLAGS -I$withval"
231
AC_ARG_WITH(krb4-libs,
232
[ --with-krb4-libs[=DIR] Specify location of kerberos4 libs],[
233
LDFLAGS="$LDFLAGS -L$withval"
241
[ --with-krb4[=DIR] where to look for Kerberos4],[
243
if test X"$OPT_KRB4" != Xyes
245
LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib"
246
KRB4LIB="$OPT_KRB4/lib"
247
CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
248
KRB4INC="$OPT_KRB4/include"
253
AC_MSG_CHECKING([if Kerberos4 support is requested])
255
if test "$want_krb4" = yes
257
if test "$ipv6" = "yes"; then
258
echo krb4 is not compatible with IPv6
263
dnl Check for & handle argument to --with-krb4
265
AC_MSG_CHECKING(where to look for Kerberos4)
266
if test X"$OPT_KRB4" = Xyes
268
AC_MSG_RESULT([defaults])
270
AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
273
dnl Check for DES library
274
AC_CHECK_LIB(des, des_pcbc_encrypt,
276
AC_CHECK_HEADERS(des.h)
279
AC_CHECK_FUNC(res_search, , AC_CHECK_LIB(resolv, res_search))
281
dnl Check for the Kerberos4 library
282
AC_CHECK_LIB(krb, krb_net_read,
284
dnl Check for header files
285
AC_CHECK_HEADERS(krb.h)
287
dnl we found the required libraries, add to LIBS
288
LIBS="-lkrb -ldes $LIBS"
290
dnl Check for function krb_get_our_ip_for_realm
291
dnl this is needed for NAT networks
292
AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
297
dnl substitute it too!
299
AC_SUBST(KRB4_ENABLED)
301
dnl the krb4 stuff needs a strlcpy()
302
AC_CHECK_FUNCS(strlcpy)
311
dnl **********************************************************************
312
dnl Check for the presence of SSL libraries and headers
313
dnl **********************************************************************
315
dnl Default to compiler & linker defaults for SSL files & libraries.
318
[ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths]
319
DIR points to the SSL installation [/usr/local/ssl]],
323
if test X"$OPT_SSL" = Xno
325
AC_MSG_WARN(SSL/https support disabled)
328
dnl Check for and handle argument to --with-ssl.
330
dnl save the pre-ssl check flags for a while
331
CLEANLDFLAGS="$LDFLAGS"
332
CLEANCPPFLAGS="$CPPFLAGS"
336
EXTRA_SSL=/usr/local/ssl ;;
340
dnl check the given spot right away!
342
LDFLAGS="$LDFLAGS -L$EXTRA_SSL/lib"
343
CPPFLAGS="$CPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
347
AC_CHECK_LIB(crypto, CRYPTO_lock,[
350
OLDLDFLAGS="$LDFLAGS"
351
OLDCPPFLAGS="$CPPFLAGS"
352
LDFLAGS="$CLEANLDFLAGS -L$EXTRA_SSL/lib"
353
CPPFLAGS="$CLEANCPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
354
AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
355
HAVECRYPTO="yes" ], [
356
LDFLAGS="$OLDLDFLAGS"
357
CPPFLAGS="$OLDCPPFLAGS"
362
if test "$HAVECRYPTO" = "yes"; then
363
dnl This is only reasonable to do if crypto actually is there: check for
364
dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
366
AC_CHECK_LIB(crypto, CRYPTO_add_lock)
367
AC_CHECK_LIB(ssl, SSL_connect)
369
if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
370
dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
371
AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
373
LIBS="$LIBS -lRSAglue -lrsaref"
374
AC_CHECK_LIB(ssl, SSL_connect)
375
if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
376
dnl still no SSL_connect
385
dnl Check for SSLeay headers
386
AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
387
openssl/pem.h openssl/ssl.h openssl/err.h,
390
if test $ac_cv_header_openssl_x509_h = no; then
391
AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
395
dnl Check for the OpenSSL engine header, it is kind of "separated"
396
dnl from the main SSL check
397
AC_CHECK_HEADERS(openssl/engine.h)
399
AC_SUBST(OPENSSL_ENABLED)
403
if test X"$OPT_SSL" != Xoff &&
404
test "$OPENSSL_ENABLED" != "1"; then
405
AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
409
dnl these can only exist if openssl exists
411
AC_CHECK_FUNCS( RAND_status \
417
dnl **********************************************************************
418
dnl Check for the presence of ZLIB libraries and headers
419
dnl **********************************************************************
421
dnl Default to compiler & linker defaults for files & libraries.
423
dnl AC_ARG_WITH(zlib,dnl
424
dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
425
dnl DIR points to the ZLIB installation prefix [/usr/local]],
426
dnl OPT_ZLIB=$withval,
429
dnl Check for & handle argument to --with-zlib.
431
dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
432
dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
435
dnl AC_MSG_CHECKING(where to look for ZLIB)
436
dnl if test X"$OPT_ZLIB" = Xno
438
dnl AC_MSG_RESULT([defaults (or given in environment)])
440
dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
441
dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
442
dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
443
dnl AC_MSG_RESULT([$OPT_ZLIB])
447
dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
450
dnl Default is to try the thread-safe versions of a few functions
452
AC_ARG_ENABLE(thread,dnl
453
[ --disable-thread tell configure to not look for thread-safe functions],
457
if test X"$OPT_THREAD" = Xoff
459
AC_MSG_WARN(libcurl will not get built using thread-safe functions)
460
AC_DEFINE(DISABLED_THREADSAFE, 1, \
461
Set to explicitly specify we don't want to use thread-safe functions)
464
dnl dig around for gethostbyname_r()
465
CURL_CHECK_GETHOSTBYNAME_R()
467
dnl dig around for gethostbyaddr_r()
468
CURL_CHECK_GETHOSTBYADDR_R()
470
dnl poke around for inet_ntoa_r()
471
CURL_CHECK_INET_NTOA_R()
473
dnl is there a localtime_r()
474
CURL_CHECK_LOCALTIME_R()
476
AC_CHECK_FUNCS( gmtime_r )
480
dnl **********************************************************************
481
dnl Back to "normal" configuring
482
dnl **********************************************************************
484
dnl Checks for header files.
516
dnl Check for libz header
517
dnl AC_CHECK_HEADERS(zlib.h)
519
dnl Checks for typedefs, structures, and compiler characteristics.
526
# check for 'long double'
527
# AC_CHECK_SIZEOF(long double, 8)
528
# check for 'long long'
529
# AC_CHECK_SIZEOF(long long, 4)
532
AC_CHECK_TYPE(ssize_t, int)
537
dnl Checks for library functions.
538
dnl AC_PROG_GCC_TRADITIONAL
541
AC_CHECK_FUNCS( socket \
571
dnl removed 'getpass' check on October 26, 2000
573
if test "$ac_cv_func_select" != "yes"; then
574
AC_MSG_ERROR(Can't work without an existing select() function)
576
if test "$ac_cv_func_socket" != "yes"; then
577
AC_MSG_ERROR(Can't work without an existing socket() function)
580
AC_PATH_PROG( PERL, perl, ,
581
$PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
584
AC_PATH_PROGS( NROFF, gnroff nroff, ,
585
$PATH:/usr/bin/:/usr/local/bin )
590
dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
591
dnl $PATH:/usr/bin/:/usr/local/bin )
594
AC_CONFIG_FILES([Makefile \
596
docs/examples/Makefile \
597
docs/libcurl/Makefile \
599
include/curl/Makefile \
603
tests/data/Makefile \
604
tests/server/Makefile \
606
packages/Win32/Makefile \
607
packages/Win32/cygwin/Makefile \
608
packages/Linux/Makefile \
609
packages/Linux/RPM/Makefile \
610
packages/Linux/RPM/curl.spec \
611
packages/Linux/RPM/curl-ssl.spec \
612
packages/Solaris/Makefile \
613
packages/EPM/curl.list \
614
packages/EPM/Makefile \