]> sjero.net Git - wget/blob - aclocal.m4
753ad2ab76554e2514d38ecfaedf563162f28046
[wget] / aclocal.m4
1 AC_DEFUN(AM_C_PROTOTYPES,
2 [AC_REQUIRE([AM_PROG_CC_STDC])
3 AC_BEFORE([$0], [AC_C_INLINE])
4 AC_MSG_CHECKING([for function prototypes])
5 if test "$am_cv_prog_cc_stdc" != no; then
6   AC_MSG_RESULT(yes)
7   AC_DEFINE(PROTOTYPES)
8   U= ANSI2KNR=
9 else
10   AC_MSG_RESULT(no)
11   U=_ ANSI2KNR=./ansi2knr
12   # Ensure some checks needed by ansi2knr itself.
13   AC_HEADER_STDC
14   AC_CHECK_HEADERS(string.h)
15 fi
16 AC_SUBST(U)dnl
17 AC_SUBST(ANSI2KNR)dnl
18 ])
19
20
21 # serial 1
22
23 # @defmac AC_PROG_CC_STDC
24 # @maindex PROG_CC_STDC
25 # @ovindex CC
26 # If the C compiler in not in ANSI C mode by default, try to add an option
27 # to output variable @code{CC} to make it so.  This macro tries various
28 # options that select ANSI C on some system or another.  It considers the
29 # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
30 # handles function prototypes correctly.
31 #
32 # If you use this macro, you should check after calling it whether the C
33 # compiler has been set to accept ANSI C; if not, the shell variable
34 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
35 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
36 # program @code{ansi2knr}, which comes with Ghostscript.
37 # @end defmac
38
39 AC_DEFUN(AM_PROG_CC_STDC,
40 [AC_REQUIRE([AC_PROG_CC])
41 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
42 AC_CACHE_VAL(am_cv_prog_cc_stdc,
43 [am_cv_prog_cc_stdc=no
44 ac_save_CC="$CC"
45 # Don't try gcc -ansi; that turns off useful extensions and
46 # breaks some systems' header files.
47 # AIX                   -qlanglvl=ansi
48 # Ultrix and OSF/1      -std1
49 # HP-UX                 -Aa -D_HPUX_SOURCE
50 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE"
51 do
52   CC="$ac_save_CC $ac_arg"
53   AC_TRY_COMPILE(
54 [#if !defined(__STDC__)
55 choke me
56 #endif
57 /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
58 #ifdef _SEQUENT_
59 # include <sys/types.h>
60 # include <sys/stat.h>
61 #endif
62 ], [
63 int test (int i, double x);
64 struct s1 {int (*f) (int a);};
65 struct s2 {int (*f) (double a);};],
66 [am_cv_prog_cc_stdc="$ac_arg"; break])
67 done
68 CC="$ac_save_CC"
69 ])
70 AC_MSG_RESULT($am_cv_prog_cc_stdc)
71 case "x$am_cv_prog_cc_stdc" in
72   x|xno) ;;
73   *) CC="$CC $am_cv_prog_cc_stdc" ;;
74 esac
75 ])
76
77 AC_DEFUN(WGET_STRUCT_UTIMBUF,
78 [AC_MSG_CHECKING([for struct utimbuf])
79 if test x"$ac_cv_header_utime_h" = xyes; then
80   AC_EGREP_CPP([struct[         ]+utimbuf],
81     [#include <utime.h>],
82     [AC_DEFINE(HAVE_STRUCT_UTIMBUF)
83       AC_MSG_RESULT(yes)],
84     AC_MSG_RESULT(no))
85 else
86   AC_MSG_RESULT(no)
87 fi])
88
89
90 dnl ************************************************************
91 dnl START OF IPv6 AUTOCONFIGURATION SUPPORT MACROS
92 dnl ************************************************************
93
94 AC_DEFUN([TYPE_STRUCT_SOCKADDR_IN6],[
95   ds6_have_sockaddr_in6=
96   AC_CHECK_TYPES([struct sockaddr_in6],[
97     ds6_have_sockaddr_in6=yes
98   ],[
99     ds6_have_sockaddr_in6=no
100   ],[
101 #include <sys/types.h>
102 #include <sys/socket.h>
103 #include <netinet/in.h>
104   ])
105
106   if test "X$ds6_have_sockaddr_in6" = "Xyes"; then :
107     $1
108   else :
109     $2
110   fi
111 ])
112
113
114 AC_DEFUN([MEMBER_SIN6_SCOPE_ID],[
115   AC_REQUIRE([TYPE_STRUCT_SOCKADDR_IN6])
116   
117   ds6_member_sin6_scope_id=
118   if test "X$ds6_have_sockaddr_in6" = "Xyes"; then
119     AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],[
120       ds6_member_sin6_scope_id=yes
121     ],[
122       ds6_member_sin6_scope_id=no
123     ],[
124 #include <sys/types.h>
125 #include <sys/socket.h>
126 #include <netinet/in.h>
127     ])
128   fi
129
130   if test "X$ds6_member_sin6_scope_id" = "Xyes"; then
131     AC_DEFINE([HAVE_SOCKADDR_IN6_SCOPE_ID], 1,
132       [Define if struct sockaddr_in6 has the sin6_scope_id member])
133     $1
134   else :
135     $2
136   fi
137 ])
138
139
140 AC_DEFUN([PROTO_INET6],[
141   AC_CACHE_CHECK([for INET6 protocol support], [ds6_cv_proto_inet6],[
142     AC_TRY_CPP([
143 #include <sys/types.h>
144 #include <sys/socket.h>
145
146 #ifndef PF_INET6
147 #error Missing PF_INET6
148 #endif
149 #ifndef AF_INET6
150 #error Mlssing AF_INET6
151 #endif
152     ],[
153       ds6_cv_proto_inet6=yes
154     ],[
155       ds6_cv_proto_inet6=no
156     ])
157   ])
158
159   if test "X$ds6_cv_proto_inet6" = "Xyes"; then :
160     $1
161   else :
162     $2
163   fi
164 ])
165
166
167 AC_DEFUN([GETADDRINFO_AI_ADDRCONFIG],[
168   AC_CACHE_CHECK([if getaddrinfo supports AI_ADDRCONFIG],
169     [ds6_cv_gai_ai_addrconfig],[
170     AC_TRY_CPP([
171 #include <netdb.h>
172
173 #ifndef AI_ADDRCONFIG
174 #error Missing AI_ADDRCONFIG
175 #endif
176     ],[
177       ds6_cv_gai_ai_addrconfig=yes
178     ],[
179       ds6_cv_gai_ai_addrconfig=no
180     ])
181   ])
182
183   if test "X$ds6_cv_gai_ai_addrconfig" = "Xyes"; then :
184     $1
185   else :
186     $2
187   fi
188 ])
189
190
191 AC_DEFUN([GETADDRINFO_AI_ALL],[
192   AC_CACHE_CHECK([if getaddrinfo supports AI_ALL],[ds6_cv_gai_ai_all],[
193     AC_TRY_CPP([
194 #include <netdb.h>
195
196 #ifndef AI_ALL
197 #error Missing AI_ALL
198 #endif
199     ],[
200       ds6_cv_gai_ai_all=yes
201     ],[
202       ds6_cv_gai_ai_all=no
203     ])
204   ])
205
206   if test "X$ds6_cv_gai_ai_all" = "Xyes"; then :
207     $1
208   else :
209     $2
210   fi
211 ])
212
213
214 AC_DEFUN([GETADDRINFO_AI_V4MAPPED],[
215   AC_CACHE_CHECK([if getaddrinfo supports AI_V4MAPPED],[ds6_cv_gai_ai_v4mapped],[
216     AC_TRY_CPP([
217 #include <netdb.h>
218
219 #ifndef AI_V4MAPPED
220 #error Missing AI_V4MAPPED
221 #endif
222     ],[
223       ds6_cv_gai_ai_v4mapped=yes
224     ],[
225       ds6_cv_gai_ai_v4mapped=no
226     ])
227   ])
228
229   if test "X$ds6_cv_gai_ai_v4mapped" = "Xyes"; then :
230     $1
231   else :
232     $2
233   fi
234 ])
235
236 dnl ************************************************************
237 dnl END OF IPv6 AUTOCONFIGURATION SUPPORT MACROS
238 dnl ************************************************************
239 \f
240 # This code originates from Ulrich Drepper's AM_WITH_NLS.
241
242 AC_DEFUN(WGET_WITH_NLS,
243   [AC_MSG_CHECKING([whether NLS is requested])
244     dnl Default is enabled NLS
245     AC_ARG_ENABLE(nls,
246       [  --disable-nls           do not use Native Language Support],
247       HAVE_NLS=$enableval, HAVE_NLS=yes)
248     AC_MSG_RESULT($HAVE_NLS)
249
250     dnl If something goes wrong, we may still decide not to use NLS.
251     dnl For this reason, defer AC_SUBST'ing HAVE_NLS until the very
252     dnl last moment.
253
254     if test x"$HAVE_NLS" = xyes; then
255       AC_MSG_RESULT([language catalogs: $ALL_LINGUAS])
256       AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
257         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
258       AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
259           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
260       AC_SUBST(MSGFMT)
261       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
262       CATOBJEXT=.gmo
263       INSTOBJEXT=.mo
264       DATADIRNAME=share
265
266       dnl Test whether we really found GNU xgettext.
267       if test "$XGETTEXT" != ":"; then
268         dnl If it is no GNU xgettext we define it as : so that the
269         dnl Makefiles still can work.
270         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
271           : ;
272         else
273           AC_MSG_RESULT(
274             [found xgettext programs is not GNU xgettext; ignore it])
275           XGETTEXT=":"
276         fi
277       fi
278
279       AC_CHECK_HEADERS(locale.h libintl.h)
280
281       dnl Prefer gettext found in -lintl to the one in libc.
282       dnl Otherwise it can happen that we include libintl.h from
283       dnl /usr/local/lib, but fail to specify -lintl, which results in
284       dnl link or run-time failures.  (Symptom: libintl_bindtextdomain
285       dnl not found at link-time.)
286
287       AC_CHECK_LIB(intl, gettext, [
288         dnl gettext is in libintl; announce the fact manually.
289         LIBS="-lintl $LIBS"
290         AC_DEFINE(HAVE_GETTEXT)
291       ], [
292         AC_CHECK_FUNCS(gettext, [], [
293           AC_MSG_RESULT([gettext not found; disabling NLS])
294           HAVE_NLS=no
295         ])
296       ])
297
298       dnl These rules are solely for the distribution goal.  While doing this
299       dnl we only have to keep exactly one list of the available catalogs
300       dnl in configure.in.
301       for lang in $ALL_LINGUAS; do
302         GMOFILES="$GMOFILES $lang.gmo"
303         POFILES="$POFILES $lang.po"
304       done
305       dnl Construct list of names of catalog files to be constructed.
306       for lang in $ALL_LINGUAS; do
307         CATALOGS="$CATALOGS ${lang}${CATOBJEXT}"
308       done
309
310       dnl Make all variables we use known to autoconf.
311       AC_SUBST(CATALOGS)
312       AC_SUBST(CATOBJEXT)
313       AC_SUBST(DATADIRNAME)
314       AC_SUBST(GMOFILES)
315       AC_SUBST(INSTOBJEXT)
316       AC_SUBST(INTLLIBS)
317       AC_SUBST(POFILES)
318     fi
319     AC_SUBST(HAVE_NLS)
320     dnl Some independently maintained files, such as po/Makefile.in,
321     dnl use `USE_NLS', so support it.
322     USE_NLS=$HAVE_NLS
323     AC_SUBST(USE_NLS)
324     if test "x$HAVE_NLS" = xyes; then
325       AC_DEFINE(HAVE_NLS)
326     fi
327   ])
328
329 dnl Generate list of files to be processed by xgettext which will
330 dnl be included in po/Makefile.
331 dnl
332 dnl This is not strictly an Autoconf macro, because it is run from
333 dnl within `config.status' rather than from within configure.  This
334 dnl is why special rules must be applied for it.
335 AC_DEFUN(WGET_PROCESS_PO,
336   [
337    dnl I wonder what the following several lines do...
338    if test "x$srcdir" != "x."; then
339      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
340        posrcprefix="$srcdir/"
341      else
342        posrcprefix="../$srcdir/"
343      fi
344    else
345      posrcprefix="../"
346    fi
347    rm -f po/POTFILES
348    dnl Use `echo' rather than AC_MSG_RESULT, because this is run from
349    dnl `config.status'.
350    echo "generating po/POTFILES from $srcdir/po/POTFILES.in"
351    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\,"  \
352        -e "\$s/\(.*\) \\\\/\1/" \
353         < $srcdir/po/POTFILES.in > po/POTFILES
354    echo "creating po/Makefile"
355    sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
356   ])
357
358 # Search path for a program which passes the given test.
359 # Ulrich Drepper <drepper@cygnus.com>, 1996.
360 #
361 # This file may be copied and used freely without restrictions.  It
362 # can be used in projects which are not available under the GNU Public
363 # License but which still want to provide support for the GNU gettext
364 # functionality.  Please note that the actual code is *not* freely
365 # available.
366
367 # serial 1
368
369 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
370 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
371 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
372 [# Extract the first word of "$2", so it can be a program name with args.
373 set dummy $2; ac_word=[$]2
374 AC_MSG_CHECKING([for $ac_word])
375 AC_CACHE_VAL(ac_cv_path_$1,
376 [case "[$]$1" in
377   /*)
378   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
379   ;;
380   *)
381   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
382   for ac_dir in ifelse([$5], , $PATH, [$5]); do
383     test -z "$ac_dir" && ac_dir=.
384     if test -f $ac_dir/$ac_word; then
385       if [$3]; then
386         ac_cv_path_$1="$ac_dir/$ac_word"
387         break
388       fi
389     fi
390   done
391   IFS="$ac_save_ifs"
392 dnl If no 4th arg is given, leave the cache variable unset,
393 dnl so AC_PATH_PROGS will keep looking.
394 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
395 ])dnl
396   ;;
397 esac])dnl
398 $1="$ac_cv_path_$1"
399 if test -n "[$]$1"; then
400   AC_MSG_RESULT([$]$1)
401 else
402   AC_MSG_RESULT(no)
403 fi
404 AC_SUBST($1)dnl
405 ])
406
407 # Include libtool code.
408
409 builtin(include, libtool.m4)dnl