1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at http://curl.haxx.se/docs/copyright.html.
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
22 ###########################################################################
24 dnl CURL_CHECK_HEADER_WINDOWS
25 dnl -------------------------------------------------
26 dnl Check for compilable and valid windows.h header
28 AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
29 AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
33 #ifndef WIN32_LEAN_AND_MEAN
34 #define WIN32_LEAN_AND_MEAN
41 ac_cv_header_windows_h="yes"
43 ac_cv_header_windows_h="no"
46 if test "x$ac_cv_header_windows_h" = "xyes"; then
47 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
48 [Define to 1 if you have the windows.h header file.])
49 AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
50 [Define to avoid automatic inclusion of winsock.h])
55 dnl CURL_CHECK_HEADER_WINSOCK
56 dnl -------------------------------------------------
57 dnl Check for compilable and valid winsock.h header
59 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
60 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
61 AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
65 #ifndef WIN32_LEAN_AND_MEAN
66 #define WIN32_LEAN_AND_MEAN
71 int dummy=WSACleanup();
74 ac_cv_header_winsock_h="yes"
76 ac_cv_header_winsock_h="no"
79 if test "x$ac_cv_header_winsock_h" = "xyes"; then
80 AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
81 [Define to 1 if you have the winsock.h header file.])
86 dnl CURL_CHECK_HEADER_WINSOCK2
87 dnl -------------------------------------------------
88 dnl Check for compilable and valid winsock2.h header
90 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
91 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
92 AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
96 #ifndef WIN32_LEAN_AND_MEAN
97 #define WIN32_LEAN_AND_MEAN
100 #include <winsock2.h>
102 int dummy=2*IPPROTO_ESP;
105 ac_cv_header_winsock2_h="yes"
107 ac_cv_header_winsock2_h="no"
110 if test "x$ac_cv_header_winsock2_h" = "xyes"; then
111 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
112 [Define to 1 if you have the winsock2.h header file.])
117 dnl CURL_CHECK_HEADER_WS2TCPIP
118 dnl -------------------------------------------------
119 dnl Check for compilable and valid ws2tcpip.h header
121 AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
122 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
123 AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
127 #ifndef WIN32_LEAN_AND_MEAN
128 #define WIN32_LEAN_AND_MEAN
131 #include <winsock2.h>
132 #include <ws2tcpip.h>
134 int dummy=2*IP_PKTINFO;
137 ac_cv_header_ws2tcpip_h="yes"
139 ac_cv_header_ws2tcpip_h="no"
142 if test "x$ac_cv_header_ws2tcpip_h" = "xyes"; then
143 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
144 [Define to 1 if you have the ws2tcpip.h header file.])
149 dnl CURL_CHECK_TYPE_SOCKLEN_T
150 dnl -------------------------------------------------
151 dnl Check for existing socklen_t type, and provide
152 dnl an equivalent type if socklen_t not available
154 AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
155 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
156 AC_CHECK_TYPE([socklen_t], ,[
157 AC_CACHE_CHECK([for socklen_t equivalent],
158 [curl_cv_socklen_t_equiv], [
159 curl_cv_socklen_t_equiv="unknown"
160 for arg2 in "struct sockaddr" void; do
161 for t in int size_t unsigned long "unsigned long"; do
165 #ifdef HAVE_WINDOWS_H
166 #ifndef WIN32_LEAN_AND_MEAN
167 #define WIN32_LEAN_AND_MEAN
170 #ifdef HAVE_WINSOCK2_H
171 #include <winsock2.h>
173 #ifdef HAVE_WINSOCK_H
178 #ifdef HAVE_SYS_TYPES_H
179 #include <sys/types.h>
181 #ifdef HAVE_SYS_SOCKET_H
182 #include <sys/socket.h>
185 int getpeername (int, $arg2 *, $t *);
188 getpeername(0,0,&len);
191 curl_cv_socklen_t_equiv="$t"
197 if test "$curl_cv_socklen_t_equiv" = "unknown"; then
198 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
200 AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
201 [type to use in place of socklen_t if not defined])
205 #ifdef HAVE_WINDOWS_H
206 #ifndef WIN32_LEAN_AND_MEAN
207 #define WIN32_LEAN_AND_MEAN
210 #ifdef HAVE_WINSOCK2_H
211 #include <winsock2.h>
212 #ifdef HAVE_WS2TCPIP_H
213 #include <ws2tcpip.h>
217 #ifdef HAVE_SYS_TYPES_H
218 #include <sys/types.h>
220 #ifdef HAVE_SYS_SOCKET_H
221 #include <sys/socket.h>
228 dnl CURL_CHECK_FUNC_GETNAMEINFO
229 dnl -------------------------------------------------
230 dnl Test if the getnameinfo function is available,
231 dnl and check the types of five of its arguments.
232 dnl If the function succeeds HAVE_GETNAMEINFO will be
233 dnl defined, defining the types of the arguments in
234 dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
235 dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
236 dnl and also defining the type qualifier of first
237 dnl argument in GETNAMEINFO_QUAL_ARG1.
239 AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
240 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
241 AC_REQUIRE([CURL_CHECK_TYPE_SOCKLEN_T])dnl
242 AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
244 AC_MSG_CHECKING([for getnameinfo])
246 AC_LANG_FUNC_LINK_TRY([getnameinfo])
249 curl_cv_getnameinfo="yes"
252 curl_cv_getnameinfo="no"
255 if test "$curl_cv_getnameinfo" != "yes"; then
256 AC_MSG_CHECKING([deeper for getnameinfo])
262 curl_cv_getnameinfo="yes"
264 AC_MSG_RESULT([but still no])
265 curl_cv_getnameinfo="no"
269 if test "$curl_cv_getnameinfo" != "yes"; then
270 AC_MSG_CHECKING([deeper and deeper for getnameinfo])
273 #ifdef HAVE_WINDOWS_H
274 #ifndef WIN32_LEAN_AND_MEAN
275 #define WIN32_LEAN_AND_MEAN
278 #ifdef HAVE_WINSOCK2_H
279 #include <winsock2.h>
280 #ifdef HAVE_WS2TCPIP_H
281 #include <ws2tcpip.h>
285 #ifdef HAVE_SYS_TYPES_H
286 #include <sys/types.h>
288 #ifdef HAVE_SYS_SOCKET_H
289 #include <sys/socket.h>
296 getnameinfo(0, 0, 0, 0, 0, 0, 0);
299 curl_cv_getnameinfo="yes"
301 AC_MSG_RESULT([but still no])
302 curl_cv_getnameinfo="no"
306 if test "$curl_cv_getnameinfo" = "yes"; then
307 AC_CACHE_CHECK([types of arguments for getnameinfo],
308 [curl_cv_func_getnameinfo_args], [
309 curl_cv_func_getnameinfo_args="unknown"
310 for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
311 for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
312 for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
313 for gni_arg7 in 'int' 'unsigned int'; do
317 #ifdef HAVE_WINDOWS_H
318 #ifndef WIN32_LEAN_AND_MEAN
319 #define WIN32_LEAN_AND_MEAN
321 #if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
323 #define _WIN32_WINNT 0x0501
326 #ifdef HAVE_WINSOCK2_H
327 #include <winsock2.h>
328 #ifdef HAVE_WS2TCPIP_H
329 #include <ws2tcpip.h>
332 #define GNICALLCONV WSAAPI
334 #ifdef HAVE_SYS_TYPES_H
335 #include <sys/types.h>
337 #ifdef HAVE_SYS_SOCKET_H
338 #include <sys/socket.h>
345 extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
351 $gni_arg46 hostlen=0;
352 $gni_arg46 servlen=0;
354 int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
357 curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
365 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
366 AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
367 AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
369 gni_prev_IFS=$IFS; IFS=','
370 set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
374 gni_qual_type_arg1=$[1]
376 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
377 [Define to the type of arg 2 for getnameinfo.])
378 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
379 [Define to the type of args 4 and 6 for getnameinfo.])
380 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
381 [Define to the type of arg 7 for getnameinfo.])
393 case "$gni_qual_type_arg1" in
396 gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
400 gni_type_arg1=$gni_qual_type_arg1
404 AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
405 [Define to the type qualifier of arg 1 for getnameinfo.])
406 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
407 [Define to the type of arg 1 for getnameinfo.])
417 AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
418 [Define to 1 if you have the getnameinfo function.])
419 ac_cv_func_getnameinfo="yes"
425 dnl TYPE_SOCKADDR_STORAGE
426 dnl -------------------------------------------------
427 dnl Check for struct sockaddr_storage. Most IPv6-enabled
428 dnl hosts have it, but AIX 4.3 is one known exception.
430 AC_DEFUN([TYPE_SOCKADDR_STORAGE],
432 AC_CHECK_TYPE([struct sockaddr_storage],
433 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
434 [if struct sockaddr_storage is defined]), ,
437 #ifdef HAVE_WINDOWS_H
438 #ifndef WIN32_LEAN_AND_MEAN
439 #define WIN32_LEAN_AND_MEAN
442 #ifdef HAVE_WINSOCK2_H
443 #include <winsock2.h>
446 #ifdef HAVE_SYS_TYPES_H
447 #include <sys/types.h>
449 #ifdef HAVE_SYS_SOCKET_H
450 #include <sys/socket.h>
452 #ifdef HAVE_NETINET_IN_H
453 #include <netinet/in.h>
455 #ifdef HAVE_ARPA_INET_H
456 #include <arpa/inet.h>
463 dnl CURL_CHECK_NI_WITHSCOPEID
464 dnl -------------------------------------------------
465 dnl Check for working NI_WITHSCOPEID in getnameinfo()
467 AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
468 AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
469 AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
470 AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
471 netdb.h netinet/in.h arpa/inet.h)
473 AC_CACHE_CHECK([for working NI_WITHSCOPEID],
474 [ac_cv_working_ni_withscopeid], [
480 #ifdef HAVE_SYS_TYPES_H
481 #include <sys/types.h>
483 #ifdef HAVE_SYS_SOCKET_H
484 #include <sys/socket.h>
489 #ifdef HAVE_NETINET_IN_H
490 #include <netinet/in.h>
492 #ifdef HAVE_ARPA_INET_H
493 #include <arpa/inet.h>
496 #if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
497 #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
498 struct sockaddr_storage sa;
500 unsigned char sa[256];
502 char hostbuf[NI_MAXHOST];
504 GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
505 GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
506 GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
507 int fd = socket(AF_INET6, SOCK_STREAM, 0);
510 return 1; /* Error creating socket */
512 rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
514 perror("getsockname()");
515 return 2; /* Error retrieving socket name */
517 rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
519 printf("rc = %s\n", gai_strerror(rc));
520 return 3; /* Error translating socket address */
522 return 0; /* Ok, NI_WITHSCOPEID works */
524 return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
528 # Exit code == 0. Program worked.
529 ac_cv_working_ni_withscopeid="yes"
531 # Exit code != 0. Program failed.
532 ac_cv_working_ni_withscopeid="no"
534 # Program is not run when cross-compiling. So we assume
535 # NI_WITHSCOPEID will work if we are able to compile it.
538 #include <sys/types.h>
539 #include <sys/socket.h>
542 unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
545 ac_cv_working_ni_withscopeid="yes"
547 ac_cv_working_ni_withscopeid="no"
548 ]) # AC_COMPILE_IFELSE
551 if test "x$ac_cv_working_ni_withscopeid" = "xyes"; then
552 AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
553 [Define to 1 if NI_WITHSCOPEID exists and works.])
558 dnl CURL_CHECK_FUNC_RECV
559 dnl -------------------------------------------------
560 dnl Test if the socket recv() function is available,
561 dnl and check its return type and the types of its
562 dnl arguments. If the function succeeds HAVE_RECV
563 dnl will be defined, defining the types of the arguments
564 dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
565 dnl and RECV_TYPE_ARG4, defining the type of the function
566 dnl return value in RECV_TYPE_RETV.
568 AC_DEFUN([CURL_CHECK_FUNC_RECV], [
569 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
571 AC_MSG_CHECKING([for recv])
574 #ifdef HAVE_SYS_TYPES_H
575 #include <sys/types.h>
577 #ifdef HAVE_SYS_SOCKET_H
578 #include <sys/socket.h>
590 if test "$curl_cv_recv" = "yes"; then
591 AC_CACHE_CHECK([types of arguments and return type for recv],
592 [curl_cv_func_recv_args], [
593 curl_cv_func_recv_args="unknown"
594 for recv_retv in 'int' 'ssize_t'; do
595 for recv_arg1 in 'int' 'ssize_t'; do
596 for recv_arg2 in 'void *' 'char *'; do
597 for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
598 for recv_arg4 in 'int' 'unsigned int'; do
602 #ifdef HAVE_SYS_TYPES_H
603 #include <sys/types.h>
605 #ifdef HAVE_SYS_SOCKET_H
606 #include <sys/socket.h>
608 extern $recv_retv recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
614 $recv_retv res = recv(s, buf, len, flags);
617 curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
626 if test "$curl_cv_func_recv_args" = "unknown"; then
627 AC_MSG_WARN([Cannot find proper types to use for recv args])
628 AC_MSG_WARN([HAVE_RECV will not be defined])
630 recv_prev_IFS=$IFS; IFS=','
631 set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
635 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
636 [Define to the type of arg 1 for recv.])
637 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
638 [Define to the type of arg 2 for recv.])
639 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
640 [Define to the type of arg 3 for recv.])
641 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
642 [Define to the type of arg 4 for recv.])
643 AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
644 [Define to the function return type for recv.])
646 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
647 [Define to 1 if you have the recv function.])
648 ac_cv_func_recv="yes"
654 dnl CURL_CHECK_FUNC_SEND
655 dnl -------------------------------------------------
656 dnl Test if the socket send() function is available,
657 dnl and check its return type and the types of its
658 dnl arguments. If the function succeeds HAVE_SEND
659 dnl will be defined, defining the types of the arguments
660 dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
661 dnl and SEND_TYPE_ARG4, defining the type of the function
662 dnl return value in SEND_TYPE_RETV.
664 AC_DEFUN([CURL_CHECK_FUNC_SEND], [
665 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
667 AC_MSG_CHECKING([for send])
670 #ifdef HAVE_SYS_TYPES_H
671 #include <sys/types.h>
673 #ifdef HAVE_SYS_SOCKET_H
674 #include <sys/socket.h>
686 if test "$curl_cv_send" = "yes"; then
687 AC_CACHE_CHECK([types of arguments and return type for send],
688 [curl_cv_func_send_args], [
689 curl_cv_func_send_args="unknown"
690 for send_retv in 'int' 'ssize_t'; do
691 for send_arg1 in 'int' 'ssize_t'; do
692 for send_arg2 in 'void *' 'char *'; do
693 for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
694 for send_arg4 in 'int' 'unsigned int'; do
698 #ifdef HAVE_SYS_TYPES_H
699 #include <sys/types.h>
701 #ifdef HAVE_SYS_SOCKET_H
702 #include <sys/socket.h>
704 extern $send_retv send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
710 $send_retv res = send(s, buf, len, flags);
713 curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
722 if test "$curl_cv_func_send_args" = "unknown"; then
723 AC_MSG_WARN([Cannot find proper types to use for send args])
724 AC_MSG_WARN([HAVE_SEND will not be defined])
726 send_prev_IFS=$IFS; IFS=','
727 set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
731 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
732 [Define to the type of arg 1 for send.])
733 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $[2],
734 [Define to the type of arg 2 for send.])
735 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
736 [Define to the type of arg 3 for send.])
737 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
738 [Define to the type of arg 4 for send.])
739 AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
740 [Define to the function return type for send.])
742 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
743 [Define to 1 if you have the send function.])
744 ac_cv_func_send="yes"
750 dnl CURL_CHECK_NONBLOCKING_SOCKET
751 dnl -------------------------------------------------
752 dnl Check for how to set a socket to non-blocking state. There seems to exist
753 dnl four known different ways, with the one used almost everywhere being POSIX
754 dnl and XPG3, while the other different ways for different systems (old BSD,
755 dnl Windows and Amiga).
757 dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the
758 dnl O_NONBLOCK define is found but does not work. This condition is attempted
759 dnl to get caught in this script by using an excessive number of #ifdefs...
761 AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET],
763 AC_MSG_CHECKING([non-blocking sockets style])
766 /* headers for O_NONBLOCK test */
767 #include <sys/types.h>
771 /* try to compile O_NONBLOCK */
773 #if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
774 # if defined(__SVR4) || defined(__srv4__)
775 # define PLATFORM_SOLARIS
777 # define PLATFORM_SUNOS4
780 #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX4)
781 # define PLATFORM_AIX_V3
784 #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
785 #error "O_NONBLOCK does not work on this platform"
788 int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
790 dnl the O_NONBLOCK test was fine
791 nonblock="O_NONBLOCK"
792 AC_DEFINE(HAVE_O_NONBLOCK, 1, [use O_NONBLOCK for non-blocking sockets])
794 dnl the code was bad, try a different program now, test 2
797 /* headers for FIONBIO test */
801 /* FIONBIO source test (old-style unix) */
803 int flags = ioctl(socket, FIONBIO, &flags);
805 dnl FIONBIO test was good
807 AC_DEFINE(HAVE_FIONBIO, 1, [use FIONBIO for non-blocking sockets])
809 dnl FIONBIO test was also bad
810 dnl the code was bad, try a different program now, test 3
813 /* headers for ioctlsocket test (Windows) */
815 #ifdef HAVE_WINDOWS_H
816 #ifndef WIN32_LEAN_AND_MEAN
817 #define WIN32_LEAN_AND_MEAN
820 #ifdef HAVE_WINSOCK2_H
821 #include <winsock2.h>
823 #ifdef HAVE_WINSOCK_H
829 /* ioctlsocket source code */
831 unsigned long flags = 0;
832 sd = socket(0, 0, 0);
833 ioctlsocket(sd, FIONBIO, &flags);
835 dnl ioctlsocket test was good
836 nonblock="ioctlsocket"
837 AC_DEFINE(HAVE_IOCTLSOCKET, 1, [use ioctlsocket() for non-blocking sockets])
839 dnl ioctlsocket didnt compile!, go to test 4
842 /* headers for IoctlSocket test (Amiga?) */
843 #include <sys/ioctl.h>
845 /* IoctlSocket source code */
847 int flags = IoctlSocket(socket, FIONBIO, (long)1);
849 dnl ioctlsocket test was good
850 nonblock="IoctlSocket"
851 AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets])
853 dnl Ioctlsocket didnt compile, do test 5!
855 /* headers for SO_NONBLOCK test (BeOS) */
858 /* SO_NONBLOCK source code */
861 int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
863 dnl the SO_NONBLOCK test was good
864 nonblock="SO_NONBLOCK"
865 AC_DEFINE(HAVE_SO_NONBLOCK, 1, [use SO_NONBLOCK for non-blocking sockets])
867 dnl test 5 didnt compile!
869 AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, [disabled non-blocking sockets])
871 dnl end of fifth test
874 dnl end of forth test
877 dnl end of third test
880 dnl end of second test
883 dnl end of non-blocking try-compile test
884 AC_MSG_RESULT($nonblock)
886 if test "$nonblock" = "nada"; then
887 AC_MSG_WARN([non-block sockets disabled])
893 dnl -------------------------------------------------
894 dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
895 dnl and a few other things.
896 AC_DEFUN([TYPE_IN_ADDR_T],
898 AC_CHECK_TYPE([in_addr_t], ,[
899 AC_MSG_CHECKING([for in_addr_t equivalent])
900 AC_CACHE_VAL([curl_cv_in_addr_t_equiv],
902 curl_cv_in_addr_t_equiv=
903 for t in "unsigned long" int size_t unsigned long; do
906 #ifdef HAVE_WINDOWS_H
907 #ifndef WIN32_LEAN_AND_MEAN
908 #define WIN32_LEAN_AND_MEAN
911 #ifdef HAVE_WINSOCK2_H
912 #include <winsock2.h>
914 #ifdef HAVE_WINSOCK_H
919 #ifdef HAVE_SYS_TYPES_H
920 #include <sys/types.h>
922 #ifdef HAVE_SYS_SOCKET_H
923 #include <sys/socket.h>
925 #ifdef HAVE_NETINET_IN_H
926 #include <netinet/in.h>
928 #ifdef HAVE_ARPA_INET_H
929 #include <arpa/inet.h>
933 $t data = inet_addr ("1.2.3.4");
935 curl_cv_in_addr_t_equiv="$t"
940 if test "x$curl_cv_in_addr_t_equiv" = x; then
941 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
944 AC_MSG_RESULT($curl_cv_in_addr_t_equiv)
945 AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
946 [type to use in place of in_addr_t if not defined])],
949 #ifdef HAVE_WINDOWS_H
950 #ifndef WIN32_LEAN_AND_MEAN
951 #define WIN32_LEAN_AND_MEAN
954 #ifdef HAVE_WINSOCK2_H
955 #include <winsock2.h>
957 #ifdef HAVE_WINSOCK_H
962 #ifdef HAVE_SYS_TYPES_H
963 #include <sys/types.h>
965 #ifdef HAVE_SYS_SOCKET_H
966 #include <sys/socket.h>
968 #ifdef HAVE_NETINET_IN_H
969 #include <netinet/in.h>
971 #ifdef HAVE_ARPA_INET_H
972 #include <arpa/inet.h>
978 dnl ************************************************************
979 dnl check for "localhost", if it doesn't exist, we can't do the
980 dnl gethostbyname_r tests!
983 AC_DEFUN([CURL_CHECK_WORKING_RESOLVER],[
984 AC_MSG_CHECKING([if "localhost" resolves])
987 #include <sys/types.h>
993 h = gethostbyname("localhost");
994 exit (h == NULL ? 1 : 0); }],[
995 AC_MSG_RESULT(yes)],[
997 AC_MSG_ERROR([can't figure out gethostbyname_r() since localhost doesn't resolve])
1003 dnl ************************************************************
1004 dnl check for working getaddrinfo() that works with AI_NUMERICHOST
1006 AC_DEFUN([CURL_CHECK_WORKING_GETADDRINFO],[
1007 AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
1010 #include <sys/types.h>
1011 #include <sys/socket.h>
1015 struct addrinfo hints, *ai;
1018 memset(&hints, 0, sizeof(hints));
1019 hints.ai_flags = AI_NUMERICHOST;
1020 hints.ai_family = AF_UNSPEC;
1021 hints.ai_socktype = SOCK_STREAM;
1022 error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
1029 ac_cv_working_getaddrinfo="yes"
1031 ac_cv_working_getaddrinfo="no"
1033 ac_cv_working_getaddrinfo="yes"
1035 if test "$ac_cv_working_getaddrinfo" = "yes"; then
1036 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works])
1037 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
1040 AC_SUBST(IPV6_ENABLED)
1045 AC_DEFUN([CURL_CHECK_LOCALTIME_R],
1047 dnl check for localtime_r
1048 AC_CHECK_FUNCS(localtime_r,[
1049 AC_MSG_CHECKING(whether localtime_r is declared)
1050 AC_EGREP_CPP(localtime_r,[
1051 #include <time.h>],[
1052 AC_MSG_RESULT(yes)],[
1054 AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
1055 AC_EGREP_CPP(localtime_r,[
1057 #include <time.h>],[
1058 AC_DEFINE(NEED_REENTRANT)
1059 AC_MSG_RESULT(yes)],
1060 AC_MSG_RESULT(no))])])
1064 dnl This function checks for strerror_r(). If it isn't found at first, it
1065 dnl retries with _THREAD_SAFE defined, as that is what AIX seems to require
1066 dnl in order to find this function.
1068 dnl If the function is found, it will then proceed to check how the function
1069 dnl actually works: glibc-style or POSIX-style.
1072 dnl char *strerror_r(int errnum, char *buf, size_t n);
1074 dnl What this one does is to return the error string (no surprises there),
1075 dnl but it doesn't usually copy anything into buf! The 'buf' and 'n'
1076 dnl parameters are only meant as an optional working area, in case strerror_r
1077 dnl needs it. A quick test on a few systems shows that it's generally not
1081 dnl int strerror_r(int errnum, char *buf, size_t n);
1083 AC_DEFUN([CURL_CHECK_STRERROR_R],
1085 AC_CHECK_FUNCS(strerror_r)
1087 if test "x$ac_cv_func_strerror_r" = "xyes"; then
1089 AC_MSG_CHECKING(whether strerror_r is declared)
1090 AC_EGREP_CPP(strerror_r,[
1091 #include <string.h>],[
1092 AC_MSG_RESULT(yes)],[
1094 AC_MSG_CHECKING(whether strerror_r with -D_REENTRANT is declared)
1095 AC_EGREP_CPP(strerror_r,[
1097 #include <string.h>],[
1098 CPPFLAGS="-D_REENTRANT $CPPFLAGS"
1099 AC_MSG_RESULT(yes)],
1101 AC_DEFINE(HAVE_NO_STRERROR_R_DECL, 1, [we have no strerror_r() proto])
1102 ) dnl with _THREAD_SAFE
1103 ]) dnl plain cpp for it
1105 dnl determine if this strerror_r() is glibc or POSIX
1106 AC_MSG_CHECKING([for a glibc strerror_r API])
1112 char buffer[1024]; /* big enough to play with */
1114 strerror_r(EACCES, buffer, sizeof(buffer));
1115 /* this should've returned a string */
1116 if(!string || !string[0])
1121 GLIBC_STRERROR_R="1"
1122 AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
1123 AC_MSG_RESULT([yes]),
1124 AC_MSG_RESULT([no]),
1126 dnl Use an inferior method of strerror_r detection while cross-compiling
1128 #include <features.h>
1133 dnl looks like glibc, so assume a glibc-style strerror_r()
1134 GLIBC_STRERROR_R="1"
1135 AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
1136 AC_MSG_RESULT([yes]),
1137 AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
1138 ) dnl while cross-compiling
1141 if test -z "$GLIBC_STRERROR_R"; then
1143 AC_MSG_CHECKING([for a POSIX strerror_r API])
1149 char buffer[1024]; /* big enough to play with */
1151 strerror_r(EACCES, buffer, sizeof(buffer));
1152 /* This should've returned zero, and written an error string in the
1154 if(!buffer[0] || error)
1159 AC_DEFINE(HAVE_POSIX_STRERROR_R, 1, [we have a POSIX-style strerror_r()])
1160 AC_MSG_RESULT([yes]),
1161 AC_MSG_RESULT([no]) ,
1162 dnl cross-compiling!
1163 AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
1166 fi dnl if not using glibc API
1168 fi dnl we have a strerror_r
1172 AC_DEFUN([CURL_CHECK_INET_NTOA_R],
1174 dnl determine if function definition for inet_ntoa_r exists.
1175 AC_CHECK_FUNCS(inet_ntoa_r,[
1176 AC_MSG_CHECKING(whether inet_ntoa_r is declared)
1177 AC_EGREP_CPP(inet_ntoa_r,[
1178 #include <arpa/inet.h>],[
1179 AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared])
1180 AC_MSG_RESULT(yes)],[
1182 AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
1183 AC_EGREP_CPP(inet_ntoa_r,[
1185 #include <arpa/inet.h>],[
1186 AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared])
1187 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT defined])
1188 AC_MSG_RESULT(yes)],
1189 AC_MSG_RESULT(no))])])
1192 AC_DEFUN([CURL_CHECK_GETHOSTBYADDR_R],
1194 dnl check for number of arguments to gethostbyaddr_r. it might take
1195 dnl either 5, 7, or 8 arguments.
1196 AC_CHECK_FUNCS(gethostbyaddr_r,[
1197 AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
1199 #include <sys/types.h>
1200 #include <netdb.h>],[
1205 struct hostent_data hdata;
1207 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
1209 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args])
1210 ac_cv_gethostbyaddr_args=5],[
1212 AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
1215 #include <sys/types.h>
1216 #include <netdb.h>],[
1221 struct hostent_data hdata;
1223 rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
1225 AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args])
1226 AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT])
1227 ac_cv_gethostbyaddr_args=5],[
1229 AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
1231 #include <sys/types.h>
1232 #include <netdb.h>],[
1239 struct hostent * hp;
1241 hp = gethostbyaddr_r(address, length, type, &h,
1242 buffer, 8192, &h_errnop);],[
1244 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args] )
1245 ac_cv_gethostbyaddr_args=7],[
1247 AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
1249 #include <sys/types.h>
1250 #include <netdb.h>],[
1257 struct hostent * hp;
1260 rc = gethostbyaddr_r(address, length, type, &h,
1261 buffer, 8192, &hp, &h_errnop);],[
1263 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args])
1264 ac_cv_gethostbyaddr_args=8],[
1266 have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
1269 AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R],
1271 dnl check for number of arguments to gethostbyname_r. it might take
1272 dnl either 3, 5, or 6 arguments.
1273 AC_CHECK_FUNCS(gethostbyname_r,[
1274 AC_MSG_CHECKING([if gethostbyname_r takes 3 arguments])
1277 #include <sys/types.h>
1280 #define NULL (void *)0
1283 gethostbyname_r(const char *, struct hostent *, struct hostent_data *);],[
1284 struct hostent_data data;
1285 gethostbyname_r(NULL, NULL, NULL);],[
1287 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
1288 ac_cv_gethostbyname_args=3],[
1290 AC_MSG_CHECKING([if gethostbyname_r with -D_REENTRANT takes 3 arguments])
1295 #include <sys/types.h>
1298 #define NULL (void *)0
1301 gethostbyname_r(const char *,struct hostent *, struct hostent_data *);],[
1302 struct hostent_data data;
1303 gethostbyname_r(NULL, NULL, NULL);],[
1305 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
1306 AC_DEFINE(NEED_REENTRANT, 1, [needs REENTRANT])
1307 ac_cv_gethostbyname_args=3],[
1309 AC_MSG_CHECKING([if gethostbyname_r takes 5 arguments])
1311 #include <sys/types.h>
1314 #define NULL (void *)0
1317 gethostbyname_r(const char *, struct hostent *, char *, int, int *);],[
1318 gethostbyname_r(NULL, NULL, NULL, 0, NULL);],[
1320 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
1321 ac_cv_gethostbyname_args=5],[
1323 AC_MSG_CHECKING([if gethostbyname_r takes 6 arguments])
1325 #include <sys/types.h>
1328 #define NULL (void *)0
1331 gethostbyname_r(const char *, struct hostent *, char *, size_t,
1332 struct hostent **, int *);],[
1333 gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL);],[
1335 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
1336 ac_cv_gethostbyname_args=6],[
1338 have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"],
1339 [ac_cv_gethostbyname_args=0])],
1340 [ac_cv_gethostbyname_args=0])],
1341 [ac_cv_gethostbyname_args=0])],
1342 [ac_cv_gethostbyname_args=0])])
1344 if test "$ac_cv_func_gethostbyname_r" = "yes"; then
1345 if test "$ac_cv_gethostbyname_args" = "0"; then
1346 dnl there's a gethostbyname_r() function, but we don't know how
1347 dnl many arguments it wants!
1348 AC_MSG_ERROR([couldn't figure out how to use gethostbyname_r()])
1354 dnl **********************************************************************
1355 dnl CURL_DETECT_ICC ([ACTION-IF-YES])
1357 dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
1358 dnl sets the $ICC variable to "yes" or "no"
1359 dnl **********************************************************************
1360 AC_DEFUN([CURL_DETECT_ICC],
1363 AC_MSG_CHECKING([for icc in use])
1364 if test "$GCC" = "yes"; then
1365 dnl check if this is icc acting as gcc in disguise
1366 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
1367 dnl action if the text is found, this it has not been replaced by the
1370 dnl the text was not found, it was replaced by the cpp
1372 AC_MSG_RESULT([yes])
1376 if test "$ICC" = "no"; then
1382 dnl We create a function for detecting which compiler we use and then set as
1383 dnl pendantic compiler options as possible for that particular compiler. The
1384 dnl options are only used for debug-builds.
1386 AC_DEFUN([CURL_CC_DEBUG_OPTS],
1388 if test "z$ICC" = "z"; then
1392 if test "$GCC" = "yes"; then
1394 dnl figure out gcc version!
1395 AC_MSG_CHECKING([gcc version])
1396 gccver=`$CC -dumpversion`
1397 num1=`echo $gccver | cut -d . -f1`
1398 num2=`echo $gccver | cut -d . -f2`
1399 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
1400 AC_MSG_RESULT($gccver)
1402 if test "$ICC" = "yes"; then
1403 dnl this is icc, not gcc.
1405 dnl ICC warnings we ignore:
1406 dnl * 269 warns on our "%Od" printf formatters for curl_off_t output:
1407 dnl "invalid format string conversion"
1408 dnl * 279 warns on static conditions in while expressions
1409 dnl * 981 warns on "operands are evaluated in unspecified order"
1410 dnl * 1418 "external definition with no prior declaration"
1411 dnl * 1419 warns on "external declaration in primary source file"
1412 dnl which we know and do on purpose.
1414 WARN="-wd279,269,981,1418,1419"
1416 if test "$gccnum" -gt "600"; then
1417 dnl icc 6.0 and older doesn't have the -Wall flag
1421 dnl this is a set of options we believe *ALL* gcc versions support:
1422 WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
1424 dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
1426 if test "$gccnum" -ge "207"; then
1427 dnl gcc 2.7 or later
1428 WARN="$WARN -Wmissing-declarations"
1431 if test "$gccnum" -gt "295"; then
1432 dnl only if the compiler is newer than 2.95 since we got lots of
1433 dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
1434 dnl gcc 2.95.4 on FreeBSD 4.9!
1435 WARN="$WARN -Wundef -Wno-long-long -Wsign-compare"
1438 if test "$gccnum" -ge "296"; then
1439 dnl gcc 2.96 or later
1440 WARN="$WARN -Wfloat-equal"
1443 if test "$gccnum" -gt "296"; then
1444 dnl this option does not exist in 2.96
1445 WARN="$WARN -Wno-format-nonliteral"
1448 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
1449 dnl on i686-Linux as it gives us heaps with false positives.
1450 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
1451 dnl over making it unusable for generic purposes. Let's not use it.
1453 if test "$gccnum" -ge "303"; then
1454 dnl gcc 3.3 and later
1455 WARN="$WARN -Wendif-labels -Wstrict-prototypes"
1458 if test "$gccnum" -ge "304"; then
1459 # try these on gcc 3.4
1460 WARN="$WARN -Wdeclaration-after-statement"
1463 for flag in $CPPFLAGS; do
1466 dnl Include path, provide a -isystem option for the same dir
1467 dnl to prevent warnings in those dirs. The -isystem was not very
1468 dnl reliable on earlier gcc versions.
1469 add=`echo $flag | sed 's/^-I/-isystem /g'`
1477 CFLAGS="$CFLAGS $WARN"
1479 AC_MSG_NOTICE([Added this set of compiler options: $WARN])
1483 AC_MSG_NOTICE([Added no extra compiler options])
1487 dnl strip off optimizer flags
1489 for flag in $CFLAGS; do
1492 dnl echo "cut off $flag"
1495 NEWFLAGS="$NEWFLAGS $flag"
1501 ]) dnl end of AC_DEFUN()
1504 dnl Determine the name of the library to pass to dlopen() based on the name
1505 dnl that would normally be given to AC_CHECK_LIB. The preprocessor symbol
1506 dnl given is set to the quoted library file name.
1507 dnl The standard dynamic library file name is first generated, based on the
1508 dnl current system type, then a search is performed for that file on the
1509 dnl standard dynamic library path. If it is a symbolic link, the destination
1510 dnl of the link is used as the file name, after stripping off any minor
1511 dnl version numbers. If a library file can't be found, a guess is made.
1512 dnl This macro assumes AC_PROG_LIBTOOL has been called and requires perl
1513 dnl to be available in the PATH, or $PERL to be set to its location.
1515 dnl CURL_DLLIB_NAME(VARIABLE, library_name)
1516 dnl e.g. CURL_DLLIB_NAME(LDAP_NAME, ldap) on a Linux system might result
1517 dnl in LDAP_NAME holding the string "libldap.so.2".
1519 AC_DEFUN([CURL_DLLIB_NAME],
1521 AC_MSG_CHECKING([name of dynamic library $2])
1522 dnl The shared library extension variable name changes from version to
1523 dnl version of libtool. Try a few names then just set one statically.
1524 test -z "$shared_ext" && shared_ext="$shrext_cmds"
1525 test -z "$shared_ext" && shared_ext="$shrext"
1526 test -z "$shared_ext" && shared_ext=".so"
1528 dnl Create the library link name of the correct form for this platform
1529 LIBNAME_LINK_SPEC=`echo "$library_names_spec" | $SED 's/^.* //'`
1530 DLGUESSLIB=`name=$2 eval echo "$libname_spec"`
1531 DLGUESSFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$LIBNAME_LINK_SPEC"`
1533 dnl Synthesize a likely dynamic library name in case we can't find an actual one
1534 SO_NAME_SPEC="$soname_spec"
1535 dnl soname_spec undefined when identical to the 1st entry in library_names_spec
1536 test -z "$SO_NAME_SPEC" && SO_NAME_SPEC=`echo "$library_names_spec" | $SED 's/ .*$//'`
1537 DLGUESSSOFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$SO_NAME_SPEC"`
1539 if test "$cross_compiling" = yes; then
1540 dnl Can't look at filesystem when cross-compiling
1541 AC_DEFINE_UNQUOTED($1, "$DLGUESSSOFILE", [$2 dynamic library file])
1542 AC_MSG_RESULT([$DLGUESSSOFILE (guess while cross-compiling)])
1546 if test "$sys_lib_dlsearch_path_spec" ; then
1547 dnl Search for the link library name and see what it points to.
1548 for direc in $sys_lib_dlsearch_path_spec ; do
1549 DLTRYFILE="$direc/$DLGUESSFILE"
1550 dnl Find where the symbolic link for this name points
1551 changequote(<<, >>)dnl
1553 DLFOUNDFILE=`${PERL:-perl} -e 'use File::Basename; (basename(readlink($ARGV[0])) =~ /^(.*[^\d]\.\d+)[\d\.]*$/ && print ${1}) || exit 1;' "$DLTRYFILE" 2>&5`
1555 changequote([, ])dnl
1556 if test "$?" -eq "0"; then
1557 dnl Found the file link
1563 if test -z "$DLFOUNDFILE" ; then
1564 dnl Couldn't find a link library, so guess at a name.
1565 DLFOUNDFILE="$DLGUESSSOFILE"
1568 AC_DEFINE_UNQUOTED($1, "$DLFOUNDFILE", [$2 dynamic library file])
1569 AC_MSG_RESULT($DLFOUNDFILE)
1573 # This is only a temporary fix. This macro is here to replace the broken one
1574 # delivered by the automake project (including the 1.9.6 release). As soon as
1575 # they ship a working version we SHOULD remove this work-around.
1577 AC_DEFUN([AM_MISSING_HAS_RUN],
1578 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1579 test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\""
1580 # Use eval to expand $SHELL
1581 if eval "$MISSING --run true"; then
1582 am_missing_run="$MISSING --run "
1585 AC_MSG_WARN([`missing' script is too old or missing])