]> sjero.net Git - wget/blob - aclocal.m4
[svn] Initial revision
[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 # SVR4                  -Xc -D__EXTENSIONS__
51 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
52 do
53   CC="$ac_save_CC $ac_arg"
54   AC_TRY_COMPILE(
55 [#if !defined(__STDC__) || __STDC__ != 1
56 choke me
57 #endif
58 /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
59 #ifdef _SEQUENT_
60 # include <sys/types.h>
61 # include <sys/stat.h>
62 #endif
63 ], [
64 int test (int i, double x);
65 struct s1 {int (*f) (int a);};
66 struct s2 {int (*f) (double a);};],
67 [am_cv_prog_cc_stdc="$ac_arg"; break])
68 done
69 CC="$ac_save_CC"
70 ])
71 AC_MSG_RESULT($am_cv_prog_cc_stdc)
72 case "x$am_cv_prog_cc_stdc" in
73   x|xno) ;;
74   *) CC="$CC $am_cv_prog_cc_stdc" ;;
75 esac
76 ])
77
78 AC_DEFUN(WGET_STRUCT_UTIMBUF,
79 [AC_MSG_CHECKING(for struct utimbuf)
80 if test x"$ac_cv_header_utime_h" = xyes; then
81   AC_EGREP_CPP([struct[         ]+utimbuf],
82     [#include <utime.h>],
83     [AC_DEFINE(HAVE_STRUCT_UTIMBUF)
84       AC_MSG_RESULT(yes)],
85     AC_MSG_RESULT(no))
86 else
87   AC_MSG_RESULT(no)
88 fi])
89
90 \f
91 # This code originates from Ulrich Drepper's AM_WITH_NLS.
92
93 AC_DEFUN(WGET_WITH_NLS,
94   [AC_MSG_CHECKING([whether NLS is requested])
95     dnl Default is enabled NLS
96     AC_ARG_ENABLE(nls,
97       [  --disable-nls           do not use Native Language Support],
98       HAVE_NLS=$enableval, HAVE_NLS=yes)
99     AC_MSG_RESULT($HAVE_NLS)
100
101     dnl If something goes wrong, we may still decide not to use NLS.
102     dnl For this reason, defer AC_SUBST'ing HAVE_NLS until the very
103     dnl last moment.
104
105     if test x"$HAVE_NLS" = xyes; then
106       AC_MSG_RESULT("language catalogs: $ALL_LINGUAS")
107       AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
108         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
109       AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
110           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
111       AC_SUBST(MSGFMT)
112       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
113       CATOBJEXT=.gmo
114       INSTOBJEXT=.mo
115       DATADIRNAME=share
116
117       dnl Test whether we really found GNU xgettext.
118       if test "$XGETTEXT" != ":"; then
119         dnl If it is no GNU xgettext we define it as : so that the
120         dnl Makefiles still can work.
121         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
122           : ;
123         else
124           AC_MSG_RESULT(
125             [found xgettext programs is not GNU xgettext; ignore it])
126           XGETTEXT=":"
127         fi
128       fi
129
130       AC_CHECK_HEADERS(locale.h libintl.h)
131
132       AC_CHECK_FUNCS(gettext, [], [
133         AC_CHECK_LIB(intl, gettext, [
134           dnl gettext is in libintl; announce the fact manually.
135           LIBS="-lintl $LIBS"
136           AC_DEFINE(HAVE_GETTEXT)
137         ], [
138           AC_MSG_RESULT(
139             [gettext not found; disabling NLS])
140           HAVE_NLS=no
141         ])
142       ])
143
144       dnl These rules are solely for the distribution goal.  While doing this
145       dnl we only have to keep exactly one list of the available catalogs
146       dnl in configure.in.
147       for lang in $ALL_LINGUAS; do
148         GMOFILES="$GMOFILES $lang.gmo"
149         POFILES="$POFILES $lang.po"
150       done
151       dnl Construct list of names of catalog files to be constructed.
152       for lang in $ALL_LINGUAS; do
153         CATALOGS="$CATALOGS ${lang}${CATOBJEXT}"
154       done
155
156       dnl Make all variables we use known to autoconf.
157       AC_SUBST(CATALOGS)
158       AC_SUBST(CATOBJEXT)
159       AC_SUBST(DATADIRNAME)
160       AC_SUBST(GMOFILES)
161       AC_SUBST(INSTOBJEXT)
162       AC_SUBST(INTLLIBS)
163       AC_SUBST(POFILES)
164     fi
165     AC_SUBST(HAVE_NLS)
166     dnl Some independently maintained files, such as po/Makefile.in,
167     dnl use `USE_NLS', so support it.
168     USE_NLS=$HAVE_NLS
169     AC_SUBST(USE_NLS)
170     if test "x$HAVE_NLS" = xyes; then
171       AC_DEFINE(HAVE_NLS)
172     fi
173   ])
174
175 dnl Generate list of files to be processed by xgettext which will
176 dnl be included in po/Makefile.
177 dnl
178 dnl This is not strictly an Autoconf macro, because it is run from
179 dnl within `config.status' rather than from within configure.  This
180 dnl is why special rules must be applied for it.
181 AC_DEFUN(WGET_PROCESS_PO,
182   [srcdir=$ac_given_srcdir # Advanced autoconf hackery
183    dnl I wonder what the following several lines do...
184    if test "x$srcdir" != "x."; then
185      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
186        posrcprefix="$srcdir/"
187      else
188        posrcprefix="../$srcdir/"
189      fi
190    else
191      posrcprefix="../"
192    fi
193    rm -f po/POTFILES
194    dnl Use `echo' rather than AC_MSG_RESULT, because this is run from
195    dnl `config.status'.
196    echo "generating po/POTFILES from $srcdir/po/POTFILES.in"
197    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\,"  \
198        -e "\$s/\(.*\) \\\\/\1/" \
199         < $srcdir/po/POTFILES.in > po/POTFILES
200    echo "creating po/Makefile"
201    sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
202   ])
203
204 # Search path for a program which passes the given test.
205 # Ulrich Drepper <drepper@cygnus.com>, 1996.
206 #
207 # This file may be copied and used freely without restrictions.  It
208 # can be used in projects which are not available under the GNU Public
209 # License but which still want to provide support for the GNU gettext
210 # functionality.  Please note that the actual code is *not* freely
211 # available.
212
213 # serial 1
214
215 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
216 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
217 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
218 [# Extract the first word of "$2", so it can be a program name with args.
219 set dummy $2; ac_word=[$]2
220 AC_MSG_CHECKING([for $ac_word])
221 AC_CACHE_VAL(ac_cv_path_$1,
222 [case "[$]$1" in
223   /*)
224   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
225   ;;
226   *)
227   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
228   for ac_dir in ifelse([$5], , $PATH, [$5]); do
229     test -z "$ac_dir" && ac_dir=.
230     if test -f $ac_dir/$ac_word; then
231       if [$3]; then
232         ac_cv_path_$1="$ac_dir/$ac_word"
233         break
234       fi
235     fi
236   done
237   IFS="$ac_save_ifs"
238 dnl If no 4th arg is given, leave the cache variable unset,
239 dnl so AC_PATH_PROGS will keep looking.
240 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
241 ])dnl
242   ;;
243 esac])dnl
244 $1="$ac_cv_path_$1"
245 if test -n "[$]$1"; then
246   AC_MSG_RESULT([$]$1)
247 else
248   AC_MSG_RESULT(no)
249 fi
250 AC_SUBST($1)dnl
251 ])