6 AC_DEFUN([GNOME_COMMON_INIT],
8 AC_CACHE_VAL(ac_cv_gnome_aclocal_dir,
9 [ac_cv_gnome_aclocal_dir="$GNOME_COMMON_MACROS_DIR"])
10 AC_CACHE_VAL(ac_cv_gnome_aclocal_flags,
11 [ac_cv_gnome_aclocal_flags="$ACLOCAL_FLAGS"])
12 GNOME_ACLOCAL_DIR="$ac_cv_gnome_aclocal_dir"
13 GNOME_ACLOCAL_FLAGS="$ac_cv_gnome_aclocal_flags"
14 AC_SUBST(GNOME_ACLOCAL_DIR)
15 AC_SUBST(GNOME_ACLOCAL_FLAGS)
17 ACLOCAL="$ACLOCAL $GNOME_ACLOCAL_FLAGS"
19 AM_CONDITIONAL(INSIDE_GNOME_DOCU, false)
22 AC_DEFUN([GNOME_GTKDOC_CHECK],
24 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
25 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
26 AC_SUBST(HAVE_GTK_DOC)
28 dnl Let people disable the gtk-doc stuff.
29 AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
31 if test x$enable_gtk_doc = xauto ; then
32 if test x$GTKDOC = xtrue ; then
39 dnl NOTE: We need to use a separate automake conditional for this
40 dnl to make this work with the tarballs.
41 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
44 AC_DEFUN([GNOME_DEBUG_CHECK],
46 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]], enable_debug="$enableval", enable_debug=no)
48 if test x$enable_debug = xyes ; then
49 AC_DEFINE(GNOME_ENABLE_DEBUG)
53 # Define a conditional.
55 AC_DEFUN([AM_CONDITIONAL],
67 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
68 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
69 dnl also defines GSTUFF_PKG_ERRORS on error
70 AC_DEFUN([PKG_CHECK_MODULES], [
73 if test -z "$PKG_CONFIG"; then
74 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
77 if test "$PKG_CONFIG" = "no" ; then
78 echo "*** The pkg-config script could not be found. Make sure it is"
79 echo "*** in your path, or set the PKG_CONFIG environment variable"
80 echo "*** to the full path to pkg-config."
81 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
83 PKG_CONFIG_MIN_VERSION=0.9.0
84 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
85 AC_MSG_CHECKING(for $2)
87 if $PKG_CONFIG --exists "$2" ; then
91 AC_MSG_CHECKING($1_CFLAGS)
92 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
93 AC_MSG_RESULT($$1_CFLAGS)
95 AC_MSG_CHECKING($1_LIBS)
96 $1_LIBS=`$PKG_CONFIG --libs "$2"`
97 AC_MSG_RESULT($$1_LIBS)
101 ## If we have a custom action on failure, don't print errors, but
102 ## do set a variable so people can do so.
103 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
104 ifelse([$4], ,echo $$1_PKG_ERRORS,)
110 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
111 echo "*** See http://www.freedesktop.org/software/pkgconfig"
115 if test $succeeded = yes; then
116 ifelse([$3], , :, [$3])
118 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])
124 # Macro to add for using GNU gettext.
125 # Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
127 # Modified to never use included libintl.
128 # Owen Taylor <otaylor@redhat.com>, 12/15/1998
131 # This file can be copied and used freely without restrictions. It can
132 # be used in projects which are not available under the GNU Public License
133 # but which still want to provide support for the GNU gettext functionality.
134 # Please note that the actual code is *not* freely available.
137 # If you make changes to this file, you MUST update the copy in
138 # acinclude.m4. [ aclocal dies on duplicate macros, so if
139 # we run 'aclocal -I macros/' then we'll run into problems
140 # once we've installed glib-gettext.m4 :-( ]
143 AC_DEFUN([AM_GLIB_LC_MESSAGES],
144 [if test $ac_cv_header_locale_h = yes; then
145 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
146 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
147 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
148 if test $am_cv_val_LC_MESSAGES = yes; then
149 AC_DEFINE(HAVE_LC_MESSAGES, 1,
150 [Define if your <locale.h> file defines LC_MESSAGES.])
154 dnl AM_GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
155 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
156 AC_DEFUN([AM_GLIB_PATH_PROG_WITH_TEST],
157 [# Extract the first word of "$2", so it can be a program name with args.
158 set dummy $2; ac_word=[$]2
159 AC_MSG_CHECKING([for $ac_word])
160 AC_CACHE_VAL(ac_cv_path_$1,
163 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
166 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
167 for ac_dir in ifelse([$5], , $PATH, [$5]); do
168 test -z "$ac_dir" && ac_dir=.
169 if test -f $ac_dir/$ac_word; then
171 ac_cv_path_$1="$ac_dir/$ac_word"
177 dnl If no 4th arg is given, leave the cache variable unset,
178 dnl so AC_PATH_PROGS will keep looking.
179 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
184 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
194 AC_DEFUN([AM_GLIB_WITH_NLS],
195 dnl NLS is obligatory
199 dnl Figure out what method
200 nls_cv_force_use_gnu_gettext="no"
202 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
203 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
204 dnl User does not insist on using GNU NLS library. Figure out what
205 dnl to use. If gettext or catgets are available (in this order) we
206 dnl use this. Else we have to fall back to GNU NLS library.
207 dnl catgets is only used if permitted by option --with-catgets.
213 AC_CHECK_HEADER(libintl.h,
214 [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
215 [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
216 gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
218 gt_cv_func_dgettext_libintl="no"
219 libintl_extra_libs=""
221 if test "$gt_cv_func_dgettext_libc" != "yes" ; then
222 AC_CHECK_LIB(intl, bindtextdomain,
223 [AC_CHECK_LIB(intl, dgettext,
224 gt_cv_func_dgettext_libintl=yes)])
226 if test "$gt_cv_func_dgettext_libc" != "yes" ; then
227 AC_MSG_CHECKING([if -liconv is needed to use gettext])
229 AC_CHECK_LIB(intl, dcgettext,
230 [gt_cv_func_dgettext_libintl=yes
231 libintl_extra_libs=-liconv],
236 if test "$gt_cv_func_dgettext_libintl" = "yes"; then
237 LIBS="$LIBS -lintl $libintl_extra_libs";
240 if test "$gt_cv_func_dgettext_libc" = "yes" \
241 || test "$gt_cv_func_dgettext_libintl" = "yes"; then
242 AC_DEFINE(HAVE_GETTEXT,1,
243 [Define if the GNU gettext() function is already present or preinstalled.])
244 AM_GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
245 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
246 if test "$MSGFMT" != "no"; then
247 AC_CHECK_FUNCS(dcgettext)
248 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
249 AM_GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
250 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
251 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
252 return _nl_msg_cat_cntr],
261 # Added by Martin Baulig 12/15/98 for libc5 systems
262 if test "$gt_cv_func_dgettext_libc" != "yes" \
263 && test "$gt_cv_func_dgettext_libintl" = "yes"; then
264 INTLLIBS="-lintl $libintl_extra_libs"
265 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
269 if test "$CATOBJEXT" = "NONE"; then
270 dnl Neither gettext nor catgets in included in the C library.
271 dnl Fall back on GNU gettext library.
272 nls_cv_use_gnu_gettext=yes
276 if test "$nls_cv_use_gnu_gettext" != "yes"; then
277 AC_DEFINE(ENABLE_NLS, 1,
278 [always defined to indicate that i18n is enabled])
280 dnl Unset this variable since we use the non-zero value as a flag.
284 dnl Test whether we really found GNU xgettext.
285 if test "$XGETTEXT" != ":"; then
286 dnl If it is no GNU xgettext we define it as : so that the
287 dnl Makefiles still can work.
288 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
292 [found xgettext program is not GNU xgettext; ignore it])
297 # We need to process the po/ directory.
301 [case "$CONFIG_FILES" in *po/Makefile.in*)
302 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
305 dnl These rules are solely for the distribution goal. While doing this
306 dnl we only have to keep exactly one list of the available catalogs
308 for lang in $ALL_LINGUAS; do
309 GMOFILES="$GMOFILES $lang.gmo"
310 POFILES="$POFILES $lang.po"
313 dnl Make all variables we use known to autoconf.
316 AC_SUBST(DATADIRNAME)
326 AC_DEFUN([AM_GLIB_GNU_GETTEXT],
327 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
328 AC_REQUIRE([AC_PROG_CC])dnl
329 AC_REQUIRE([AC_PROG_RANLIB])dnl
330 AC_REQUIRE([AC_HEADER_STDC])dnl
331 AC_REQUIRE([AC_C_CONST])dnl
332 AC_REQUIRE([AC_C_INLINE])dnl
333 AC_REQUIRE([AC_TYPE_OFF_T])dnl
334 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
335 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
336 AC_REQUIRE([AC_FUNC_MMAP])dnl
338 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
339 unistd.h sys/param.h])
340 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
341 strdup __argz_count __argz_stringify __argz_next])
346 if test "x$CATOBJEXT" != "x"; then
347 if test "x$ALL_LINGUAS" = "x"; then
350 AC_MSG_CHECKING(for catalogs to be installed)
352 for lang in ${LINGUAS=$ALL_LINGUAS}; do
353 case "$ALL_LINGUAS" in
354 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
358 AC_MSG_RESULT($LINGUAS)
361 dnl Construct list of names of catalog files to be constructed.
362 if test -n "$LINGUAS"; then
363 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
367 dnl Determine which catalog format we have (if any is needed)
368 dnl For now we know about two different formats:
369 dnl Linux libc-5 and the normal X/Open format
370 test -d po || mkdir po
371 if test "$CATOBJEXT" = ".cat"; then
372 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
374 dnl Transform the SED scripts while copying because some dumb SEDs
375 dnl cannot handle comments.
376 sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed
379 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
380 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
381 dnl Try to locate is.
383 if test -n "$ac_aux_dir"; then
384 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
386 if test -z "$MKINSTALLDIRS"; then
387 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
389 AC_SUBST(MKINSTALLDIRS)
391 dnl Generate list of files to be processed by xgettext which will
392 dnl be included in po/Makefile.
393 test -d po || mkdir po
394 if test "x$srcdir" != "x."; then
395 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
396 posrcprefix="$srcdir/"
398 posrcprefix="../$srcdir/"
404 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
405 < $srcdir/po/POTFILES.in > po/POTFILES