removed perl and php makefiles
[platform/upstream/curl.git] / configure.in
1 dnl $Id$
2 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT
4 AC_CONFIG_SRCDIR([lib/urldata.h])
5 AM_CONFIG_HEADER(config.h src/config.h)
6
7 VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
8 AM_INIT_AUTOMAKE(curl,$VERSION)
9
10 dnl
11 dnl we extract the numerical version for curl-config only
12 VERSIONNUM=`sed -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curl.h`
13 AC_SUBST(VERSIONNUM)
14
15 dnl Solaris pkgadd support definitions
16 PKGADD_PKG="HAXXcurl"
17 PKGADD_NAME="cURL - a client that groks URLs"
18 PKGADD_VENDOR="curl.haxx.se"
19 AC_SUBST(PKGADD_PKG)
20 AC_SUBST(PKGADD_NAME)
21 AC_SUBST(PKGADD_VENDOR)
22
23
24 dnl
25 dnl Detect the canonical host and target build environment
26 dnl
27
28 AC_CANONICAL_HOST
29 dnl Get system canonical name
30 AC_DEFINE_UNQUOTED(OS, "${host}")
31
32 dnl Check for AIX weirdos
33 AC_AIX
34
35 dnl Checks for programs.
36 AC_PROG_CC
37
38 dnl check for how to do large files
39 AC_SYS_LARGEFILE
40
41 AM_PROG_LIBTOOL
42
43 dnl The install stuff has already been taken care of by the automake stuff
44 dnl AC_PROG_INSTALL
45 AC_PROG_MAKE_SET
46
47 dnl ************************************************************
48 dnl lame option to switch on debug options
49 dnl
50 AC_MSG_CHECKING([whether to enable debug options])
51 AC_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"
61     CFLAGS="-W -Wall -Wwrite-strings -pedantic -g" 
62        ;;
63   esac ],
64        AC_MSG_RESULT(no)
65 )
66
67 dnl **********************************************************************
68 dnl Checks for IPv6
69 dnl **********************************************************************
70
71 AC_MSG_CHECKING([whether to enable ipv6])
72 AC_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)
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>
88 main()
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)
97   ipv6=yes,
98   AC_MSG_RESULT(no)
99   ipv6=no,
100   AC_MSG_RESULT(no)
101   ipv6=no
102 ))
103
104 if test "$ipv6" = "yes"; then
105   CURL_CHECK_WORKING_GETADDRINFO
106 fi
107
108
109 dnl **********************************************************************
110 dnl Checks for libraries.
111 dnl **********************************************************************
112
113 dnl gethostbyname in the nsl lib?
114 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
115
116 if 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))
119 fi
120
121 dnl At least one system has been identified to require BOTH nsl and
122 dnl socket libs to link properly.
123 if 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
140 fi
141
142 dnl resolve lib?
143 AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
144
145 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
146   AC_CHECK_LIB(resolve, strcasecmp,
147               [LIBS="-lresolve $LIBS"],
148                ,
149                -lnsl)
150 fi
151
152 dnl socket lib?
153 AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
154
155 dnl ucb lib?
156 AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
157
158 dnl dl lib?
159 AC_CHECK_FUNC(dlclose, , AC_CHECK_LIB(dl, dlopen))
160
161 dnl **********************************************************************
162 dnl Check for the random seed preferences 
163 dnl **********************************************************************
164
165 AC_ARG_WITH(egd-socket,
166     [  --with-egd-socket=FILE  Entropy Gathering Daemon socket pathname],
167     [ EGD_SOCKET="$withval" ]
168 )
169 if test -n "$EGD_SOCKET" ; then
170         AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
171 fi
172
173 dnl Check for user-specified random device
174 AC_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 )
186 if test -n "$RANDOM_FILE" ; then
187         AC_SUBST(RANDOM_FILE)
188         AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE")
189 fi
190
191 dnl **********************************************************************
192 dnl Check for the presence of Kerberos4 libraries and headers
193 dnl **********************************************************************
194
195 AC_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
202 AC_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
210 OPT_KRB4=off
211 AC_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
224 AC_MSG_CHECKING([if Kerberos4 support is requested])
225
226 if test "$want_krb4" = yes
227 then
228   if test "$ipv6" = "yes"; then
229     echo krb4 is not compatible with IPv6
230     exit 1
231   fi
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
268       dnl substitute it too!
269       KRB4_ENABLED=1
270       AC_SUBST(KRB4_ENABLED)
271
272       dnl the krb4 stuff needs a strlcpy()
273       AC_CHECK_FUNCS(strlcpy)
274
275     ])
276   ])
277 else
278   AC_MSG_RESULT(no)
279 fi
280
281
282 dnl **********************************************************************
283 dnl Check for the presence of SSL libraries and headers
284 dnl **********************************************************************
285
286 dnl Default to compiler & linker defaults for SSL files & libraries.
287 OPT_SSL=off
288 AC_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
294 if test X"$OPT_SSL" = Xno
295 then
296   AC_MSG_WARN(SSL/https support disabled)  
297 else
298
299   dnl Check for and handle argument to --with-ssl.
300
301   dnl save the pre-ssl check flags for a while
302   CLEANLDFLAGS="$LDFLAGS"
303   CLEANCPPFLAGS="$CPPFLAGS"
304
305   case "$OPT_SSL" in
306   yes)
307     EXTRA_SSL=/usr/local/ssl ;;
308   off)
309     EXTRA_SSL= ;;
310   *)
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     ;;
316   esac
317
318   AC_CHECK_LIB(crypto, CRYPTO_lock,[
319      HAVECRYPTO="yes"
320      ],[
321      OLDLDFLAGS="$LDFLAGS"
322      OLDCPPFLAGS="$CPPFLAGS"
323      LDFLAGS="$CLEANLDFLAGS -L$EXTRA_SSL/lib"
324      CPPFLAGS="$CLEANCPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
325      AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
326        HAVECRYPTO="yes" ], [
327        LDFLAGS="$OLDLDFLAGS"
328        CPPFLAGS="$OLDCPPFLAGS"
329        ])
330     ])
331
332
333   if test "$HAVECRYPTO" = "yes"; then
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
336
337     AC_CHECK_LIB(crypto, CRYPTO_add_lock)
338     AC_CHECK_LIB(ssl, SSL_connect)
339
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
356     dnl Check for SSLeay headers
357     AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
358                      openssl/pem.h openssl/ssl.h openssl/err.h,
359       OPENSSL_ENABLED=1)
360
361     if test $ac_cv_header_openssl_x509_h = no; then
362       AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
363         OPENSSL_ENABLED=1)
364     fi
365
366     AC_SUBST(OPENSSL_ENABLED)
367
368   fi
369
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
376   dnl these can only exist if openssl exists
377
378   AC_CHECK_FUNCS( RAND_status \
379                   RAND_screen \
380                   RAND_egd )
381
382 fi
383
384 dnl **********************************************************************
385 dnl Check for the presence of ZLIB libraries and headers
386 dnl **********************************************************************
387
388 dnl Default to compiler & linker defaults for files & libraries.
389 dnl OPT_ZLIB=no
390 dnl AC_ARG_WITH(zlib,dnl
391 dnl [  --with-zlib[=DIR]  where to look for ZLIB [compiler/linker default paths]
392 dnl                      DIR points to the ZLIB installation prefix [/usr/local]],
393 dnl  OPT_ZLIB=$withval,
394 dnl )
395
396 dnl Check for & handle argument to --with-zlib.
397 dnl
398 dnl NOTE:  We *always* look for ZLIB headers & libraries, all this option
399 dnl        does is change where we look (by adjusting LIBS and CPPFLAGS.)
400 dnl
401
402 dnl AC_MSG_CHECKING(where to look for ZLIB)
403 dnl if test X"$OPT_ZLIB" = Xno
404 dnl then
405 dnl     AC_MSG_RESULT([defaults (or given in environment)])
406 dnl else
407 dnl     test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
408 dnl     LIBS="$LIBS -L$OPT_ZLIB/lib"
409 dnl     CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
410 dnl     AC_MSG_RESULT([$OPT_ZLIB])
411 dnl fi
412
413 dnl z lib?
414 dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
415
416
417 dnl Default is to try the thread-safe versions of a few functions
418 OPT_THREAD=on
419 AC_ARG_ENABLE(thread,dnl
420 [  --disable-thread       tell configure to not look for thread-safe functions],
421   OPT_THREAD=off
422 )
423
424 if test X"$OPT_THREAD" = Xoff
425 then
426   AC_MSG_WARN(libcurl will not get built using thread-safe functions)
427   AC_DEFINE(DISABLED_THREADSAFE, 1, \
428 Set to explicitly specify we don't want to use thread-safe functions)
429 else
430
431   dnl check that 'localhost' resolves first
432   CURL_CHECK_WORKING_RESOLVER
433
434   dnl dig around for gethostbyname_r()
435   CURL_CHECK_GETHOSTBYNAME_R()
436
437   dnl dig around for gethostbyaddr_r()
438   CURL_CHECK_GETHOSTBYADDR_R()
439
440   dnl poke around for inet_ntoa_r()
441   CURL_CHECK_INET_NTOA_R()
442
443   dnl is there a localtime_r()
444   CURL_CHECK_LOCALTIME_R()
445
446 fi
447
448 dnl **********************************************************************
449 dnl Back to "normal" configuring
450 dnl **********************************************************************
451
452 dnl Checks for header files.
453 AC_HEADER_STDC
454 AC_CHECK_HEADERS( \
455         unistd.h \
456         malloc.h \
457         stdlib.h \
458         arpa/inet.h \
459         net/if.h \
460         netinet/in.h \
461         netinet/if_ether.h \
462         netdb.h \
463         sys/select.h \
464         sys/socket.h \
465         sys/sockio.h \
466         sys/stat.h \
467         sys/types.h \
468         sys/time.h \
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 \
480         pwd.h \
481         utime.h \
482         sys/utime.h
483 )
484
485 dnl Check for libz header
486 dnl AC_CHECK_HEADERS(zlib.h)
487
488 dnl Checks for typedefs, structures, and compiler characteristics.
489 AC_C_CONST
490 AC_TYPE_SIZE_T
491 AC_HEADER_TIME
492
493 # mprintf() checks:
494
495 # check for 'long double'
496 AC_CHECK_SIZEOF(long double, 8)
497 # check for 'long long'
498 AC_CHECK_SIZEOF(long long, 4)
499
500 # check for ssize_t
501 AC_CHECK_TYPE(ssize_t, int)
502
503 TYPE_SOCKLEN_T
504
505 dnl Checks for library functions.
506 dnl AC_PROG_GCC_TRADITIONAL
507 AC_TYPE_SIGNAL
508 dnl AC_FUNC_VPRINTF
509 AC_CHECK_FUNCS( socket \
510                 select \
511                 strdup \
512                 strstr \
513                 strtok_r \
514                 strftime \
515                 uname \
516                 strcasecmp \
517                 stricmp \
518                 strcmpi \
519                 gethostname \
520                 gethostbyaddr \
521                 getservbyname \
522                 gettimeofday \
523                 inet_addr \
524                 inet_ntoa \
525                 tcsetattr \
526                 tcgetattr \
527                 perror \
528                 closesocket \
529                 setvbuf \
530                 sigaction \
531                 signal \
532                 getpass_r \
533                 strlcat \
534                 getpwuid \
535                 geteuid \
536                 dlopen \
537                 utime
538 )
539
540 dnl removed 'getpass' check on October 26, 2000
541
542 if test "$ac_cv_func_select" != "yes"; then
543   AC_MSG_ERROR(Can't work without an existing select() function)
544 fi
545 if test "$ac_cv_func_socket" != "yes"; then
546   AC_MSG_ERROR(Can't work without an existing socket() function)
547 fi
548
549 AC_PATH_PROG( PERL, perl, , 
550   $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
551 AC_SUBST(PERL)
552
553 AC_PATH_PROGS( NROFF, gnroff nroff, , 
554   $PATH:/usr/bin/:/usr/local/bin )
555 AC_SUBST(NROFF)
556
557 AC_PROG_YACC
558
559 dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib, 
560 dnl   $PATH:/usr/bin/:/usr/local/bin )
561 dnl AC_SUBST(RANLIB)
562
563 AC_CONFIG_FILES([Makefile \
564            docs/Makefile \
565            docs/examples/Makefile \
566            include/Makefile \
567            include/curl/Makefile \
568            src/Makefile \
569            lib/Makefile \
570            tests/Makefile \
571            tests/data/Makefile \
572            packages/Makefile \
573            packages/Win32/Makefile \
574            packages/Linux/Makefile \
575            packages/Linux/RPM/Makefile \
576            packages/Linux/RPM/curl.spec \
577            packages/Linux/RPM/curl-ssl.spec \
578            packages/Solaris/Makefile \
579            curl-config
580 ])
581 AC_OUTPUT
582