~ubuntu-branches/ubuntu/trusty/goocanvas/trusty-proposed

« back to all changes in this revision

Viewing changes to aclocal.m4

  • Committer: Bazaar Package Importer
  • Author(s): Jose Carlos Garcia Sogo
  • Date: 2007-05-14 22:49:11 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070514224911-vyv39khpicv46oe2
Tags: 0.8-2
Link gtk-doc to /usr/share/doc/libgoocanvas-dev (Closes: #423410)

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
12
# PARTICULAR PURPOSE.
13
13
 
 
14
# Copyright (C) 1995-2002 Free Software Foundation, Inc.
 
15
# Copyright (C) 2001-2003,2004 Red Hat, Inc.
 
16
#
 
17
# This file is free software, distributed under the terms of the GNU
 
18
# General Public License.  As a special exception to the GNU General
 
19
# Public License, this file may be distributed as part of a program
 
20
# that contains a configuration script generated by Autoconf, under
 
21
# the same distribution terms as the rest of that program.
 
22
#
 
23
# This file can be copied and used freely without restrictions.  It can
 
24
# be used in projects which are not available under the GNU Public License
 
25
# but which still want to provide support for the GNU gettext functionality.
 
26
#
 
27
# Macro to add for using GNU gettext.
 
28
# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
 
29
#
 
30
# Modified to never use included libintl. 
 
31
# Owen Taylor <otaylor@redhat.com>, 12/15/1998
 
32
#
 
33
# Major rework to remove unused code
 
34
# Owen Taylor <otaylor@redhat.com>, 12/11/2002
 
35
#
 
36
# Added better handling of ALL_LINGUAS from GNU gettext version 
 
37
# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
 
38
#
 
39
# Modified to require ngettext
 
40
# Matthias Clasen <mclasen@redhat.com> 08/06/2004
 
41
#
 
42
# We need this here as well, since someone might use autoconf-2.5x
 
43
# to configure GLib then an older version to configure a package
 
44
# using AM_GLIB_GNU_GETTEXT
 
45
AC_PREREQ(2.53)
 
46
 
 
47
dnl
 
48
dnl We go to great lengths to make sure that aclocal won't 
 
49
dnl try to pull in the installed version of these macros
 
50
dnl when running aclocal in the glib directory.
 
51
dnl
 
52
m4_copy([AC_DEFUN],[glib_DEFUN])
 
53
m4_copy([AC_REQUIRE],[glib_REQUIRE])
 
54
dnl
 
55
dnl At the end, if we're not within glib, we'll define the public
 
56
dnl definitions in terms of our private definitions.
 
57
dnl
 
58
 
 
59
# GLIB_LC_MESSAGES
 
60
#--------------------
 
61
glib_DEFUN([GLIB_LC_MESSAGES],
 
62
  [AC_CHECK_HEADERS([locale.h])
 
63
    if test $ac_cv_header_locale_h = yes; then
 
64
    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
 
65
      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
 
66
       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
 
67
    if test $am_cv_val_LC_MESSAGES = yes; then
 
68
      AC_DEFINE(HAVE_LC_MESSAGES, 1,
 
69
        [Define if your <locale.h> file defines LC_MESSAGES.])
 
70
    fi
 
71
  fi])
 
72
 
 
73
# GLIB_PATH_PROG_WITH_TEST
 
74
#----------------------------
 
75
dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
 
76
dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
 
77
glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
 
78
[# Extract the first word of "$2", so it can be a program name with args.
 
79
set dummy $2; ac_word=[$]2
 
80
AC_MSG_CHECKING([for $ac_word])
 
81
AC_CACHE_VAL(ac_cv_path_$1,
 
82
[case "[$]$1" in
 
83
  /*)
 
84
  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
 
85
  ;;
 
86
  *)
 
87
  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
 
88
  for ac_dir in ifelse([$5], , $PATH, [$5]); do
 
89
    test -z "$ac_dir" && ac_dir=.
 
90
    if test -f $ac_dir/$ac_word; then
 
91
      if [$3]; then
 
92
        ac_cv_path_$1="$ac_dir/$ac_word"
 
93
        break
 
94
      fi
 
95
    fi
 
96
  done
 
97
  IFS="$ac_save_ifs"
 
98
dnl If no 4th arg is given, leave the cache variable unset,
 
99
dnl so AC_PATH_PROGS will keep looking.
 
100
ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
 
101
])dnl
 
102
  ;;
 
103
esac])dnl
 
104
$1="$ac_cv_path_$1"
 
105
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
 
106
  AC_MSG_RESULT([$]$1)
 
107
else
 
108
  AC_MSG_RESULT(no)
 
109
fi
 
110
AC_SUBST($1)dnl
 
111
])
 
112
 
 
113
# GLIB_WITH_NLS
 
114
#-----------------
 
115
glib_DEFUN([GLIB_WITH_NLS],
 
116
  dnl NLS is obligatory
 
117
  [USE_NLS=yes
 
118
    AC_SUBST(USE_NLS)
 
119
 
 
120
    gt_cv_have_gettext=no
 
121
 
 
122
    CATOBJEXT=NONE
 
123
    XGETTEXT=:
 
124
    INTLLIBS=
 
125
 
 
126
    AC_CHECK_HEADER(libintl.h,
 
127
     [gt_cv_func_dgettext_libintl="no"
 
128
      libintl_extra_libs=""
 
129
 
 
130
      #
 
131
      # First check in libc
 
132
      #
 
133
      AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
 
134
        [AC_TRY_LINK([
 
135
#include <libintl.h>
 
136
],
 
137
         [return !ngettext ("","", 1)],
 
138
          gt_cv_func_ngettext_libc=yes,
 
139
          gt_cv_func_ngettext_libc=no)
 
140
        ])
 
141
  
 
142
      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
 
143
              AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
 
144
                [AC_TRY_LINK([
 
145
#include <libintl.h>
 
146
],
 
147
                  [return !dgettext ("","")],
 
148
                  gt_cv_func_dgettext_libc=yes,
 
149
                  gt_cv_func_dgettext_libc=no)
 
150
                ])
 
151
      fi
 
152
  
 
153
      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
 
154
        AC_CHECK_FUNCS(bind_textdomain_codeset)
 
155
      fi
 
156
 
 
157
      #
 
158
      # If we don't have everything we want, check in libintl
 
159
      #
 
160
      if test "$gt_cv_func_dgettext_libc" != "yes" \
 
161
         || test "$gt_cv_func_ngettext_libc" != "yes" \
 
162
         || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
 
163
        
 
164
        AC_CHECK_LIB(intl, bindtextdomain,
 
165
            [AC_CHECK_LIB(intl, ngettext,
 
166
                    [AC_CHECK_LIB(intl, dgettext,
 
167
                                  gt_cv_func_dgettext_libintl=yes)])])
 
168
 
 
169
        if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
 
170
          AC_MSG_CHECKING([if -liconv is needed to use gettext])
 
171
          AC_MSG_RESULT([])
 
172
          AC_CHECK_LIB(intl, ngettext,
 
173
                [AC_CHECK_LIB(intl, dcgettext,
 
174
                       [gt_cv_func_dgettext_libintl=yes
 
175
                        libintl_extra_libs=-liconv],
 
176
                        :,-liconv)],
 
177
                :,-liconv)
 
178
        fi
 
179
 
 
180
        #
 
181
        # If we found libintl, then check in it for bind_textdomain_codeset();
 
182
        # we'll prefer libc if neither have bind_textdomain_codeset(),
 
183
        # and both have dgettext and ngettext
 
184
        #
 
185
        if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
 
186
          glib_save_LIBS="$LIBS"
 
187
          LIBS="$LIBS -lintl $libintl_extra_libs"
 
188
          unset ac_cv_func_bind_textdomain_codeset
 
189
          AC_CHECK_FUNCS(bind_textdomain_codeset)
 
190
          LIBS="$glib_save_LIBS"
 
191
 
 
192
          if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
 
193
            gt_cv_func_dgettext_libc=no
 
194
          else
 
195
            if test "$gt_cv_func_dgettext_libc" = "yes" \
 
196
                && test "$gt_cv_func_ngettext_libc" = "yes"; then
 
197
              gt_cv_func_dgettext_libintl=no
 
198
            fi
 
199
          fi
 
200
        fi
 
201
      fi
 
202
 
 
203
      if test "$gt_cv_func_dgettext_libc" = "yes" \
 
204
        || test "$gt_cv_func_dgettext_libintl" = "yes"; then
 
205
        gt_cv_have_gettext=yes
 
206
      fi
 
207
  
 
208
      if test "$gt_cv_func_dgettext_libintl" = "yes"; then
 
209
        INTLLIBS="-lintl $libintl_extra_libs"
 
210
      fi
 
211
  
 
212
      if test "$gt_cv_have_gettext" = "yes"; then
 
213
        AC_DEFINE(HAVE_GETTEXT,1,
 
214
          [Define if the GNU gettext() function is already present or preinstalled.])
 
215
        GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
 
216
          [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
 
217
        if test "$MSGFMT" != "no"; then
 
218
          glib_save_LIBS="$LIBS"
 
219
          LIBS="$LIBS $INTLLIBS"
 
220
          AC_CHECK_FUNCS(dcgettext)
 
221
          AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
 
222
          GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
 
223
            [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
 
224
          AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
 
225
                         return _nl_msg_cat_cntr],
 
226
            [CATOBJEXT=.gmo 
 
227
             DATADIRNAME=share],
 
228
            [case $host in
 
229
            *-*-solaris*)
 
230
            dnl On Solaris, if bind_textdomain_codeset is in libc,
 
231
            dnl GNU format message catalog is always supported,
 
232
            dnl since both are added to the libc all together.
 
233
            dnl Hence, we'd like to go with DATADIRNAME=share and
 
234
            dnl and CATOBJEXT=.gmo in this case.
 
235
            AC_CHECK_FUNC(bind_textdomain_codeset,
 
236
              [CATOBJEXT=.gmo 
 
237
               DATADIRNAME=share],
 
238
              [CATOBJEXT=.mo
 
239
               DATADIRNAME=lib])
 
240
            ;;
 
241
            *)
 
242
            CATOBJEXT=.mo
 
243
            DATADIRNAME=lib
 
244
            ;;
 
245
            esac])
 
246
          LIBS="$glib_save_LIBS"
 
247
          INSTOBJEXT=.mo
 
248
        else
 
249
          gt_cv_have_gettext=no
 
250
        fi
 
251
      fi
 
252
    ])
 
253
 
 
254
    if test "$gt_cv_have_gettext" = "yes" ; then
 
255
      AC_DEFINE(ENABLE_NLS, 1,
 
256
        [always defined to indicate that i18n is enabled])
 
257
    fi
 
258
 
 
259
    dnl Test whether we really found GNU xgettext.
 
260
    if test "$XGETTEXT" != ":"; then
 
261
      dnl If it is not GNU xgettext we define it as : so that the
 
262
      dnl Makefiles still can work.
 
263
      if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
 
264
        : ;
 
265
      else
 
266
        AC_MSG_RESULT(
 
267
          [found xgettext program is not GNU xgettext; ignore it])
 
268
        XGETTEXT=":"
 
269
      fi
 
270
    fi
 
271
 
 
272
    # We need to process the po/ directory.
 
273
    POSUB=po
 
274
 
 
275
    AC_OUTPUT_COMMANDS(
 
276
      [case "$CONFIG_FILES" in *po/Makefile.in*)
 
277
        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
 
278
      esac])
 
279
 
 
280
    dnl These rules are solely for the distribution goal.  While doing this
 
281
    dnl we only have to keep exactly one list of the available catalogs
 
282
    dnl in configure.in.
 
283
    for lang in $ALL_LINGUAS; do
 
284
      GMOFILES="$GMOFILES $lang.gmo"
 
285
      POFILES="$POFILES $lang.po"
 
286
    done
 
287
 
 
288
    dnl Make all variables we use known to autoconf.
 
289
    AC_SUBST(CATALOGS)
 
290
    AC_SUBST(CATOBJEXT)
 
291
    AC_SUBST(DATADIRNAME)
 
292
    AC_SUBST(GMOFILES)
 
293
    AC_SUBST(INSTOBJEXT)
 
294
    AC_SUBST(INTLLIBS)
 
295
    AC_SUBST(PO_IN_DATADIR_TRUE)
 
296
    AC_SUBST(PO_IN_DATADIR_FALSE)
 
297
    AC_SUBST(POFILES)
 
298
    AC_SUBST(POSUB)
 
299
  ])
 
300
 
 
301
# AM_GLIB_GNU_GETTEXT
 
302
# -------------------
 
303
# Do checks necessary for use of gettext. If a suitable implementation 
 
304
# of gettext is found in either in libintl or in the C library,
 
305
# it will set INTLLIBS to the libraries needed for use of gettext
 
306
# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
 
307
# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
 
308
# on various variables needed by the Makefile.in.in installed by 
 
309
# glib-gettextize.
 
310
dnl
 
311
glib_DEFUN([GLIB_GNU_GETTEXT],
 
312
  [AC_REQUIRE([AC_PROG_CC])dnl
 
313
   AC_REQUIRE([AC_HEADER_STDC])dnl
 
314
   
 
315
   GLIB_LC_MESSAGES
 
316
   GLIB_WITH_NLS
 
317
 
 
318
   if test "$gt_cv_have_gettext" = "yes"; then
 
319
     if test "x$ALL_LINGUAS" = "x"; then
 
320
       LINGUAS=
 
321
     else
 
322
       AC_MSG_CHECKING(for catalogs to be installed)
 
323
       NEW_LINGUAS=
 
324
       for presentlang in $ALL_LINGUAS; do
 
325
         useit=no
 
326
         if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
 
327
           desiredlanguages="$LINGUAS"
 
328
         else
 
329
           desiredlanguages="$ALL_LINGUAS"
 
330
         fi
 
331
         for desiredlang in $desiredlanguages; do
 
332
           # Use the presentlang catalog if desiredlang is
 
333
           #   a. equal to presentlang, or
 
334
           #   b. a variant of presentlang (because in this case,
 
335
           #      presentlang can be used as a fallback for messages
 
336
           #      which are not translated in the desiredlang catalog).
 
337
           case "$desiredlang" in
 
338
             "$presentlang"*) useit=yes;;
 
339
           esac
 
340
         done
 
341
         if test $useit = yes; then
 
342
           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
 
343
         fi
 
344
       done
 
345
       LINGUAS=$NEW_LINGUAS
 
346
       AC_MSG_RESULT($LINGUAS)
 
347
     fi
 
348
 
 
349
     dnl Construct list of names of catalog files to be constructed.
 
350
     if test -n "$LINGUAS"; then
 
351
       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
 
352
     fi
 
353
   fi
 
354
 
 
355
   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
 
356
   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
 
357
   dnl Try to locate is.
 
358
   MKINSTALLDIRS=
 
359
   if test -n "$ac_aux_dir"; then
 
360
     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
 
361
   fi
 
362
   if test -z "$MKINSTALLDIRS"; then
 
363
     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
 
364
   fi
 
365
   AC_SUBST(MKINSTALLDIRS)
 
366
 
 
367
   dnl Generate list of files to be processed by xgettext which will
 
368
   dnl be included in po/Makefile.
 
369
   test -d po || mkdir po
 
370
   if test "x$srcdir" != "x."; then
 
371
     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
 
372
       posrcprefix="$srcdir/"
 
373
     else
 
374
       posrcprefix="../$srcdir/"
 
375
     fi
 
376
   else
 
377
     posrcprefix="../"
 
378
   fi
 
379
   rm -f po/POTFILES
 
380
   sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
 
381
        < $srcdir/po/POTFILES.in > po/POTFILES
 
382
  ])
 
383
 
 
384
# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
 
385
# -------------------------------
 
386
# Define VARIABLE to the location where catalog files will
 
387
# be installed by po/Makefile.
 
388
glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
 
389
[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
 
390
glib_save_prefix="$prefix"
 
391
glib_save_exec_prefix="$exec_prefix"
 
392
test "x$prefix" = xNONE && prefix=$ac_default_prefix
 
393
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
 
394
if test "x$CATOBJEXT" = "x.mo" ; then
 
395
  localedir=`eval echo "${libdir}/locale"`
 
396
else
 
397
  localedir=`eval echo "${datadir}/locale"`
 
398
fi
 
399
prefix="$glib_save_prefix"
 
400
exec_prefix="$glib_save_exec_prefix"
 
401
AC_DEFINE_UNQUOTED($1, "$localedir",
 
402
  [Define the location where the catalogs will be installed])
 
403
])
 
404
 
 
405
dnl
 
406
dnl Now the definitions that aclocal will find
 
407
dnl
 
408
ifdef(glib_configure_in,[],[
 
409
AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
 
410
AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
 
411
])dnl
 
412
 
 
413
dnl -*- mode: autoconf -*-
 
414
 
 
415
# serial 1
 
416
 
 
417
dnl Usage:
 
418
dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
 
419
AC_DEFUN([GTK_DOC_CHECK],
 
420
[
 
421
  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
 
422
  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
 
423
  dnl for overriding the documentation installation directory
 
424
  AC_ARG_WITH(html-dir,
 
425
    AC_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
 
426
    [with_html_dir='${datadir}/gtk-doc/html'])
 
427
  HTML_DIR="$with_html_dir"
 
428
  AC_SUBST(HTML_DIR)
 
429
 
 
430
  dnl enable/disable documentation building
 
431
  AC_ARG_ENABLE(gtk-doc,
 
432
    AC_HELP_STRING([--enable-gtk-doc],
 
433
                   [use gtk-doc to build documentation [default=no]]),,
 
434
    enable_gtk_doc=no)
 
435
 
 
436
  have_gtk_doc=no
 
437
  if test x$enable_gtk_doc = xyes; then
 
438
    if test -z "$PKG_CONFIG"; then
 
439
      AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
 
440
    fi
 
441
    if test "$PKG_CONFIG" != "no" && $PKG_CONFIG --exists gtk-doc; then
 
442
      have_gtk_doc=yes
 
443
    fi
 
444
 
 
445
  dnl do we want to do a version check?
 
446
ifelse([$1],[],,
 
447
    [gtk_doc_min_version=$1
 
448
    if test "$have_gtk_doc" = yes; then
 
449
      AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
 
450
      if $PKG_CONFIG --atleast-version $gtk_doc_min_version gtk-doc; then
 
451
        AC_MSG_RESULT(yes)
 
452
      else
 
453
        AC_MSG_RESULT(no)
 
454
        have_gtk_doc=no
 
455
      fi
 
456
    fi
 
457
])
 
458
    if test "$have_gtk_doc" != yes; then
 
459
      enable_gtk_doc=no
 
460
    fi
 
461
  fi
 
462
 
 
463
  AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
 
464
  AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
 
465
])
 
466
 
14
467
# isc-posix.m4 serial 2 (gettext-0.11.2)
15
468
dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
16
469
dnl This file is free software; the Free Software Foundation
7459
7912
AC_SUBST([am__untar])
7460
7913
]) # _AM_PROG_TAR
7461
7914
 
7462
 
# Copyright (C) 1995-2002 Free Software Foundation, Inc.
7463
 
# Copyright (C) 2001-2003,2004 Red Hat, Inc.
7464
 
#
7465
 
# This file is free software, distributed under the terms of the GNU
7466
 
# General Public License.  As a special exception to the GNU General
7467
 
# Public License, this file may be distributed as part of a program
7468
 
# that contains a configuration script generated by Autoconf, under
7469
 
# the same distribution terms as the rest of that program.
7470
 
#
7471
 
# This file can be copied and used freely without restrictions.  It can
7472
 
# be used in projects which are not available under the GNU Public License
7473
 
# but which still want to provide support for the GNU gettext functionality.
7474
 
#
7475
 
# Macro to add for using GNU gettext.
7476
 
# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
7477
 
#
7478
 
# Modified to never use included libintl. 
7479
 
# Owen Taylor <otaylor@redhat.com>, 12/15/1998
7480
 
#
7481
 
# Major rework to remove unused code
7482
 
# Owen Taylor <otaylor@redhat.com>, 12/11/2002
7483
 
#
7484
 
# Added better handling of ALL_LINGUAS from GNU gettext version 
7485
 
# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
7486
 
#
7487
 
# Modified to require ngettext
7488
 
# Matthias Clasen <mclasen@redhat.com> 08/06/2004
7489
 
#
7490
 
# We need this here as well, since someone might use autoconf-2.5x
7491
 
# to configure GLib then an older version to configure a package
7492
 
# using AM_GLIB_GNU_GETTEXT
7493
 
AC_PREREQ(2.53)
7494
 
 
7495
 
dnl
7496
 
dnl We go to great lengths to make sure that aclocal won't 
7497
 
dnl try to pull in the installed version of these macros
7498
 
dnl when running aclocal in the glib directory.
7499
 
dnl
7500
 
m4_copy([AC_DEFUN],[glib_DEFUN])
7501
 
m4_copy([AC_REQUIRE],[glib_REQUIRE])
7502
 
dnl
7503
 
dnl At the end, if we're not within glib, we'll define the public
7504
 
dnl definitions in terms of our private definitions.
7505
 
dnl
7506
 
 
7507
 
# GLIB_LC_MESSAGES
7508
 
#--------------------
7509
 
glib_DEFUN([GLIB_LC_MESSAGES],
7510
 
  [AC_CHECK_HEADERS([locale.h])
7511
 
    if test $ac_cv_header_locale_h = yes; then
7512
 
    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
7513
 
      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
7514
 
       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
7515
 
    if test $am_cv_val_LC_MESSAGES = yes; then
7516
 
      AC_DEFINE(HAVE_LC_MESSAGES, 1,
7517
 
        [Define if your <locale.h> file defines LC_MESSAGES.])
7518
 
    fi
7519
 
  fi])
7520
 
 
7521
 
# GLIB_PATH_PROG_WITH_TEST
7522
 
#----------------------------
7523
 
dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
7524
 
dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
7525
 
glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
7526
 
[# Extract the first word of "$2", so it can be a program name with args.
7527
 
set dummy $2; ac_word=[$]2
7528
 
AC_MSG_CHECKING([for $ac_word])
7529
 
AC_CACHE_VAL(ac_cv_path_$1,
7530
 
[case "[$]$1" in
7531
 
  /*)
7532
 
  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
7533
 
  ;;
7534
 
  *)
7535
 
  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
7536
 
  for ac_dir in ifelse([$5], , $PATH, [$5]); do
7537
 
    test -z "$ac_dir" && ac_dir=.
7538
 
    if test -f $ac_dir/$ac_word; then
7539
 
      if [$3]; then
7540
 
        ac_cv_path_$1="$ac_dir/$ac_word"
7541
 
        break
7542
 
      fi
7543
 
    fi
7544
 
  done
7545
 
  IFS="$ac_save_ifs"
7546
 
dnl If no 4th arg is given, leave the cache variable unset,
7547
 
dnl so AC_PATH_PROGS will keep looking.
7548
 
ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
7549
 
])dnl
7550
 
  ;;
7551
 
esac])dnl
7552
 
$1="$ac_cv_path_$1"
7553
 
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
7554
 
  AC_MSG_RESULT([$]$1)
7555
 
else
7556
 
  AC_MSG_RESULT(no)
7557
 
fi
7558
 
AC_SUBST($1)dnl
7559
 
])
7560
 
 
7561
 
# GLIB_WITH_NLS
7562
 
#-----------------
7563
 
glib_DEFUN([GLIB_WITH_NLS],
7564
 
  dnl NLS is obligatory
7565
 
  [AC_REQUIRE([AC_CANONICAL_HOST])dnl
7566
 
    USE_NLS=yes
7567
 
    AC_SUBST(USE_NLS)
7568
 
 
7569
 
    gt_cv_have_gettext=no
7570
 
 
7571
 
    CATOBJEXT=NONE
7572
 
    XGETTEXT=:
7573
 
    INTLLIBS=
7574
 
 
7575
 
    AC_CHECK_HEADER(libintl.h,
7576
 
     [gt_cv_func_dgettext_libintl="no"
7577
 
      libintl_extra_libs=""
7578
 
 
7579
 
      #
7580
 
      # First check in libc
7581
 
      #
7582
 
      AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
7583
 
        [AC_TRY_LINK([
7584
 
#include <libintl.h>
7585
 
],
7586
 
         [return !ngettext ("","", 1)],
7587
 
          gt_cv_func_ngettext_libc=yes,
7588
 
          gt_cv_func_ngettext_libc=no)
7589
 
        ])
7590
 
  
7591
 
      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
7592
 
              AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
7593
 
                [AC_TRY_LINK([
7594
 
#include <libintl.h>
7595
 
],
7596
 
                  [return !dgettext ("","")],
7597
 
                  gt_cv_func_dgettext_libc=yes,
7598
 
                  gt_cv_func_dgettext_libc=no)
7599
 
                ])
7600
 
      fi
7601
 
  
7602
 
      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
7603
 
        AC_CHECK_FUNCS(bind_textdomain_codeset)
7604
 
      fi
7605
 
 
7606
 
      #
7607
 
      # If we don't have everything we want, check in libintl
7608
 
      #
7609
 
      if test "$gt_cv_func_dgettext_libc" != "yes" \
7610
 
         || test "$gt_cv_func_ngettext_libc" != "yes" \
7611
 
         || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
7612
 
        
7613
 
        AC_CHECK_LIB(intl, bindtextdomain,
7614
 
            [AC_CHECK_LIB(intl, ngettext,
7615
 
                    [AC_CHECK_LIB(intl, dgettext,
7616
 
                                  gt_cv_func_dgettext_libintl=yes)])])
7617
 
 
7618
 
        if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
7619
 
          AC_MSG_CHECKING([if -liconv is needed to use gettext])
7620
 
          AC_MSG_RESULT([])
7621
 
          AC_CHECK_LIB(intl, ngettext,
7622
 
                [AC_CHECK_LIB(intl, dcgettext,
7623
 
                       [gt_cv_func_dgettext_libintl=yes
7624
 
                        libintl_extra_libs=-liconv],
7625
 
                        :,-liconv)],
7626
 
                :,-liconv)
7627
 
        fi
7628
 
 
7629
 
        #
7630
 
        # If we found libintl, then check in it for bind_textdomain_codeset();
7631
 
        # we'll prefer libc if neither have bind_textdomain_codeset(),
7632
 
        # and both have dgettext and ngettext
7633
 
        #
7634
 
        if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
7635
 
          glib_save_LIBS="$LIBS"
7636
 
          LIBS="$LIBS -lintl $libintl_extra_libs"
7637
 
          unset ac_cv_func_bind_textdomain_codeset
7638
 
          AC_CHECK_FUNCS(bind_textdomain_codeset)
7639
 
          LIBS="$glib_save_LIBS"
7640
 
 
7641
 
          if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
7642
 
            gt_cv_func_dgettext_libc=no
7643
 
          else
7644
 
            if test "$gt_cv_func_dgettext_libc" = "yes" \
7645
 
                && test "$gt_cv_func_ngettext_libc" = "yes"; then
7646
 
              gt_cv_func_dgettext_libintl=no
7647
 
            fi
7648
 
          fi
7649
 
        fi
7650
 
      fi
7651
 
 
7652
 
      if test "$gt_cv_func_dgettext_libc" = "yes" \
7653
 
        || test "$gt_cv_func_dgettext_libintl" = "yes"; then
7654
 
        gt_cv_have_gettext=yes
7655
 
      fi
7656
 
  
7657
 
      if test "$gt_cv_func_dgettext_libintl" = "yes"; then
7658
 
        INTLLIBS="-lintl $libintl_extra_libs"
7659
 
      fi
7660
 
  
7661
 
      if test "$gt_cv_have_gettext" = "yes"; then
7662
 
        AC_DEFINE(HAVE_GETTEXT,1,
7663
 
          [Define if the GNU gettext() function is already present or preinstalled.])
7664
 
        GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
7665
 
          [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
7666
 
        if test "$MSGFMT" != "no"; then
7667
 
          glib_save_LIBS="$LIBS"
7668
 
          LIBS="$LIBS $INTLLIBS"
7669
 
          AC_CHECK_FUNCS(dcgettext)
7670
 
          AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
7671
 
          GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
7672
 
            [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
7673
 
          AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
7674
 
                         return _nl_msg_cat_cntr],
7675
 
            [CATOBJEXT=.gmo 
7676
 
             DATADIRNAME=share],
7677
 
            [case $host in
7678
 
            *-*-solaris*)
7679
 
            dnl On Solaris, if bind_textdomain_codeset is in libc,
7680
 
            dnl GNU format message catalog is always supported,
7681
 
            dnl since both are added to the libc all together.
7682
 
            dnl Hence, we'd like to go with DATADIRNAME=share and
7683
 
            dnl and CATOBJEXT=.gmo in this case.
7684
 
            AC_CHECK_FUNC(bind_textdomain_codeset,
7685
 
              [CATOBJEXT=.gmo 
7686
 
               DATADIRNAME=share],
7687
 
              [CATOBJEXT=.mo
7688
 
               DATADIRNAME=lib])
7689
 
            ;;
7690
 
            *)
7691
 
            CATOBJEXT=.mo
7692
 
            DATADIRNAME=lib
7693
 
            ;;
7694
 
            esac])
7695
 
          LIBS="$glib_save_LIBS"
7696
 
          INSTOBJEXT=.mo
7697
 
        else
7698
 
          gt_cv_have_gettext=no
7699
 
        fi
7700
 
      fi
7701
 
    ])
7702
 
 
7703
 
    if test "$gt_cv_have_gettext" = "yes" ; then
7704
 
      AC_DEFINE(ENABLE_NLS, 1,
7705
 
        [always defined to indicate that i18n is enabled])
7706
 
    fi
7707
 
 
7708
 
    dnl Test whether we really found GNU xgettext.
7709
 
    if test "$XGETTEXT" != ":"; then
7710
 
      dnl If it is not GNU xgettext we define it as : so that the
7711
 
      dnl Makefiles still can work.
7712
 
      if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
7713
 
        : ;
7714
 
      else
7715
 
        AC_MSG_RESULT(
7716
 
          [found xgettext program is not GNU xgettext; ignore it])
7717
 
        XGETTEXT=":"
7718
 
      fi
7719
 
    fi
7720
 
 
7721
 
    # We need to process the po/ directory.
7722
 
    POSUB=po
7723
 
 
7724
 
    AC_OUTPUT_COMMANDS(
7725
 
      [case "$CONFIG_FILES" in *po/Makefile.in*)
7726
 
        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
7727
 
      esac])
7728
 
 
7729
 
    dnl These rules are solely for the distribution goal.  While doing this
7730
 
    dnl we only have to keep exactly one list of the available catalogs
7731
 
    dnl in configure.in.
7732
 
    for lang in $ALL_LINGUAS; do
7733
 
      GMOFILES="$GMOFILES $lang.gmo"
7734
 
      POFILES="$POFILES $lang.po"
7735
 
    done
7736
 
 
7737
 
    dnl Make all variables we use known to autoconf.
7738
 
    AC_SUBST(CATALOGS)
7739
 
    AC_SUBST(CATOBJEXT)
7740
 
    AC_SUBST(DATADIRNAME)
7741
 
    AC_SUBST(GMOFILES)
7742
 
    AC_SUBST(INSTOBJEXT)
7743
 
    AC_SUBST(INTLLIBS)
7744
 
    AC_SUBST(PO_IN_DATADIR_TRUE)
7745
 
    AC_SUBST(PO_IN_DATADIR_FALSE)
7746
 
    AC_SUBST(POFILES)
7747
 
    AC_SUBST(POSUB)
7748
 
  ])
7749
 
 
7750
 
# AM_GLIB_GNU_GETTEXT
7751
 
# -------------------
7752
 
# Do checks necessary for use of gettext. If a suitable implementation 
7753
 
# of gettext is found in either in libintl or in the C library,
7754
 
# it will set INTLLIBS to the libraries needed for use of gettext
7755
 
# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
7756
 
# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
7757
 
# on various variables needed by the Makefile.in.in installed by 
7758
 
# glib-gettextize.
7759
 
dnl
7760
 
glib_DEFUN([GLIB_GNU_GETTEXT],
7761
 
  [AC_REQUIRE([AC_PROG_CC])dnl
7762
 
   AC_REQUIRE([AC_HEADER_STDC])dnl
7763
 
   
7764
 
   GLIB_LC_MESSAGES
7765
 
   GLIB_WITH_NLS
7766
 
 
7767
 
   if test "$gt_cv_have_gettext" = "yes"; then
7768
 
     if test "x$ALL_LINGUAS" = "x"; then
7769
 
       LINGUAS=
7770
 
     else
7771
 
       AC_MSG_CHECKING(for catalogs to be installed)
7772
 
       NEW_LINGUAS=
7773
 
       for presentlang in $ALL_LINGUAS; do
7774
 
         useit=no
7775
 
         if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
7776
 
           desiredlanguages="$LINGUAS"
7777
 
         else
7778
 
           desiredlanguages="$ALL_LINGUAS"
7779
 
         fi
7780
 
         for desiredlang in $desiredlanguages; do
7781
 
           # Use the presentlang catalog if desiredlang is
7782
 
           #   a. equal to presentlang, or
7783
 
           #   b. a variant of presentlang (because in this case,
7784
 
           #      presentlang can be used as a fallback for messages
7785
 
           #      which are not translated in the desiredlang catalog).
7786
 
           case "$desiredlang" in
7787
 
             "$presentlang"*) useit=yes;;
7788
 
           esac
7789
 
         done
7790
 
         if test $useit = yes; then
7791
 
           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
7792
 
         fi
7793
 
       done
7794
 
       LINGUAS=$NEW_LINGUAS
7795
 
       AC_MSG_RESULT($LINGUAS)
7796
 
     fi
7797
 
 
7798
 
     dnl Construct list of names of catalog files to be constructed.
7799
 
     if test -n "$LINGUAS"; then
7800
 
       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
7801
 
     fi
7802
 
   fi
7803
 
 
7804
 
   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
7805
 
   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
7806
 
   dnl Try to locate is.
7807
 
   MKINSTALLDIRS=
7808
 
   if test -n "$ac_aux_dir"; then
7809
 
     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
7810
 
   fi
7811
 
   if test -z "$MKINSTALLDIRS"; then
7812
 
     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
7813
 
   fi
7814
 
   AC_SUBST(MKINSTALLDIRS)
7815
 
 
7816
 
   dnl Generate list of files to be processed by xgettext which will
7817
 
   dnl be included in po/Makefile.
7818
 
   test -d po || mkdir po
7819
 
   if test "x$srcdir" != "x."; then
7820
 
     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
7821
 
       posrcprefix="$srcdir/"
7822
 
     else
7823
 
       posrcprefix="../$srcdir/"
7824
 
     fi
7825
 
   else
7826
 
     posrcprefix="../"
7827
 
   fi
7828
 
   rm -f po/POTFILES
7829
 
   sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
7830
 
        < $srcdir/po/POTFILES.in > po/POTFILES
7831
 
  ])
7832
 
 
7833
 
# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
7834
 
# -------------------------------
7835
 
# Define VARIABLE to the location where catalog files will
7836
 
# be installed by po/Makefile.
7837
 
glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
7838
 
[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
7839
 
glib_save_prefix="$prefix"
7840
 
glib_save_exec_prefix="$exec_prefix"
7841
 
glib_save_datarootdir="$datarootdir"
7842
 
test "x$prefix" = xNONE && prefix=$ac_default_prefix
7843
 
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
7844
 
datarootdir=`eval echo "${datarootdir}"`
7845
 
if test "x$CATOBJEXT" = "x.mo" ; then
7846
 
  localedir=`eval echo "${libdir}/locale"`
7847
 
else
7848
 
  localedir=`eval echo "${datadir}/locale"`
7849
 
fi
7850
 
prefix="$glib_save_prefix"
7851
 
exec_prefix="$glib_save_exec_prefix"
7852
 
datarootdir="$glib_save_datarootdir"
7853
 
AC_DEFINE_UNQUOTED($1, "$localedir",
7854
 
  [Define the location where the catalogs will be installed])
7855
 
])
7856
 
 
7857
 
dnl
7858
 
dnl Now the definitions that aclocal will find
7859
 
dnl
7860
 
ifdef(glib_configure_in,[],[
7861
 
AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
7862
 
AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
7863
 
])dnl
7864
 
 
7865
 
dnl -*- mode: autoconf -*-
7866
 
 
7867
 
# serial 1
7868
 
 
7869
 
dnl Usage:
7870
 
dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
7871
 
AC_DEFUN([GTK_DOC_CHECK],
7872
 
[
7873
 
  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
7874
 
  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
7875
 
  dnl for overriding the documentation installation directory
7876
 
  AC_ARG_WITH(html-dir,
7877
 
    AC_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
7878
 
    [with_html_dir='${datadir}/gtk-doc/html'])
7879
 
  HTML_DIR="$with_html_dir"
7880
 
  AC_SUBST(HTML_DIR)
7881
 
 
7882
 
  dnl enable/disable documentation building
7883
 
  AC_ARG_ENABLE(gtk-doc,
7884
 
    AC_HELP_STRING([--enable-gtk-doc],
7885
 
                   [use gtk-doc to build documentation [default=no]]),,
7886
 
    enable_gtk_doc=no)
7887
 
 
7888
 
  have_gtk_doc=no
7889
 
  if test x$enable_gtk_doc = xyes; then
7890
 
    if test -z "$PKG_CONFIG"; then
7891
 
      AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
7892
 
    fi
7893
 
    if test "$PKG_CONFIG" != "no" && $PKG_CONFIG --exists gtk-doc; then
7894
 
      have_gtk_doc=yes
7895
 
    fi
7896
 
 
7897
 
  dnl do we want to do a version check?
7898
 
ifelse([$1],[],,
7899
 
    [gtk_doc_min_version=$1
7900
 
    if test "$have_gtk_doc" = yes; then
7901
 
      AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
7902
 
      if $PKG_CONFIG --atleast-version $gtk_doc_min_version gtk-doc; then
7903
 
        AC_MSG_RESULT(yes)
7904
 
      else
7905
 
        AC_MSG_RESULT(no)
7906
 
        have_gtk_doc=no
7907
 
      fi
7908
 
    fi
7909
 
])
7910
 
    if test "$have_gtk_doc" != yes; then
7911
 
      enable_gtk_doc=no
7912
 
    fi
7913
 
  fi
7914
 
 
7915
 
  AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
7916
 
  AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
7917
 
])
7918