source: trunk/third/lprng/ifhp/aclocal.m4 @ 12503

Revision 12503, 10.7 KB checked in by ghudson, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12502, which included commits to RCS files with non-trunk default branches.
Line 
1# Search path for a program which passes the given test.
2# Ulrich Drepper <drepper@cygnus.com>, 1996.
3
4# serial 1
5
6dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
7dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
8AC_DEFUN(AM_PATH_PROG_WITH_TEST,
9[# Extract the first word of "$2", so it can be a program name with args.
10set dummy $2; ac_word=[$]2
11AC_MSG_CHECKING([for $ac_word])
12AC_CACHE_VAL(ac_cv_path_$1,
13[case "[$]$1" in
14  /*)
15  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
16  ;;
17  *)
18  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
19  for ac_dir in ifelse([$5], , $PATH, [$5]); do
20    test -z "$ac_dir" && ac_dir=.
21    if test -f $ac_dir/$ac_word; then
22      if [$3]; then
23        ac_cv_path_$1="$ac_dir/$ac_word"
24        break
25      fi
26    fi
27  done
28  IFS="$ac_save_ifs"
29dnl If no 4th arg is given, leave the cache variable unset,
30dnl so AC_PATH_PROGS will keep looking.
31ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
32])dnl
33  ;;
34esac])dnl
35$1="$ac_cv_path_$1"
36if test -n "[$]$1"; then
37  AC_MSG_RESULT([$]$1)
38else
39  AC_MSG_RESULT(no)
40fi
41AC_SUBST($1)dnl
42])
43
44# Check whether LC_MESSAGES is available in <locale.h>.
45# Ulrich Drepper <drepper@cygnus.com>, 1995.
46
47# serial 1
48
49AC_DEFUN(AM_LC_MESSAGES,
50  [if test $ac_cv_header_locale_h = yes; then
51    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
52      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
53       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
54    if test $am_cv_val_LC_MESSAGES = yes; then
55      AC_DEFINE(HAVE_LC_MESSAGES)
56    fi
57  fi])
58
59# Macro to add for using GNU gettext.
60# Ulrich Drepper <drepper@cygnus.com>, 1995.
61
62# serial 1
63
64AC_DEFUN(AM_WITH_NLS,
65  [AC_MSG_CHECKING([whether NLS is requested])
66    dnl Default is enabled NLS
67dnl    AC_ARG_ENABLE(nls,
68dnl      [  --disable-nls           do not use Native Language Support],
69dnl      USE_NLS=$enableval, USE_NLS=yes)
70       AC_ARG_ENABLE(nls,
71         [  --enable-nls           use Native Language Support],
72       USE_NLS=$enableval, USE_NLS=no)
73    AC_MSG_RESULT($USE_NLS)
74    AC_SUBST(USE_NLS)
75
76    USE_INCLUDED_LIBINTL=no
77
78    dnl If we use NLS figure out what method
79    if test "$USE_NLS" = "yes"; then
80      AC_DEFINE(ENABLE_NLS)
81      AC_MSG_CHECKING([whether included gettext is requested])
82      AC_ARG_WITH(included-gettext,
83        [  --with-included-gettext use the GNU gettext library included here],
84        nls_cv_force_use_gnu_gettext=$withval,
85        nls_cv_force_use_gnu_gettext=no)
86      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
87
88      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
89      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
90        dnl User does not insist on using GNU NLS library.  Figure out what
91        dnl to use.  If gettext or catgets are available (in this order) we
92        dnl use this.  Else we have to fall back to GNU NLS library.
93        dnl catgets is only used if permitted by option --with-catgets.
94        nls_cv_header_intl=
95        nls_cv_header_libgt=
96        CATOBJEXT=NONE
97
98        AC_CHECK_HEADER(libintl.h,
99          [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
100            [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
101               gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
102
103           if test "$gt_cv_func_gettext_libc" != "yes"; then
104             AC_CHECK_LIB(intl, bindtextdomain,
105               [AC_CACHE_CHECK([for gettext in libintl],
106                 gt_cv_func_gettext_libintl,
107                 [AC_TRY_LINK([], [return (int) gettext ("")],
108                 gt_cv_func_gettext_libintl=yes,
109                 gt_cv_func_gettext_libintl=no)])])
110           fi
111
112           if test "$gt_cv_func_gettext_libc" = "yes" \
113              || test "$gt_cv_func_gettext_libintl" = "yes"; then
114              AC_DEFINE(HAVE_GETTEXT)
115              AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
116                [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
117              if test "$MSGFMT" != "no"; then
118                AC_CHECK_FUNCS(dcgettext)
119                AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
120                AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
121                  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
122                AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
123                               return _nl_msg_cat_cntr],
124                  [CATOBJEXT=.gmo
125                   DATADIRNAME=share],
126                  [CATOBJEXT=.mo
127                   DATADIRNAME=lib])
128                INSTOBJEXT=.mo
129              fi
130            fi
131        ])
132
133        if test "$CATOBJEXT" = "NONE"; then
134          AC_MSG_CHECKING([whether catgets can be used])
135          AC_ARG_WITH(catgets,
136            [  --with-catgets          use catgets functions if available],
137            nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
138          AC_MSG_RESULT($nls_cv_use_catgets)
139
140          if test "$nls_cv_use_catgets" = "yes"; then
141            dnl No gettext in C library.  Try catgets next.
142            AC_CHECK_LIB(i, main)
143            AC_CHECK_FUNC(catgets,
144              [AC_DEFINE(HAVE_CATGETS)
145               INTLOBJS="\$(CATOBJS)"
146               AC_PATH_PROG(GENCAT, gencat, no)dnl
147               if test "$GENCAT" != "no"; then
148                 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
149                 if test "$GMSGFMT" = "no"; then
150                   AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
151                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
152                 fi
153                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
154                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
155                 USE_INCLUDED_LIBINTL=yes
156                 CATOBJEXT=.cat
157                 INSTOBJEXT=.cat
158                 DATADIRNAME=lib
159                 INTLDEPS="../intl/libintl.a"
160                 INTLLIBS=$INTLDEPS
161                 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
162                 nls_cv_header_intl=intl/libintl.h
163                 nls_cv_header_libgt=intl/libgettext.h
164               fi])
165          fi
166        fi
167
168        if test "$CATOBJEXT" = "NONE"; then
169          dnl Neither gettext nor catgets in included in the C library.
170          dnl Fall back on GNU gettext library.
171          nls_cv_use_gnu_gettext=yes
172        fi
173      fi
174
175      if test "$nls_cv_use_gnu_gettext" = "yes"; then
176        dnl Mark actions used to generate GNU NLS library.
177        INTLOBJS="\$(GETTOBJS)"
178        AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
179          [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
180        AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
181        AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
182          [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
183        AC_SUBST(MSGFMT)
184        USE_INCLUDED_LIBINTL=yes
185        CATOBJEXT=.gmo
186        INSTOBJEXT=.mo
187        DATADIRNAME=share
188        INTLDEPS="../intl/libintl.a"
189        INTLLIBS=$INTLDEPS
190        LIBS=`echo $LIBS | sed -e 's/-lintl//'`
191        nls_cv_header_intl=intl/libintl.h
192        nls_cv_header_libgt=intl/libgettext.h
193      fi
194
195      dnl Test whether we really found GNU xgettext.
196      if test "$XGETTEXT" != ":"; then
197        dnl If it is no GNU xgettext we define it as : so that the
198        dnl Makefiles still can work.
199        if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
200          : ;
201        else
202          AC_MSG_RESULT(
203            [found xgettext programs is not GNU xgettext; ignore it])
204          XGETTEXT=":"
205        fi
206      fi
207
208      # We need to process the po/ directory.
209      POSUB=po
210    else
211      DATADIRNAME=share
212      nls_cv_header_intl=intl/libintl.h
213      nls_cv_header_libgt=intl/libgettext.h
214    fi
215
216    # If this is used in GNU gettext we have to set USE_NLS to `yes'
217    # because some of the sources are only built for this goal.
218    if test "$PACKAGE" = gettext; then
219      USE_NLS=yes
220      USE_INCLUDED_LIBINTL=yes
221    fi
222
223    dnl These rules are solely for the distribution goal.  While doing this
224    dnl we only have to keep exactly one list of the available catalogs
225    dnl in configure.in.
226    for lang in $ALL_LINGUAS; do
227      GMOFILES="$GMOFILES $lang.gmo"
228      POFILES="$POFILES $lang.po"
229    done
230
231    dnl Make all variables we use known to autoconf.
232    AC_SUBST(USE_INCLUDED_LIBINTL)
233    AC_SUBST(CATALOGS)
234    AC_SUBST(CATOBJEXT)
235    AC_SUBST(DATADIRNAME)
236    AC_SUBST(GMOFILES)
237    AC_SUBST(INSTOBJEXT)
238    AC_SUBST(INTLDEPS)
239    AC_SUBST(INTLLIBS)
240    AC_SUBST(INTLOBJS)
241    AC_SUBST(POFILES)
242    AC_SUBST(POSUB)
243  ])
244
245AC_DEFUN(AM_GNU_GETTEXT,
246  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
247   AC_REQUIRE([AC_PROG_CC])dnl
248   AC_REQUIRE([AC_ISC_POSIX])dnl
249   AC_REQUIRE([AC_PROG_RANLIB])dnl
250   AC_REQUIRE([AC_HEADER_STDC])dnl
251   AC_REQUIRE([AC_C_CONST])dnl
252   AC_REQUIRE([AC_C_INLINE])dnl
253   AC_REQUIRE([AC_TYPE_OFF_T])dnl
254   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
255   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
256   AC_REQUIRE([AC_FUNC_MMAP])dnl
257
258   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
259unistd.h values.h])
260   AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
261__argz_count __argz_stringify __argz_next])
262
263   if test "${ac_cv_func_stpcpy+set}" != "set"; then
264     AC_CHECK_FUNCS(stpcpy)
265   fi
266   if test "${ac_cv_func_stpcpy}" = "yes"; then
267     AC_DEFINE(HAVE_STPCPY)
268   fi
269
270   AM_LC_MESSAGES
271   AM_WITH_NLS
272
273   if test "x$CATOBJEXT" != "x"; then
274     if test "x$ALL_LINGUAS" = "x"; then
275       LINGUAS=
276     else
277       AC_MSG_CHECKING(for catalogs to be installed)
278       NEW_LINGUAS=
279       for lang in ${LINGUAS=$ALL_LINGUAS}; do
280         case "$ALL_LINGUAS" in
281          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
282         esac
283       done
284       LINGUAS=$NEW_LINGUAS
285       AC_MSG_RESULT($LINGUAS)
286     fi
287
288     dnl Construct list of names of catalog files to be constructed.
289     if test -n "$LINGUAS"; then
290       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
291     fi
292   fi
293
294   dnl Determine which catalog format we have (if any is needed)
295   dnl For now we know about two different formats:
296   dnl   Linux libc-5 and the normal X/Open format
297   test -d intl || mkdir intl
298   if test "$CATOBJEXT" = ".cat"; then
299     AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
300
301     dnl Transform the SED scripts while copying because some dumb SEDs
302     dnl cannot handle comments.
303     sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
304   fi
305   dnl po2tbl.sed is always needed.
306   sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
307     $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
308
309   dnl In the intl/Makefile.in we have a special dependency which makes
310   dnl only sense for gettext.  We comment this out for non-gettext
311   dnl packages.
312   if test "$PACKAGE" = "gettext"; then
313     GT_NO="#NO#"
314     GT_YES=
315   else
316     GT_NO=
317     GT_YES="#YES#"
318   fi
319   AC_SUBST(GT_NO)
320   AC_SUBST(GT_YES)
321
322   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
323   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
324   dnl Try to locate is.
325   MKINSTALLDIRS=
326   if test $ac_aux_dir; then
327     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
328   fi
329   if test -z $MKINSTALLDIRS; then
330     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
331   fi
332   AC_SUBST(MKINSTALLDIRS)
333
334   dnl Generate list of files to be processed by xgettext which will
335   dnl be included in po/Makefile.
336   test -d po || mkdir po
337   if test "x$srcdir" != "x."; then
338     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
339       posrcprefix="$srcdir/"
340     else
341       posrcprefix="../$srcdir/"
342     fi
343   else
344     posrcprefix="../"
345   fi
346   sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
347        < $srcdir/po/POTFILES.in > po/POTFILES
348  ])
Note: See TracBrowser for help on using the repository browser.