~ubuntu-branches/ubuntu/precise/simple-scan/precise

« back to all changes in this revision

Viewing changes to aclocal.m4

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-08-30 11:13:49 UTC
  • mfrom: (1.1.22 upstream)
  • Revision ID: james.westby@ubuntu.com-20100830111349-qv7xkbjmkjogx6mw
Tags: 2.31.91-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
  AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [test "$enable_schemas_install" != no])
65
65
])
66
66
 
67
 
# Copyright (C) 1995-2002 Free Software Foundation, Inc.
68
 
# Copyright (C) 2001-2003,2004 Red Hat, Inc.
69
 
#
70
 
# This file is free software, distributed under the terms of the GNU
71
 
# General Public License.  As a special exception to the GNU General
72
 
# Public License, this file may be distributed as part of a program
73
 
# that contains a configuration script generated by Autoconf, under
74
 
# the same distribution terms as the rest of that program.
75
 
#
76
 
# This file can be copied and used freely without restrictions.  It can
77
 
# be used in projects which are not available under the GNU Public License
78
 
# but which still want to provide support for the GNU gettext functionality.
79
 
#
80
 
# Macro to add for using GNU gettext.
81
 
# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
82
 
#
83
 
# Modified to never use included libintl. 
84
 
# Owen Taylor <otaylor@redhat.com>, 12/15/1998
85
 
#
86
 
# Major rework to remove unused code
87
 
# Owen Taylor <otaylor@redhat.com>, 12/11/2002
88
 
#
89
 
# Added better handling of ALL_LINGUAS from GNU gettext version 
90
 
# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
91
 
#
92
 
# Modified to require ngettext
93
 
# Matthias Clasen <mclasen@redhat.com> 08/06/2004
94
 
#
95
 
# We need this here as well, since someone might use autoconf-2.5x
96
 
# to configure GLib then an older version to configure a package
97
 
# using AM_GLIB_GNU_GETTEXT
98
 
AC_PREREQ(2.53)
99
 
 
100
 
dnl
101
 
dnl We go to great lengths to make sure that aclocal won't 
102
 
dnl try to pull in the installed version of these macros
103
 
dnl when running aclocal in the glib directory.
104
 
dnl
105
 
m4_copy([AC_DEFUN],[glib_DEFUN])
106
 
m4_copy([AC_REQUIRE],[glib_REQUIRE])
107
 
dnl
108
 
dnl At the end, if we're not within glib, we'll define the public
109
 
dnl definitions in terms of our private definitions.
110
 
dnl
111
 
 
112
 
# GLIB_LC_MESSAGES
113
 
#--------------------
114
 
glib_DEFUN([GLIB_LC_MESSAGES],
115
 
  [AC_CHECK_HEADERS([locale.h])
116
 
    if test $ac_cv_header_locale_h = yes; then
117
 
    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
118
 
      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
119
 
       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
120
 
    if test $am_cv_val_LC_MESSAGES = yes; then
121
 
      AC_DEFINE(HAVE_LC_MESSAGES, 1,
122
 
        [Define if your <locale.h> file defines LC_MESSAGES.])
123
 
    fi
124
 
  fi])
125
 
 
126
 
# GLIB_PATH_PROG_WITH_TEST
127
 
#----------------------------
128
 
dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
129
 
dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
130
 
glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
131
 
[# Extract the first word of "$2", so it can be a program name with args.
132
 
set dummy $2; ac_word=[$]2
133
 
AC_MSG_CHECKING([for $ac_word])
134
 
AC_CACHE_VAL(ac_cv_path_$1,
135
 
[case "[$]$1" in
136
 
  /*)
137
 
  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
138
 
  ;;
139
 
  *)
140
 
  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
141
 
  for ac_dir in ifelse([$5], , $PATH, [$5]); do
142
 
    test -z "$ac_dir" && ac_dir=.
143
 
    if test -f $ac_dir/$ac_word; then
144
 
      if [$3]; then
145
 
        ac_cv_path_$1="$ac_dir/$ac_word"
146
 
        break
147
 
      fi
148
 
    fi
149
 
  done
150
 
  IFS="$ac_save_ifs"
151
 
dnl If no 4th arg is given, leave the cache variable unset,
152
 
dnl so AC_PATH_PROGS will keep looking.
153
 
ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
154
 
])dnl
155
 
  ;;
156
 
esac])dnl
157
 
$1="$ac_cv_path_$1"
158
 
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
159
 
  AC_MSG_RESULT([$]$1)
160
 
else
161
 
  AC_MSG_RESULT(no)
162
 
fi
163
 
AC_SUBST($1)dnl
164
 
])
165
 
 
166
 
# GLIB_WITH_NLS
167
 
#-----------------
168
 
glib_DEFUN([GLIB_WITH_NLS],
169
 
  dnl NLS is obligatory
170
 
  [USE_NLS=yes
171
 
    AC_SUBST(USE_NLS)
172
 
 
173
 
    gt_cv_have_gettext=no
174
 
 
175
 
    CATOBJEXT=NONE
176
 
    XGETTEXT=:
177
 
    INTLLIBS=
178
 
 
179
 
    AC_CHECK_HEADER(libintl.h,
180
 
     [gt_cv_func_dgettext_libintl="no"
181
 
      libintl_extra_libs=""
182
 
 
183
 
      #
184
 
      # First check in libc
185
 
      #
186
 
      AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
187
 
        [AC_TRY_LINK([
188
 
#include <libintl.h>
189
 
],
190
 
         [return !ngettext ("","", 1)],
191
 
          gt_cv_func_ngettext_libc=yes,
192
 
          gt_cv_func_ngettext_libc=no)
193
 
        ])
194
 
  
195
 
      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
196
 
              AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
197
 
                [AC_TRY_LINK([
198
 
#include <libintl.h>
199
 
],
200
 
                  [return !dgettext ("","")],
201
 
                  gt_cv_func_dgettext_libc=yes,
202
 
                  gt_cv_func_dgettext_libc=no)
203
 
                ])
204
 
      fi
205
 
  
206
 
      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
207
 
        AC_CHECK_FUNCS(bind_textdomain_codeset)
208
 
      fi
209
 
 
210
 
      #
211
 
      # If we don't have everything we want, check in libintl
212
 
      #
213
 
      if test "$gt_cv_func_dgettext_libc" != "yes" \
214
 
         || test "$gt_cv_func_ngettext_libc" != "yes" \
215
 
         || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
216
 
        
217
 
        AC_CHECK_LIB(intl, bindtextdomain,
218
 
            [AC_CHECK_LIB(intl, ngettext,
219
 
                    [AC_CHECK_LIB(intl, dgettext,
220
 
                                  gt_cv_func_dgettext_libintl=yes)])])
221
 
 
222
 
        if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
223
 
          AC_MSG_CHECKING([if -liconv is needed to use gettext])
224
 
          AC_MSG_RESULT([])
225
 
          AC_CHECK_LIB(intl, ngettext,
226
 
                [AC_CHECK_LIB(intl, dcgettext,
227
 
                       [gt_cv_func_dgettext_libintl=yes
228
 
                        libintl_extra_libs=-liconv],
229
 
                        :,-liconv)],
230
 
                :,-liconv)
231
 
        fi
232
 
 
233
 
        #
234
 
        # If we found libintl, then check in it for bind_textdomain_codeset();
235
 
        # we'll prefer libc if neither have bind_textdomain_codeset(),
236
 
        # and both have dgettext and ngettext
237
 
        #
238
 
        if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
239
 
          glib_save_LIBS="$LIBS"
240
 
          LIBS="$LIBS -lintl $libintl_extra_libs"
241
 
          unset ac_cv_func_bind_textdomain_codeset
242
 
          AC_CHECK_FUNCS(bind_textdomain_codeset)
243
 
          LIBS="$glib_save_LIBS"
244
 
 
245
 
          if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
246
 
            gt_cv_func_dgettext_libc=no
247
 
          else
248
 
            if test "$gt_cv_func_dgettext_libc" = "yes" \
249
 
                && test "$gt_cv_func_ngettext_libc" = "yes"; then
250
 
              gt_cv_func_dgettext_libintl=no
251
 
            fi
252
 
          fi
253
 
        fi
254
 
      fi
255
 
 
256
 
      if test "$gt_cv_func_dgettext_libc" = "yes" \
257
 
        || test "$gt_cv_func_dgettext_libintl" = "yes"; then
258
 
        gt_cv_have_gettext=yes
259
 
      fi
260
 
  
261
 
      if test "$gt_cv_func_dgettext_libintl" = "yes"; then
262
 
        INTLLIBS="-lintl $libintl_extra_libs"
263
 
      fi
264
 
  
265
 
      if test "$gt_cv_have_gettext" = "yes"; then
266
 
        AC_DEFINE(HAVE_GETTEXT,1,
267
 
          [Define if the GNU gettext() function is already present or preinstalled.])
268
 
        GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
269
 
          [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
270
 
        if test "$MSGFMT" != "no"; then
271
 
          glib_save_LIBS="$LIBS"
272
 
          LIBS="$LIBS $INTLLIBS"
273
 
          AC_CHECK_FUNCS(dcgettext)
274
 
          MSGFMT_OPTS=
275
 
          AC_MSG_CHECKING([if msgfmt accepts -c])
276
 
          GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[
277
 
msgid ""
278
 
msgstr ""
279
 
"Content-Type: text/plain; charset=UTF-8\n"
280
 
"Project-Id-Version: test 1.0\n"
281
 
"PO-Revision-Date: 2007-02-15 12:01+0100\n"
282
 
"Last-Translator: test <foo@bar.xx>\n"
283
 
"Language-Team: C <LL@li.org>\n"
284
 
"MIME-Version: 1.0\n"
285
 
"Content-Transfer-Encoding: 8bit\n"
286
 
], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
287
 
          AC_SUBST(MSGFMT_OPTS)
288
 
          AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
289
 
          GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
290
 
            [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
291
 
          AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
292
 
                         return _nl_msg_cat_cntr],
293
 
            [CATOBJEXT=.gmo 
294
 
             DATADIRNAME=share],
295
 
            [case $host in
296
 
            *-*-solaris*)
297
 
            dnl On Solaris, if bind_textdomain_codeset is in libc,
298
 
            dnl GNU format message catalog is always supported,
299
 
            dnl since both are added to the libc all together.
300
 
            dnl Hence, we'd like to go with DATADIRNAME=share and
301
 
            dnl and CATOBJEXT=.gmo in this case.
302
 
            AC_CHECK_FUNC(bind_textdomain_codeset,
303
 
              [CATOBJEXT=.gmo 
304
 
               DATADIRNAME=share],
305
 
              [CATOBJEXT=.mo
306
 
               DATADIRNAME=lib])
307
 
            ;;
308
 
            *)
309
 
            CATOBJEXT=.mo
310
 
            DATADIRNAME=lib
311
 
            ;;
312
 
            esac])
313
 
          LIBS="$glib_save_LIBS"
314
 
          INSTOBJEXT=.mo
315
 
        else
316
 
          gt_cv_have_gettext=no
317
 
        fi
318
 
      fi
319
 
    ])
320
 
 
321
 
    if test "$gt_cv_have_gettext" = "yes" ; then
322
 
      AC_DEFINE(ENABLE_NLS, 1,
323
 
        [always defined to indicate that i18n is enabled])
324
 
    fi
325
 
 
326
 
    dnl Test whether we really found GNU xgettext.
327
 
    if test "$XGETTEXT" != ":"; then
328
 
      dnl If it is not GNU xgettext we define it as : so that the
329
 
      dnl Makefiles still can work.
330
 
      if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
331
 
        : ;
332
 
      else
333
 
        AC_MSG_RESULT(
334
 
          [found xgettext program is not GNU xgettext; ignore it])
335
 
        XGETTEXT=":"
336
 
      fi
337
 
    fi
338
 
 
339
 
    # We need to process the po/ directory.
340
 
    POSUB=po
341
 
 
342
 
    AC_OUTPUT_COMMANDS(
343
 
      [case "$CONFIG_FILES" in *po/Makefile.in*)
344
 
        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
345
 
      esac])
346
 
 
347
 
    dnl These rules are solely for the distribution goal.  While doing this
348
 
    dnl we only have to keep exactly one list of the available catalogs
349
 
    dnl in configure.ac.
350
 
    for lang in $ALL_LINGUAS; do
351
 
      GMOFILES="$GMOFILES $lang.gmo"
352
 
      POFILES="$POFILES $lang.po"
353
 
    done
354
 
 
355
 
    dnl Make all variables we use known to autoconf.
356
 
    AC_SUBST(CATALOGS)
357
 
    AC_SUBST(CATOBJEXT)
358
 
    AC_SUBST(DATADIRNAME)
359
 
    AC_SUBST(GMOFILES)
360
 
    AC_SUBST(INSTOBJEXT)
361
 
    AC_SUBST(INTLLIBS)
362
 
    AC_SUBST(PO_IN_DATADIR_TRUE)
363
 
    AC_SUBST(PO_IN_DATADIR_FALSE)
364
 
    AC_SUBST(POFILES)
365
 
    AC_SUBST(POSUB)
366
 
  ])
367
 
 
368
 
# AM_GLIB_GNU_GETTEXT
369
 
# -------------------
370
 
# Do checks necessary for use of gettext. If a suitable implementation 
371
 
# of gettext is found in either in libintl or in the C library,
372
 
# it will set INTLLIBS to the libraries needed for use of gettext
373
 
# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
374
 
# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
375
 
# on various variables needed by the Makefile.in.in installed by 
376
 
# glib-gettextize.
377
 
dnl
378
 
glib_DEFUN([GLIB_GNU_GETTEXT],
379
 
  [AC_REQUIRE([AC_PROG_CC])dnl
380
 
   AC_REQUIRE([AC_HEADER_STDC])dnl
381
 
   
382
 
   GLIB_LC_MESSAGES
383
 
   GLIB_WITH_NLS
384
 
 
385
 
   if test "$gt_cv_have_gettext" = "yes"; then
386
 
     if test "x$ALL_LINGUAS" = "x"; then
387
 
       LINGUAS=
388
 
     else
389
 
       AC_MSG_CHECKING(for catalogs to be installed)
390
 
       NEW_LINGUAS=
391
 
       for presentlang in $ALL_LINGUAS; do
392
 
         useit=no
393
 
         if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
394
 
           desiredlanguages="$LINGUAS"
395
 
         else
396
 
           desiredlanguages="$ALL_LINGUAS"
397
 
         fi
398
 
         for desiredlang in $desiredlanguages; do
399
 
           # Use the presentlang catalog if desiredlang is
400
 
           #   a. equal to presentlang, or
401
 
           #   b. a variant of presentlang (because in this case,
402
 
           #      presentlang can be used as a fallback for messages
403
 
           #      which are not translated in the desiredlang catalog).
404
 
           case "$desiredlang" in
405
 
             "$presentlang"*) useit=yes;;
406
 
           esac
407
 
         done
408
 
         if test $useit = yes; then
409
 
           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
410
 
         fi
411
 
       done
412
 
       LINGUAS=$NEW_LINGUAS
413
 
       AC_MSG_RESULT($LINGUAS)
414
 
     fi
415
 
 
416
 
     dnl Construct list of names of catalog files to be constructed.
417
 
     if test -n "$LINGUAS"; then
418
 
       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
419
 
     fi
420
 
   fi
421
 
 
422
 
   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
423
 
   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
424
 
   dnl Try to locate is.
425
 
   MKINSTALLDIRS=
426
 
   if test -n "$ac_aux_dir"; then
427
 
     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
428
 
   fi
429
 
   if test -z "$MKINSTALLDIRS"; then
430
 
     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
431
 
   fi
432
 
   AC_SUBST(MKINSTALLDIRS)
433
 
 
434
 
   dnl Generate list of files to be processed by xgettext which will
435
 
   dnl be included in po/Makefile.
436
 
   test -d po || mkdir po
437
 
   if test "x$srcdir" != "x."; then
438
 
     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
439
 
       posrcprefix="$srcdir/"
440
 
     else
441
 
       posrcprefix="../$srcdir/"
442
 
     fi
443
 
   else
444
 
     posrcprefix="../"
445
 
   fi
446
 
   rm -f po/POTFILES
447
 
   sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
448
 
        < $srcdir/po/POTFILES.in > po/POTFILES
449
 
  ])
450
 
 
451
 
# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
452
 
# -------------------------------
453
 
# Define VARIABLE to the location where catalog files will
454
 
# be installed by po/Makefile.
455
 
glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
456
 
[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
457
 
glib_save_prefix="$prefix"
458
 
glib_save_exec_prefix="$exec_prefix"
459
 
glib_save_datarootdir="$datarootdir"
460
 
test "x$prefix" = xNONE && prefix=$ac_default_prefix
461
 
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
462
 
datarootdir=`eval echo "${datarootdir}"`
463
 
if test "x$CATOBJEXT" = "x.mo" ; then
464
 
  localedir=`eval echo "${libdir}/locale"`
465
 
else
466
 
  localedir=`eval echo "${datadir}/locale"`
467
 
fi
468
 
prefix="$glib_save_prefix"
469
 
exec_prefix="$glib_save_exec_prefix"
470
 
datarootdir="$glib_save_datarootdir"
471
 
AC_DEFINE_UNQUOTED($1, "$localedir",
472
 
  [Define the location where the catalogs will be installed])
473
 
])
474
 
 
475
 
dnl
476
 
dnl Now the definitions that aclocal will find
477
 
dnl
478
 
ifdef(glib_configure_ac,[],[
479
 
AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
480
 
AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
481
 
])dnl
482
 
 
483
 
# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL])
484
 
485
 
# Create a temporary file with TEST-FILE as its contents and pass the
486
 
# file name to PROGRAM.  Perform ACTION-IF-PASS if PROGRAM exits with
487
 
# 0 and perform ACTION-IF-FAIL for any other exit status.
488
 
AC_DEFUN([GLIB_RUN_PROG],
489
 
[cat >conftest.foo <<_ACEOF
490
 
$2
491
 
_ACEOF
492
 
if AC_RUN_LOG([$1 conftest.foo]); then
493
 
  m4_ifval([$3], [$3], [:])
494
 
m4_ifvaln([$4], [else $4])dnl
495
 
echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD
496
 
sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD
497
 
fi])
498
 
 
499
 
 
500
67
# gnome-common.m4
501
68
502
69