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
192 AC_DEFUN([AM_GLIB_WITH_NLS],
193 dnl NLS is obligatory
197 dnl Figure out what method
198 nls_cv_force_use_gnu_gettext="no"
200 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
201 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
202 dnl User does not insist on using GNU NLS library. Figure out what
203 dnl to use. If gettext or catgets are available (in this order) we
204 dnl use this. Else we have to fall back to GNU NLS library.
205 dnl catgets is only used if permitted by option --with-catgets.
211 AC_CHECK_HEADER(libintl.h,
212 [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
213 [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
214 gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
216 gt_cv_func_dgettext_libintl="no"
217 libintl_extra_libs=""
219 if test "$gt_cv_func_dgettext_libc" != "yes" ; then
220 AC_CHECK_LIB(intl, bindtextdomain,
221 [AC_CHECK_LIB(intl, dgettext,
222 gt_cv_func_dgettext_libintl=yes)])
224 if test "$gt_cv_func_dgettext_libc" != "yes" ; then
225 AC_MSG_CHECKING([if -liconv is needed to use gettext])
227 AC_CHECK_LIB(intl, dcgettext,
228 [gt_cv_func_dgettext_libintl=yes
229 libintl_extra_libs=-liconv],
234 if test "$gt_cv_func_dgettext_libintl" = "yes"; then
235 LIBS="$LIBS -lintl $libintl_extra_libs";
238 if test "$gt_cv_func_dgettext_libc" = "yes" \
239 || test "$gt_cv_func_dgettext_libintl" = "yes"; then
240 AC_DEFINE(HAVE_GETTEXT,1,
241 [Define if the GNU gettext() function is already present or preinstalled.])
242 AM_GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
243 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
244 if test "$MSGFMT" != "no"; then
245 AC_CHECK_FUNCS(dcgettext)
246 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
247 AM_GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
248 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
249 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
250 return _nl_msg_cat_cntr],
259 # Added by Martin Baulig 12/15/98 for libc5 systems
260 if test "$gt_cv_func_dgettext_libc" != "yes" \
261 && test "$gt_cv_func_dgettext_libintl" = "yes"; then
262 INTLLIBS="-lintl $libintl_extra_libs"
263 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
267 if test "$CATOBJEXT" = "NONE"; then
268 dnl Neither gettext nor catgets in included in the C library.
269 dnl Fall back on GNU gettext library.
270 nls_cv_use_gnu_gettext=yes
274 if test "$nls_cv_use_gnu_gettext" != "yes"; then
275 AC_DEFINE(ENABLE_NLS, 1,
276 [always defined to indicate that i18n is enabled])
278 dnl Unset this variable since we use the non-zero value as a flag.
282 dnl Test whether we really found GNU xgettext.
283 if test "$XGETTEXT" != ":"; then
284 dnl If it is no GNU xgettext we define it as : so that the
285 dnl Makefiles still can work.
286 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
290 [found xgettext program is not GNU xgettext; ignore it])
295 # We need to process the po/ directory.
299 [case "$CONFIG_FILES" in *po/Makefile.in*)
300 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
303 dnl These rules are solely for the distribution goal. While doing this
304 dnl we only have to keep exactly one list of the available catalogs
306 for lang in $ALL_LINGUAS; do
307 GMOFILES="$GMOFILES $lang.gmo"
308 POFILES="$POFILES $lang.po"
311 dnl Make all variables we use known to autoconf.
314 AC_SUBST(DATADIRNAME)
324 AC_DEFUN([AM_GLIB_GNU_GETTEXT],
325 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
326 AC_REQUIRE([AC_PROG_CC])dnl
327 AC_REQUIRE([AC_PROG_RANLIB])dnl
328 AC_REQUIRE([AC_HEADER_STDC])dnl
329 AC_REQUIRE([AC_C_CONST])dnl
330 AC_REQUIRE([AC_C_INLINE])dnl
331 AC_REQUIRE([AC_TYPE_OFF_T])dnl
332 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
333 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
334 AC_REQUIRE([AC_FUNC_MMAP])dnl
336 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
337 unistd.h sys/param.h])
338 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
339 strdup __argz_count __argz_stringify __argz_next])
344 if test "x$CATOBJEXT" != "x"; then
345 if test "x$ALL_LINGUAS" = "x"; then
348 AC_MSG_CHECKING(for catalogs to be installed)
350 for lang in ${LINGUAS=$ALL_LINGUAS}; do
351 case "$ALL_LINGUAS" in
352 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
356 AC_MSG_RESULT($LINGUAS)
359 dnl Construct list of names of catalog files to be constructed.
360 if test -n "$LINGUAS"; then
361 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
365 dnl Determine which catalog format we have (if any is needed)
366 dnl For now we know about two different formats:
367 dnl Linux libc-5 and the normal X/Open format
368 test -d po || mkdir po
369 if test "$CATOBJEXT" = ".cat"; then
370 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
372 dnl Transform the SED scripts while copying because some dumb SEDs
373 dnl cannot handle comments.
374 sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed
377 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
378 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
379 dnl Try to locate is.
381 if test -n "$ac_aux_dir"; then
382 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
384 if test -z "$MKINSTALLDIRS"; then
385 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
387 AC_SUBST(MKINSTALLDIRS)
389 dnl Generate list of files to be processed by xgettext which will
390 dnl be included in po/Makefile.
391 test -d po || mkdir po
392 if test "x$srcdir" != "x."; then
393 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
394 posrcprefix="$srcdir/"
396 posrcprefix="../$srcdir/"
402 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
403 < $srcdir/po/POTFILES.in > po/POTFILES