source: trunk/third/acme/aclocal.m4 @ 18698

Revision 18698, 26.2 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18697, which included commits to RCS files with non-trunk default branches.
Line 
1dnl aclocal.m4 generated automatically by aclocal 1.4-p6
2
3dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13# Do all the work for Automake.  This macro actually does too much --
14# some checks are only needed if your package does certain things.
15# But this isn't really a big deal.
16
17# serial 1
18
19dnl Usage:
20dnl AM_INIT_AUTOMAKE(package,version, [no-define])
21
22AC_DEFUN([AM_INIT_AUTOMAKE],
23[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
24AC_REQUIRE([AC_PROG_INSTALL])
25PACKAGE=[$1]
26AC_SUBST(PACKAGE)
27VERSION=[$2]
28AC_SUBST(VERSION)
29dnl test to see if srcdir already configured
30if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
31  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
32fi
33ifelse([$3],,
34AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
35AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
36AC_REQUIRE([AM_SANITY_CHECK])
37AC_REQUIRE([AC_ARG_PROGRAM])
38dnl FIXME This is truly gross.
39missing_dir=`cd $ac_aux_dir && pwd`
40AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
41AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
42AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
43AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
44AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
45AC_REQUIRE([AC_PROG_MAKE_SET])])
46
47# Copyright 2002  Free Software Foundation, Inc.
48
49# This program is free software; you can redistribute it and/or modify
50# it under the terms of the GNU General Public License as published by
51# the Free Software Foundation; either version 2, or (at your option)
52# any later version.
53
54# This program is distributed in the hope that it will be useful,
55# but WITHOUT ANY WARRANTY; without even the implied warranty of
56# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
57# GNU General Public License for more details.
58
59# You should have received a copy of the GNU General Public License
60# along with this program; if not, write to the Free Software
61# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
62
63# AM_AUTOMAKE_VERSION(VERSION)
64# ----------------------------
65# Automake X.Y traces this macro to ensure aclocal.m4 has been
66# generated from the m4 files accompanying Automake X.Y.
67AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
68
69# AM_SET_CURRENT_AUTOMAKE_VERSION
70# -------------------------------
71# Call AM_AUTOMAKE_VERSION so it can be traced.
72# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
73AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
74         [AM_AUTOMAKE_VERSION([1.4-p6])])
75
76#
77# Check to make sure that the build environment is sane.
78#
79
80AC_DEFUN([AM_SANITY_CHECK],
81[AC_MSG_CHECKING([whether build environment is sane])
82# Just in case
83sleep 1
84echo timestamp > conftestfile
85# Do `set' in a subshell so we don't clobber the current shell's
86# arguments.  Must try -L first in case configure is actually a
87# symlink; some systems play weird games with the mod time of symlinks
88# (eg FreeBSD returns the mod time of the symlink's containing
89# directory).
90if (
91   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
92   if test "[$]*" = "X"; then
93      # -L didn't work.
94      set X `ls -t $srcdir/configure conftestfile`
95   fi
96   if test "[$]*" != "X $srcdir/configure conftestfile" \
97      && test "[$]*" != "X conftestfile $srcdir/configure"; then
98
99      # If neither matched, then we have a broken ls.  This can happen
100      # if, for instance, CONFIG_SHELL is bash and it inherits a
101      # broken ls alias from the environment.  This has actually
102      # happened.  Such a system could not be considered "sane".
103      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
104alias in your environment])
105   fi
106
107   test "[$]2" = conftestfile
108   )
109then
110   # Ok.
111   :
112else
113   AC_MSG_ERROR([newly created file is older than distributed files!
114Check your system clock])
115fi
116rm -f conftest*
117AC_MSG_RESULT(yes)])
118
119dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
120dnl The program must properly implement --version.
121AC_DEFUN([AM_MISSING_PROG],
122[AC_MSG_CHECKING(for working $2)
123# Run test in a subshell; some versions of sh will print an error if
124# an executable is not found, even if stderr is redirected.
125# Redirect stdin to placate older versions of autoconf.  Sigh.
126if ($2 --version) < /dev/null > /dev/null 2>&1; then
127   $1=$2
128   AC_MSG_RESULT(found)
129else
130   $1="$3/missing $2"
131   AC_MSG_RESULT(missing)
132fi
133AC_SUBST($1)])
134
135# Like AC_CONFIG_HEADER, but automatically create stamp file.
136
137AC_DEFUN([AM_CONFIG_HEADER],
138[AC_PREREQ([2.12])
139AC_CONFIG_HEADER([$1])
140dnl When config.status generates a header, we must update the stamp-h file.
141dnl This file resides in the same directory as the config header
142dnl that is generated.  We must strip everything past the first ":",
143dnl and everything past the last "/".
144AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
145ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
146<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
147<<am_indx=1
148for am_file in <<$1>>; do
149  case " <<$>>CONFIG_HEADERS " in
150  *" <<$>>am_file "*<<)>>
151    echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
152    ;;
153  esac
154  am_indx=`expr "<<$>>am_indx" + 1`
155done<<>>dnl>>)
156changequote([,]))])
157
158
159dnl AC_PROG_INTLTOOL([MINIMUM-VERSION])
160# serial 1 AC_PROG_INTLTOOL
161AC_DEFUN(AC_PROG_INTLTOOL,
162[
163
164if test -n "$1"; then
165    AC_MSG_CHECKING(for intltool >= $1)
166
167    INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ printf "%d", $[1] * 100 + $[2]; }'`
168    INTLTOOL_APPLIED_VERSION=`awk -F\" '/\\$VERSION / { printf $[2]; }'  < ${srcdir}/intltool-update.in`
169    changequote({{,}})
170    INTLTOOL_APPLIED_VERSION_AS_INT=`awk -F\" '/\\$VERSION / { split(${{2}}, VERSION, "."); printf "%d\n", VERSION[1] * 100 + VERSION[2];}' < ${srcdir}/intltool-update.in`
171    changequote([,])
172
173    if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT"; then
174        AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found])
175    else
176        AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found. Your intltool is too old.  You need intltool $1 or later.])
177        exit 1
178    fi
179fi
180
181  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'
182INTLTOOL_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'
183     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'
184     INTLTOOL_PROP_RULE='%.prop:      %.prop.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -d -u -c $(top_builddir)/po/.intltool-merge-cache'
185      INTLTOOL_OAF_RULE='%.oaf:       %.oaf.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -o -p'
186     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'
187   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'
188    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'
189INTLTOOL_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'
190       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'
191      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'
192    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'
193  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'
194    INTLTOOL_THEME_RULE='%.theme:     %.theme.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< [$]@ -d -u -c $(top_builddir)/po/.intltool-merge-cache'
195
196AC_SUBST(INTLTOOL_DESKTOP_RULE)
197AC_SUBST(INTLTOOL_DIRECTORY_RULE)
198AC_SUBST(INTLTOOL_KEYS_RULE)
199AC_SUBST(INTLTOOL_PROP_RULE)
200AC_SUBST(INTLTOOL_OAF_RULE)
201AC_SUBST(INTLTOOL_PONG_RULE)
202AC_SUBST(INTLTOOL_SERVER_RULE)
203AC_SUBST(INTLTOOL_SHEET_RULE)
204AC_SUBST(INTLTOOL_SOUNDLIST_RULE)
205AC_SUBST(INTLTOOL_UI_RULE)
206AC_SUBST(INTLTOOL_XML_RULE)
207AC_SUBST(INTLTOOL_CAVES_RULE)
208AC_SUBST(INTLTOOL_SCHEMAS_RULE)
209AC_SUBST(INTLTOOL_THEME_RULE)
210
211# Use the tools built into the package, not the ones that are installed.
212
213INTLTOOL_EXTRACT='$(top_builddir)/intltool-extract'
214INTLTOOL_MERGE='$(top_builddir)/intltool-merge'
215INTLTOOL_UPDATE='$(top_builddir)/intltool-update'
216
217AC_SUBST(INTLTOOL_EXTRACT)
218AC_SUBST(INTLTOOL_MERGE)
219AC_SUBST(INTLTOOL_UPDATE)
220
221AC_PATH_PROG(INTLTOOL_PERL, perl)
222if test -z "$INTLTOOL_PERL"; then
223   AC_MSG_ERROR([perl not found; required for intltool])
224fi
225if test -z "`$INTLTOOL_PERL -v | fgrep '5.' 2> /dev/null`"; then
226   AC_MSG_ERROR([perl 5.x required for intltool])
227fi
228
229# Remove file type tags (using []) from po/POTFILES.
230
231ifdef([AC_DIVERSION_ICMDS],[
232  AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)
233      changequote(,)
234      mv -f po/POTFILES po/POTFILES.tmp
235      sed -e 's/\[.*\] *//' < po/POTFILES.tmp > po/POTFILES
236      rm -f po/POTFILES.tmp
237      changequote([,])
238  AC_DIVERT_POP()
239],[
240  ifdef([AC_CONFIG_COMMANDS_PRE],[
241    AC_CONFIG_COMMANDS_PRE([
242        changequote(,)
243        mv -f po/POTFILES po/POTFILES.tmp
244        sed -e 's/\[.*\] *//' < po/POTFILES.tmp > po/POTFILES
245        rm -f po/POTFILES.tmp
246        changequote([,])
247    ])
248  ])
249])
250
251# Manually sed perl in so people don't have to put the intltool scripts in AC_OUTPUT.
252
253AC_OUTPUT_COMMANDS([
254
255sed -e "s:@INTLTOOL_PERL@:${INTLTOOL_PERL}:;" < ${srcdir}/intltool-extract.in > intltool-extract.out
256if cmp -s intltool-extract intltool-extract.out 2>/dev/null; then
257  rm -f intltool-extract.out
258else
259  mv -f intltool-extract.out intltool-extract
260fi
261chmod ugo+x intltool-extract
262chmod u+w intltool-extract
263
264sed -e "s:@INTLTOOL_PERL@:${INTLTOOL_PERL}:;" < ${srcdir}/intltool-merge.in > intltool-merge.out
265if cmp -s intltool-merge intltool-merge.out 2>/dev/null; then
266  rm -f intltool-merge.out
267else
268  mv -f intltool-merge.out intltool-merge
269fi
270chmod ugo+x intltool-merge
271chmod u+w intltool-merge
272
273sed -e "s:@INTLTOOL_PERL@:${INTLTOOL_PERL}:;" < ${srcdir}/intltool-update.in > intltool-update.out
274if cmp -s intltool-update intltool-update.out 2>/dev/null; then
275  rm -f intltool-update.out
276else
277  mv -f intltool-update.out intltool-update
278fi
279chmod ugo+x intltool-update
280chmod u+w intltool-update
281
282], INTLTOOL_PERL=${INTLTOOL_PERL})
283
284])
285
286dnl
287dnl GOB_HOOK(script if found, fail)
288dnl if fail = "failure", abort if GOB not found
289dnl
290
291
292AC_DEFUN(GOB2_HOOK,[
293        AC_PATH_PROG(GOB2,gob2)
294        if test ! x$GOB2 = x; then     
295                if test ! x$1 = x; then
296                        AC_MSG_CHECKING(for gob-2 >= $1)
297                        g_r_ve=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
298                        g_r_ma=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
299                        g_r_mi=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
300                        g_ve=`$GOB2 --version 2>&1|sed 's/Gob version \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
301                        g_ma=`$GOB2 --version 2>&1|sed 's/Gob version \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
302                        g_mi=`$GOB2 --version 2>&1|sed 's/Gob version \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
303
304                        if test $g_ve -eq $g_r_ve; then
305                                if test $g_ma -ge $g_r_ma; then
306                                        if test $g_mi -ge $g_r_mi; then
307                                                AC_MSG_RESULT(ok)
308                                        else
309                                                if test $g_ma -gt $g_r_ma; then
310                                                        AC_MSG_RESULT(ok)
311                                                else
312                                                        AC_MSG_ERROR("found $g_ve.$g_ma.$g_mi requires $g_r_ve.$g_r_ma.$g_r_mi")
313                                                fi
314                                        fi
315                                else
316                                        AC_MSG_ERROR("found $g_ve.$g_ma.$g_mi requires $g_r_ve.$g_r_ma.$g_r_mi")
317                                fi
318                        else
319                                if test $g_ve -gt $g_r_ve; then
320                                        AC_MSG_RESULT(ok)
321                                else
322                                        AC_MSG_ERROR(major version $g_ve found but $g_r_ve required)
323                                fi
324                        fi
325       
326                        unset gob_version
327                        unset g_ve
328                        unset g_ma
329                        unset g_mi
330                        unset g_r_ve
331                        unset g_r_ma
332                        unset g_r_mi
333                fi
334                AC_SUBST(GOB2)
335                $2
336        else           
337                $3
338        fi
339])
340
341AC_DEFUN([GOB2_CHECK],[
342        GOB2_HOOK($1,[],[AC_MSG_WARN([Cannot find GOB-2, check http://www.5z.com/jirka/gob.html])])
343])
344
345
346dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
347dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
348dnl also defines GSTUFF_PKG_ERRORS on error
349AC_DEFUN(PKG_CHECK_MODULES, [
350  succeeded=no
351
352  if test -z "$PKG_CONFIG"; then
353    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
354  fi
355
356  if test "$PKG_CONFIG" = "no" ; then
357     echo "*** The pkg-config script could not be found. Make sure it is"
358     echo "*** in your path, or set the PKG_CONFIG environment variable"
359     echo "*** to the full path to pkg-config."
360     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
361  else
362     PKG_CONFIG_MIN_VERSION=0.9.0
363     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
364        AC_MSG_CHECKING(for $2)
365
366        if $PKG_CONFIG --exists "$2" ; then
367            AC_MSG_RESULT(yes)
368            succeeded=yes
369
370            AC_MSG_CHECKING($1_CFLAGS)
371            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
372            AC_MSG_RESULT($$1_CFLAGS)
373
374            AC_MSG_CHECKING($1_LIBS)
375            $1_LIBS=`$PKG_CONFIG --libs "$2"`
376            AC_MSG_RESULT($$1_LIBS)
377        else
378            $1_CFLAGS=""
379            $1_LIBS=""
380            ## If we have a custom action on failure, don't print errors, but
381            ## do set a variable so people can do so.
382            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
383            ifelse([$4], ,echo $$1_PKG_ERRORS,)
384        fi
385
386        AC_SUBST($1_CFLAGS)
387        AC_SUBST($1_LIBS)
388     else
389        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
390        echo "*** See http://www.freedesktop.org/software/pkgconfig"
391     fi
392  fi
393
394  if test $succeeded = yes; then
395     ifelse([$3], , :, [$3])
396  else
397     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])
398  fi
399])
400
401
402
403dnl AM_GCONF_SOURCE_2
404dnl Defines GCONF_SCHEMA_CONFIG_SOURCE which is where you should install schemas
405dnl  (i.e. pass to gconftool-2
406dnl Defines GCONF_SCHEMA_FILE_DIR which is a filesystem directory where
407dnl  you should install foo.schemas files
408dnl
409
410AC_DEFUN(AM_GCONF_SOURCE_2,
411[
412  if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then
413    GCONF_SCHEMA_CONFIG_SOURCE=`gconftool-2 --get-default-source`
414  else
415    GCONF_SCHEMA_CONFIG_SOURCE=$GCONF_SCHEMA_INSTALL_SOURCE
416  fi
417
418  AC_ARG_WITH(gconf-source,
419  [  --with-gconf-source=sourceaddress      Config database for installing schema files.],GCONF_SCHEMA_CONFIG_SOURCE="$withval",)
420
421  AC_SUBST(GCONF_SCHEMA_CONFIG_SOURCE)
422  AC_MSG_RESULT([Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation])
423
424  if test "x$GCONF_SCHEMA_FILE_DIR" = "x"; then
425    GCONF_SCHEMA_FILE_DIR='$(sysconfdir)/gconf/schemas/'
426  else
427    GCONF_SCHEMA_FILE_DIR=$GCONF_SCHEMA_FILE_DIR
428  fi
429
430  AC_ARG_WITH(gconf-schema-file-dir,
431  [  --with-gconf-schema-file-dir=dir        Directory for installing schema files.],GCONF_SCHEMA_FILE_DIR="$withval",)
432
433  AC_SUBST(GCONF_SCHEMA_FILE_DIR)
434  AC_MSG_RESULT([Using $GCONF_SCHEMA_FILE_DIR as install directory for schema files])
435])
436
437# Define a conditional.
438
439AC_DEFUN([AM_CONDITIONAL],
440[AC_SUBST($1_TRUE)
441AC_SUBST($1_FALSE)
442if $2; then
443  $1_TRUE=
444  $1_FALSE='#'
445else
446  $1_TRUE='#'
447  $1_FALSE=
448fi])
449
450# Macro to add for using GNU gettext.
451# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
452#
453# Modified to never use included libintl.
454# Owen Taylor <otaylor@redhat.com>, 12/15/1998
455#
456# Major rework to remove unused code
457# Owen Taylor <otaylor@redhat.com>, 12/11/2002
458#
459# This file can be copied and used freely without restrictions.  It can
460# be used in projects which are not available under the GNU Public License
461# but which still want to provide support for the GNU gettext functionality.
462#
463
464#
465# We need this here as well, since someone might use autoconf-2.5x
466# to configure GLib then an older version to configure a package
467# using AM_GLIB_GNU_GETTEXT
468AC_PREREQ(2.53)
469
470dnl
471dnl We go to great lengths to make sure that aclocal won't
472dnl try to pull in the installed version of these macros
473dnl when running aclocal in the glib directory.
474dnl
475m4_copy([AC_DEFUN],[glib_DEFUN])
476m4_copy([AC_REQUIRE],[glib_REQUIRE])
477dnl
478dnl At the end, if we're not within glib, we'll define the public
479dnl definitions in terms of our private definitions.
480dnl
481
482# GLIB_LC_MESSAGES
483#--------------------
484glib_DEFUN([GLIB_LC_MESSAGES],
485  [AC_CHECK_HEADERS([locale.h])
486    if test $ac_cv_header_locale_h = yes; then
487    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
488      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
489       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
490    if test $am_cv_val_LC_MESSAGES = yes; then
491      AC_DEFINE(HAVE_LC_MESSAGES, 1,
492        [Define if your <locale.h> file defines LC_MESSAGES.])
493    fi
494  fi])
495
496# GLIB_PATH_PROG_WITH_TEST
497#----------------------------
498dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
499dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
500glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
501[# Extract the first word of "$2", so it can be a program name with args.
502set dummy $2; ac_word=[$]2
503AC_MSG_CHECKING([for $ac_word])
504AC_CACHE_VAL(ac_cv_path_$1,
505[case "[$]$1" in
506  /*)
507  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
508  ;;
509  *)
510  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
511  for ac_dir in ifelse([$5], , $PATH, [$5]); do
512    test -z "$ac_dir" && ac_dir=.
513    if test -f $ac_dir/$ac_word; then
514      if [$3]; then
515        ac_cv_path_$1="$ac_dir/$ac_word"
516        break
517      fi
518    fi
519  done
520  IFS="$ac_save_ifs"
521dnl If no 4th arg is given, leave the cache variable unset,
522dnl so AC_PATH_PROGS will keep looking.
523ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
524])dnl
525  ;;
526esac])dnl
527$1="$ac_cv_path_$1"
528if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
529  AC_MSG_RESULT([$]$1)
530else
531  AC_MSG_RESULT(no)
532fi
533AC_SUBST($1)dnl
534])
535
536# GLIB_WITH_NLS
537#-----------------
538glib_DEFUN([GLIB_WITH_NLS],
539  dnl NLS is obligatory
540  [USE_NLS=yes
541    AC_SUBST(USE_NLS)
542
543    gt_cv_have_gettext=no
544
545    CATOBJEXT=NONE
546    XGETTEXT=:
547    INTLLIBS=
548
549    AC_CHECK_HEADER(libintl.h,
550     [gt_cv_func_dgettext_libintl="no"
551      libintl_extra_libs=""
552
553      #
554      # First check in libc
555      #
556      AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
557        [AC_TRY_LINK([
558#include <libintl.h>
559],
560          [return (int) dgettext ("","")],
561          gt_cv_func_dgettext_libc=yes,
562          gt_cv_func_dgettext_libc=no)
563        ])
564 
565      if test "$gt_cv_func_dgettext_libc" = "yes" ; then
566        AC_CHECK_FUNCS(bind_textdomain_codeset)
567      fi
568
569      #
570      # If we don't have everything we want, check in libintl
571      #
572      if test "$gt_cv_func_dgettext_libc" != "yes" \
573         || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
574       
575        AC_CHECK_LIB(intl, bindtextdomain,
576            [AC_CHECK_LIB(intl, dgettext,
577                          gt_cv_func_dgettext_libintl=yes)])
578
579        if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
580          AC_MSG_CHECKING([if -liconv is needed to use gettext])
581          AC_MSG_RESULT([])
582          AC_CHECK_LIB(intl, dcgettext,
583                       [gt_cv_func_dgettext_libintl=yes
584                        libintl_extra_libs=-liconv],
585                        :,-liconv)
586        fi
587
588        #
589        # If we found libintl, then check in it for bind_textdomain_codeset();
590        # we'll prefer libc if neither have bind_textdomain_codeset(),
591        # and both have dgettext
592        #
593        if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
594          glib_save_LIBS="$LIBS"
595          LIBS="$LIBS -lintl $libintl_extra_libs"
596          unset ac_cv_func_bind_textdomain_codeset
597          AC_CHECK_FUNCS(bind_textdomain_codeset)
598          LIBS="$glib_save_LIBS"
599
600          if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
601            gt_cv_func_dgettext_libc=no
602          else
603            if test "$gt_cv_func_dgettext_libc" = "yes"; then
604              gt_cv_func_dgettext_libintl=no
605            fi
606          fi
607        fi
608      fi
609
610      if test "$gt_cv_func_dgettext_libc" = "yes" \
611        || test "$gt_cv_func_dgettext_libintl" = "yes"; then
612        gt_cv_have_gettext=yes
613      fi
614 
615      if test "$gt_cv_func_dgettext_libintl" = "yes"; then
616        INTLLIBS="-lintl $libintl_extra_libs"
617      fi
618 
619      if test "$gt_cv_have_gettext" = "yes"; then
620        AC_DEFINE(HAVE_GETTEXT,1,
621          [Define if the GNU gettext() function is already present or preinstalled.])
622        GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
623          [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
624        if test "$MSGFMT" != "no"; then
625          AC_CHECK_FUNCS(dcgettext)
626          AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
627          GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
628            [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
629          AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
630                         return _nl_msg_cat_cntr],
631            [CATOBJEXT=.gmo
632             DATADIRNAME=share],
633            [CATOBJEXT=.mo
634             DATADIRNAME=lib])
635          INSTOBJEXT=.mo
636        fi
637      fi
638    ])
639
640    if test "$gt_cv_have_gettext" = "yes" ; then
641      AC_DEFINE(ENABLE_NLS, 1,
642        [always defined to indicate that i18n is enabled])
643    fi
644
645    dnl Test whether we really found GNU xgettext.
646    if test "$XGETTEXT" != ":"; then
647      dnl If it is not GNU xgettext we define it as : so that the
648      dnl Makefiles still can work.
649      if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
650        : ;
651      else
652        AC_MSG_RESULT(
653          [found xgettext program is not GNU xgettext; ignore it])
654        XGETTEXT=":"
655      fi
656    fi
657
658    # We need to process the po/ directory.
659    POSUB=po
660
661    AC_OUTPUT_COMMANDS(
662      [case "$CONFIG_FILES" in *po/Makefile.in*)
663        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
664      esac])
665
666    dnl These rules are solely for the distribution goal.  While doing this
667    dnl we only have to keep exactly one list of the available catalogs
668    dnl in configure.in.
669    for lang in $ALL_LINGUAS; do
670      GMOFILES="$GMOFILES $lang.gmo"
671      POFILES="$POFILES $lang.po"
672    done
673
674    dnl Make all variables we use known to autoconf.
675    AC_SUBST(CATALOGS)
676    AC_SUBST(CATOBJEXT)
677    AC_SUBST(DATADIRNAME)
678    AC_SUBST(GMOFILES)
679    AC_SUBST(INSTOBJEXT)
680    AC_SUBST(INTLLIBS)
681    AC_SUBST(PO_IN_DATADIR_TRUE)
682    AC_SUBST(PO_IN_DATADIR_FALSE)
683    AC_SUBST(POFILES)
684    AC_SUBST(POSUB)
685  ])
686
687# AM_GLIB_GNU_GETTEXT
688# -------------------
689# Do checks necessary for use of gettext. If a suitable implementation
690# of gettext is found in either in libintl or in the C library,
691# it will set INTLLIBS to the libraries needed for use of gettext
692# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
693# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
694# on various variables needed by the Makefile.in.in installed by
695# glib-gettextize.
696dnl
697glib_DEFUN(GLIB_GNU_GETTEXT,
698  [AC_REQUIRE([AC_PROG_CC])dnl
699   AC_REQUIRE([AC_HEADER_STDC])dnl
700   
701   GLIB_LC_MESSAGES
702   GLIB_WITH_NLS
703
704   if test "$gt_cv_have_gettext" = "yes"; then
705     if test "x$ALL_LINGUAS" = "x"; then
706       LINGUAS=
707     else
708       AC_MSG_CHECKING(for catalogs to be installed)
709       NEW_LINGUAS=
710       for lang in ${LINGUAS=$ALL_LINGUAS}; do
711         case "$ALL_LINGUAS" in
712          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
713         esac
714       done
715       LINGUAS=$NEW_LINGUAS
716       AC_MSG_RESULT($LINGUAS)
717     fi
718
719     dnl Construct list of names of catalog files to be constructed.
720     if test -n "$LINGUAS"; then
721       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
722     fi
723   fi
724
725   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
726   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
727   dnl Try to locate is.
728   MKINSTALLDIRS=
729   if test -n "$ac_aux_dir"; then
730     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
731   fi
732   if test -z "$MKINSTALLDIRS"; then
733     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
734   fi
735   AC_SUBST(MKINSTALLDIRS)
736
737   dnl Generate list of files to be processed by xgettext which will
738   dnl be included in po/Makefile.
739   test -d po || mkdir po
740   if test "x$srcdir" != "x."; then
741     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
742       posrcprefix="$srcdir/"
743     else
744       posrcprefix="../$srcdir/"
745     fi
746   else
747     posrcprefix="../"
748   fi
749   rm -f po/POTFILES
750   sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
751        < $srcdir/po/POTFILES.in > po/POTFILES
752  ])
753
754# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
755# -------------------------------
756# Define VARIABLE to the location where catalog files will
757# be installed by po/Makefile.
758glib_DEFUN(GLIB_DEFINE_LOCALEDIR,
759[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
760glib_save_prefix="$prefix"
761test "x$prefix" = xNONE && prefix=$ac_default_prefix
762if test "x$CATOBJEXT" = "x.mo" ; then
763  localedir=`eval echo "${libdir}/locale"`
764else
765  localedir=`eval echo "${datadir}/locale"`
766fi
767prefix="$glib_save_prefix"
768AC_DEFINE_UNQUOTED($1, "$localedir",
769  [Define the location where the catalogs will be installed])
770])
771
772dnl
773dnl Now the definitions that aclocal will find
774dnl
775ifdef(glib_configure_in,[],[
776AC_DEFUN(AM_GLIB_GNU_GETTEXT,[GLIB_GNU_GETTEXT($@)])
777AC_DEFUN(AM_GLIB_DEFINE_LOCALEDIR,[GLIB_DEFINE_LOCALEDIR($@)])
778])dnl
779
Note: See TracBrowser for help on using the repository browser.