]> git.sur5r.net Git - glabels/blob - glabels2/aclocal.m4
Removed configure from CVS.
[glabels] / glabels2 / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p5
2
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 # Do all the work for Automake.  This macro actually does too much --
14 # some checks are only needed if your package does certain things.
15 # But this isn't really a big deal.
16
17 # serial 1
18
19 dnl Usage:
20 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
21
22 AC_DEFUN([AM_INIT_AUTOMAKE],
23 [AC_REQUIRE([AC_PROG_INSTALL])
24 PACKAGE=[$1]
25 AC_SUBST(PACKAGE)
26 VERSION=[$2]
27 AC_SUBST(VERSION)
28 dnl test to see if srcdir already configured
29 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
30   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
31 fi
32 ifelse([$3],,
33 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
34 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
35 AC_REQUIRE([AM_SANITY_CHECK])
36 AC_REQUIRE([AC_ARG_PROGRAM])
37 dnl FIXME This is truly gross.
38 missing_dir=`cd $ac_aux_dir && pwd`
39 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
40 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
41 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
42 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
43 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
44 AC_REQUIRE([AC_PROG_MAKE_SET])])
45
46 #
47 # Check to make sure that the build environment is sane.
48 #
49
50 AC_DEFUN([AM_SANITY_CHECK],
51 [AC_MSG_CHECKING([whether build environment is sane])
52 # Just in case
53 sleep 1
54 echo timestamp > conftestfile
55 # Do `set' in a subshell so we don't clobber the current shell's
56 # arguments.  Must try -L first in case configure is actually a
57 # symlink; some systems play weird games with the mod time of symlinks
58 # (eg FreeBSD returns the mod time of the symlink's containing
59 # directory).
60 if (
61    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
62    if test "[$]*" = "X"; then
63       # -L didn't work.
64       set X `ls -t $srcdir/configure conftestfile`
65    fi
66    if test "[$]*" != "X $srcdir/configure conftestfile" \
67       && test "[$]*" != "X conftestfile $srcdir/configure"; then
68
69       # If neither matched, then we have a broken ls.  This can happen
70       # if, for instance, CONFIG_SHELL is bash and it inherits a
71       # broken ls alias from the environment.  This has actually
72       # happened.  Such a system could not be considered "sane".
73       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
74 alias in your environment])
75    fi
76
77    test "[$]2" = conftestfile
78    )
79 then
80    # Ok.
81    :
82 else
83    AC_MSG_ERROR([newly created file is older than distributed files!
84 Check your system clock])
85 fi
86 rm -f conftest*
87 AC_MSG_RESULT(yes)])
88
89 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
90 dnl The program must properly implement --version.
91 AC_DEFUN([AM_MISSING_PROG],
92 [AC_MSG_CHECKING(for working $2)
93 # Run test in a subshell; some versions of sh will print an error if
94 # an executable is not found, even if stderr is redirected.
95 # Redirect stdin to placate older versions of autoconf.  Sigh.
96 if ($2 --version) < /dev/null > /dev/null 2>&1; then
97    $1=$2
98    AC_MSG_RESULT(found)
99 else
100    $1="$3/missing $2"
101    AC_MSG_RESULT(missing)
102 fi
103 AC_SUBST($1)])
104
105 # Add --enable-maintainer-mode option to configure.
106 # From Jim Meyering
107
108 # serial 1
109
110 AC_DEFUN([AM_MAINTAINER_MODE],
111 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
112   dnl maintainer-mode is disabled by default
113   AC_ARG_ENABLE(maintainer-mode,
114 [  --enable-maintainer-mode enable make rules and dependencies not useful
115                           (and sometimes confusing) to the casual installer],
116       USE_MAINTAINER_MODE=$enableval,
117       USE_MAINTAINER_MODE=no)
118   AC_MSG_RESULT($USE_MAINTAINER_MODE)
119   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
120   MAINT=$MAINTAINER_MODE_TRUE
121   AC_SUBST(MAINT)dnl
122 ]
123 )
124
125 # Define a conditional.
126
127 AC_DEFUN([AM_CONDITIONAL],
128 [AC_SUBST($1_TRUE)
129 AC_SUBST($1_FALSE)
130 if $2; then
131   $1_TRUE=
132   $1_FALSE='#'
133 else
134   $1_TRUE='#'
135   $1_FALSE=
136 fi])
137
138 # Like AC_CONFIG_HEADER, but automatically create stamp file.
139
140 AC_DEFUN([AM_CONFIG_HEADER],
141 [AC_PREREQ([2.12])
142 AC_CONFIG_HEADER([$1])
143 dnl When config.status generates a header, we must update the stamp-h file.
144 dnl This file resides in the same directory as the config header
145 dnl that is generated.  We must strip everything past the first ":",
146 dnl and everything past the last "/".
147 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
148 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
149 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
150 <<am_indx=1
151 for am_file in <<$1>>; do
152   case " <<$>>CONFIG_HEADERS " in
153   *" <<$>>am_file "*<<)>>
154     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
155     ;;
156   esac
157   am_indx=`expr "<<$>>am_indx" + 1`
158 done<<>>dnl>>)
159 changequote([,]))])
160
161 dnl
162 dnl GNOME_PLATFORM_GNOME_2(default, [force])
163 dnl
164 dnl   If the first parameter is `yes', then the default is
165 dnl   the GNOME 2.x platform, otherwise the GNOME 1.x one.
166 dnl
167 dnl   If the optional second parameter is `force', then use
168 dnl   the default value without command line argument.
169 dnl
170
171 AC_DEFUN([GNOME_PLATFORM_GNOME_2],[
172         AC_REQUIRE([GNOME_REQUIRE_PKGCONFIG])
173
174         if test x$1 = xyes ; then
175             platform_gnome_2_default=yes
176         else
177             platform_gnome_2_default=no
178         fi
179         if test x$2 = xforce ; then
180             platform_gnome_2="$platform_gnome_2_default";
181         else
182             AC_ARG_ENABLE(platform-gnome-2, [  --enable-platform-gnome-2 enable GNOME 2.x platform [default=no]],[platform_gnome_2="$enableval"],[platform_gnome_2="$platform_gnome_2_default"])
183         fi
184
185         AM_CONDITIONAL(PLATFORM_GNOME_2, test $platform_gnome_2 = yes)
186
187         AC_MSG_CHECKING(for GNOME Platform)
188         if test $platform_gnome_2 = yes; then
189             AC_MSG_RESULT(GNOME 2.x)
190             GNOME_INTERFACE_VERSION=2
191             GNOME_REQUIRE_PKGCONFIG
192         else
193             AC_MSG_RESULT(GNOME 1.x)
194             GNOME_INTERFACE_VERSION=1
195         fi
196         AC_SUBST(GNOME_INTERFACE_VERSION)
197 ])
198
199 dnl
200 dnl GNOME_CHECK_PKGCONFIG (script-if-enabled, [failflag])
201 dnl
202 AC_DEFUN([GNOME_CHECK_PKGCONFIG],[
203         AC_PATH_PROG(PKG_CONFIG, pkg-config)
204         have_pkgconfig=no
205         if test -x "$PKG_CONFIG" ; then
206             have_pkgconfig=yes
207         else
208             PKG_CONFIG=
209         fi
210         AC_MSG_CHECKING(for pkg-config)
211         pkgconfig_required_version=0.8.0
212         if test x$have_pkgconfig = xyes ; then
213             $PKG_CONFIG --atleast-pkgconfig-version $pkgconfig_required_version
214             if test $? -ne 0; then
215                 echo "*** Your version of pkg-config is too old. You need version $pkgconfig_required_version or newer."
216                 echo "*** See http://www.freedesktop.org/software/pkgconfig"
217                 have_pkgconfig=no
218             fi
219         fi
220         if test x$have_pkgconfig = xyes ; then
221             AC_MSG_RESULT(yes)
222         else
223             PKG_CONFIG=
224             AC_MSG_RESULT(not found)
225             if test x$2 = xfail; then
226                 AC_MSG_ERROR([
227 *** You need the latest pkg-config (at least $pkgconfig_required_version).
228 *** Get the latest version of pkg-config from
229 *** http://www.freedesktop.org/software/pkgconfig.])
230             fi
231         fi
232         AC_SUBST(PKG_CONFIG)
233
234         AC_PROVIDE([GNOME_REQUIRE_PKGCONFIG])
235 ])
236
237 dnl
238 dnl GNOME_REQUIRE_PKGCONFIG
239 dnl
240 AC_DEFUN([GNOME_REQUIRE_PKGCONFIG],[
241         GNOME_CHECK_PKGCONFIG([], fail)
242 ])
243
244 #serial 1
245 # This test replaces the one in autoconf.
246 # Currently this macro should have the same name as the autoconf macro
247 # because gettext's gettext.m4 (distributed in the automake package)
248 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
249 # give these diagnostics:
250 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
251 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
252
253 undefine([AC_ISC_POSIX])
254
255 AC_DEFUN([AC_ISC_POSIX],
256   [
257     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
258     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
259   ]
260 )
261
262
263 # serial 1
264
265 # @defmac AC_PROG_CC_STDC
266 # @maindex PROG_CC_STDC
267 # @ovindex CC
268 # If the C compiler in not in ANSI C mode by default, try to add an option
269 # to output variable @code{CC} to make it so.  This macro tries various
270 # options that select ANSI C on some system or another.  It considers the
271 # compiler to be in ANSI C mode if it handles function prototypes correctly.
272 #
273 # If you use this macro, you should check after calling it whether the C
274 # compiler has been set to accept ANSI C; if not, the shell variable
275 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
276 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
277 # program @code{ansi2knr}, which comes with Ghostscript.
278 # @end defmac
279
280 AC_DEFUN([AM_PROG_CC_STDC],
281 [AC_REQUIRE([AC_PROG_CC])
282 AC_BEFORE([$0], [AC_C_INLINE])
283 AC_BEFORE([$0], [AC_C_CONST])
284 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
285 dnl a magic option to avoid problems with ANSI preprocessor commands
286 dnl like #elif.
287 dnl FIXME: can't do this because then AC_AIX won't work due to a
288 dnl circular dependency.
289 dnl AC_BEFORE([$0], [AC_PROG_CPP])
290 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
291 AC_CACHE_VAL(am_cv_prog_cc_stdc,
292 [am_cv_prog_cc_stdc=no
293 ac_save_CC="$CC"
294 # Don't try gcc -ansi; that turns off useful extensions and
295 # breaks some systems' header files.
296 # AIX                   -qlanglvl=ansi
297 # Ultrix and OSF/1      -std1
298 # HP-UX                 -Aa -D_HPUX_SOURCE
299 # SVR4                  -Xc -D__EXTENSIONS__
300 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
301 do
302   CC="$ac_save_CC $ac_arg"
303   AC_TRY_COMPILE(
304 [#include <stdarg.h>
305 #include <stdio.h>
306 #include <sys/types.h>
307 #include <sys/stat.h>
308 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
309 struct buf { int x; };
310 FILE * (*rcsopen) (struct buf *, struct stat *, int);
311 static char *e (p, i)
312      char **p;
313      int i;
314 {
315   return p[i];
316 }
317 static char *f (char * (*g) (char **, int), char **p, ...)
318 {
319   char *s;
320   va_list v;
321   va_start (v,p);
322   s = g (p, va_arg (v,int));
323   va_end (v);
324   return s;
325 }
326 int test (int i, double x);
327 struct s1 {int (*f) (int a);};
328 struct s2 {int (*f) (double a);};
329 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
330 int argc;
331 char **argv;
332 ], [
333 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
334 ],
335 [am_cv_prog_cc_stdc="$ac_arg"; break])
336 done
337 CC="$ac_save_CC"
338 ])
339 if test -z "$am_cv_prog_cc_stdc"; then
340   AC_MSG_RESULT([none needed])
341 else
342   AC_MSG_RESULT($am_cv_prog_cc_stdc)
343 fi
344 case "x$am_cv_prog_cc_stdc" in
345   x|xno) ;;
346   *) CC="$CC $am_cv_prog_cc_stdc" ;;
347 esac
348 ])
349
350 dnl GNOME_COMPILE_WARNINGS
351 dnl Turn on many useful compiler warnings
352 dnl For now, only works on GCC
353 AC_DEFUN([GNOME_COMPILE_WARNINGS],[
354     dnl ******************************
355     dnl More compiler warnings
356     dnl ******************************
357
358     if test -z "$1" ; then
359         default_compile_warnings=no
360     else
361         default_compile_warnings="$1"
362     fi
363
364     AC_ARG_ENABLE(compile-warnings, 
365     [  --enable-compile-warnings=[no/minimum/yes/maximum/error] Turn on compiler warnings.], [enable_compile_warnings="$enableval"],[enable_compile_warnings="$default_compile_warnings"])
366
367     warnCFLAGS=
368     if test "x$GCC" != xyes; then
369         enable_compile_warnings=no
370     fi
371
372     warning_flags=
373     realsave_CFLAGS="$CFLAGS"
374
375     case "$enable_compile_warnings" in
376     no)
377         warning_flags=
378         ;;
379     minimum)
380         warning_flags="-Wall -Wunused"
381         ;;
382     yes)
383         warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
384         ;;
385     maximum|error)
386         warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
387         CFLAGS="$warning_flags $CFLAGS"
388         for option in -Wsign-promo -Wno-sign-compare; do
389                 SAVE_CFLAGS="$CFLAGS"
390                 CFLAGS="$CFLAGS $option"
391                 AC_MSG_CHECKING([whether gcc understands $option])
392                 AC_TRY_COMPILE([], [],
393                         has_option=yes,
394                         has_option=no,)
395                 CFLAGS="$SAVE_CFLAGS"
396                 AC_MSG_RESULT($has_option)
397                 if test $has_option = yes; then
398                   warning_flags="$warning_flags $option"
399                 fi
400                 unset has_option
401                 unset SAVE_CFLAGS
402         done
403         unset option
404         if test "$enable_compile_warnings" = "error" ; then
405             warning_flags="$warning_flags -Werror"
406         fi
407         ;;
408     *)
409         AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
410         ;;
411     esac
412     CFLAGS="$realsave_CFLAGS"
413     AC_MSG_CHECKING(what warning flags to pass to the C compiler)
414     AC_MSG_RESULT($warning_flags)
415
416     AC_ARG_ENABLE(iso-c,
417     [  --enable-iso-c          Try to warn if code is not ISO C ],,
418     enable_iso_c=no)
419
420     AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
421     complCFLAGS=
422     if test "x$enable_iso_c" != "xno"; then
423         if test "x$GCC" = "xyes"; then
424         case " $CFLAGS " in
425             *[\ \       ]-ansi[\ \      ]*) ;;
426             *) complCFLAGS="$complCFLAGS -ansi" ;;
427         esac
428         case " $CFLAGS " in
429             *[\ \       ]-pedantic[\ \  ]*) ;;
430             *) complCFLAGS="$complCFLAGS -pedantic" ;;
431         esac
432         fi
433     fi
434     AC_MSG_RESULT($complCFLAGS)
435
436     WARN_CFLAGS="$warning_flags $complCFLAGS"
437     AC_SUBST(WARN_CFLAGS)
438 ])
439
440 dnl For C++, do basically the same thing.
441
442 AC_DEFUN([GNOME_CXX_WARNINGS],[
443   AC_ARG_ENABLE(cxx-warnings, 
444     [  --enable-cxx-warnings=[no/minimum/yes]   Turn on compiler warnings.],,enable_cxx_warnings=minimum)
445
446   AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
447   warnCXXFLAGS=
448   if test "x$GCC" != xyes; then
449     enable_compile_warnings=no
450   fi
451   if test "x$enable_cxx_warnings" != "xno"; then
452     if test "x$GCC" = "xyes"; then
453       case " $CXXFLAGS " in
454       *[\ \     ]-Wall[\ \      ]*) ;;
455       *) warnCXXFLAGS="-Wall -Wno-unused" ;;
456       esac
457
458       ## -W is not all that useful.  And it cannot be controlled
459       ## with individual -Wno-xxx flags, unlike -Wall
460       if test "x$enable_cxx_warnings" = "xyes"; then
461         warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual"
462       fi
463     fi
464   fi
465   AC_MSG_RESULT($warnCXXFLAGS)
466
467    AC_ARG_ENABLE(iso-cxx,
468      [  --enable-iso-cxx          Try to warn if code is not ISO C++ ],,
469      enable_iso_cxx=no)
470
471    AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
472    complCXXFLAGS=
473    if test "x$enable_iso_cxx" != "xno"; then
474      if test "x$GCC" = "xyes"; then
475       case " $CXXFLAGS " in
476       *[\ \     ]-ansi[\ \      ]*) ;;
477       *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
478       esac
479
480       case " $CXXFLAGS " in
481       *[\ \     ]-pedantic[\ \  ]*) ;;
482       *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
483       esac
484      fi
485    fi
486   AC_MSG_RESULT($complCXXFLAGS)
487   if test "x$cxxflags_set" != "xyes"; then
488     CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
489     cxxflags_set=yes
490     AC_SUBST(cxxflags_set)
491   fi
492 ])
493
494
495 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
496 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
497 dnl also defines GSTUFF_PKG_ERRORS on error
498 AC_DEFUN(PKG_CHECK_MODULES, [
499   succeeded=no
500
501   if test -z "$PKG_CONFIG"; then
502     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
503   fi
504
505   if test "$PKG_CONFIG" = "no" ; then
506      echo "*** The pkg-config script could not be found. Make sure it is"
507      echo "*** in your path, or set the PKG_CONFIG environment variable"
508      echo "*** to the full path to pkg-config."
509      echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
510   else
511      PKG_CONFIG_MIN_VERSION=0.9.0
512      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
513         AC_MSG_CHECKING(for $2)
514
515         if $PKG_CONFIG --exists "$2" ; then
516             AC_MSG_RESULT(yes)
517             succeeded=yes
518
519             AC_MSG_CHECKING($1_CFLAGS)
520             $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
521             AC_MSG_RESULT($$1_CFLAGS)
522
523             AC_MSG_CHECKING($1_LIBS)
524             $1_LIBS=`$PKG_CONFIG --libs "$2"`
525             AC_MSG_RESULT($$1_LIBS)
526         else
527             $1_CFLAGS=""
528             $1_LIBS=""
529             ## If we have a custom action on failure, don't print errors, but 
530             ## do set a variable so people can do so.
531             $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
532             ifelse([$4], ,echo $$1_PKG_ERRORS,)
533         fi
534
535         AC_SUBST($1_CFLAGS)
536         AC_SUBST($1_LIBS)
537      else
538         echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
539         echo "*** See http://www.freedesktop.org/software/pkgconfig"
540      fi
541   fi
542
543   if test $succeeded = yes; then
544      ifelse([$3], , :, [$3])
545   else
546      ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
547   fi
548 ])
549
550
551
552 # Macro to add for using GNU gettext.
553 # Ulrich Drepper <drepper@cygnus.com>, 1995.
554 #
555 # Modified to never use included libintl. 
556 # Owen Taylor <otaylor@redhat.com>, 12/15/1998
557 #
558 #
559 # This file can be copied and used freely without restrictions.  It can
560 # be used in projects which are not available under the GNU Public License
561 # but which still want to provide support for the GNU gettext functionality.
562 # Please note that the actual code is *not* freely available.
563 #
564 #
565 # If you make changes to this file, you MUST update the copy in
566 # acinclude.m4. [ aclocal dies on duplicate macros, so if
567 # we run 'aclocal -I macros/' then we'll run into problems
568 # once we've installed glib-gettext.m4 :-( ]
569 #
570
571 # serial 5
572
573 AC_DEFUN(AM_GLIB_WITH_NLS,
574   dnl NLS is obligatory
575   [USE_NLS=yes
576     AC_SUBST(USE_NLS)
577
578     dnl Figure out what method
579     nls_cv_force_use_gnu_gettext="no"
580
581     nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
582     if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
583       dnl User does not insist on using GNU NLS library.  Figure out what
584       dnl to use.  If gettext or catgets are available (in this order) we
585       dnl use this.  Else we have to fall back to GNU NLS library.
586       dnl catgets is only used if permitted by option --with-catgets.
587       nls_cv_header_intl=
588       nls_cv_header_libgt=
589       CATOBJEXT=NONE
590
591       AC_CHECK_HEADER(libintl.h,
592         [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
593           [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
594             gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
595
596           if test "$gt_cv_func_dgettext_libc" != "yes"; then
597             AC_CHECK_LIB(intl, bindtextdomain,
598               [AC_CACHE_CHECK([for dgettext in libintl],
599                 gt_cv_func_dgettext_libintl,
600                 [AC_CHECK_LIB(intl, dgettext,
601                   gt_cv_func_dgettext_libintl=yes,
602                   gt_cv_func_dgettext_libintl=no)],
603                 gt_cv_func_dgettext_libintl=no)])
604           fi
605
606           if test "$gt_cv_func_dgettext_libintl" = "yes"; then
607             LIBS="$LIBS -lintl";
608           fi
609
610           if test "$gt_cv_func_dgettext_libc" = "yes" \
611             || test "$gt_cv_func_dgettext_libintl" = "yes"; then
612             AC_DEFINE(HAVE_GETTEXT,1,
613               [Define if the GNU gettext() function is already present or preinstalled.])
614             AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
615               [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
616             if test "$MSGFMT" != "no"; then
617               AC_CHECK_FUNCS(dcgettext)
618               AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
619               AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
620                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
621               AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
622                              return _nl_msg_cat_cntr],
623                 [CATOBJEXT=.gmo
624                  DATADIRNAME=share],
625                 [CATOBJEXT=.mo
626                  DATADIRNAME=lib])
627               INSTOBJEXT=.mo
628             fi
629           fi
630
631           # Added by Martin Baulig 12/15/98 for libc5 systems
632           if test "$gt_cv_func_dgettext_libc" != "yes" \
633             && test "$gt_cv_func_dgettext_libintl" = "yes"; then
634             INTLLIBS=-lintl
635             LIBS=`echo $LIBS | sed -e 's/-lintl//'`
636           fi
637       ])
638
639       if test "$CATOBJEXT" = "NONE"; then
640         dnl Neither gettext nor catgets in included in the C library.
641         dnl Fall back on GNU gettext library.
642         nls_cv_use_gnu_gettext=yes
643       fi
644     fi
645
646     if test "$nls_cv_use_gnu_gettext" != "yes"; then
647       AC_DEFINE(ENABLE_NLS, 1,
648         [always defined to indicate that i18n is enabled])
649     else
650       dnl Unset this variable since we use the non-zero value as a flag.
651       CATOBJEXT=
652     fi
653
654     dnl Test whether we really found GNU xgettext.
655     if test "$XGETTEXT" != ":"; then
656       dnl If it is no GNU xgettext we define it as : so that the
657       dnl Makefiles still can work.
658       if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
659         : ;
660       else
661         AC_MSG_RESULT(
662           [found xgettext program is not GNU xgettext; ignore it])
663         XGETTEXT=":"
664       fi
665     fi
666
667     # We need to process the po/ directory.
668     POSUB=po
669
670     AC_OUTPUT_COMMANDS(
671       [case "$CONFIG_FILES" in *po/Makefile.in*)
672         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
673       esac])
674
675     dnl These rules are solely for the distribution goal.  While doing this
676     dnl we only have to keep exactly one list of the available catalogs
677     dnl in configure.in.
678     for lang in $ALL_LINGUAS; do
679       GMOFILES="$GMOFILES $lang.gmo"
680       POFILES="$POFILES $lang.po"
681     done
682
683     dnl Make all variables we use known to autoconf.
684     AC_SUBST(CATALOGS)
685     AC_SUBST(CATOBJEXT)
686     AC_SUBST(DATADIRNAME)
687     AC_SUBST(GMOFILES)
688     AC_SUBST(INSTOBJEXT)
689     AC_SUBST(INTLDEPS)
690     AC_SUBST(INTLLIBS)
691     AC_SUBST(INTLOBJS)
692     AC_SUBST(POFILES)
693     AC_SUBST(POSUB)
694   ])
695
696 AC_DEFUN(AM_GLIB_GNU_GETTEXT,
697   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
698    AC_REQUIRE([AC_PROG_CC])dnl
699    AC_REQUIRE([AC_PROG_RANLIB])dnl
700    AC_REQUIRE([AC_HEADER_STDC])dnl
701    AC_REQUIRE([AC_C_CONST])dnl
702    AC_REQUIRE([AC_C_INLINE])dnl
703    AC_REQUIRE([AC_TYPE_OFF_T])dnl
704    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
705    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
706    AC_REQUIRE([AC_FUNC_MMAP])dnl
707
708    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
709 unistd.h sys/param.h])
710    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
711 strdup __argz_count __argz_stringify __argz_next])
712
713    AM_LC_MESSAGES
714    AM_GLIB_WITH_NLS
715
716    if test "x$CATOBJEXT" != "x"; then
717      if test "x$ALL_LINGUAS" = "x"; then
718        LINGUAS=
719      else
720        AC_MSG_CHECKING(for catalogs to be installed)
721        NEW_LINGUAS=
722        for lang in ${LINGUAS=$ALL_LINGUAS}; do
723          case "$ALL_LINGUAS" in
724           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
725          esac
726        done
727        LINGUAS=$NEW_LINGUAS
728        AC_MSG_RESULT($LINGUAS)
729      fi
730
731      dnl Construct list of names of catalog files to be constructed.
732      if test -n "$LINGUAS"; then
733        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
734      fi
735    fi
736
737    dnl Determine which catalog format we have (if any is needed)
738    dnl For now we know about two different formats:
739    dnl   Linux libc-5 and the normal X/Open format
740    test -d po || mkdir po
741    if test "$CATOBJEXT" = ".cat"; then
742      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
743
744      dnl Transform the SED scripts while copying because some dumb SEDs
745      dnl cannot handle comments.
746      sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed
747    fi
748
749    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
750    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
751    dnl Try to locate is.
752    MKINSTALLDIRS=
753    if test -n "$ac_aux_dir"; then
754      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
755    fi
756    if test -z "$MKINSTALLDIRS"; then
757      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
758    fi
759    AC_SUBST(MKINSTALLDIRS)
760
761    dnl Generate list of files to be processed by xgettext which will
762    dnl be included in po/Makefile.
763    test -d po || mkdir po
764    if test "x$srcdir" != "x."; then
765      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
766        posrcprefix="$srcdir/"
767      else
768        posrcprefix="../$srcdir/"
769      fi
770    else
771      posrcprefix="../"
772    fi
773    rm -f po/POTFILES
774    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
775         < $srcdir/po/POTFILES.in > po/POTFILES
776   ])
777
778
779 # Search path for a program which passes the given test.
780 # Ulrich Drepper <drepper@cygnus.com>, 1996.
781 #
782 # This file can be copied and used freely without restrictions.  It can
783 # be used in projects which are not available under the GNU Public License
784 # but which still want to provide support for the GNU gettext functionality.
785 # Please note that the actual code is *not* freely available.
786
787 # serial 1
788
789 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
790 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
791 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
792 [# Extract the first word of "$2", so it can be a program name with args.
793 set dummy $2; ac_word=[$]2
794 AC_MSG_CHECKING([for $ac_word])
795 AC_CACHE_VAL(ac_cv_path_$1,
796 [case "[$]$1" in
797   /*)
798   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
799   ;;
800   *)
801   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
802   for ac_dir in ifelse([$5], , $PATH, [$5]); do
803     test -z "$ac_dir" && ac_dir=.
804     if test -f $ac_dir/$ac_word; then
805       if [$3]; then
806         ac_cv_path_$1="$ac_dir/$ac_word"
807         break
808       fi
809     fi
810   done
811   IFS="$ac_save_ifs"
812 dnl If no 4th arg is given, leave the cache variable unset,
813 dnl so AC_PATH_PROGS will keep looking.
814 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
815 ])dnl
816   ;;
817 esac])dnl
818 $1="$ac_cv_path_$1"
819 if test -n "[$]$1"; then
820   AC_MSG_RESULT([$]$1)
821 else
822   AC_MSG_RESULT(no)
823 fi
824 AC_SUBST($1)dnl
825 ])
826
827 # Check whether LC_MESSAGES is available in <locale.h>.
828 # Ulrich Drepper <drepper@cygnus.com>, 1995.
829 #
830 # This file can be copied and used freely without restrictions.  It can
831 # be used in projects which are not available under the GNU Public License
832 # but which still want to provide support for the GNU gettext functionality.
833 # Please note that the actual code is *not* freely available.
834
835 # serial 2
836
837 AC_DEFUN([AM_LC_MESSAGES],
838   [if test $ac_cv_header_locale_h = yes; then
839     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
840       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
841        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
842     if test $am_cv_val_LC_MESSAGES = yes; then
843       AC_DEFINE(HAVE_LC_MESSAGES, 1,
844         [Define if your <locale.h> file defines LC_MESSAGES.])
845     fi
846   fi])
847