]> git.sur5r.net Git - glabels/blob - glabels2/aclocal.m4
Highlight is now placed in object group, so it no longer needs to track object moveme...
[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 # gnome-common.m4
770
771
772 dnl GNOME_COMMON_INIT
773
774 AC_DEFUN([GNOME_COMMON_INIT],
775 [
776         AC_CACHE_VAL(ac_cv_gnome_aclocal_dir,
777         [ac_cv_gnome_aclocal_dir="$GNOME_COMMON_MACROS_DIR"])
778         AC_CACHE_VAL(ac_cv_gnome_aclocal_flags,
779         [ac_cv_gnome_aclocal_flags="$ACLOCAL_FLAGS"])
780         GNOME_ACLOCAL_DIR="$ac_cv_gnome_aclocal_dir"
781         GNOME_ACLOCAL_FLAGS="$ac_cv_gnome_aclocal_flags"
782         AC_SUBST(GNOME_ACLOCAL_DIR)
783         AC_SUBST(GNOME_ACLOCAL_FLAGS)
784
785         ACLOCAL="$ACLOCAL $GNOME_ACLOCAL_FLAGS"
786
787         AM_CONDITIONAL(INSIDE_GNOME_DOCU, false)
788 ])
789
790 AC_DEFUN([GNOME_GTKDOC_CHECK],
791 [
792         AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
793         AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
794         AC_SUBST(HAVE_GTK_DOC)
795
796         dnl Let people disable the gtk-doc stuff.
797         AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
798
799         if test x$enable_gtk_doc = xauto ; then
800           if test x$GTKDOC = xtrue ; then
801             enable_gtk_doc=yes
802           else
803             enable_gtk_doc=no
804           fi
805         fi
806
807         dnl NOTE: We need to use a separate automake conditional for this
808         dnl       to make this work with the tarballs.
809         AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
810 ])
811
812 AC_DEFUN([GNOME_DEBUG_CHECK],
813 [
814         AC_ARG_ENABLE(debug, [  --enable-debug turn on debugging [default=no]], enable_debug="$enableval", enable_debug=no)
815
816         if test x$enable_debug = xyes ; then
817           AC_DEFINE(GNOME_ENABLE_DEBUG)
818         fi
819 ])
820
821
822 # serial 1
823
824 # @defmac AC_PROG_CC_STDC
825 # @maindex PROG_CC_STDC
826 # @ovindex CC
827 # If the C compiler in not in ANSI C mode by default, try to add an option
828 # to output variable @code{CC} to make it so.  This macro tries various
829 # options that select ANSI C on some system or another.  It considers the
830 # compiler to be in ANSI C mode if it handles function prototypes correctly.
831 #
832 # If you use this macro, you should check after calling it whether the C
833 # compiler has been set to accept ANSI C; if not, the shell variable
834 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
835 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
836 # program @code{ansi2knr}, which comes with Ghostscript.
837 # @end defmac
838
839 AC_DEFUN([AM_PROG_CC_STDC],
840 [AC_REQUIRE([AC_PROG_CC])
841 AC_BEFORE([$0], [AC_C_INLINE])
842 AC_BEFORE([$0], [AC_C_CONST])
843 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
844 dnl a magic option to avoid problems with ANSI preprocessor commands
845 dnl like #elif.
846 dnl FIXME: can't do this because then AC_AIX won't work due to a
847 dnl circular dependency.
848 dnl AC_BEFORE([$0], [AC_PROG_CPP])
849 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
850 AC_CACHE_VAL(am_cv_prog_cc_stdc,
851 [am_cv_prog_cc_stdc=no
852 ac_save_CC="$CC"
853 # Don't try gcc -ansi; that turns off useful extensions and
854 # breaks some systems' header files.
855 # AIX                   -qlanglvl=ansi
856 # Ultrix and OSF/1      -std1
857 # HP-UX                 -Aa -D_HPUX_SOURCE
858 # SVR4                  -Xc -D__EXTENSIONS__
859 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
860 do
861   CC="$ac_save_CC $ac_arg"
862   AC_TRY_COMPILE(
863 [#include <stdarg.h>
864 #include <stdio.h>
865 #include <sys/types.h>
866 #include <sys/stat.h>
867 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
868 struct buf { int x; };
869 FILE * (*rcsopen) (struct buf *, struct stat *, int);
870 static char *e (p, i)
871      char **p;
872      int i;
873 {
874   return p[i];
875 }
876 static char *f (char * (*g) (char **, int), char **p, ...)
877 {
878   char *s;
879   va_list v;
880   va_start (v,p);
881   s = g (p, va_arg (v,int));
882   va_end (v);
883   return s;
884 }
885 int test (int i, double x);
886 struct s1 {int (*f) (int a);};
887 struct s2 {int (*f) (double a);};
888 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
889 int argc;
890 char **argv;
891 ], [
892 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
893 ],
894 [am_cv_prog_cc_stdc="$ac_arg"; break])
895 done
896 CC="$ac_save_CC"
897 ])
898 if test -z "$am_cv_prog_cc_stdc"; then
899   AC_MSG_RESULT([none needed])
900 else
901   AC_MSG_RESULT($am_cv_prog_cc_stdc)
902 fi
903 case "x$am_cv_prog_cc_stdc" in
904   x|xno) ;;
905   *) CC="$CC $am_cv_prog_cc_stdc" ;;
906 esac
907 ])
908
909 dnl GNOME_COMPILE_WARNINGS
910 dnl Turn on many useful compiler warnings
911 dnl For now, only works on GCC
912 AC_DEFUN([GNOME_COMPILE_WARNINGS],[
913     dnl ******************************
914     dnl More compiler warnings
915     dnl ******************************
916
917     if test -z "$1" ; then
918         default_compile_warnings=no
919     else
920         default_compile_warnings="$1"
921     fi
922
923     AC_ARG_ENABLE(compile-warnings, 
924     [  --enable-compile-warnings=[no/minimum/yes/maximum/error] Turn on compiler warnings.], [enable_compile_warnings="$enableval"],[enable_compile_warnings="$default_compile_warnings"])
925
926     warnCFLAGS=
927     if test "x$GCC" != xyes; then
928         enable_compile_warnings=no
929     fi
930
931     warning_flags=
932     realsave_CFLAGS="$CFLAGS"
933
934     case "$enable_compile_warnings" in
935     no)
936         warning_flags=
937         ;;
938     minimum)
939         warning_flags="-Wall -Wunused"
940         ;;
941     yes)
942         warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
943         ;;
944     maximum|error)
945         warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
946         CFLAGS="$warning_flags $CFLAGS"
947         for option in -Wsign-promo -Wno-sign-compare; do
948                 SAVE_CFLAGS="$CFLAGS"
949                 CFLAGS="$CFLAGS $option"
950                 AC_MSG_CHECKING([whether gcc understands $option])
951                 AC_TRY_COMPILE([], [],
952                         has_option=yes,
953                         has_option=no,)
954                 CFLAGS="$SAVE_CFLAGS"
955                 AC_MSG_RESULT($has_option)
956                 if test $has_option = yes; then
957                   warning_flags="$warning_flags $option"
958                 fi
959                 unset has_option
960                 unset SAVE_CFLAGS
961         done
962         unset option
963         if test "$enable_compile_warnings" = "error" ; then
964             warning_flags="$warning_flags -Werror"
965         fi
966         ;;
967     *)
968         AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
969         ;;
970     esac
971     CFLAGS="$realsave_CFLAGS"
972     AC_MSG_CHECKING(what warning flags to pass to the C compiler)
973     AC_MSG_RESULT($warning_flags)
974
975     AC_ARG_ENABLE(iso-c,
976     [  --enable-iso-c          Try to warn if code is not ISO C ],,
977     enable_iso_c=no)
978
979     AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
980     complCFLAGS=
981     if test "x$enable_iso_c" != "xno"; then
982         if test "x$GCC" = "xyes"; then
983         case " $CFLAGS " in
984             *[\ \       ]-ansi[\ \      ]*) ;;
985             *) complCFLAGS="$complCFLAGS -ansi" ;;
986         esac
987         case " $CFLAGS " in
988             *[\ \       ]-pedantic[\ \  ]*) ;;
989             *) complCFLAGS="$complCFLAGS -pedantic" ;;
990         esac
991         fi
992     fi
993     AC_MSG_RESULT($complCFLAGS)
994
995     WARN_CFLAGS="$warning_flags $complCFLAGS"
996     AC_SUBST(WARN_CFLAGS)
997 ])
998
999 dnl For C++, do basically the same thing.
1000
1001 AC_DEFUN([GNOME_CXX_WARNINGS],[
1002   AC_ARG_ENABLE(cxx-warnings, 
1003     [  --enable-cxx-warnings=[no/minimum/yes]   Turn on compiler warnings.],,enable_cxx_warnings=minimum)
1004
1005   AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
1006   warnCXXFLAGS=
1007   if test "x$GCC" != xyes; then
1008     enable_compile_warnings=no
1009   fi
1010   if test "x$enable_cxx_warnings" != "xno"; then
1011     if test "x$GCC" = "xyes"; then
1012       case " $CXXFLAGS " in
1013       *[\ \     ]-Wall[\ \      ]*) ;;
1014       *) warnCXXFLAGS="-Wall -Wno-unused" ;;
1015       esac
1016
1017       ## -W is not all that useful.  And it cannot be controlled
1018       ## with individual -Wno-xxx flags, unlike -Wall
1019       if test "x$enable_cxx_warnings" = "xyes"; then
1020         warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual"
1021       fi
1022     fi
1023   fi
1024   AC_MSG_RESULT($warnCXXFLAGS)
1025
1026    AC_ARG_ENABLE(iso-cxx,
1027      [  --enable-iso-cxx          Try to warn if code is not ISO C++ ],,
1028      enable_iso_cxx=no)
1029
1030    AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
1031    complCXXFLAGS=
1032    if test "x$enable_iso_cxx" != "xno"; then
1033      if test "x$GCC" = "xyes"; then
1034       case " $CXXFLAGS " in
1035       *[\ \     ]-ansi[\ \      ]*) ;;
1036       *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
1037       esac
1038
1039       case " $CXXFLAGS " in
1040       *[\ \     ]-pedantic[\ \  ]*) ;;
1041       *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
1042       esac
1043      fi
1044    fi
1045   AC_MSG_RESULT($complCXXFLAGS)
1046   if test "x$cxxflags_set" != "xyes"; then
1047     CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
1048     cxxflags_set=yes
1049     AC_SUBST(cxxflags_set)
1050   fi
1051 ])
1052
1053
1054 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1055 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1056 dnl also defines GSTUFF_PKG_ERRORS on error
1057 AC_DEFUN(PKG_CHECK_MODULES, [
1058   succeeded=no
1059
1060   if test -z "$PKG_CONFIG"; then
1061     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1062   fi
1063
1064   if test "$PKG_CONFIG" = "no" ; then
1065      echo "*** The pkg-config script could not be found. Make sure it is"
1066      echo "*** in your path, or set the PKG_CONFIG environment variable"
1067      echo "*** to the full path to pkg-config."
1068      echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1069   else
1070      PKG_CONFIG_MIN_VERSION=0.9.0
1071      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1072         AC_MSG_CHECKING(for $2)
1073
1074         if $PKG_CONFIG --exists "$2" ; then
1075             AC_MSG_RESULT(yes)
1076             succeeded=yes
1077
1078             AC_MSG_CHECKING($1_CFLAGS)
1079             $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1080             AC_MSG_RESULT($$1_CFLAGS)
1081
1082             AC_MSG_CHECKING($1_LIBS)
1083             $1_LIBS=`$PKG_CONFIG --libs "$2"`
1084             AC_MSG_RESULT($$1_LIBS)
1085         else
1086             $1_CFLAGS=""
1087             $1_LIBS=""
1088             ## If we have a custom action on failure, don't print errors, but 
1089             ## do set a variable so people can do so.
1090             $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1091             ifelse([$4], ,echo $$1_PKG_ERRORS,)
1092         fi
1093
1094         AC_SUBST($1_CFLAGS)
1095         AC_SUBST($1_LIBS)
1096      else
1097         echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1098         echo "*** See http://www.freedesktop.org/software/pkgconfig"
1099      fi
1100   fi
1101
1102   if test $succeeded = yes; then
1103      ifelse([$3], , :, [$3])
1104   else
1105      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])
1106   fi
1107 ])
1108
1109
1110
1111 # Macro to add for using GNU gettext.
1112 # Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
1113 #
1114 # Modified to never use included libintl. 
1115 # Owen Taylor <otaylor@redhat.com>, 12/15/1998
1116 #
1117 #
1118 # This file can be copied and used freely without restrictions.  It can
1119 # be used in projects which are not available under the GNU Public License
1120 # but which still want to provide support for the GNU gettext functionality.
1121 # Please note that the actual code is *not* freely available.
1122 #
1123 #
1124 # If you make changes to this file, you MUST update the copy in
1125 # acinclude.m4. [ aclocal dies on duplicate macros, so if
1126 # we run 'aclocal -I macros/' then we'll run into problems
1127 # once we've installed glib-gettext.m4 :-( ]
1128 #
1129
1130 AC_DEFUN([AM_GLIB_LC_MESSAGES],
1131   [if test $ac_cv_header_locale_h = yes; then
1132     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1133       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1134        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1135     if test $am_cv_val_LC_MESSAGES = yes; then
1136       AC_DEFINE(HAVE_LC_MESSAGES, 1,
1137         [Define if your <locale.h> file defines LC_MESSAGES.])
1138     fi
1139   fi])
1140
1141 dnl AM_GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1142 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1143 AC_DEFUN([AM_GLIB_PATH_PROG_WITH_TEST],
1144 [# Extract the first word of "$2", so it can be a program name with args.
1145 set dummy $2; ac_word=[$]2
1146 AC_MSG_CHECKING([for $ac_word])
1147 AC_CACHE_VAL(ac_cv_path_$1,
1148 [case "[$]$1" in
1149   /*)
1150   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1151   ;;
1152   *)
1153   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1154   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1155     test -z "$ac_dir" && ac_dir=.
1156     if test -f $ac_dir/$ac_word; then
1157       if [$3]; then
1158         ac_cv_path_$1="$ac_dir/$ac_word"
1159         break
1160       fi
1161     fi
1162   done
1163   IFS="$ac_save_ifs"
1164 dnl If no 4th arg is given, leave the cache variable unset,
1165 dnl so AC_PATH_PROGS will keep looking.
1166 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1167 ])dnl
1168   ;;
1169 esac])dnl
1170 $1="$ac_cv_path_$1"
1171 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1172   AC_MSG_RESULT([$]$1)
1173 else
1174   AC_MSG_RESULT(no)
1175 fi
1176 AC_SUBST($1)dnl
1177 ])
1178
1179 # serial 5
1180
1181 AC_DEFUN(AM_GLIB_WITH_NLS,
1182   dnl NLS is obligatory
1183   [USE_NLS=yes
1184     AC_SUBST(USE_NLS)
1185
1186     dnl Figure out what method
1187     nls_cv_force_use_gnu_gettext="no"
1188
1189     nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1190     if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1191       dnl User does not insist on using GNU NLS library.  Figure out what
1192       dnl to use.  If gettext or catgets are available (in this order) we
1193       dnl use this.  Else we have to fall back to GNU NLS library.
1194       dnl catgets is only used if permitted by option --with-catgets.
1195       nls_cv_header_intl=
1196       nls_cv_header_libgt=
1197       CATOBJEXT=NONE
1198       XGETTEXT=:
1199
1200       AC_CHECK_HEADER(libintl.h,
1201         [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
1202           [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
1203             gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
1204
1205           gt_cv_func_dgettext_libintl="no"
1206           libintl_extra_libs=""
1207
1208           if test "$gt_cv_func_dgettext_libc" != "yes" ; then
1209             AC_CHECK_LIB(intl, bindtextdomain,
1210               [AC_CHECK_LIB(intl, dgettext,
1211                             gt_cv_func_dgettext_libintl=yes)])
1212
1213             if test "$gt_cv_func_dgettext_libc" != "yes" ; then
1214               AC_MSG_CHECKING([if -liconv is needed to use gettext])
1215               AC_MSG_RESULT([])
1216               AC_CHECK_LIB(intl, dcgettext,
1217                            [gt_cv_func_dgettext_libintl=yes
1218                             libintl_extra_libs=-liconv],
1219                            :,-liconv)
1220             fi
1221           fi
1222
1223           if test "$gt_cv_func_dgettext_libintl" = "yes"; then
1224             LIBS="$LIBS -lintl $libintl_extra_libs";
1225           fi
1226
1227           if test "$gt_cv_func_dgettext_libc" = "yes" \
1228             || test "$gt_cv_func_dgettext_libintl" = "yes"; then
1229             AC_DEFINE(HAVE_GETTEXT,1,
1230               [Define if the GNU gettext() function is already present or preinstalled.])
1231             AM_GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1232               [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
1233             if test "$MSGFMT" != "no"; then
1234               AC_CHECK_FUNCS(dcgettext)
1235               AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1236               AM_GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1237                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
1238               AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
1239                              return _nl_msg_cat_cntr],
1240                 [CATOBJEXT=.gmo
1241                  DATADIRNAME=share],
1242                 [CATOBJEXT=.mo
1243                  DATADIRNAME=lib])
1244               INSTOBJEXT=.mo
1245             fi
1246           fi
1247
1248           # Added by Martin Baulig 12/15/98 for libc5 systems
1249           if test "$gt_cv_func_dgettext_libc" != "yes" \
1250             && test "$gt_cv_func_dgettext_libintl" = "yes"; then
1251             INTLLIBS="-lintl $libintl_extra_libs"
1252             LIBS=`echo $LIBS | sed -e 's/-lintl//'`
1253           fi
1254       ])
1255
1256       if test "$CATOBJEXT" = "NONE"; then
1257         dnl Neither gettext nor catgets in included in the C library.
1258         dnl Fall back on GNU gettext library.
1259         nls_cv_use_gnu_gettext=yes
1260       fi
1261     fi
1262
1263     if test "$nls_cv_use_gnu_gettext" != "yes"; then
1264       AC_DEFINE(ENABLE_NLS, 1,
1265         [always defined to indicate that i18n is enabled])
1266     else
1267       dnl Unset this variable since we use the non-zero value as a flag.
1268       CATOBJEXT=
1269     fi
1270
1271     dnl Test whether we really found GNU xgettext.
1272     if test "$XGETTEXT" != ":"; then
1273       dnl If it is no GNU xgettext we define it as : so that the
1274       dnl Makefiles still can work.
1275       if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
1276         : ;
1277       else
1278         AC_MSG_RESULT(
1279           [found xgettext program is not GNU xgettext; ignore it])
1280         XGETTEXT=":"
1281       fi
1282     fi
1283
1284     # We need to process the po/ directory.
1285     POSUB=po
1286
1287     AC_OUTPUT_COMMANDS(
1288       [case "$CONFIG_FILES" in *po/Makefile.in*)
1289         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
1290       esac])
1291
1292     dnl These rules are solely for the distribution goal.  While doing this
1293     dnl we only have to keep exactly one list of the available catalogs
1294     dnl in configure.in.
1295     for lang in $ALL_LINGUAS; do
1296       GMOFILES="$GMOFILES $lang.gmo"
1297       POFILES="$POFILES $lang.po"
1298     done
1299
1300     dnl Make all variables we use known to autoconf.
1301     AC_SUBST(CATALOGS)
1302     AC_SUBST(CATOBJEXT)
1303     AC_SUBST(DATADIRNAME)
1304     AC_SUBST(GMOFILES)
1305     AC_SUBST(INSTOBJEXT)
1306     AC_SUBST(INTLDEPS)
1307     AC_SUBST(INTLLIBS)
1308     AC_SUBST(INTLOBJS)
1309     AC_SUBST(POFILES)
1310     AC_SUBST(POSUB)
1311   ])
1312
1313 AC_DEFUN(AM_GLIB_GNU_GETTEXT,
1314   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1315    AC_REQUIRE([AC_PROG_CC])dnl
1316    AC_REQUIRE([AC_PROG_RANLIB])dnl
1317    AC_REQUIRE([AC_HEADER_STDC])dnl
1318    AC_REQUIRE([AC_C_CONST])dnl
1319    AC_REQUIRE([AC_C_INLINE])dnl
1320    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1321    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1322    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1323    AC_REQUIRE([AC_FUNC_MMAP])dnl
1324
1325    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
1326 unistd.h sys/param.h])
1327    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
1328 strdup __argz_count __argz_stringify __argz_next])
1329
1330    AM_GLIB_LC_MESSAGES
1331    AM_GLIB_WITH_NLS
1332
1333    if test "x$CATOBJEXT" != "x"; then
1334      if test "x$ALL_LINGUAS" = "x"; then
1335        LINGUAS=
1336      else
1337        AC_MSG_CHECKING(for catalogs to be installed)
1338        NEW_LINGUAS=
1339        for lang in ${LINGUAS=$ALL_LINGUAS}; do
1340          case "$ALL_LINGUAS" in
1341           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
1342          esac
1343        done
1344        LINGUAS=$NEW_LINGUAS
1345        AC_MSG_RESULT($LINGUAS)
1346      fi
1347
1348      dnl Construct list of names of catalog files to be constructed.
1349      if test -n "$LINGUAS"; then
1350        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1351      fi
1352    fi
1353
1354    dnl Determine which catalog format we have (if any is needed)
1355    dnl For now we know about two different formats:
1356    dnl   Linux libc-5 and the normal X/Open format
1357    test -d po || mkdir po
1358    if test "$CATOBJEXT" = ".cat"; then
1359      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
1360
1361      dnl Transform the SED scripts while copying because some dumb SEDs
1362      dnl cannot handle comments.
1363      sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed
1364    fi
1365
1366    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1367    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
1368    dnl Try to locate is.
1369    MKINSTALLDIRS=
1370    if test -n "$ac_aux_dir"; then
1371      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1372    fi
1373    if test -z "$MKINSTALLDIRS"; then
1374      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1375    fi
1376    AC_SUBST(MKINSTALLDIRS)
1377
1378    dnl Generate list of files to be processed by xgettext which will
1379    dnl be included in po/Makefile.
1380    test -d po || mkdir po
1381    if test "x$srcdir" != "x."; then
1382      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
1383        posrcprefix="$srcdir/"
1384      else
1385        posrcprefix="../$srcdir/"
1386      fi
1387    else
1388      posrcprefix="../"
1389    fi
1390    rm -f po/POTFILES
1391    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
1392         < $srcdir/po/POTFILES.in > po/POTFILES
1393   ])
1394
1395