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>
30 ], [AC_MSG_RESULT(socklen_t)], [
32 #include <sys/types.h>
33 #include <sys/socket.h>
34 int accept (int, struct sockaddr *, size_t *);
37 AC_DEFINE([socklen_t], [size_t],
38 [Define to int or size_t on systems without socklen_t.])
41 AC_DEFINE([socklen_t], [int],
42 [Define to int or size_t on systems without socklen_t.])
47 dnl Check whether fnmatch.h can be included. This doesn't use
48 dnl AC_FUNC_FNMATCH because Wget is already careful to only use
49 dnl fnmatch on certain OS'es. However, fnmatch.h is sometimes broken
50 dnl even on those because Apache installs its own fnmatch.h to
51 dnl /usr/local/include (!), which GCC uses before /usr/include.
53 AC_DEFUN([WGET_FNMATCH], [
54 AC_MSG_CHECKING([for working fnmatch.h])
55 AC_COMPILE_IFELSE([#include <fnmatch.h>
58 AC_DEFINE([HAVE_WORKING_FNMATCH_H], 1,
59 [Define if fnmatch.h can be included.])
65 dnl Check for nanosleep. For nanosleep to work on Solaris, we must
66 dnl link with -lt (recently) or with -lposix (older releases).
68 AC_DEFUN([WGET_NANOSLEEP], [
69 AC_CHECK_FUNCS(nanosleep, [], [
70 AC_CHECK_LIB(rt, nanosleep, [
71 AC_DEFINE([HAVE_NANOSLEEP], 1,
72 [Define if you have the nanosleep function.])
75 AC_CHECK_LIB(posix4, nanosleep, [
76 AC_DEFINE([HAVE_NANOSLEEP], 1,
77 [Define if you have the nanosleep function.])
84 dnl Check whether we need to link with -lnsl and -lsocket, as is the
85 dnl case on e.g. Solaris.
87 AC_DEFUN([WGET_NSL_SOCKET], [
88 dnl On Solaris, -lnsl is needed to use gethostbyname. But checking
89 dnl for gethostbyname is not enough because on "NCR MP-RAS 3.0"
90 dnl gethostbyname is in libc, but -lnsl is still needed to use
91 dnl -lsocket, as well as for functions such as inet_ntoa. We look
92 dnl for such known offenders and if one of them is not found, we
93 dnl check if -lnsl is needed.
94 wget_check_in_nsl=NONE
95 AC_CHECK_FUNCS(gethostbyname, [], [
96 wget_check_in_nsl=gethostbyname
98 AC_CHECK_FUNCS(inet_ntoa, [], [
99 wget_check_in_nsl=inet_ntoa
101 if test $wget_check_in_nsl != NONE; then
102 AC_CHECK_LIB(nsl, $wget_check_in_nsl)
104 AC_CHECK_LIB(socket, socket)
110 # @defmac AC_PROG_CC_STDC
111 # @maindex PROG_CC_STDC
113 # If the C compiler in not in ANSI C mode by default, try to add an option
114 # to output variable @code{CC} to make it so. This macro tries various
115 # options that select ANSI C on some system or another. It considers the
116 # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
117 # handles function prototypes correctly.
119 # If you use this macro, you should check after calling it whether the C
120 # compiler has been set to accept ANSI C; if not, the shell variable
121 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
122 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
123 # program @code{ansi2knr}, which comes with Ghostscript.
126 AC_DEFUN(AM_PROG_CC_STDC,
127 [AC_REQUIRE([AC_PROG_CC])
128 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
129 AC_CACHE_VAL(am_cv_prog_cc_stdc,
130 [am_cv_prog_cc_stdc=no
132 # Don't try gcc -ansi; that turns off useful extensions and
133 # breaks some systems' header files.
135 # Ultrix and OSF/1 -std1
136 # HP-UX -Aa -D_HPUX_SOURCE
137 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE"
139 CC="$ac_save_CC $ac_arg"
141 [#if !defined(__STDC__)
144 /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
146 # include <sys/types.h>
147 # include <sys/stat.h>
150 int test (int i, double x);
151 struct s1 {int (*f) (int a);};
152 struct s2 {int (*f) (double a);};],
153 [am_cv_prog_cc_stdc="$ac_arg"; break])
157 AC_MSG_RESULT($am_cv_prog_cc_stdc)
158 case "x$am_cv_prog_cc_stdc" in
160 *) CC="$CC $am_cv_prog_cc_stdc" ;;
165 dnl ************************************************************
166 dnl START OF IPv6 AUTOCONFIGURATION SUPPORT MACROS
167 dnl ************************************************************
169 AC_DEFUN([TYPE_STRUCT_SOCKADDR_IN6],[
170 wget_have_sockaddr_in6=
171 AC_CHECK_TYPES([struct sockaddr_in6],[
172 wget_have_sockaddr_in6=yes
174 wget_have_sockaddr_in6=no
176 #include <sys/types.h>
177 #include <sys/socket.h>
178 #include <netinet/in.h>
181 if test "X$wget_have_sockaddr_in6" = "Xyes"; then :
189 AC_DEFUN([MEMBER_SIN6_SCOPE_ID],[
190 AC_REQUIRE([TYPE_STRUCT_SOCKADDR_IN6])
192 wget_member_sin6_scope_id=
193 if test "X$wget_have_sockaddr_in6" = "Xyes"; then
194 AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],[
195 wget_member_sin6_scope_id=yes
197 wget_member_sin6_scope_id=no
199 #include <sys/types.h>
200 #include <sys/socket.h>
201 #include <netinet/in.h>
205 if test "X$wget_member_sin6_scope_id" = "Xyes"; then
206 AC_DEFINE([HAVE_SOCKADDR_IN6_SCOPE_ID], 1,
207 [Define if struct sockaddr_in6 has the sin6_scope_id member])
215 AC_DEFUN([PROTO_INET6],[
216 AC_CACHE_CHECK([for INET6 protocol support], [wget_cv_proto_inet6],[
218 #include <sys/types.h>
219 #include <sys/socket.h>
222 #error Missing PF_INET6
225 #error Mlssing AF_INET6
228 wget_cv_proto_inet6=yes
230 wget_cv_proto_inet6=no
234 if test "X$wget_cv_proto_inet6" = "Xyes"; then :
242 AC_DEFUN([GETADDRINFO_AI_ADDRCONFIG],[
243 AC_CACHE_CHECK([if getaddrinfo supports AI_ADDRCONFIG],
244 [wget_cv_gai_ai_addrconfig],[
248 #ifndef AI_ADDRCONFIG
249 #error Missing AI_ADDRCONFIG
252 wget_cv_gai_ai_addrconfig=yes
254 wget_cv_gai_ai_addrconfig=no
258 if test "X$wget_cv_gai_ai_addrconfig" = "Xyes"; then :
266 AC_DEFUN([WGET_STRUCT_SOCKADDR_STORAGE],[
267 AC_CHECK_TYPES([struct sockaddr_storage],[], [], [
268 #include <sys/types.h>
269 #include <sys/socket.h>
273 dnl ************************************************************
274 dnl END OF IPv6 AUTOCONFIGURATION SUPPORT MACROS
275 dnl ************************************************************
277 # This code originates from Ulrich Drepper's AM_WITH_NLS.
279 AC_DEFUN([WGET_WITH_NLS],
280 [AC_MSG_CHECKING([whether NLS is requested])
281 dnl Default is enabled NLS
283 [ --disable-nls do not use Native Language Support],
284 HAVE_NLS=$enableval, HAVE_NLS=yes)
285 AC_MSG_RESULT($HAVE_NLS)
287 dnl If something goes wrong, we may still decide not to use NLS.
288 dnl For this reason, defer AC_SUBST'ing HAVE_NLS until the very
291 if test x"$HAVE_NLS" = xyes; then
292 dnl If LINGUAS is specified, use only those languages. In fact,
293 dnl compute an intersection of languages in LINGUAS and
294 dnl ALL_LINGUAS, and use that.
295 if test x"$LINGUAS" != x; then
297 for lang1 in $ALL_LINGUAS; do
298 for lang2 in $LINGUAS; do
299 if test "$lang1" = "$lang2"; then
300 new_linguas="$new_linguas $lang1"
304 ALL_LINGUAS=$new_linguas
306 AC_MSG_NOTICE([language catalogs: $ALL_LINGUAS])
307 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
308 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
309 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
310 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
312 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
317 dnl Test whether we really found GNU xgettext.
318 if test "$XGETTEXT" != ":"; then
319 dnl If it is no GNU xgettext we define it as : so that the
320 dnl Makefiles still can work.
321 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
325 [found xgettext programs is not GNU xgettext; ignore it])
330 AC_CHECK_HEADERS(locale.h libintl.h)
332 dnl Prefer gettext found in -lintl to the one in libc.
333 dnl Otherwise it can happen that we include libintl.h from
334 dnl /usr/local/lib, but fail to specify -lintl, which results in
335 dnl link or run-time failures. (Symptom: libintl_bindtextdomain
336 dnl not found at link-time.)
338 AC_CHECK_LIB(intl, gettext, [
339 dnl gettext is in libintl; announce the fact manually.
341 AC_DEFINE([HAVE_GETTEXT], 1,
342 [Define if you have the gettext function.])
344 AC_CHECK_FUNCS(gettext, [], [
345 AC_MSG_RESULT([gettext not found; disabling NLS])
350 for lang in $ALL_LINGUAS; do
351 GMOFILES="$GMOFILES $lang.gmo"
352 POFILES="$POFILES $lang.po"
354 dnl Construct list of names of catalog files to be constructed.
355 for lang in $ALL_LINGUAS; do
356 CATALOGS="$CATALOGS ${lang}${CATOBJEXT}"
359 dnl Make all variables we use known to autoconf.
362 AC_SUBST(DATADIRNAME)
369 dnl Some independently maintained files, such as po/Makefile.in,
370 dnl use `USE_NLS', so support it.
373 if test "x$HAVE_NLS" = xyes; then
374 AC_DEFINE([HAVE_NLS], 1, [Define this if you want the NLS support.])
378 dnl Generate list of files to be processed by xgettext which will
379 dnl be included in po/Makefile.
381 dnl This is not strictly an Autoconf macro, because it is run from
382 dnl within `config.status' rather than from within configure. This
383 dnl is why special rules must be applied for it.
384 AC_DEFUN(WGET_PROCESS_PO,
386 dnl I wonder what the following several lines do...
387 if test "x$srcdir" != "x."; then
388 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
389 posrcprefix="$srcdir/"
391 posrcprefix="../$srcdir/"
397 dnl Use `echo' rather than AC_MSG_RESULT, because this is run from
399 echo "generating po/POTFILES from $srcdir/po/POTFILES.in"
400 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," \
401 -e "\$s/\(.*\) \\\\/\1/" \
402 < $srcdir/po/POTFILES.in > po/POTFILES
403 echo "creating po/Makefile"
404 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
407 # Search path for a program which passes the given test.
408 # Ulrich Drepper <drepper@cygnus.com>, 1996.
410 # This file may be copied and used freely without restrictions. It
411 # can be used in projects which are not available under the GNU Public
412 # License but which still want to provide support for the GNU gettext
413 # functionality. Please note that the actual code is *not* freely
418 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
419 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
420 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
421 [# Extract the first word of "$2", so it can be a program name with args.
422 set dummy $2; ac_word=[$]2
423 AC_MSG_CHECKING([for $ac_word])
424 AC_CACHE_VAL(ac_cv_path_$1,
427 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
430 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
431 for ac_dir in ifelse([$5], , $PATH, [$5]); do
432 test -z "$ac_dir" && ac_dir=.
433 if test -f $ac_dir/$ac_word; then
435 ac_cv_path_$1="$ac_dir/$ac_word"
441 dnl If no 4th arg is given, leave the cache variable unset,
442 dnl so AC_PATH_PROGS will keep looking.
443 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
448 if test -n "[$]$1"; then
456 # Include libtool code.
458 builtin(include, libtool.m4)dnl