]> git.sur5r.net Git - glabels/blob - glabels2/aclocal.m4
Skrewing with the build environment.
[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
14 # progtest.m4 from gettext 0.32
15 # Search path for a program which passes the given test.
16 # Ulrich Drepper <drepper@cygnus.com>, 1996.
17 #
18 # This file file be copied and used freely without restrictions.  It can
19 # be used in projects which are not available under the GNU Public License
20 # but which still want to provide support for the GNU gettext functionality.
21 # Please note that the actual code is *not* freely available.
22
23 # serial 1
24
25 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
26 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
27 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
28 [# Extract the first word of "$2", so it can be a program name with args.
29 set dummy $2; ac_word=[$]2
30 AC_MSG_CHECKING([for $ac_word])
31 AC_CACHE_VAL(ac_cv_path_$1,
32 [case "[$]$1" in
33   /*)
34   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
35   ;;
36   *)
37   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
38   for ac_dir in ifelse([$5], , $PATH, [$5]); do
39     test -z "$ac_dir" && ac_dir=.
40     if test -f $ac_dir/$ac_word; then
41       if [$3]; then
42         ac_cv_path_$1="$ac_dir/$ac_word"
43         break
44       fi
45     fi
46   done
47   IFS="$ac_save_ifs"
48 dnl If no 4th arg is given, leave the cache variable unset,
49 dnl so AC_PATH_PROGS will keep looking.
50 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
51 ])dnl
52   ;;
53 esac])dnl
54 $1="$ac_cv_path_$1"
55 if test -n "[$]$1"; then
56   AC_MSG_RESULT([$]$1)
57 else
58   AC_MSG_RESULT(no)
59 fi
60 AC_SUBST($1)dnl
61 ])
62
63
64 # lcmessage.m4 from gettext 0.32
65 # Check whether LC_MESSAGES is available in <locale.h>.
66 # Ulrich Drepper <drepper@cygnus.com>, 1995.
67 #
68 # This file file be copied and used freely without restrictions.  It can
69 # be used in projects which are not available under the GNU Public License
70 # but which still want to provide support for the GNU gettext functionality.
71 # Please note that the actual code is *not* freely available.
72
73 # serial 1
74
75 AC_DEFUN(AM_LC_MESSAGES,
76   [if test $ac_cv_header_locale_h = yes; then
77     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
78       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
79        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
80     if test $am_cv_val_LC_MESSAGES = yes; then
81       AC_DEFINE(HAVE_LC_MESSAGES)
82     fi
83   fi])
84
85
86
87 # gettext.m4 from gettext 0.32
88 # Macro to add for using GNU gettext.
89 # Ulrich Drepper <drepper@cygnus.com>, 1995.
90 #
91 # This file file be copied and used freely without restrictions.  It can
92 # be used in projects which are not available under the GNU Public License
93 # but which still want to provide support for the GNU gettext functionality.
94 # Please note that the actual code is *not* freely available.
95
96 # serial 3
97
98 AC_DEFUN(AM_WITH_NLS,
99   [AC_MSG_CHECKING([whether NLS is requested])
100     dnl Default is enabled NLS
101     AC_ARG_ENABLE(nls,
102       [  --disable-nls           do not use Native Language Support],
103       USE_NLS=$enableval, USE_NLS=yes)
104     AC_MSG_RESULT($USE_NLS)
105     AC_SUBST(USE_NLS)
106
107     USE_INCLUDED_LIBINTL=no
108
109     dnl If we use NLS figure out what method
110     if test "$USE_NLS" = "yes"; then
111       AC_DEFINE(ENABLE_NLS)
112       AC_MSG_CHECKING([whether included gettext is requested])
113       AC_ARG_WITH(included-gettext,
114         [  --with-included-gettext use the GNU gettext library included here],
115         nls_cv_force_use_gnu_gettext=$withval,
116         nls_cv_force_use_gnu_gettext=no)
117       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
118
119       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
120       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
121         dnl User does not insist on using GNU NLS library.  Figure out what
122         dnl to use.  If gettext or catgets are available (in this order) we
123         dnl use this.  Else we have to fall back to GNU NLS library.
124         dnl catgets is only used if permitted by option --with-catgets.
125         nls_cv_header_intl=
126         nls_cv_header_libgt=
127         CATOBJEXT=NONE
128
129         AC_CHECK_HEADER(libintl.h,
130           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
131             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
132                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
133
134            if test "$gt_cv_func_gettext_libc" != "yes"; then
135              AC_CHECK_LIB(intl, bindtextdomain,
136                [AC_CACHE_CHECK([for gettext in libintl],
137                  gt_cv_func_gettext_libintl,
138                  [AC_TRY_LINK([], [return (int) gettext ("")],
139                  gt_cv_func_gettext_libintl=yes,
140                  gt_cv_func_gettext_libintl=no)])])
141            fi
142
143            if test "$gt_cv_func_gettext_libc" = "yes" \
144               || test "$gt_cv_func_gettext_libintl" = "yes"; then
145               AC_DEFINE(HAVE_GETTEXT)
146               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
147                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
148               if test "$MSGFMT" != "no"; then
149                 AC_CHECK_FUNCS(dcgettext)
150                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
151                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
152                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
153                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
154                                return _nl_msg_cat_cntr],
155                   [CATOBJEXT=.gmo
156                    DATADIRNAME=share],
157                   [CATOBJEXT=.mo
158                    DATADIRNAME=lib])
159                 INSTOBJEXT=.mo
160               fi
161             fi
162         ])
163
164         if test "$CATOBJEXT" = "NONE"; then
165           AC_MSG_CHECKING([whether catgets can be used])
166           AC_ARG_WITH(catgets,
167             [  --with-catgets          use catgets functions if available],
168             nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
169           AC_MSG_RESULT($nls_cv_use_catgets)
170
171           if test "$nls_cv_use_catgets" = "yes"; then
172             dnl No gettext in C library.  Try catgets next.
173             AC_CHECK_LIB(i, main)
174             AC_CHECK_FUNC(catgets,
175               [AC_DEFINE(HAVE_CATGETS)
176                INTLOBJS="\$(CATOBJS)"
177                AC_PATH_PROG(GENCAT, gencat, no)dnl
178                if test "$GENCAT" != "no"; then
179                  AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
180                  if test "$GMSGFMT" = "no"; then
181                    AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
182                     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
183                  fi
184                  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
185                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
186                  USE_INCLUDED_LIBINTL=yes
187                  CATOBJEXT=.cat
188                  INSTOBJEXT=.cat
189                  DATADIRNAME=lib
190                  INTLDEPS='$(top_builddir)/intl/libintl.a'
191                  INTLLIBS=$INTLDEPS
192                  LIBS=`echo $LIBS | sed -e 's/-lintl//'`
193                  nls_cv_header_intl=intl/libintl.h
194                  nls_cv_header_libgt=intl/libgettext.h
195                fi])
196           fi
197         fi
198
199         if test "$CATOBJEXT" = "NONE"; then
200           dnl Neither gettext nor catgets in included in the C library.
201           dnl Fall back on GNU gettext library.
202           nls_cv_use_gnu_gettext=yes
203         fi
204       fi
205
206       if test "$nls_cv_use_gnu_gettext" = "yes"; then
207         dnl Mark actions used to generate GNU NLS library.
208         INTLOBJS="\$(GETTOBJS)"
209         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
210           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
211         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
212         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
213           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
214         AC_SUBST(MSGFMT)
215         USE_INCLUDED_LIBINTL=yes
216         CATOBJEXT=.gmo
217         INSTOBJEXT=.mo
218         DATADIRNAME=share
219         INTLDEPS='$(top_builddir)/intl/libintl.a'
220         INTLLIBS=$INTLDEPS
221         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
222         nls_cv_header_intl=intl/libintl.h
223         nls_cv_header_libgt=intl/libgettext.h
224       fi
225
226       dnl Test whether we really found GNU xgettext.
227       if test "$XGETTEXT" != ":"; then
228         dnl If it is no GNU xgettext we define it as : so that the
229         dnl Makefiles still can work.
230         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
231           : ;
232         else
233           AC_MSG_RESULT(
234             [found xgettext programs is not GNU xgettext; ignore it])
235           XGETTEXT=":"
236         fi
237       fi
238
239       # We need to process the po/ directory.
240       POSUB=po
241     else
242       DATADIRNAME=share
243       nls_cv_header_intl=intl/libintl.h
244       nls_cv_header_libgt=intl/libgettext.h
245     fi
246
247     # If this is used in GNU gettext we have to set USE_NLS to `yes'
248     # because some of the sources are only built for this goal.
249     if test "$PACKAGE" = gettext; then
250       USE_NLS=yes
251       USE_INCLUDED_LIBINTL=yes
252     fi
253
254     dnl These rules are solely for the distribution goal.  While doing this
255     dnl we only have to keep exactly one list of the available catalogs
256     dnl in configure.in.
257     for lang in $ALL_LINGUAS; do
258       GMOFILES="$GMOFILES $lang.gmo"
259       POFILES="$POFILES $lang.po"
260     done
261
262     dnl Make all variables we use known to autoconf.
263     AC_SUBST(USE_INCLUDED_LIBINTL)
264     AC_SUBST(CATALOGS)
265     AC_SUBST(CATOBJEXT)
266     AC_SUBST(DATADIRNAME)
267     AC_SUBST(GMOFILES)
268     AC_SUBST(INSTOBJEXT)
269     AC_SUBST(INTLDEPS)
270     AC_SUBST(INTLLIBS)
271     AC_SUBST(INTLOBJS)
272     AC_SUBST(POFILES)
273     AC_SUBST(POSUB)
274   ])
275
276 AC_DEFUN(AM_GNU_GETTEXT,
277   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
278    AC_REQUIRE([AC_PROG_CC])dnl
279    AC_REQUIRE([AC_PROG_RANLIB])dnl
280    AC_REQUIRE([AC_ISC_POSIX])dnl
281    AC_REQUIRE([AC_HEADER_STDC])dnl
282    AC_REQUIRE([AC_C_CONST])dnl
283    AC_REQUIRE([AC_C_INLINE])dnl
284    AC_REQUIRE([AC_TYPE_OFF_T])dnl
285    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
286    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
287    AC_REQUIRE([AC_FUNC_MMAP])dnl
288
289    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
290 unistd.h values.h sys/param.h])
291    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
292 __argz_count __argz_stringify __argz_next])
293
294    if test "${ac_cv_func_stpcpy+set}" != "set"; then
295      AC_CHECK_FUNCS(stpcpy)
296    fi
297    if test "${ac_cv_func_stpcpy}" = "yes"; then
298      AC_DEFINE(HAVE_STPCPY)
299    fi
300
301    AM_LC_MESSAGES
302    AM_WITH_NLS
303
304    if test "x$CATOBJEXT" != "x"; then
305      if test "x$ALL_LINGUAS" = "x"; then
306        LINGUAS=
307      else
308        AC_MSG_CHECKING(for catalogs to be installed)
309        NEW_LINGUAS=
310        for lang in ${LINGUAS=$ALL_LINGUAS}; do
311          case "$ALL_LINGUAS" in
312           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
313          esac
314        done
315        LINGUAS=$NEW_LINGUAS
316        AC_MSG_RESULT($LINGUAS)
317      fi
318
319      dnl Construct list of names of catalog files to be constructed.
320      if test -n "$LINGUAS"; then
321        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
322      fi
323    fi
324
325    dnl The reference to <locale.h> in the installed <libintl.h> file
326    dnl must be resolved because we cannot expect the users of this
327    dnl to define HAVE_LOCALE_H.
328    if test $ac_cv_header_locale_h = yes; then
329      INCLUDE_LOCALE_H="#include <locale.h>"
330    else
331      INCLUDE_LOCALE_H="\
332 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
333    fi
334    AC_SUBST(INCLUDE_LOCALE_H)
335
336    dnl Determine which catalog format we have (if any is needed)
337    dnl For now we know about two different formats:
338    dnl   Linux libc-5 and the normal X/Open format
339    test -d intl || mkdir intl
340    if test "$CATOBJEXT" = ".cat"; then
341      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
342
343      dnl Transform the SED scripts while copying because some dumb SEDs
344      dnl cannot handle comments.
345      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
346    fi
347    dnl po2tbl.sed is always needed.
348    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
349      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
350
351    dnl In the intl/Makefile.in we have a special dependency which makes
352    dnl only sense for gettext.  We comment this out for non-gettext
353    dnl packages.
354    if test "$PACKAGE" = "gettext"; then
355      GT_NO="#NO#"
356      GT_YES=
357    else
358      GT_NO=
359      GT_YES="#YES#"
360    fi
361    AC_SUBST(GT_NO)
362    AC_SUBST(GT_YES)
363
364    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
365    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
366    dnl Try to locate is.
367    MKINSTALLDIRS=
368    if test -n "$ac_aux_dir"; then
369      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
370    fi
371    if test -z "$MKINSTALLDIRS"; then
372      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
373    fi
374    AC_SUBST(MKINSTALLDIRS)
375
376    dnl *** For now the libtool support in intl/Makefile is not for real.
377    l=
378    AC_SUBST(l)
379
380    dnl Generate list of files to be processed by xgettext which will
381    dnl be included in po/Makefile.
382    test -d po || mkdir po
383    if test "x$srcdir" != "x."; then
384      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
385        posrcprefix="$srcdir/"
386      else
387        posrcprefix="../$srcdir/"
388      fi
389    else
390      posrcprefix="../"
391    fi
392    rm -f po/POTFILES
393    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
394         < $srcdir/po/POTFILES.in > po/POTFILES
395   ])
396
397 #serial 1
398 # This test replaces the one in autoconf.
399 # Currently this macro should have the same name as the autoconf macro
400 # because gettext's gettext.m4 (distributed in the automake package)
401 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
402 # give these diagnostics:
403 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
404 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
405
406 undefine([AC_ISC_POSIX])
407
408 AC_DEFUN([AC_ISC_POSIX],
409   [
410     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
411     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
412   ]
413 )
414
415 # Do all the work for Automake.  This macro actually does too much --
416 # some checks are only needed if your package does certain things.
417 # But this isn't really a big deal.
418
419 # serial 1
420
421 dnl Usage:
422 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
423
424 AC_DEFUN([AM_INIT_AUTOMAKE],
425 [AC_REQUIRE([AC_PROG_INSTALL])
426 PACKAGE=[$1]
427 AC_SUBST(PACKAGE)
428 VERSION=[$2]
429 AC_SUBST(VERSION)
430 dnl test to see if srcdir already configured
431 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
432   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
433 fi
434 ifelse([$3],,
435 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
436 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
437 AC_REQUIRE([AM_SANITY_CHECK])
438 AC_REQUIRE([AC_ARG_PROGRAM])
439 dnl FIXME This is truly gross.
440 missing_dir=`cd $ac_aux_dir && pwd`
441 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
442 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
443 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
444 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
445 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
446 AC_REQUIRE([AC_PROG_MAKE_SET])])
447
448 #
449 # Check to make sure that the build environment is sane.
450 #
451
452 AC_DEFUN([AM_SANITY_CHECK],
453 [AC_MSG_CHECKING([whether build environment is sane])
454 # Just in case
455 sleep 1
456 echo timestamp > conftestfile
457 # Do `set' in a subshell so we don't clobber the current shell's
458 # arguments.  Must try -L first in case configure is actually a
459 # symlink; some systems play weird games with the mod time of symlinks
460 # (eg FreeBSD returns the mod time of the symlink's containing
461 # directory).
462 if (
463    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
464    if test "[$]*" = "X"; then
465       # -L didn't work.
466       set X `ls -t $srcdir/configure conftestfile`
467    fi
468    if test "[$]*" != "X $srcdir/configure conftestfile" \
469       && test "[$]*" != "X conftestfile $srcdir/configure"; then
470
471       # If neither matched, then we have a broken ls.  This can happen
472       # if, for instance, CONFIG_SHELL is bash and it inherits a
473       # broken ls alias from the environment.  This has actually
474       # happened.  Such a system could not be considered "sane".
475       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
476 alias in your environment])
477    fi
478
479    test "[$]2" = conftestfile
480    )
481 then
482    # Ok.
483    :
484 else
485    AC_MSG_ERROR([newly created file is older than distributed files!
486 Check your system clock])
487 fi
488 rm -f conftest*
489 AC_MSG_RESULT(yes)])
490
491 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
492 dnl The program must properly implement --version.
493 AC_DEFUN([AM_MISSING_PROG],
494 [AC_MSG_CHECKING(for working $2)
495 # Run test in a subshell; some versions of sh will print an error if
496 # an executable is not found, even if stderr is redirected.
497 # Redirect stdin to placate older versions of autoconf.  Sigh.
498 if ($2 --version) < /dev/null > /dev/null 2>&1; then
499    $1=$2
500    AC_MSG_RESULT(found)
501 else
502    $1="$3/missing $2"
503    AC_MSG_RESULT(missing)
504 fi
505 AC_SUBST($1)])
506
507 # Add --enable-maintainer-mode option to configure.
508 # From Jim Meyering
509
510 # serial 1
511
512 AC_DEFUN([AM_MAINTAINER_MODE],
513 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
514   dnl maintainer-mode is disabled by default
515   AC_ARG_ENABLE(maintainer-mode,
516 [  --enable-maintainer-mode enable make rules and dependencies not useful
517                           (and sometimes confusing) to the casual installer],
518       USE_MAINTAINER_MODE=$enableval,
519       USE_MAINTAINER_MODE=no)
520   AC_MSG_RESULT($USE_MAINTAINER_MODE)
521   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
522   MAINT=$MAINTAINER_MODE_TRUE
523   AC_SUBST(MAINT)dnl
524 ]
525 )
526
527 # Define a conditional.
528
529 AC_DEFUN([AM_CONDITIONAL],
530 [AC_SUBST($1_TRUE)
531 AC_SUBST($1_FALSE)
532 if $2; then
533   $1_TRUE=
534   $1_FALSE='#'
535 else
536   $1_TRUE='#'
537   $1_FALSE=
538 fi])
539
540 # Like AC_CONFIG_HEADER, but automatically create stamp file.
541
542 AC_DEFUN([AM_CONFIG_HEADER],
543 [AC_PREREQ([2.12])
544 AC_CONFIG_HEADER([$1])
545 dnl When config.status generates a header, we must update the stamp-h file.
546 dnl This file resides in the same directory as the config header
547 dnl that is generated.  We must strip everything past the first ":",
548 dnl and everything past the last "/".
549 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
550 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
551 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
552 <<am_indx=1
553 for am_file in <<$1>>; do
554   case " <<$>>CONFIG_HEADERS " in
555   *" <<$>>am_file "*<<)>>
556     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
557     ;;
558   esac
559   am_indx=`expr "<<$>>am_indx" + 1`
560 done<<>>dnl>>)
561 changequote([,]))])
562
563
564 dnl AC_PROG_INTLTOOL([MINIMUM-VERSION])
565 # serial 1 AC_PROG_INTLTOOL
566 AC_DEFUN(AC_PROG_INTLTOOL,
567 [
568
569 if test -n "$1"; then
570     AC_MSG_CHECKING(for intltool >= $1)
571
572     INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ printf "%d", $[1] * 100 + $[2]; }'`
573     INTLTOOL_APPLIED_VERSION=`awk -F\" '/\\$VERSION / { printf $[2]; }'  < ${srcdir}/intltool-update.in`
574     changequote({{,}})
575     INTLTOOL_APPLIED_VERSION_AS_INT=`awk -F\" '/\\$VERSION / { split(${{2}}, VERSION, "."); printf "%d\n", VERSION[1] * 100 + VERSION[2];}' < ${srcdir}/intltool-update.in`
576     changequote([,])
577
578     if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT"; then
579         AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found])
580     else
581         AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found. Your intltool is too old.  You need intltool $1 or later.])
582         exit 1
583     fi
584 fi
585
586   INTLTOOL_DESKTOP_RULE='%.desktop:   %.desktop.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -d -u -c $(top_builddir)/po/.intltool-merge-cache'
587 INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -d -u -c $(top_builddir)/po/.intltool-merge-cache'
588      INTLTOOL_KEYS_RULE='%.keys:      %.keys.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -k -u -c $(top_builddir)/po/.intltool-merge-cache'
589       INTLTOOL_OAF_RULE='%.oaf:       %.oaf.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -o -p'
590      INTLTOOL_PONG_RULE='%.pong:      %.pong.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -x -u -c $(top_builddir)/po/.intltool-merge-cache'
591    INTLTOOL_SERVER_RULE='%.server:    %.server.in    $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -o -u -c $(top_builddir)/po/.intltool-merge-cache'
592     INTLTOOL_SHEET_RULE='%.sheet:     %.sheet.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -x -u -c $(top_builddir)/po/.intltool-merge-cache'
593 INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -d -u -c $(top_builddir)/po/.intltool-merge-cache'
594        INTLTOOL_UI_RULE='%.ui:        %.ui.in        $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -x -u -c $(top_builddir)/po/.intltool-merge-cache'
595       INTLTOOL_XML_RULE='%.xml:       %.xml.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -x -u -c $(top_builddir)/po/.intltool-merge-cache'
596     INTLTOOL_CAVES_RULE='%.caves:     %.caves.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -d -u -c $(top_builddir)/po/.intltool-merge-cache'
597     INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -s -u -c $(top_builddir)/po/.intltool-merge-cache'
598
599 AC_SUBST(INTLTOOL_DESKTOP_RULE)
600 AC_SUBST(INTLTOOL_DIRECTORY_RULE)
601 AC_SUBST(INTLTOOL_KEYS_RULE)
602 AC_SUBST(INTLTOOL_OAF_RULE)
603 AC_SUBST(INTLTOOL_PONG_RULE)
604 AC_SUBST(INTLTOOL_SERVER_RULE)
605 AC_SUBST(INTLTOOL_SHEET_RULE)
606 AC_SUBST(INTLTOOL_SOUNDLIST_RULE)
607 AC_SUBST(INTLTOOL_UI_RULE)
608 AC_SUBST(INTLTOOL_XML_RULE)
609 AC_SUBST(INTLTOOL_CAVES_RULE)
610 AC_SUBST(INTLTOOL_SCHEMAS_RULE)
611
612 # Use the tools built into the package, not the ones that are installed.
613
614 INTLTOOL_EXTRACT='$(top_builddir)/intltool-extract'
615 INTLTOOL_MERGE='$(top_builddir)/intltool-merge'
616 INTLTOOL_UPDATE='$(top_builddir)/intltool-update'
617
618 AC_SUBST(INTLTOOL_EXTRACT)
619 AC_SUBST(INTLTOOL_MERGE)
620 AC_SUBST(INTLTOOL_UPDATE)
621
622 AC_PATH_PROG(INTLTOOL_PERL, perl)
623 if test -z "$INTLTOOL_PERL"; then
624    AC_MSG_ERROR([perl not found; required for intltool])
625 fi
626 if test -z "`$INTLTOOL_PERL -v | fgrep '5.' 2> /dev/null`"; then
627    AC_MSG_ERROR([perl 5.x required for intltool])
628 fi
629
630 # Remove file type tags (using []) from po/POTFILES.
631
632 ifdef([AC_DIVERSION_ICMDS],[
633   AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)
634       changequote(,)
635       mv -f po/POTFILES po/POTFILES.tmp
636       sed -e 's/\[.*\] *//' < po/POTFILES.tmp > po/POTFILES
637       rm -f po/POTFILES.tmp
638       changequote([,])
639   AC_DIVERT_POP()
640 ],[
641   ifdef([AC_CONFIG_COMMANDS_PRE],[
642     AC_CONFIG_COMMANDS_PRE([
643         changequote(,)
644         mv -f po/POTFILES po/POTFILES.tmp
645         sed -e 's/\[.*\] *//' < po/POTFILES.tmp > po/POTFILES
646         rm -f po/POTFILES.tmp
647         changequote([,])
648     ])
649   ])
650 ])
651
652 # Manually sed perl in so people don't have to put the intltool scripts in AC_OUTPUT.
653
654 AC_OUTPUT_COMMANDS([
655
656 sed -e "s:@INTLTOOL_PERL@:${INTLTOOL_PERL}:;" < ${srcdir}/intltool-extract.in > intltool-extract.out
657 if cmp -s intltool-extract intltool-extract.out 2>/dev/null; then
658   rm -f intltool-extract.out
659 else
660   mv -f intltool-extract.out intltool-extract
661 fi
662 chmod ugo+x intltool-extract
663 chmod u+w intltool-extract
664
665 sed -e "s:@INTLTOOL_PERL@:${INTLTOOL_PERL}:;" < ${srcdir}/intltool-merge.in > intltool-merge.out
666 if cmp -s intltool-merge intltool-merge.out 2>/dev/null; then
667   rm -f intltool-merge.out
668 else
669   mv -f intltool-merge.out intltool-merge
670 fi
671 chmod ugo+x intltool-merge
672 chmod u+w intltool-merge
673
674 sed -e "s:@INTLTOOL_PERL@:${INTLTOOL_PERL}:;" < ${srcdir}/intltool-update.in > intltool-update.out
675 if cmp -s intltool-update intltool-update.out 2>/dev/null; then
676   rm -f intltool-update.out
677 else
678   mv -f intltool-update.out intltool-update
679 fi
680 chmod ugo+x intltool-update
681 chmod u+w intltool-update
682
683 ], INTLTOOL_PERL=${INTLTOOL_PERL})
684
685 ])
686
687 dnl
688 dnl GNOME_PLATFORM_GNOME_2(default, [force])
689 dnl
690 dnl   If the first parameter is `yes', then the default is
691 dnl   the GNOME 2.x platform, otherwise the GNOME 1.x one.
692 dnl
693 dnl   If the optional second parameter is `force', then use
694 dnl   the default value without command line argument.
695 dnl
696
697 AC_DEFUN([GNOME_PLATFORM_GNOME_2],[
698         AC_REQUIRE([GNOME_REQUIRE_PKGCONFIG])
699
700         if test x$1 = xyes ; then
701             platform_gnome_2_default=yes
702         else
703             platform_gnome_2_default=no
704         fi
705         if test x$2 = xforce ; then
706             platform_gnome_2="$platform_gnome_2_default";
707         else
708             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"])
709         fi
710
711         AM_CONDITIONAL(PLATFORM_GNOME_2, test $platform_gnome_2 = yes)
712
713         AC_MSG_CHECKING(for GNOME Platform)
714         if test $platform_gnome_2 = yes; then
715             AC_MSG_RESULT(GNOME 2.x)
716             GNOME_INTERFACE_VERSION=2
717             GNOME_REQUIRE_PKGCONFIG
718         else
719             AC_MSG_RESULT(GNOME 1.x)
720             GNOME_INTERFACE_VERSION=1
721         fi
722         AC_SUBST(GNOME_INTERFACE_VERSION)
723 ])
724
725 dnl
726 dnl GNOME_CHECK_PKGCONFIG (script-if-enabled, [failflag])
727 dnl
728 AC_DEFUN([GNOME_CHECK_PKGCONFIG],[
729         AC_PATH_PROG(PKG_CONFIG, pkg-config)
730         have_pkgconfig=no
731         if test -x "$PKG_CONFIG" ; then
732             have_pkgconfig=yes
733         else
734             PKG_CONFIG=
735         fi
736         AC_MSG_CHECKING(for pkg-config)
737         pkgconfig_required_version=0.8.0
738         if test x$have_pkgconfig = xyes ; then
739             if ! $PKG_CONFIG --atleast-pkgconfig-version $pkgconfig_required_version; then
740                 echo "*** Your version of pkg-config is too old. You need version $pkgconfig_required_version or newer."
741                 echo "*** See http://www.freedesktop.org/software/pkgconfig"
742                 have_pkgconfig=no
743             fi
744         fi
745         if test x$have_pkgconfig = xyes ; then
746             AC_MSG_RESULT(yes)
747         else
748             PKG_CONFIG=
749             AC_MSG_RESULT(not found)
750             if test x$2 = xfail; then
751                 AC_MSG_ERROR([
752 *** You need the latest pkg-config (at least $pkgconfig_required_version).
753 *** Get the latest version of pkg-config from
754 *** http://www.freedesktop.org/software/pkgconfig.])
755             fi
756         fi
757         AC_SUBST(PKG_CONFIG)
758
759         AC_PROVIDE([GNOME_REQUIRE_PKGCONFIG])
760 ])
761
762 dnl
763 dnl GNOME_REQUIRE_PKGCONFIG
764 dnl
765 AC_DEFUN([GNOME_REQUIRE_PKGCONFIG],[
766         GNOME_CHECK_PKGCONFIG([], fail)
767 ])
768
769
770 # serial 1
771
772 # @defmac AC_PROG_CC_STDC
773 # @maindex PROG_CC_STDC
774 # @ovindex CC
775 # If the C compiler in not in ANSI C mode by default, try to add an option
776 # to output variable @code{CC} to make it so.  This macro tries various
777 # options that select ANSI C on some system or another.  It considers the
778 # compiler to be in ANSI C mode if it handles function prototypes correctly.
779 #
780 # If you use this macro, you should check after calling it whether the C
781 # compiler has been set to accept ANSI C; if not, the shell variable
782 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
783 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
784 # program @code{ansi2knr}, which comes with Ghostscript.
785 # @end defmac
786
787 AC_DEFUN([AM_PROG_CC_STDC],
788 [AC_REQUIRE([AC_PROG_CC])
789 AC_BEFORE([$0], [AC_C_INLINE])
790 AC_BEFORE([$0], [AC_C_CONST])
791 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
792 dnl a magic option to avoid problems with ANSI preprocessor commands
793 dnl like #elif.
794 dnl FIXME: can't do this because then AC_AIX won't work due to a
795 dnl circular dependency.
796 dnl AC_BEFORE([$0], [AC_PROG_CPP])
797 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
798 AC_CACHE_VAL(am_cv_prog_cc_stdc,
799 [am_cv_prog_cc_stdc=no
800 ac_save_CC="$CC"
801 # Don't try gcc -ansi; that turns off useful extensions and
802 # breaks some systems' header files.
803 # AIX                   -qlanglvl=ansi
804 # Ultrix and OSF/1      -std1
805 # HP-UX                 -Aa -D_HPUX_SOURCE
806 # SVR4                  -Xc -D__EXTENSIONS__
807 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
808 do
809   CC="$ac_save_CC $ac_arg"
810   AC_TRY_COMPILE(
811 [#include <stdarg.h>
812 #include <stdio.h>
813 #include <sys/types.h>
814 #include <sys/stat.h>
815 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
816 struct buf { int x; };
817 FILE * (*rcsopen) (struct buf *, struct stat *, int);
818 static char *e (p, i)
819      char **p;
820      int i;
821 {
822   return p[i];
823 }
824 static char *f (char * (*g) (char **, int), char **p, ...)
825 {
826   char *s;
827   va_list v;
828   va_start (v,p);
829   s = g (p, va_arg (v,int));
830   va_end (v);
831   return s;
832 }
833 int test (int i, double x);
834 struct s1 {int (*f) (int a);};
835 struct s2 {int (*f) (double a);};
836 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
837 int argc;
838 char **argv;
839 ], [
840 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
841 ],
842 [am_cv_prog_cc_stdc="$ac_arg"; break])
843 done
844 CC="$ac_save_CC"
845 ])
846 if test -z "$am_cv_prog_cc_stdc"; then
847   AC_MSG_RESULT([none needed])
848 else
849   AC_MSG_RESULT($am_cv_prog_cc_stdc)
850 fi
851 case "x$am_cv_prog_cc_stdc" in
852   x|xno) ;;
853   *) CC="$CC $am_cv_prog_cc_stdc" ;;
854 esac
855 ])
856
857 dnl GNOME_COMPILE_WARNINGS
858 dnl Turn on many useful compiler warnings
859 dnl For now, only works on GCC
860 AC_DEFUN([GNOME_COMPILE_WARNINGS],[
861     dnl ******************************
862     dnl More compiler warnings
863     dnl ******************************
864
865     if test -z "$1" ; then
866         default_compile_warnings=no
867     else
868         default_compile_warnings="$1"
869     fi
870
871     AC_ARG_ENABLE(compile-warnings, 
872     [  --enable-compile-warnings=[no/minimum/yes/maximum/error] Turn on compiler warnings.], [enable_compile_warnings="$enableval"],[enable_compile_warnings="$default_compile_warnings"])
873
874     warnCFLAGS=
875     if test "x$GCC" != xyes; then
876         enable_compile_warnings=no
877     fi
878
879     warning_flags=
880     realsave_CFLAGS="$CFLAGS"
881
882     case "$enable_compile_warnings" in
883     no)
884         warning_flags=
885         ;;
886     minimum)
887         warning_flags="-Wall -Wunused"
888         ;;
889     yes)
890         warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
891         ;;
892     maximum|error)
893         warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
894         CFLAGS="$warning_flags $CFLAGS"
895         for option in -Wsign-promo -Wno-sign-compare; do
896                 SAVE_CFLAGS="$CFLAGS"
897                 CFLAGS="$CFLAGS $option"
898                 AC_MSG_CHECKING([whether gcc understands $option])
899                 AC_TRY_COMPILE([], [],
900                         has_option=yes,
901                         has_option=no,)
902                 CFLAGS="$SAVE_CFLAGS"
903                 AC_MSG_RESULT($has_option)
904                 if test $has_option = yes; then
905                   warning_flags="$warning_flags $option"
906                 fi
907                 unset has_option
908                 unset SAVE_CFLAGS
909         done
910         unset option
911         if test "$enable_compile_warnings" = "error" ; then
912             warning_flags="$warning_flags -Werror"
913         fi
914         ;;
915     *)
916         AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
917         ;;
918     esac
919     CFLAGS="$realsave_CFLAGS"
920     AC_MSG_CHECKING(what warning flags to pass to the C compiler)
921     AC_MSG_RESULT($warning_flags)
922
923     AC_ARG_ENABLE(iso-c,
924     [  --enable-iso-c          Try to warn if code is not ISO C ],,
925     enable_iso_c=no)
926
927     AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
928     complCFLAGS=
929     if test "x$enable_iso_c" != "xno"; then
930         if test "x$GCC" = "xyes"; then
931         case " $CFLAGS " in
932             *[\ \       ]-ansi[\ \      ]*) ;;
933             *) complCFLAGS="$complCFLAGS -ansi" ;;
934         esac
935         case " $CFLAGS " in
936             *[\ \       ]-pedantic[\ \  ]*) ;;
937             *) complCFLAGS="$complCFLAGS -pedantic" ;;
938         esac
939         fi
940     fi
941     AC_MSG_RESULT($complCFLAGS)
942
943     WARN_CFLAGS="$warning_flags $complCFLAGS"
944     AC_SUBST(WARN_CFLAGS)
945 ])
946
947 dnl For C++, do basically the same thing.
948
949 AC_DEFUN([GNOME_CXX_WARNINGS],[
950   AC_ARG_ENABLE(cxx-warnings, 
951     [  --enable-cxx-warnings=[no/minimum/yes]   Turn on compiler warnings.],,enable_cxx_warnings=minimum)
952
953   AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
954   warnCXXFLAGS=
955   if test "x$GCC" != xyes; then
956     enable_compile_warnings=no
957   fi
958   if test "x$enable_cxx_warnings" != "xno"; then
959     if test "x$GCC" = "xyes"; then
960       case " $CXXFLAGS " in
961       *[\ \     ]-Wall[\ \      ]*) ;;
962       *) warnCXXFLAGS="-Wall -Wno-unused" ;;
963       esac
964
965       ## -W is not all that useful.  And it cannot be controlled
966       ## with individual -Wno-xxx flags, unlike -Wall
967       if test "x$enable_cxx_warnings" = "xyes"; then
968         warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual"
969       fi
970     fi
971   fi
972   AC_MSG_RESULT($warnCXXFLAGS)
973
974    AC_ARG_ENABLE(iso-cxx,
975      [  --enable-iso-cxx          Try to warn if code is not ISO C++ ],,
976      enable_iso_cxx=no)
977
978    AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
979    complCXXFLAGS=
980    if test "x$enable_iso_cxx" != "xno"; then
981      if test "x$GCC" = "xyes"; then
982       case " $CXXFLAGS " in
983       *[\ \     ]-ansi[\ \      ]*) ;;
984       *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
985       esac
986
987       case " $CXXFLAGS " in
988       *[\ \     ]-pedantic[\ \  ]*) ;;
989       *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
990       esac
991      fi
992    fi
993   AC_MSG_RESULT($complCXXFLAGS)
994   if test "x$cxxflags_set" != "xyes"; then
995     CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
996     cxxflags_set=yes
997     AC_SUBST(cxxflags_set)
998   fi
999 ])
1000
1001
1002 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1003 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1004 dnl also defines GSTUFF_PKG_ERRORS on error
1005 AC_DEFUN(PKG_CHECK_MODULES, [
1006   succeeded=no
1007
1008   if test -z "$PKG_CONFIG"; then
1009     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1010   fi
1011
1012   if test "$PKG_CONFIG" = "no" ; then
1013      echo "*** The pkg-config script could not be found. Make sure it is"
1014      echo "*** in your path, or set the PKG_CONFIG environment variable"
1015      echo "*** to the full path to pkg-config."
1016      echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1017   else
1018      PKG_CONFIG_MIN_VERSION=0.9.0
1019      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1020         AC_MSG_CHECKING(for $2)
1021
1022         if $PKG_CONFIG --exists "$2" ; then
1023             AC_MSG_RESULT(yes)
1024             succeeded=yes
1025
1026             AC_MSG_CHECKING($1_CFLAGS)
1027             $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1028             AC_MSG_RESULT($$1_CFLAGS)
1029
1030             AC_MSG_CHECKING($1_LIBS)
1031             $1_LIBS=`$PKG_CONFIG --libs "$2"`
1032             AC_MSG_RESULT($$1_LIBS)
1033         else
1034             $1_CFLAGS=""
1035             $1_LIBS=""
1036             ## If we have a custom action on failure, don't print errors, but 
1037             ## do set a variable so people can do so.
1038             $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1039             ifelse([$4], ,echo $$1_PKG_ERRORS,)
1040         fi
1041
1042         AC_SUBST($1_CFLAGS)
1043         AC_SUBST($1_LIBS)
1044      else
1045         echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1046         echo "*** See http://www.freedesktop.org/software/pkgconfig"
1047      fi
1048   fi
1049
1050   if test $succeeded = yes; then
1051      ifelse([$3], , :, [$3])
1052   else
1053      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])
1054   fi
1055 ])
1056
1057
1058
1059 # Macro to add for using GNU gettext.
1060 # Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
1061 #
1062 # Modified to never use included libintl. 
1063 # Owen Taylor <otaylor@redhat.com>, 12/15/1998
1064 #
1065 #
1066 # This file can be copied and used freely without restrictions.  It can
1067 # be used in projects which are not available under the GNU Public License
1068 # but which still want to provide support for the GNU gettext functionality.
1069 # Please note that the actual code is *not* freely available.
1070 #
1071 #
1072 # If you make changes to this file, you MUST update the copy in
1073 # acinclude.m4. [ aclocal dies on duplicate macros, so if
1074 # we run 'aclocal -I macros/' then we'll run into problems
1075 # once we've installed glib-gettext.m4 :-( ]
1076 #
1077
1078 AC_DEFUN([AM_GLIB_LC_MESSAGES],
1079   [if test $ac_cv_header_locale_h = yes; then
1080     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1081       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1082        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1083     if test $am_cv_val_LC_MESSAGES = yes; then
1084       AC_DEFINE(HAVE_LC_MESSAGES, 1,
1085         [Define if your <locale.h> file defines LC_MESSAGES.])
1086     fi
1087   fi])
1088
1089 dnl AM_GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1090 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1091 AC_DEFUN([AM_GLIB_PATH_PROG_WITH_TEST],
1092 [# Extract the first word of "$2", so it can be a program name with args.
1093 set dummy $2; ac_word=[$]2
1094 AC_MSG_CHECKING([for $ac_word])
1095 AC_CACHE_VAL(ac_cv_path_$1,
1096 [case "[$]$1" in
1097   /*)
1098   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1099   ;;
1100   *)
1101   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1102   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1103     test -z "$ac_dir" && ac_dir=.
1104     if test -f $ac_dir/$ac_word; then
1105       if [$3]; then
1106         ac_cv_path_$1="$ac_dir/$ac_word"
1107         break
1108       fi
1109     fi
1110   done
1111   IFS="$ac_save_ifs"
1112 dnl If no 4th arg is given, leave the cache variable unset,
1113 dnl so AC_PATH_PROGS will keep looking.
1114 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1115 ])dnl
1116   ;;
1117 esac])dnl
1118 $1="$ac_cv_path_$1"
1119 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1120   AC_MSG_RESULT([$]$1)
1121 else
1122   AC_MSG_RESULT(no)
1123 fi
1124 AC_SUBST($1)dnl
1125 ])
1126
1127 # serial 5
1128
1129 AC_DEFUN(AM_GLIB_WITH_NLS,
1130   dnl NLS is obligatory
1131   [USE_NLS=yes
1132     AC_SUBST(USE_NLS)
1133
1134     dnl Figure out what method
1135     nls_cv_force_use_gnu_gettext="no"
1136
1137     nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1138     if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1139       dnl User does not insist on using GNU NLS library.  Figure out what
1140       dnl to use.  If gettext or catgets are available (in this order) we
1141       dnl use this.  Else we have to fall back to GNU NLS library.
1142       dnl catgets is only used if permitted by option --with-catgets.
1143       nls_cv_header_intl=
1144       nls_cv_header_libgt=
1145       CATOBJEXT=NONE
1146       XGETTEXT=:
1147
1148       AC_CHECK_HEADER(libintl.h,
1149         [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
1150           [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
1151             gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
1152
1153           gt_cv_func_dgettext_libintl="no"
1154           libintl_extra_libs=""
1155
1156           if test "$gt_cv_func_dgettext_libc" != "yes" ; then
1157             AC_CHECK_LIB(intl, bindtextdomain,
1158               [AC_CHECK_LIB(intl, dgettext,
1159                             gt_cv_func_dgettext_libintl=yes)])
1160
1161             if test "$gt_cv_func_dgettext_libc" != "yes" ; then
1162               AC_MSG_CHECKING([if -liconv is needed to use gettext])
1163               AC_MSG_RESULT([])
1164               AC_CHECK_LIB(intl, dcgettext,
1165                            [gt_cv_func_dgettext_libintl=yes
1166                             libintl_extra_libs=-liconv],
1167                            :,-liconv)
1168             fi
1169           fi
1170
1171           if test "$gt_cv_func_dgettext_libintl" = "yes"; then
1172             LIBS="$LIBS -lintl $libintl_extra_libs";
1173           fi
1174
1175           if test "$gt_cv_func_dgettext_libc" = "yes" \
1176             || test "$gt_cv_func_dgettext_libintl" = "yes"; then
1177             AC_DEFINE(HAVE_GETTEXT,1,
1178               [Define if the GNU gettext() function is already present or preinstalled.])
1179             AM_GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1180               [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
1181             if test "$MSGFMT" != "no"; then
1182               AC_CHECK_FUNCS(dcgettext)
1183               AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1184               AM_GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1185                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
1186               AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
1187                              return _nl_msg_cat_cntr],
1188                 [CATOBJEXT=.gmo
1189                  DATADIRNAME=share],
1190                 [CATOBJEXT=.mo
1191                  DATADIRNAME=lib])
1192               INSTOBJEXT=.mo
1193             fi
1194           fi
1195
1196           # Added by Martin Baulig 12/15/98 for libc5 systems
1197           if test "$gt_cv_func_dgettext_libc" != "yes" \
1198             && test "$gt_cv_func_dgettext_libintl" = "yes"; then
1199             INTLLIBS="-lintl $libintl_extra_libs"
1200             LIBS=`echo $LIBS | sed -e 's/-lintl//'`
1201           fi
1202       ])
1203
1204       if test "$CATOBJEXT" = "NONE"; then
1205         dnl Neither gettext nor catgets in included in the C library.
1206         dnl Fall back on GNU gettext library.
1207         nls_cv_use_gnu_gettext=yes
1208       fi
1209     fi
1210
1211     if test "$nls_cv_use_gnu_gettext" != "yes"; then
1212       AC_DEFINE(ENABLE_NLS, 1,
1213         [always defined to indicate that i18n is enabled])
1214     else
1215       dnl Unset this variable since we use the non-zero value as a flag.
1216       CATOBJEXT=
1217     fi
1218
1219     dnl Test whether we really found GNU xgettext.
1220     if test "$XGETTEXT" != ":"; then
1221       dnl If it is no GNU xgettext we define it as : so that the
1222       dnl Makefiles still can work.
1223       if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
1224         : ;
1225       else
1226         AC_MSG_RESULT(
1227           [found xgettext program is not GNU xgettext; ignore it])
1228         XGETTEXT=":"
1229       fi
1230     fi
1231
1232     # We need to process the po/ directory.
1233     POSUB=po
1234
1235     AC_OUTPUT_COMMANDS(
1236       [case "$CONFIG_FILES" in *po/Makefile.in*)
1237         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
1238       esac])
1239
1240     dnl These rules are solely for the distribution goal.  While doing this
1241     dnl we only have to keep exactly one list of the available catalogs
1242     dnl in configure.in.
1243     for lang in $ALL_LINGUAS; do
1244       GMOFILES="$GMOFILES $lang.gmo"
1245       POFILES="$POFILES $lang.po"
1246     done
1247
1248     dnl Make all variables we use known to autoconf.
1249     AC_SUBST(CATALOGS)
1250     AC_SUBST(CATOBJEXT)
1251     AC_SUBST(DATADIRNAME)
1252     AC_SUBST(GMOFILES)
1253     AC_SUBST(INSTOBJEXT)
1254     AC_SUBST(INTLDEPS)
1255     AC_SUBST(INTLLIBS)
1256     AC_SUBST(INTLOBJS)
1257     AC_SUBST(POFILES)
1258     AC_SUBST(POSUB)
1259   ])
1260
1261 AC_DEFUN(AM_GLIB_GNU_GETTEXT,
1262   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1263    AC_REQUIRE([AC_PROG_CC])dnl
1264    AC_REQUIRE([AC_PROG_RANLIB])dnl
1265    AC_REQUIRE([AC_HEADER_STDC])dnl
1266    AC_REQUIRE([AC_C_CONST])dnl
1267    AC_REQUIRE([AC_C_INLINE])dnl
1268    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1269    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1270    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1271    AC_REQUIRE([AC_FUNC_MMAP])dnl
1272
1273    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
1274 unistd.h sys/param.h])
1275    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
1276 strdup __argz_count __argz_stringify __argz_next])
1277
1278    AM_GLIB_LC_MESSAGES
1279    AM_GLIB_WITH_NLS
1280
1281    if test "x$CATOBJEXT" != "x"; then
1282      if test "x$ALL_LINGUAS" = "x"; then
1283        LINGUAS=
1284      else
1285        AC_MSG_CHECKING(for catalogs to be installed)
1286        NEW_LINGUAS=
1287        for lang in ${LINGUAS=$ALL_LINGUAS}; do
1288          case "$ALL_LINGUAS" in
1289           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
1290          esac
1291        done
1292        LINGUAS=$NEW_LINGUAS
1293        AC_MSG_RESULT($LINGUAS)
1294      fi
1295
1296      dnl Construct list of names of catalog files to be constructed.
1297      if test -n "$LINGUAS"; then
1298        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1299      fi
1300    fi
1301
1302    dnl Determine which catalog format we have (if any is needed)
1303    dnl For now we know about two different formats:
1304    dnl   Linux libc-5 and the normal X/Open format
1305    test -d po || mkdir po
1306    if test "$CATOBJEXT" = ".cat"; then
1307      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
1308
1309      dnl Transform the SED scripts while copying because some dumb SEDs
1310      dnl cannot handle comments.
1311      sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed
1312    fi
1313
1314    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1315    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
1316    dnl Try to locate is.
1317    MKINSTALLDIRS=
1318    if test -n "$ac_aux_dir"; then
1319      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1320    fi
1321    if test -z "$MKINSTALLDIRS"; then
1322      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1323    fi
1324    AC_SUBST(MKINSTALLDIRS)
1325
1326    dnl Generate list of files to be processed by xgettext which will
1327    dnl be included in po/Makefile.
1328    test -d po || mkdir po
1329    if test "x$srcdir" != "x."; then
1330      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
1331        posrcprefix="$srcdir/"
1332      else
1333        posrcprefix="../$srcdir/"
1334      fi
1335    else
1336      posrcprefix="../"
1337    fi
1338    rm -f po/POTFILES
1339    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
1340         < $srcdir/po/POTFILES.in > po/POTFILES
1341   ])
1342
1343