2 dnl Check for `struct utimbuf'.
5 AC_DEFUN([WGET_STRUCT_UTIMBUF], [
6 AC_MSG_CHECKING([for struct utimbuf])
7 if test x"$ac_cv_header_utime_h" = xyes; then
8 AC_EGREP_CPP([struct[ ]+utimbuf],
11 AC_DEFINE([HAVE_STRUCT_UTIMBUF], [],
12 [Define if you have struct utimbuf.])
22 dnl Check for socklen_t. The third argument of accept, getsockname,
23 dnl etc. is int * on some systems, but size_t * on others. POSIX
24 dnl finally standardized on socklen_t, but older systems don't have
25 dnl it. If socklen_t exists, we use it, else if accept() accepts
26 dnl size_t *, we use that, else we use int.
28 AC_DEFUN([WGET_SOCKLEN_T], [
29 AC_MSG_CHECKING(for socklen_t)
31 #include <sys/types.h>
32 #include <sys/socket.h>
35 [], [AC_MSG_RESULT(socklen_t)], [
37 #include <sys/types.h>
38 #include <sys/socket.h>
39 int accept (int, struct sockaddr *, size_t *);
43 AC_DEFINE([socklen_t], [size_t],
44 [Define to int or size_t on systems without socklen_t.])
47 AC_DEFINE([socklen_t], [int],
48 [Define to int or size_t on systems without socklen_t.])
53 dnl Check whether fnmatch.h can be included. This doesn't use
54 dnl AC_FUNC_FNMATCH because Wget is already careful to only use
55 dnl fnmatch on certain OS'es. However, fnmatch.h is sometimes broken
56 dnl even on those because Apache installs its own fnmatch.h to
57 dnl /usr/local/include (!), which GCC uses before /usr/include.
59 AC_DEFUN([WGET_FNMATCH], [
60 AC_MSG_CHECKING([for working fnmatch.h])
61 AC_COMPILE_IFELSE([#include <fnmatch.h>
64 AC_DEFINE([HAVE_WORKING_FNMATCH_H], [],
65 [Define if fnmatch.h can be included.])
71 dnl Check for nanosleep. For nanosleep to work on Solaris, we must
72 dnl link with -lt (recently) or with -lposix (older releases).
74 AC_DEFUN([WGET_NANOSLEEP], [
75 AC_CHECK_FUNCS(nanosleep, [], [
76 AC_CHECK_LIB(rt, nanosleep, [
77 AC_DEFINE([HAVE_NANOSLEEP], [],
78 [Define if you have the nanosleep function.])
81 AC_CHECK_LIB(posix4, nanosleep, [
82 AC_DEFINE([HAVE_NANOSLEEP], [],
83 [Define if you have the nanosleep function.])
90 dnl Check whether we need to link with -lnsl and -lsocket, as is the
91 dnl case on e.g. Solaris.
93 AC_DEFUN([WGET_NSL_SOCKET], [
94 dnl On Solaris, -lnsl is needed to use gethostbyname. But checking
95 dnl for gethostbyname is not enough because on "NCR MP-RAS 3.0"
96 dnl gethostbyname is in libc, but -lnsl is still needed to use
97 dnl -lsocket, as well as for functions such as inet_ntoa. We look
98 dnl for such known offenders and if one of them is not found, we
99 dnl check if -lnsl is needed.
100 wget_check_in_nsl=NONE
101 AC_CHECK_FUNCS(gethostbyname, [], [
102 wget_check_in_nsl=gethostbyname
104 AC_CHECK_FUNCS(inet_ntoa, [], [
105 wget_check_in_nsl=inet_ntoa
107 if test $wget_check_in_nsl != NONE; then
108 AC_CHECK_LIB(nsl, $wget_check_in_nsl)
110 AC_CHECK_LIB(socket, socket)
115 dnl ansi2knr support: check whether C prototypes are available.
118 AC_DEFUN(AM_C_PROTOTYPES,
119 [AC_REQUIRE([AM_PROG_CC_STDC])
120 AC_BEFORE([$0], [AC_C_INLINE])
121 AC_MSG_CHECKING([for function prototypes])
122 if test "$am_cv_prog_cc_stdc" != no; then
124 AC_DEFINE([PROTOTYPES], [],
125 [Define if ANSI function prototypes are available.])
129 U=_ ANSI2KNR=./ansi2knr
130 # Ensure some checks needed by ansi2knr itself.
132 AC_CHECK_HEADERS(string.h)
135 AC_SUBST(ANSI2KNR)dnl
141 # @defmac AC_PROG_CC_STDC
142 # @maindex PROG_CC_STDC
144 # If the C compiler in not in ANSI C mode by default, try to add an option
145 # to output variable @code{CC} to make it so. This macro tries various
146 # options that select ANSI C on some system or another. It considers the
147 # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
148 # handles function prototypes correctly.
150 # If you use this macro, you should check after calling it whether the C
151 # compiler has been set to accept ANSI C; if not, the shell variable
152 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
153 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
154 # program @code{ansi2knr}, which comes with Ghostscript.
157 AC_DEFUN(AM_PROG_CC_STDC,
158 [AC_REQUIRE([AC_PROG_CC])
159 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
160 AC_CACHE_VAL(am_cv_prog_cc_stdc,
161 [am_cv_prog_cc_stdc=no
163 # Don't try gcc -ansi; that turns off useful extensions and
164 # breaks some systems' header files.
166 # Ultrix and OSF/1 -std1
167 # HP-UX -Aa -D_HPUX_SOURCE
168 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE"
170 CC="$ac_save_CC $ac_arg"
172 [#if !defined(__STDC__)
175 /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
177 # include <sys/types.h>
178 # include <sys/stat.h>
181 int test (int i, double x);
182 struct s1 {int (*f) (int a);};
183 struct s2 {int (*f) (double a);};],
184 [am_cv_prog_cc_stdc="$ac_arg"; break])
188 AC_MSG_RESULT($am_cv_prog_cc_stdc)
189 case "x$am_cv_prog_cc_stdc" in
191 *) CC="$CC $am_cv_prog_cc_stdc" ;;
196 dnl ************************************************************
197 dnl START OF IPv6 AUTOCONFIGURATION SUPPORT MACROS
198 dnl ************************************************************
200 AC_DEFUN([TYPE_STRUCT_SOCKADDR_IN6],[
201 ds6_have_sockaddr_in6=
202 AC_CHECK_TYPES([struct sockaddr_in6],[
203 ds6_have_sockaddr_in6=yes
205 ds6_have_sockaddr_in6=no
207 #include <sys/types.h>
208 #include <sys/socket.h>
209 #include <netinet/in.h>
212 if test "X$ds6_have_sockaddr_in6" = "Xyes"; then :
220 AC_DEFUN([MEMBER_SIN6_SCOPE_ID],[
221 AC_REQUIRE([TYPE_STRUCT_SOCKADDR_IN6])
223 ds6_member_sin6_scope_id=
224 if test "X$ds6_have_sockaddr_in6" = "Xyes"; then
225 AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],[
226 ds6_member_sin6_scope_id=yes
228 ds6_member_sin6_scope_id=no
230 #include <sys/types.h>
231 #include <sys/socket.h>
232 #include <netinet/in.h>
236 if test "X$ds6_member_sin6_scope_id" = "Xyes"; then
237 AC_DEFINE([HAVE_SOCKADDR_IN6_SCOPE_ID], 1,
238 [Define if struct sockaddr_in6 has the sin6_scope_id member])
246 AC_DEFUN([PROTO_INET6],[
247 AC_CACHE_CHECK([for INET6 protocol support], [ds6_cv_proto_inet6],[
249 #include <sys/types.h>
250 #include <sys/socket.h>
253 #error Missing PF_INET6
256 #error Mlssing AF_INET6
259 ds6_cv_proto_inet6=yes
261 ds6_cv_proto_inet6=no
265 if test "X$ds6_cv_proto_inet6" = "Xyes"; then :
273 AC_DEFUN([GETADDRINFO_AI_ADDRCONFIG],[
274 AC_CACHE_CHECK([if getaddrinfo supports AI_ADDRCONFIG],
275 [ds6_cv_gai_ai_addrconfig],[
279 #ifndef AI_ADDRCONFIG
280 #error Missing AI_ADDRCONFIG
283 ds6_cv_gai_ai_addrconfig=yes
285 ds6_cv_gai_ai_addrconfig=no
289 if test "X$ds6_cv_gai_ai_addrconfig" = "Xyes"; then :
297 AC_DEFUN([GETADDRINFO_AI_ALL],[
298 AC_CACHE_CHECK([if getaddrinfo supports AI_ALL],[ds6_cv_gai_ai_all],[
303 #error Missing AI_ALL
306 ds6_cv_gai_ai_all=yes
312 if test "X$ds6_cv_gai_ai_all" = "Xyes"; then :
320 AC_DEFUN([GETADDRINFO_AI_V4MAPPED],[
321 AC_CACHE_CHECK([if getaddrinfo supports AI_V4MAPPED],[ds6_cv_gai_ai_v4mapped],[
326 #error Missing AI_V4MAPPED
329 ds6_cv_gai_ai_v4mapped=yes
331 ds6_cv_gai_ai_v4mapped=no
335 if test "X$ds6_cv_gai_ai_v4mapped" = "Xyes"; then :
342 dnl ************************************************************
343 dnl END OF IPv6 AUTOCONFIGURATION SUPPORT MACROS
344 dnl ************************************************************
346 # This code originates from Ulrich Drepper's AM_WITH_NLS.
348 AC_DEFUN(WGET_WITH_NLS,
349 [AC_MSG_CHECKING([whether NLS is requested])
350 dnl Default is enabled NLS
352 [ --disable-nls do not use Native Language Support],
353 HAVE_NLS=$enableval, HAVE_NLS=yes)
354 AC_MSG_RESULT($HAVE_NLS)
356 dnl If something goes wrong, we may still decide not to use NLS.
357 dnl For this reason, defer AC_SUBST'ing HAVE_NLS until the very
360 if test x"$HAVE_NLS" = xyes; then
361 AC_MSG_RESULT([language catalogs: $ALL_LINGUAS])
362 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
363 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
364 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
365 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
367 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
372 dnl Test whether we really found GNU xgettext.
373 if test "$XGETTEXT" != ":"; then
374 dnl If it is no GNU xgettext we define it as : so that the
375 dnl Makefiles still can work.
376 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
380 [found xgettext programs is not GNU xgettext; ignore it])
385 AC_CHECK_HEADERS(locale.h libintl.h)
387 dnl Prefer gettext found in -lintl to the one in libc.
388 dnl Otherwise it can happen that we include libintl.h from
389 dnl /usr/local/lib, but fail to specify -lintl, which results in
390 dnl link or run-time failures. (Symptom: libintl_bindtextdomain
391 dnl not found at link-time.)
393 AC_CHECK_LIB(intl, gettext, [
394 dnl gettext is in libintl; announce the fact manually.
396 AC_DEFINE([HAVE_GETTEXT], [],
397 [Define if you have the gettext function.])
399 AC_CHECK_FUNCS(gettext, [], [
400 AC_MSG_RESULT([gettext not found; disabling NLS])
405 dnl These rules are solely for the distribution goal. While doing this
406 dnl we only have to keep exactly one list of the available catalogs
408 for lang in $ALL_LINGUAS; do
409 GMOFILES="$GMOFILES $lang.gmo"
410 POFILES="$POFILES $lang.po"
412 dnl Construct list of names of catalog files to be constructed.
413 for lang in $ALL_LINGUAS; do
414 CATALOGS="$CATALOGS ${lang}${CATOBJEXT}"
417 dnl Make all variables we use known to autoconf.
420 AC_SUBST(DATADIRNAME)
427 dnl Some independently maintained files, such as po/Makefile.in,
428 dnl use `USE_NLS', so support it.
431 if test "x$HAVE_NLS" = xyes; then
432 AC_DEFINE([HAVE_NLS], [], [Define this if you want the NLS support.])
436 dnl Generate list of files to be processed by xgettext which will
437 dnl be included in po/Makefile.
439 dnl This is not strictly an Autoconf macro, because it is run from
440 dnl within `config.status' rather than from within configure. This
441 dnl is why special rules must be applied for it.
442 AC_DEFUN(WGET_PROCESS_PO,
444 dnl I wonder what the following several lines do...
445 if test "x$srcdir" != "x."; then
446 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
447 posrcprefix="$srcdir/"
449 posrcprefix="../$srcdir/"
455 dnl Use `echo' rather than AC_MSG_RESULT, because this is run from
457 echo "generating po/POTFILES from $srcdir/po/POTFILES.in"
458 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," \
459 -e "\$s/\(.*\) \\\\/\1/" \
460 < $srcdir/po/POTFILES.in > po/POTFILES
461 echo "creating po/Makefile"
462 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
465 # Search path for a program which passes the given test.
466 # Ulrich Drepper <drepper@cygnus.com>, 1996.
468 # This file may be copied and used freely without restrictions. It
469 # can be used in projects which are not available under the GNU Public
470 # License but which still want to provide support for the GNU gettext
471 # functionality. Please note that the actual code is *not* freely
476 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
477 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
478 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
479 [# Extract the first word of "$2", so it can be a program name with args.
480 set dummy $2; ac_word=[$]2
481 AC_MSG_CHECKING([for $ac_word])
482 AC_CACHE_VAL(ac_cv_path_$1,
485 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
488 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
489 for ac_dir in ifelse([$5], , $PATH, [$5]); do
490 test -z "$ac_dir" && ac_dir=.
491 if test -f $ac_dir/$ac_word; then
493 ac_cv_path_$1="$ac_dir/$ac_word"
499 dnl If no 4th arg is given, leave the cache variable unset,
500 dnl so AC_PATH_PROGS will keep looking.
501 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
506 if test -n "[$]$1"; then
514 # Include libtool code.
516 builtin(include, libtool.m4)dnl