checks for a few functions and include files more for the new getpwuid()
[platform/upstream/curl.git] / configure.in
1 dnl $Id$
2 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(lib/urldata.h)
4 AM_CONFIG_HEADER(config.h src/config.h)
5
6 VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
7 AM_INIT_AUTOMAKE(curl,$VERSION)
8 AM_PROG_LIBTOOL
9
10 dnl
11 dnl Detect the canonical host and target build environment
12 dnl
13 AC_CANONICAL_HOST
14 AC_CANONICAL_TARGET
15
16 dnl Checks for programs.
17 AC_PROG_CC
18
19 dnl Check for AIX weirdos
20 AC_AIX
21
22 dnl check for how to do large files
23 AC_SYS_LARGEFILE
24
25 dnl The install stuff has already been taken care of by the automake stuff
26 dnl AC_PROG_INSTALL
27 AC_PROG_MAKE_SET
28
29 dnl ************************************************************
30 dnl lame option to switch on debug options
31 dnl
32 AC_MSG_CHECKING([whether to enable debug options])
33 AC_ARG_ENABLE(debug,
34 [  --enable-debug               Enable pedantic debug options
35   --disable-debug               Disable debug options],
36 [ case "$enableval" in
37   no)
38        AC_MSG_RESULT(no)
39        ;;
40   *)   AC_MSG_RESULT(yes)
41
42     CPPFLAGS="$CPPFLAGS -DMALLOCDEBUG"
43     CFLAGS="-Wall -pedantic -g" 
44        ;;
45   esac ],
46        AC_MSG_RESULT(no)
47 )
48
49
50 dnl
51 dnl check for working getaddrinfo()
52 dnl
53 AC_DEFUN(CURL_CHECK_WORKING_GETADDRINFO,[
54   AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
55   AC_TRY_RUN( [
56 #include <netdb.h>
57 #include <sys/types.h>
58 #include <sys/socket.h>
59
60 void main(void) {
61     struct addrinfo hints, *ai;
62     int error;
63
64     memset(&hints, 0, sizeof(hints));
65     hints.ai_family = AF_UNSPEC;
66     hints.ai_socktype = SOCK_STREAM;
67     error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
68     if (error) {
69         exit(1);
70     }
71     else {
72         exit(0);
73     }
74 }
75 ],[
76   ac_cv_working_getaddrinfo="yes"
77 ],[
78   ac_cv_working_getaddrinfo="no"
79 ],[
80   ac_cv_working_getaddrinfo="yes"
81 ])])
82 if test "$ac_cv_working_getaddrinfo" = "yes"; then
83   AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works])
84   AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
85 fi
86 ])
87
88
89 AC_DEFUN(CURL_CHECK_LOCALTIME_R,
90 [
91   dnl check for a few thread-safe functions
92   AC_CHECK_FUNCS(localtime_r,[
93     AC_MSG_CHECKING(whether localtime_r is declared)
94     AC_EGREP_CPP(localtime_r,[
95 #include <time.h>],[
96       AC_MSG_RESULT(yes)],[
97       AC_MSG_RESULT(no)
98       AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
99       AC_EGREP_CPP(localtime_r,[
100 #define _REENTRANT
101 #include <time.h>],[
102         AC_DEFINE(NEED_REENTRANT)
103         AC_MSG_RESULT(yes)],
104         AC_MSG_RESULT(no))])])
105 ])
106
107 AC_DEFUN(CURL_CHECK_INET_NTOA_R,
108 [
109   dnl determine if function definition for inet_ntoa_r exists.
110   AC_CHECK_FUNCS(inet_ntoa_r,[
111     AC_MSG_CHECKING(whether inet_ntoa_r is declared)
112     AC_EGREP_CPP(inet_ntoa_r,[
113 #include <arpa/inet.h>],[
114       AC_DEFINE(HAVE_INET_NTOA_R_DECL)
115       AC_MSG_RESULT(yes)],[
116       AC_MSG_RESULT(no)
117       AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
118       AC_EGREP_CPP(inet_ntoa_r,[
119 #define _REENTRANT
120 #include <arpa/inet.h>],[
121         AC_DEFINE(HAVE_INET_NTOA_R_DECL)
122         AC_DEFINE(NEED_REENTRANT)
123         AC_MSG_RESULT(yes)],
124         AC_MSG_RESULT(no))])])
125
126 ])
127
128 AC_DEFUN(CURL_CHECK_GETHOSTBYADDR_R,
129 [
130   dnl check for number of arguments to gethostbyaddr_r. it might take
131   dnl either 5, 7, or 8 arguments.
132   AC_CHECK_FUNCS(gethostbyaddr_r,[
133     AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
134     AC_TRY_COMPILE([
135 #include <sys/types.h>
136 #include <netdb.h>],[
137 char * address;
138 int length;
139 int type;
140 struct hostent h;
141 struct hostent_data hdata;
142 int rc;
143 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
144       AC_MSG_RESULT(yes)
145       AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
146       ac_cv_gethostbyaddr_args=5],[
147       AC_MSG_RESULT(no)
148       AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
149       AC_TRY_COMPILE([
150 #define _REENTRANT
151 #include <sys/types.h>
152 #include <netdb.h>],[
153 char * address;
154 int length;
155 int type;
156 struct hostent h;
157 struct hostent_data hdata;
158 int rc;
159 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
160         AC_MSG_RESULT(yes)
161         AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
162         AC_DEFINE(NEED_REENTRANT)
163         ac_cv_gethostbyaddr_args=5],[
164         AC_MSG_RESULT(no)
165         AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
166         AC_TRY_COMPILE([
167 #include <sys/types.h>
168 #include <netdb.h>],[
169 char * address;
170 int length;
171 int type;
172 struct hostent h;
173 char buffer[8192];
174 int h_errnop;
175 struct hostent * hp;
176
177 hp = gethostbyaddr_r(address, length, type, &h,
178                      buffer, 8192, &h_errnop);],[
179           AC_MSG_RESULT(yes)
180           AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
181           ac_cv_gethostbyaddr_args=7],[
182           AC_MSG_RESULT(no)
183           AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
184           AC_TRY_COMPILE([
185 #include <sys/types.h>
186 #include <netdb.h>],[
187 char * address;
188 int length;
189 int type;
190 struct hostent h;
191 char buffer[8192];
192 int h_errnop;
193 struct hostent * hp;
194 int rc;
195
196 rc = gethostbyaddr_r(address, length, type, &h,
197                      buffer, 8192, &hp, &h_errnop);],[
198             AC_MSG_RESULT(yes)
199             AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
200             ac_cv_gethostbyaddr_args=8],[
201             AC_MSG_RESULT(no)
202             have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
203
204
205 ])
206
207 AC_DEFUN(CURL_CHECK_GETHOSTBYNAME_R,
208 [
209   dnl check for number of arguments to gethostbyname_r. it might take
210   dnl either 3, 5, or 6 arguments.
211   AC_CHECK_FUNCS(gethostbyname_r,[
212     AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments)
213     AC_TRY_RUN([
214 #include <string.h>
215 #include <sys/types.h>
216 #include <netdb.h>
217
218 int
219 main () {
220 struct hostent h;
221 struct hostent_data hdata;
222 char *name = "localhost";
223 int rc;
224 memset(&h, 0, sizeof(struct hostent));
225 memset(&hdata, 0, sizeof(struct hostent_data));
226 rc = gethostbyname_r(name, &h, &hdata);
227 exit (rc != 0 ? 1 : 0); }],[
228       AC_MSG_RESULT(yes)
229       AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
230       ac_cv_gethostbyname_args=3],[
231       AC_MSG_RESULT(no)
232       AC_MSG_CHECKING(if gethostbyname_r with -D_REENTRANT takes 3 arguments)
233       AC_TRY_RUN([
234 #define _REENTRANT
235
236 #include <string.h>
237 #include <sys/types.h>
238 #include <netdb.h>
239
240 int
241 main () {
242 struct hostent h;
243 struct hostent_data hdata;
244 char *name = "localhost";
245 int rc;
246 memset(&h, 0, sizeof(struct hostent));
247 memset(&hdata, 0, sizeof(struct hostent_data));
248 rc = gethostbyname_r(name, &h, &hdata);
249 exit (rc != 0 ? 1 : 0); }],[
250         AC_MSG_RESULT(yes)
251         AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
252         AC_DEFINE(NEED_REENTRANT)
253         ac_cv_gethostbyname_args=3],[
254         AC_MSG_RESULT(no)
255         AC_MSG_CHECKING(if gethostbyname_r takes 5 arguments)
256         AC_TRY_RUN([
257 #include <sys/types.h>
258 #include <netdb.h>
259
260 int
261 main () {
262 struct hostent *hp;
263 struct hostent h;
264 char *name = "localhost";
265 char buffer[8192];
266 int h_errno;
267 hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
268 exit (hp == NULL ? 1 : 0); }],[
269           AC_MSG_RESULT(yes)
270           AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
271           ac_cv_gethostbyname_args=5],[
272           AC_MSG_RESULT(no)
273           AC_MSG_CHECKING(if gethostbyname_r takes 6 arguments)
274           AC_TRY_RUN([
275 #include <sys/types.h>
276 #include <netdb.h>
277
278 int
279 main () {
280 struct hostent h;
281 struct hostent *hp;
282 char *name = "localhost";
283 char buf[8192];
284 int rc;
285 int h_errno;
286 rc = gethostbyname_r(name, &h, buf, 8192, &hp, &h_errno);
287 exit (rc != 0 ? 1 : 0); }],[
288             AC_MSG_RESULT(yes)
289             AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
290             ac_cv_gethostbyname_args=6],[
291             AC_MSG_RESULT(no)
292             have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"],
293             [ac_cv_gethostbyname_args=0])],
294           [ac_cv_gethostbyname_args=0])],
295         [ac_cv_gethostbyname_args=0])],
296       [ac_cv_gethostbyname_args=0])])
297
298 ])
299
300 dnl **********************************************************************
301 dnl Checks for IPv6
302 dnl **********************************************************************
303
304 AC_MSG_CHECKING([whether to enable ipv6])
305 AC_ARG_ENABLE(ipv6,
306 [  --enable-ipv6                Enable ipv6 (with ipv4) support
307   --disable-ipv6                Disable ipv6 support],
308 [ case "$enableval" in
309   no)
310        AC_MSG_RESULT(no)
311        ipv6=no
312        ;;
313   *)   AC_MSG_RESULT(yes)
314        ipv6=yes
315        ;;
316   esac ],
317
318   AC_TRY_RUN([ /* is AF_INET6 available? */
319 #include <sys/types.h>
320 #include <sys/socket.h>
321 main()
322 {
323  if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
324    exit(1);
325  else
326    exit(0);
327 }
328 ],
329   AC_MSG_RESULT(yes)
330   ipv6=yes,
331   AC_MSG_RESULT(no)
332   ipv6=no,
333   AC_MSG_RESULT(no)
334   ipv6=no
335 ))
336
337 if test "$ipv6" = "yes"; then
338   CURL_CHECK_WORKING_GETADDRINFO
339 fi
340
341
342 dnl **********************************************************************
343 dnl Checks for libraries.
344 dnl **********************************************************************
345
346 dnl gethostbyname in the nsl lib?
347 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
348
349 if test "$ac_cv_lib_nsl_gethostbyname" != "yes" -a "$ac_cv_func_gethostbyname" != "yes"; then
350   dnl gethostbyname in the socket lib?
351   AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(socket, gethostbyname))
352 fi
353
354 dnl At least one system has been identified to require BOTH nsl and
355 dnl socket libs to link properly.
356 if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname"; then
357   AC_MSG_CHECKING([trying both nsl and socket libs])
358   my_ac_save_LIBS=$LIBS
359   LIBS="-lnsl -lsocket $LIBS"
360   AC_TRY_LINK( ,
361              [gethostbyname();],
362              my_ac_link_result=success,
363              my_ac_link_result=failure )
364
365   if test "$my_ac_link_result" = "failure"; then
366     AC_MSG_RESULT([no])
367     AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
368     dnl restore LIBS
369     LIBS=$my_ac_save_LIBS
370   else
371     AC_MSG_RESULT([yes])
372   fi
373 fi
374
375 dnl resolve lib?
376 AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
377
378 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
379   AC_CHECK_LIB(resolve, strcasecmp,
380               [LIBS="-lresolve $LIBS"],
381                ,
382                -lnsl)
383 fi
384
385 dnl socket lib?
386 AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
387
388 dnl ucb lib?
389 AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
390
391 dnl dl lib?
392 AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
393
394 dnl **********************************************************************
395 dnl Check for the random seed preferences 
396 dnl **********************************************************************
397
398 AC_ARG_WITH(egd-socket,
399     [  --with-egd-socket=FILE  Entropy Gathering Daemon socket pathname],
400     [ EGD_SOCKET="$withval" ]
401 )
402 if test -n "$EGD_SOCKET" ; then
403         AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
404 fi
405
406 dnl Check for user-specified random device
407 AC_ARG_WITH(random,
408     [  --with-random=FILE      read randomness from FILE (default=/dev/urandom)],
409     [ RANDOM_FILE="$withval" ],
410     [
411         dnl Check for random device
412         AC_CHECK_FILE("/dev/urandom",
413             [
414                 RANDOM_FILE="/dev/urandom";
415             ]
416         )
417     ]
418 )
419 if test -n "$RANDOM_FILE" ; then
420         AC_SUBST(RANDOM_FILE)
421         AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE")
422 fi
423
424 dnl **********************************************************************
425 dnl Check for the presence of Kerberos4 libraries and headers
426 dnl **********************************************************************
427
428 AC_ARG_WITH(krb4-includes,
429  [  --with-krb4-includes[=DIR]   Specify location of kerberos4 headers],[
430  CPPFLAGS="$CPPFLAGS -I$withval"
431  KRB4INC="$withval"
432  want_krb4=yes
433  ])
434
435 AC_ARG_WITH(krb4-libs,
436  [  --with-krb4-libs[=DIR]   Specify location of kerberos4 libs],[
437  LDFLAGS="$LDFLAGS -L$withval"
438  KRB4LIB="$withval"
439  want_krb4=yes
440  ])
441
442
443 OPT_KRB4=off
444 AC_ARG_WITH(krb4,dnl
445 [  --with-krb4[=DIR]       where to look for Kerberos4],[
446   OPT_KRB4="$withval"
447   if test X"$OPT_KRB4" != Xyes
448   then
449     LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib"
450     KRB4LIB="$OPT_KRB4/lib"
451     CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
452     KRB4INC="$OPT_KRB4/include"
453   fi
454   want_krb4="yes"
455  ])
456
457 AC_MSG_CHECKING([if Kerberos4 support is requested])
458
459 if test "$want_krb4" = yes
460 then
461   if test "$ipv6" = "yes"; then
462     echo krb4 is not compatible with IPv6
463     exit 1
464   fi
465   AC_MSG_RESULT(yes)
466
467   dnl Check for & handle argument to --with-krb4
468
469   AC_MSG_CHECKING(where to look for Kerberos4)
470   if test X"$OPT_KRB4" = Xyes
471   then
472     AC_MSG_RESULT([defaults])
473   else
474     AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
475   fi
476
477   dnl Check for DES library
478   AC_CHECK_LIB(des, des_pcbc_encrypt,
479   [
480     AC_CHECK_HEADERS(des.h)
481
482     dnl resolv lib?
483     AC_CHECK_FUNC(res_search, , AC_CHECK_LIB(resolv, res_search))
484
485     dnl Check for the Kerberos4 library
486     AC_CHECK_LIB(krb, krb_net_read,
487     [
488       dnl Check for header files
489       AC_CHECK_HEADERS(krb.h)
490
491       dnl we found the required libraries, add to LIBS
492       LIBS="-lkrb -ldes $LIBS"
493
494       dnl Check for function krb_get_our_ip_for_realm
495       dnl this is needed for NAT networks
496       AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
497
498       dnl add define KRB4
499       AC_DEFINE(KRB4)
500
501       dnl the krb4 stuff needs a strlcpy()
502       AC_CHECK_FUNCS(strlcpy)
503
504     ])
505   ])
506 else
507   AC_MSG_RESULT(no)
508 fi
509
510 dnl **********************************************************************
511 dnl Check for the presence of SSL libraries and headers
512 dnl **********************************************************************
513
514 dnl Default to compiler & linker defaults for SSL files & libraries.
515 OPT_SSL=off
516 AC_ARG_WITH(ssl,dnl
517 [  --with-ssl[=DIR]        where to look for SSL [compiler/linker default paths]
518                           DIR points to the SSL installation [/usr/local/ssl]],
519   OPT_SSL=$withval
520 )
521
522 if test X"$OPT_SSL" = Xno
523 then
524   AC_MSG_WARN(SSL/https support disabled)  
525 else
526
527   dnl Check for & handle argument to --with-ssl.
528
529   AC_MSG_CHECKING(where to look for SSL)
530   if test X"$OPT_SSL" = Xoff
531   then
532         AC_MSG_RESULT([defaults (or given in environment)])
533   else
534         test X"$OPT_SSL" = Xyes && OPT_SSL=/usr/local/ssl
535         dnl     LIBS="$LIBS -L$OPT_SSL/lib"
536         LDFLAGS="$LDFLAGS -L$OPT_SSL/lib"
537         CPPFLAGS="$CPPFLAGS -I$OPT_SSL/include/openssl -I$OPT_SSL/include"
538         AC_MSG_RESULT([$OPT_SSL])
539   fi
540
541   dnl check for crypto libs (part of SSLeay)
542   AC_CHECK_LIB(crypto, CRYPTO_lock)
543
544   if test $ac_cv_lib_crypto_CRYPTO_lock = yes; then
545     dnl This is only reasonable to do if crypto actually is there: check for
546     dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
547     AC_CHECK_LIB(ssl, SSL_connect)
548
549     if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
550         dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
551         AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
552         OLIBS=$LIBS
553         LIBS="$LIBS -lRSAglue -lrsaref"
554         AC_CHECK_LIB(ssl, SSL_connect)
555         if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
556             dnl still no SSL_connect
557             AC_MSG_RESULT(no)
558             LIBS=$OLIBS
559         else
560             AC_MSG_RESULT(yes)
561         fi
562     fi
563
564
565
566     dnl Check for SSLeay headers
567     AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h openssl/pem.h openssl/ssl.h openssl/err.h)
568
569     if test $ac_cv_header_openssl_x509_h = no; then
570       AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
571     fi
572
573   fi
574
575   dnl these can only exist if openssl exists
576
577   AC_CHECK_FUNCS( RAND_status \
578                   RAND_screen \
579                   RAND_egd )
580
581 fi
582
583 dnl **********************************************************************
584 dnl Check for the presence of ZLIB libraries and headers
585 dnl **********************************************************************
586
587 dnl Default to compiler & linker defaults for files & libraries.
588 dnl OPT_ZLIB=no
589 dnl AC_ARG_WITH(zlib,dnl
590 dnl [  --with-zlib[=DIR]  where to look for ZLIB [compiler/linker default paths]
591 dnl                      DIR points to the ZLIB installation prefix [/usr/local]],
592 dnl  OPT_ZLIB=$withval,
593 dnl )
594
595 dnl Check for & handle argument to --with-zlib.
596 dnl
597 dnl NOTE:  We *always* look for ZLIB headers & libraries, all this option
598 dnl        does is change where we look (by adjusting LIBS and CPPFLAGS.)
599 dnl
600
601 dnl AC_MSG_CHECKING(where to look for ZLIB)
602 dnl if test X"$OPT_ZLIB" = Xno
603 dnl then
604 dnl     AC_MSG_RESULT([defaults (or given in environment)])
605 dnl else
606 dnl     test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
607 dnl     LIBS="$LIBS -L$OPT_ZLIB/lib"
608 dnl     CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
609 dnl     AC_MSG_RESULT([$OPT_ZLIB])
610 dnl fi
611
612 dnl z lib?
613 dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
614
615
616 dnl Default is to try the thread-safe versions of a few functions
617 OPT_THREAD=on
618 AC_ARG_ENABLE(thread,dnl
619 [  --disable-thread       tell configure to not look for thread-safe functions],
620   OPT_THREAD=off
621 )
622
623 if test X"$OPT_THREAD" = Xoff
624 then
625   AC_MSG_WARN(libcurl will not get built using thread-safe functions)
626   AC_DEFINE(DISABLED_THREADSAFE, 1, \
627 Set to explicitly specify we don't want to use thread-safe functions)
628 else
629
630   dnl dig around for gethostbyname_r()
631   CURL_CHECK_GETHOSTBYNAME_R()
632
633   dnl dig around for gethostbyaddr_r()
634   CURL_CHECK_GETHOSTBYADDR_R()
635
636   dnl poke around for inet_ntoa_r()
637   CURL_CHECK_INET_NTOA_R()
638
639   dnl is there a localtime_r()
640   CURL_CHECK_LOCALTIME_R()
641
642 fi
643
644 dnl **********************************************************************
645 dnl Back to "normal" configuring
646 dnl **********************************************************************
647
648 dnl Checks for header files.
649 AC_HEADER_STDC
650 AC_CHECK_HEADERS( \
651         unistd.h \
652         malloc.h \
653         stdlib.h \
654         arpa/inet.h \
655         net/if.h \
656         netinet/in.h \
657         netinet/if_ether.h \
658         netdb.h \
659         sys/select.h \
660         sys/socket.h \
661         sys/sockio.h \
662         sys/stat.h \
663         sys/types.h \
664         sys/time.h \
665         getopt.h \
666         sys/param.h \
667         termios.h \
668         termio.h \
669         sgtty.h \
670         fcntl.h \
671         dlfcn.h \
672         alloca.h \
673         winsock.h \
674         time.h \
675         io.h \
676         pwd.h
677 )
678
679 dnl Check for libz header
680 dnl AC_CHECK_HEADERS(zlib.h)
681
682 dnl Checks for typedefs, structures, and compiler characteristics.
683 AC_C_CONST
684 AC_TYPE_SIZE_T
685 AC_HEADER_TIME
686
687 # mprintf() checks:
688
689 # check for 'long double'
690 AC_CHECK_SIZEOF(long double, 8)
691 # check for 'long long'
692 AC_CHECK_SIZEOF(long long, 4)
693
694 # check for ssize_t
695 AC_CHECK_TYPE(ssize_t, int)
696
697 dnl
698 dnl We can't just AC_CHECK_TYPE() for socklen_t since it doesn't appear
699 dnl in the standard headers. We egrep for it in the socket headers and
700 dnl if it is used there we assume we have the type defined, otherwise
701 dnl we search for it with AC_CHECK_TYPE() the "normal" way
702 dnl
703
704 if test "$ac_cv_header_sys_socket_h" = "yes"; then
705    AC_MSG_CHECKING(for socklen_t in sys/socket.h)
706    AC_EGREP_HEADER(socklen_t,
707     sys/socket.h,
708     socklen_t=yes
709     AC_MSG_RESULT(yes),
710     AC_MSG_RESULT(no))
711 fi
712
713 if test "$socklen_t" != "yes"; then
714   # check for socklen_t the standard way if it wasn't found before
715   AC_CHECK_TYPE(socklen_t, int)
716 fi
717
718
719 dnl Get system canonical name
720 AC_CANONICAL_HOST
721 AC_DEFINE_UNQUOTED(OS, "${host}")
722
723 dnl Checks for library functions.
724 dnl AC_PROG_GCC_TRADITIONAL
725 AC_TYPE_SIGNAL
726 dnl AC_FUNC_VPRINTF
727 AC_CHECK_FUNCS( socket \
728                 select \
729                 strdup \
730                 strstr \
731                 strftime \
732                 uname \
733                 strcasecmp \
734                 stricmp \
735                 strcmpi \
736                 gethostname \
737                 gethostbyaddr \
738                 getservbyname \
739                 gettimeofday \
740                 inet_addr \
741                 inet_ntoa \
742                 tcsetattr \
743                 tcgetattr \
744                 perror \
745                 closesocket \
746                 setvbuf \
747                 sigaction \
748                 signal \
749                 getpass_r \
750                 strlcat \
751                 getpwuid \
752                 geteuid
753 )
754
755 dnl removed 'getpass' check on October 26, 2000
756
757 if test "$ac_cv_func_select" != "yes"; then
758   AC_MSG_ERROR(Can't work without an existing select() function)
759 fi
760 if test "$ac_cv_func_socket" != "yes"; then
761   AC_MSG_ERROR(Can't work without an existing socket() function)
762 fi
763
764 AC_PATH_PROG( PERL, perl, , 
765   $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
766 AC_SUBST(PERL)
767
768 AC_PATH_PROGS( NROFF, gnroff nroff, , 
769   $PATH:/usr/bin/:/usr/local/bin )
770 AC_SUBST(NROFF)
771
772 AC_PROG_YACC
773
774 dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib, 
775 dnl   $PATH:/usr/bin/:/usr/local/bin )
776 dnl AC_SUBST(RANLIB)
777
778 AC_OUTPUT( Makefile \
779            docs/Makefile \
780            docs/examples/Makefile \
781            include/Makefile \
782            include/curl/Makefile \
783            src/Makefile \
784            lib/Makefile \
785            tests/Makefile \
786            tests/data/Makefile \
787            packages/Makefile \
788            packages/Win32/Makefile \
789            packages/Linux/Makefile \
790            packages/Linux/RPM/Makefile \
791            packages/Linux/RPM/curl.spec \
792            packages/Linux/RPM/curl-ssl.spec )
793