2 dnl Check for `struct utimbuf'.
5 AC_DEFUN([WGET_STRUCT_UTIMBUF], [
6 AC_CHECK_TYPES([struct utimbuf], [], [], [
9 # include <sys/types.h>
18 dnl Check for socklen_t. The third argument of accept, getsockname,
19 dnl etc. is int * on some systems, but size_t * on others. POSIX
20 dnl finally standardized on socklen_t, but older systems don't have
21 dnl it. If socklen_t exists, we use it, else if accept() accepts
22 dnl size_t *, we use that, else we use int.
24 AC_DEFUN([WGET_SOCKLEN_T], [
25 AC_MSG_CHECKING(for socklen_t)
27 #include <sys/types.h>
28 #include <sys/socket.h>
31 [], [AC_MSG_RESULT(socklen_t)], [
33 #include <sys/types.h>
34 #include <sys/socket.h>
35 int accept (int, struct sockaddr *, size_t *);
39 AC_DEFINE([socklen_t], [size_t],
40 [Define to int or size_t on systems without socklen_t.])
43 AC_DEFINE([socklen_t], [int],
44 [Define to int or size_t on systems without socklen_t.])
49 dnl Check whether fnmatch.h can be included. This doesn't use
50 dnl AC_FUNC_FNMATCH because Wget is already careful to only use
51 dnl fnmatch on certain OS'es. However, fnmatch.h is sometimes broken
52 dnl even on those because Apache installs its own fnmatch.h to
53 dnl /usr/local/include (!), which GCC uses before /usr/include.
55 AC_DEFUN([WGET_FNMATCH], [
56 AC_MSG_CHECKING([for working fnmatch.h])
57 AC_COMPILE_IFELSE([#include <fnmatch.h>
60 AC_DEFINE([HAVE_WORKING_FNMATCH_H], 1,
61 [Define if fnmatch.h can be included.])
67 dnl Check for nanosleep. For nanosleep to work on Solaris, we must
68 dnl link with -lt (recently) or with -lposix (older releases).
70 AC_DEFUN([WGET_NANOSLEEP], [
71 AC_CHECK_FUNCS(nanosleep, [], [
72 AC_CHECK_LIB(rt, nanosleep, [
73 AC_DEFINE([HAVE_NANOSLEEP], 1,
74 [Define if you have the nanosleep function.])
77 AC_CHECK_LIB(posix4, nanosleep, [
78 AC_DEFINE([HAVE_NANOSLEEP], 1,
79 [Define if you have the nanosleep function.])
86 dnl Check whether we need to link with -lnsl and -lsocket, as is the
87 dnl case on e.g. Solaris.
89 AC_DEFUN([WGET_NSL_SOCKET], [
90 dnl On Solaris, -lnsl is needed to use gethostbyname. But checking
91 dnl for gethostbyname is not enough because on "NCR MP-RAS 3.0"
92 dnl gethostbyname is in libc, but -lnsl is still needed to use
93 dnl -lsocket, as well as for functions such as inet_ntoa. We look
94 dnl for such known offenders and if one of them is not found, we
95 dnl check if -lnsl is needed.
96 wget_check_in_nsl=NONE
97 AC_CHECK_FUNCS(gethostbyname, [], [
98 wget_check_in_nsl=gethostbyname
100 AC_CHECK_FUNCS(inet_ntoa, [], [
101 wget_check_in_nsl=inet_ntoa
103 if test $wget_check_in_nsl != NONE; then
104 AC_CHECK_LIB(nsl, $wget_check_in_nsl)
106 AC_CHECK_LIB(socket, socket)
112 # @defmac AC_PROG_CC_STDC
113 # @maindex PROG_CC_STDC
115 # If the C compiler in not in ANSI C mode by default, try to add an option
116 # to output variable @code{CC} to make it so. This macro tries various
117 # options that select ANSI C on some system or another. It considers the
118 # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
119 # handles function prototypes correctly.
121 # If you use this macro, you should check after calling it whether the C
122 # compiler has been set to accept ANSI C; if not, the shell variable
123 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
124 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
125 # program @code{ansi2knr}, which comes with Ghostscript.
128 AC_DEFUN(AM_PROG_CC_STDC,
129 [AC_REQUIRE([AC_PROG_CC])
130 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
131 AC_CACHE_VAL(am_cv_prog_cc_stdc,
132 [am_cv_prog_cc_stdc=no
134 # Don't try gcc -ansi; that turns off useful extensions and
135 # breaks some systems' header files.
137 # Ultrix and OSF/1 -std1
138 # HP-UX -Aa -D_HPUX_SOURCE
139 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE"
141 CC="$ac_save_CC $ac_arg"
143 [#if !defined(__STDC__)
146 /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
148 # include <sys/types.h>
149 # include <sys/stat.h>
152 int test (int i, double x);
153 struct s1 {int (*f) (int a);};
154 struct s2 {int (*f) (double a);};],
155 [am_cv_prog_cc_stdc="$ac_arg"; break])
159 AC_MSG_RESULT($am_cv_prog_cc_stdc)
160 case "x$am_cv_prog_cc_stdc" in
162 *) CC="$CC $am_cv_prog_cc_stdc" ;;
167 dnl ************************************************************
168 dnl START OF IPv6 AUTOCONFIGURATION SUPPORT MACROS
169 dnl ************************************************************
171 AC_DEFUN([TYPE_STRUCT_SOCKADDR_IN6],[
172 ds6_have_sockaddr_in6=
173 AC_CHECK_TYPES([struct sockaddr_in6],[
174 ds6_have_sockaddr_in6=yes
176 ds6_have_sockaddr_in6=no
178 #include <sys/types.h>
179 #include <sys/socket.h>
180 #include <netinet/in.h>
183 if test "X$ds6_have_sockaddr_in6" = "Xyes"; then :
191 AC_DEFUN([MEMBER_SIN6_SCOPE_ID],[
192 AC_REQUIRE([TYPE_STRUCT_SOCKADDR_IN6])
194 ds6_member_sin6_scope_id=
195 if test "X$ds6_have_sockaddr_in6" = "Xyes"; then
196 AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],[
197 ds6_member_sin6_scope_id=yes
199 ds6_member_sin6_scope_id=no
201 #include <sys/types.h>
202 #include <sys/socket.h>
203 #include <netinet/in.h>
207 if test "X$ds6_member_sin6_scope_id" = "Xyes"; then
208 AC_DEFINE([HAVE_SOCKADDR_IN6_SCOPE_ID], 1,
209 [Define if struct sockaddr_in6 has the sin6_scope_id member])
217 AC_DEFUN([PROTO_INET6],[
218 AC_CACHE_CHECK([for INET6 protocol support], [ds6_cv_proto_inet6],[
220 #include <sys/types.h>
221 #include <sys/socket.h>
224 #error Missing PF_INET6
227 #error Mlssing AF_INET6
230 ds6_cv_proto_inet6=yes
232 ds6_cv_proto_inet6=no
236 if test "X$ds6_cv_proto_inet6" = "Xyes"; then :
244 AC_DEFUN([GETADDRINFO_AI_ADDRCONFIG],[
245 AC_CACHE_CHECK([if getaddrinfo supports AI_ADDRCONFIG],
246 [ds6_cv_gai_ai_addrconfig],[
250 #ifndef AI_ADDRCONFIG
251 #error Missing AI_ADDRCONFIG
254 ds6_cv_gai_ai_addrconfig=yes
256 ds6_cv_gai_ai_addrconfig=no
260 if test "X$ds6_cv_gai_ai_addrconfig" = "Xyes"; then :
268 AC_DEFUN([GETADDRINFO_AI_ALL],[
269 AC_CACHE_CHECK([if getaddrinfo supports AI_ALL],[ds6_cv_gai_ai_all],[
274 #error Missing AI_ALL
277 ds6_cv_gai_ai_all=yes
283 if test "X$ds6_cv_gai_ai_all" = "Xyes"; then :
291 AC_DEFUN([GETADDRINFO_AI_V4MAPPED],[
292 AC_CACHE_CHECK([if getaddrinfo supports AI_V4MAPPED],[ds6_cv_gai_ai_v4mapped],[
297 #error Missing AI_V4MAPPED
300 ds6_cv_gai_ai_v4mapped=yes
302 ds6_cv_gai_ai_v4mapped=no
306 if test "X$ds6_cv_gai_ai_v4mapped" = "Xyes"; then :
313 dnl ************************************************************
314 dnl END OF IPv6 AUTOCONFIGURATION SUPPORT MACROS
315 dnl ************************************************************
317 # This code originates from Ulrich Drepper's AM_WITH_NLS.
319 AC_DEFUN([WGET_WITH_NLS],
320 [AC_MSG_CHECKING([whether NLS is requested])
321 dnl Default is enabled NLS
323 [ --disable-nls do not use Native Language Support],
324 HAVE_NLS=$enableval, HAVE_NLS=yes)
325 AC_MSG_RESULT($HAVE_NLS)
327 dnl If something goes wrong, we may still decide not to use NLS.
328 dnl For this reason, defer AC_SUBST'ing HAVE_NLS until the very
331 if test x"$HAVE_NLS" = xyes; then
332 dnl If LINGUAS is specified, use only those languages. In fact,
333 dnl compute an intersection of languages in LINGUAS and
334 dnl ALL_LINGUAS, and use that.
335 if test x"$LINGUAS" != x; then
337 for lang1 in $ALL_LINGUAS; do
338 for lang2 in $LINGUAS; do
339 if test "$lang1" = "$lang2"; then
340 new_linguas="$new_linguas $lang1"
344 ALL_LINGUAS=$new_linguas
346 AC_MSG_NOTICE([language catalogs: $ALL_LINGUAS])
347 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
348 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
349 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
350 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
352 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
357 dnl Test whether we really found GNU xgettext.
358 if test "$XGETTEXT" != ":"; then
359 dnl If it is no GNU xgettext we define it as : so that the
360 dnl Makefiles still can work.
361 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
365 [found xgettext programs is not GNU xgettext; ignore it])
370 AC_CHECK_HEADERS(locale.h libintl.h)
372 dnl Prefer gettext found in -lintl to the one in libc.
373 dnl Otherwise it can happen that we include libintl.h from
374 dnl /usr/local/lib, but fail to specify -lintl, which results in
375 dnl link or run-time failures. (Symptom: libintl_bindtextdomain
376 dnl not found at link-time.)
378 AC_CHECK_LIB(intl, gettext, [
379 dnl gettext is in libintl; announce the fact manually.
381 AC_DEFINE([HAVE_GETTEXT], 1,
382 [Define if you have the gettext function.])
384 AC_CHECK_FUNCS(gettext, [], [
385 AC_MSG_RESULT([gettext not found; disabling NLS])
390 for lang in $ALL_LINGUAS; do
391 GMOFILES="$GMOFILES $lang.gmo"
392 POFILES="$POFILES $lang.po"
394 dnl Construct list of names of catalog files to be constructed.
395 for lang in $ALL_LINGUAS; do
396 CATALOGS="$CATALOGS ${lang}${CATOBJEXT}"
399 dnl Make all variables we use known to autoconf.
402 AC_SUBST(DATADIRNAME)
409 dnl Some independently maintained files, such as po/Makefile.in,
410 dnl use `USE_NLS', so support it.
413 if test "x$HAVE_NLS" = xyes; then
414 AC_DEFINE([HAVE_NLS], 1, [Define this if you want the NLS support.])
418 dnl Generate list of files to be processed by xgettext which will
419 dnl be included in po/Makefile.
421 dnl This is not strictly an Autoconf macro, because it is run from
422 dnl within `config.status' rather than from within configure. This
423 dnl is why special rules must be applied for it.
424 AC_DEFUN(WGET_PROCESS_PO,
426 dnl I wonder what the following several lines do...
427 if test "x$srcdir" != "x."; then
428 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
429 posrcprefix="$srcdir/"
431 posrcprefix="../$srcdir/"
437 dnl Use `echo' rather than AC_MSG_RESULT, because this is run from
439 echo "generating po/POTFILES from $srcdir/po/POTFILES.in"
440 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," \
441 -e "\$s/\(.*\) \\\\/\1/" \
442 < $srcdir/po/POTFILES.in > po/POTFILES
443 echo "creating po/Makefile"
444 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
447 # Search path for a program which passes the given test.
448 # Ulrich Drepper <drepper@cygnus.com>, 1996.
450 # This file may be copied and used freely without restrictions. It
451 # can be used in projects which are not available under the GNU Public
452 # License but which still want to provide support for the GNU gettext
453 # functionality. Please note that the actual code is *not* freely
458 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
459 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
460 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
461 [# Extract the first word of "$2", so it can be a program name with args.
462 set dummy $2; ac_word=[$]2
463 AC_MSG_CHECKING([for $ac_word])
464 AC_CACHE_VAL(ac_cv_path_$1,
467 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
470 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
471 for ac_dir in ifelse([$5], , $PATH, [$5]); do
472 test -z "$ac_dir" && ac_dir=.
473 if test -f $ac_dir/$ac_word; then
475 ac_cv_path_$1="$ac_dir/$ac_word"
481 dnl If no 4th arg is given, leave the cache variable unset,
482 dnl so AC_PATH_PROGS will keep looking.
483 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
488 if test -n "[$]$1"; then
496 # Include libtool code.
498 builtin(include, libtool.m4)dnl