~ubuntu-branches/ubuntu/trusty/rygel/trusty

« back to all changes in this revision

Viewing changes to aclocal.m4

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2011-12-16 15:21:25 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20111216152125-qgn31dkfmhouhrf0
Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 
14
14
m4_ifndef([AC_AUTOCONF_VERSION],
15
15
  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16
 
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
17
 
[m4_warning([this file was generated for autoconf 2.67.
 
16
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
 
17
[m4_warning([this file was generated for autoconf 2.68.
18
18
You have another version of autoconf.  It may work, but is not guaranteed to.
19
19
If you have problems, you may need to regenerate the build system entirely.
20
20
To do so, use the procedure documented by the package, typically `autoreconf'.])])
21
21
 
22
 
# Copyright (C) 1995-2002 Free Software Foundation, Inc.
23
 
# Copyright (C) 2001-2003,2004 Red Hat, Inc.
24
 
#
25
 
# This file is free software, distributed under the terms of the GNU
26
 
# General Public License.  As a special exception to the GNU General
27
 
# Public License, this file may be distributed as part of a program
28
 
# that contains a configuration script generated by Autoconf, under
29
 
# the same distribution terms as the rest of that program.
30
 
#
31
 
# This file can be copied and used freely without restrictions.  It can
32
 
# be used in projects which are not available under the GNU Public License
33
 
# but which still want to provide support for the GNU gettext functionality.
34
 
#
35
 
# Macro to add for using GNU gettext.
36
 
# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
37
 
#
38
 
# Modified to never use included libintl. 
39
 
# Owen Taylor <otaylor@redhat.com>, 12/15/1998
40
 
#
41
 
# Major rework to remove unused code
42
 
# Owen Taylor <otaylor@redhat.com>, 12/11/2002
43
 
#
44
 
# Added better handling of ALL_LINGUAS from GNU gettext version 
45
 
# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
46
 
#
47
 
# Modified to require ngettext
48
 
# Matthias Clasen <mclasen@redhat.com> 08/06/2004
49
 
#
50
 
# We need this here as well, since someone might use autoconf-2.5x
51
 
# to configure GLib then an older version to configure a package
52
 
# using AM_GLIB_GNU_GETTEXT
53
 
AC_PREREQ(2.53)
54
 
 
55
 
dnl
56
 
dnl We go to great lengths to make sure that aclocal won't 
57
 
dnl try to pull in the installed version of these macros
58
 
dnl when running aclocal in the glib directory.
59
 
dnl
60
 
m4_copy([AC_DEFUN],[glib_DEFUN])
61
 
m4_copy([AC_REQUIRE],[glib_REQUIRE])
62
 
dnl
63
 
dnl At the end, if we're not within glib, we'll define the public
64
 
dnl definitions in terms of our private definitions.
65
 
dnl
66
 
 
67
 
# GLIB_LC_MESSAGES
68
 
#--------------------
69
 
glib_DEFUN([GLIB_LC_MESSAGES],
70
 
  [AC_CHECK_HEADERS([locale.h])
71
 
    if test $ac_cv_header_locale_h = yes; then
72
 
    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
73
 
      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
74
 
       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
75
 
    if test $am_cv_val_LC_MESSAGES = yes; then
76
 
      AC_DEFINE(HAVE_LC_MESSAGES, 1,
77
 
        [Define if your <locale.h> file defines LC_MESSAGES.])
78
 
    fi
79
 
  fi])
80
 
 
81
 
# GLIB_PATH_PROG_WITH_TEST
82
 
#----------------------------
83
 
dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
84
 
dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
85
 
glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
86
 
[# Extract the first word of "$2", so it can be a program name with args.
87
 
set dummy $2; ac_word=[$]2
88
 
AC_MSG_CHECKING([for $ac_word])
89
 
AC_CACHE_VAL(ac_cv_path_$1,
90
 
[case "[$]$1" in
91
 
  /*)
92
 
  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
93
 
  ;;
94
 
  *)
95
 
  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
96
 
  for ac_dir in ifelse([$5], , $PATH, [$5]); do
97
 
    test -z "$ac_dir" && ac_dir=.
98
 
    if test -f $ac_dir/$ac_word; then
99
 
      if [$3]; then
100
 
        ac_cv_path_$1="$ac_dir/$ac_word"
101
 
        break
102
 
      fi
103
 
    fi
104
 
  done
105
 
  IFS="$ac_save_ifs"
106
 
dnl If no 4th arg is given, leave the cache variable unset,
107
 
dnl so AC_PATH_PROGS will keep looking.
108
 
ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
109
 
])dnl
110
 
  ;;
111
 
esac])dnl
112
 
$1="$ac_cv_path_$1"
113
 
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
114
 
  AC_MSG_RESULT([$]$1)
115
 
else
116
 
  AC_MSG_RESULT(no)
117
 
fi
118
 
AC_SUBST($1)dnl
119
 
])
120
 
 
121
 
# GLIB_WITH_NLS
122
 
#-----------------
123
 
glib_DEFUN([GLIB_WITH_NLS],
124
 
  dnl NLS is obligatory
125
 
  [USE_NLS=yes
126
 
    AC_SUBST(USE_NLS)
127
 
 
128
 
    gt_cv_have_gettext=no
129
 
 
130
 
    CATOBJEXT=NONE
131
 
    XGETTEXT=:
132
 
    INTLLIBS=
133
 
 
134
 
    AC_CHECK_HEADER(libintl.h,
135
 
     [gt_cv_func_dgettext_libintl="no"
136
 
      libintl_extra_libs=""
137
 
 
138
 
      #
139
 
      # First check in libc
140
 
      #
141
 
      AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
142
 
        [AC_TRY_LINK([
143
 
#include <libintl.h>
144
 
],
145
 
         [return !ngettext ("","", 1)],
146
 
          gt_cv_func_ngettext_libc=yes,
147
 
          gt_cv_func_ngettext_libc=no)
148
 
        ])
149
 
  
150
 
      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
151
 
              AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
152
 
                [AC_TRY_LINK([
153
 
#include <libintl.h>
154
 
],
155
 
                  [return !dgettext ("","")],
156
 
                  gt_cv_func_dgettext_libc=yes,
157
 
                  gt_cv_func_dgettext_libc=no)
158
 
                ])
159
 
      fi
160
 
  
161
 
      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
162
 
        AC_CHECK_FUNCS(bind_textdomain_codeset)
163
 
      fi
164
 
 
165
 
      #
166
 
      # If we don't have everything we want, check in libintl
167
 
      #
168
 
      if test "$gt_cv_func_dgettext_libc" != "yes" \
169
 
         || test "$gt_cv_func_ngettext_libc" != "yes" \
170
 
         || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
171
 
        
172
 
        AC_CHECK_LIB(intl, bindtextdomain,
173
 
            [AC_CHECK_LIB(intl, ngettext,
174
 
                    [AC_CHECK_LIB(intl, dgettext,
175
 
                                  gt_cv_func_dgettext_libintl=yes)])])
176
 
 
177
 
        if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
178
 
          AC_MSG_CHECKING([if -liconv is needed to use gettext])
179
 
          AC_MSG_RESULT([])
180
 
          AC_CHECK_LIB(intl, ngettext,
181
 
                [AC_CHECK_LIB(intl, dcgettext,
182
 
                       [gt_cv_func_dgettext_libintl=yes
183
 
                        libintl_extra_libs=-liconv],
184
 
                        :,-liconv)],
185
 
                :,-liconv)
186
 
        fi
187
 
 
188
 
        #
189
 
        # If we found libintl, then check in it for bind_textdomain_codeset();
190
 
        # we'll prefer libc if neither have bind_textdomain_codeset(),
191
 
        # and both have dgettext and ngettext
192
 
        #
193
 
        if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
194
 
          glib_save_LIBS="$LIBS"
195
 
          LIBS="$LIBS -lintl $libintl_extra_libs"
196
 
          unset ac_cv_func_bind_textdomain_codeset
197
 
          AC_CHECK_FUNCS(bind_textdomain_codeset)
198
 
          LIBS="$glib_save_LIBS"
199
 
 
200
 
          if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
201
 
            gt_cv_func_dgettext_libc=no
202
 
          else
203
 
            if test "$gt_cv_func_dgettext_libc" = "yes" \
204
 
                && test "$gt_cv_func_ngettext_libc" = "yes"; then
205
 
              gt_cv_func_dgettext_libintl=no
206
 
            fi
207
 
          fi
208
 
        fi
209
 
      fi
210
 
 
211
 
      if test "$gt_cv_func_dgettext_libc" = "yes" \
212
 
        || test "$gt_cv_func_dgettext_libintl" = "yes"; then
213
 
        gt_cv_have_gettext=yes
214
 
      fi
215
 
  
216
 
      if test "$gt_cv_func_dgettext_libintl" = "yes"; then
217
 
        INTLLIBS="-lintl $libintl_extra_libs"
218
 
      fi
219
 
  
220
 
      if test "$gt_cv_have_gettext" = "yes"; then
221
 
        AC_DEFINE(HAVE_GETTEXT,1,
222
 
          [Define if the GNU gettext() function is already present or preinstalled.])
223
 
        GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
224
 
          [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
225
 
        if test "$MSGFMT" != "no"; then
226
 
          glib_save_LIBS="$LIBS"
227
 
          LIBS="$LIBS $INTLLIBS"
228
 
          AC_CHECK_FUNCS(dcgettext)
229
 
          MSGFMT_OPTS=
230
 
          AC_MSG_CHECKING([if msgfmt accepts -c])
231
 
          GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[
232
 
msgid ""
233
 
msgstr ""
234
 
"Content-Type: text/plain; charset=UTF-8\n"
235
 
"Project-Id-Version: test 1.0\n"
236
 
"PO-Revision-Date: 2007-02-15 12:01+0100\n"
237
 
"Last-Translator: test <foo@bar.xx>\n"
238
 
"Language-Team: C <LL@li.org>\n"
239
 
"MIME-Version: 1.0\n"
240
 
"Content-Transfer-Encoding: 8bit\n"
241
 
], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
242
 
          AC_SUBST(MSGFMT_OPTS)
243
 
          AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
244
 
          GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
245
 
            [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
246
 
          AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
247
 
                         return _nl_msg_cat_cntr],
248
 
            [CATOBJEXT=.gmo 
249
 
             DATADIRNAME=share],
250
 
            [case $host in
251
 
            *-*-solaris*)
252
 
            dnl On Solaris, if bind_textdomain_codeset is in libc,
253
 
            dnl GNU format message catalog is always supported,
254
 
            dnl since both are added to the libc all together.
255
 
            dnl Hence, we'd like to go with DATADIRNAME=share and
256
 
            dnl and CATOBJEXT=.gmo in this case.
257
 
            AC_CHECK_FUNC(bind_textdomain_codeset,
258
 
              [CATOBJEXT=.gmo 
259
 
               DATADIRNAME=share],
260
 
              [CATOBJEXT=.mo
261
 
               DATADIRNAME=lib])
262
 
            ;;
263
 
            *)
264
 
            CATOBJEXT=.mo
265
 
            DATADIRNAME=lib
266
 
            ;;
267
 
            esac])
268
 
          LIBS="$glib_save_LIBS"
269
 
          INSTOBJEXT=.mo
270
 
        else
271
 
          gt_cv_have_gettext=no
272
 
        fi
273
 
      fi
274
 
    ])
275
 
 
276
 
    if test "$gt_cv_have_gettext" = "yes" ; then
277
 
      AC_DEFINE(ENABLE_NLS, 1,
278
 
        [always defined to indicate that i18n is enabled])
279
 
    fi
280
 
 
281
 
    dnl Test whether we really found GNU xgettext.
282
 
    if test "$XGETTEXT" != ":"; then
283
 
      dnl If it is not GNU xgettext we define it as : so that the
284
 
      dnl Makefiles still can work.
285
 
      if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
286
 
        : ;
287
 
      else
288
 
        AC_MSG_RESULT(
289
 
          [found xgettext program is not GNU xgettext; ignore it])
290
 
        XGETTEXT=":"
291
 
      fi
292
 
    fi
293
 
 
294
 
    # We need to process the po/ directory.
295
 
    POSUB=po
296
 
 
297
 
    AC_OUTPUT_COMMANDS(
298
 
      [case "$CONFIG_FILES" in *po/Makefile.in*)
299
 
        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
300
 
      esac])
301
 
 
302
 
    dnl These rules are solely for the distribution goal.  While doing this
303
 
    dnl we only have to keep exactly one list of the available catalogs
304
 
    dnl in configure.ac.
305
 
    for lang in $ALL_LINGUAS; do
306
 
      GMOFILES="$GMOFILES $lang.gmo"
307
 
      POFILES="$POFILES $lang.po"
308
 
    done
309
 
 
310
 
    dnl Make all variables we use known to autoconf.
311
 
    AC_SUBST(CATALOGS)
312
 
    AC_SUBST(CATOBJEXT)
313
 
    AC_SUBST(DATADIRNAME)
314
 
    AC_SUBST(GMOFILES)
315
 
    AC_SUBST(INSTOBJEXT)
316
 
    AC_SUBST(INTLLIBS)
317
 
    AC_SUBST(PO_IN_DATADIR_TRUE)
318
 
    AC_SUBST(PO_IN_DATADIR_FALSE)
319
 
    AC_SUBST(POFILES)
320
 
    AC_SUBST(POSUB)
321
 
  ])
322
 
 
323
 
# AM_GLIB_GNU_GETTEXT
324
 
# -------------------
325
 
# Do checks necessary for use of gettext. If a suitable implementation 
326
 
# of gettext is found in either in libintl or in the C library,
327
 
# it will set INTLLIBS to the libraries needed for use of gettext
328
 
# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
329
 
# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
330
 
# on various variables needed by the Makefile.in.in installed by 
331
 
# glib-gettextize.
332
 
dnl
333
 
glib_DEFUN([GLIB_GNU_GETTEXT],
334
 
  [AC_REQUIRE([AC_PROG_CC])dnl
335
 
   AC_REQUIRE([AC_HEADER_STDC])dnl
336
 
   
337
 
   GLIB_LC_MESSAGES
338
 
   GLIB_WITH_NLS
339
 
 
340
 
   if test "$gt_cv_have_gettext" = "yes"; then
341
 
     if test "x$ALL_LINGUAS" = "x"; then
342
 
       LINGUAS=
343
 
     else
344
 
       AC_MSG_CHECKING(for catalogs to be installed)
345
 
       NEW_LINGUAS=
346
 
       for presentlang in $ALL_LINGUAS; do
347
 
         useit=no
348
 
         if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
349
 
           desiredlanguages="$LINGUAS"
350
 
         else
351
 
           desiredlanguages="$ALL_LINGUAS"
352
 
         fi
353
 
         for desiredlang in $desiredlanguages; do
354
 
           # Use the presentlang catalog if desiredlang is
355
 
           #   a. equal to presentlang, or
356
 
           #   b. a variant of presentlang (because in this case,
357
 
           #      presentlang can be used as a fallback for messages
358
 
           #      which are not translated in the desiredlang catalog).
359
 
           case "$desiredlang" in
360
 
             "$presentlang"*) useit=yes;;
361
 
           esac
362
 
         done
363
 
         if test $useit = yes; then
364
 
           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
365
 
         fi
366
 
       done
367
 
       LINGUAS=$NEW_LINGUAS
368
 
       AC_MSG_RESULT($LINGUAS)
369
 
     fi
370
 
 
371
 
     dnl Construct list of names of catalog files to be constructed.
372
 
     if test -n "$LINGUAS"; then
373
 
       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
374
 
     fi
375
 
   fi
376
 
 
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.
380
 
   MKINSTALLDIRS=
381
 
   if test -n "$ac_aux_dir"; then
382
 
     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
383
 
   fi
384
 
   if test -z "$MKINSTALLDIRS"; then
385
 
     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
386
 
   fi
387
 
   AC_SUBST(MKINSTALLDIRS)
388
 
 
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/"
395
 
     else
396
 
       posrcprefix="../$srcdir/"
397
 
     fi
398
 
   else
399
 
     posrcprefix="../"
400
 
   fi
401
 
   rm -f po/POTFILES
402
 
   sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
403
 
        < $srcdir/po/POTFILES.in > po/POTFILES
404
 
  ])
405
 
 
406
 
# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
407
 
# -------------------------------
408
 
# Define VARIABLE to the location where catalog files will
409
 
# be installed by po/Makefile.
410
 
glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
411
 
[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
412
 
glib_save_prefix="$prefix"
413
 
glib_save_exec_prefix="$exec_prefix"
414
 
glib_save_datarootdir="$datarootdir"
415
 
test "x$prefix" = xNONE && prefix=$ac_default_prefix
416
 
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
417
 
datarootdir=`eval echo "${datarootdir}"`
418
 
if test "x$CATOBJEXT" = "x.mo" ; then
419
 
  localedir=`eval echo "${libdir}/locale"`
420
 
else
421
 
  localedir=`eval echo "${datadir}/locale"`
422
 
fi
423
 
prefix="$glib_save_prefix"
424
 
exec_prefix="$glib_save_exec_prefix"
425
 
datarootdir="$glib_save_datarootdir"
426
 
AC_DEFINE_UNQUOTED($1, "$localedir",
427
 
  [Define the location where the catalogs will be installed])
428
 
])
429
 
 
430
 
dnl
431
 
dnl Now the definitions that aclocal will find
432
 
dnl
433
 
ifdef(glib_configure_ac,[],[
434
 
AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
435
 
AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
436
 
])dnl
437
 
 
438
 
# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL])
439
 
440
 
# Create a temporary file with TEST-FILE as its contents and pass the
441
 
# file name to PROGRAM.  Perform ACTION-IF-PASS if PROGRAM exits with
442
 
# 0 and perform ACTION-IF-FAIL for any other exit status.
443
 
AC_DEFUN([GLIB_RUN_PROG],
444
 
[cat >conftest.foo <<_ACEOF
445
 
$2
446
 
_ACEOF
447
 
if AC_RUN_LOG([$1 conftest.foo]); then
448
 
  m4_ifval([$3], [$3], [:])
449
 
m4_ifvaln([$4], [else $4])dnl
450
 
echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD
451
 
sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD
452
 
fi])
453
 
 
454
 
 
455
 
# nls.m4 serial 5 (gettext-0.18)
456
 
dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation,
457
 
dnl Inc.
458
 
dnl This file is free software; the Free Software Foundation
459
 
dnl gives unlimited permission to copy and/or distribute it,
460
 
dnl with or without modifications, as long as this notice is preserved.
461
 
dnl
462
 
dnl This file can can be used in projects which are not available under
463
 
dnl the GNU General Public License or the GNU Library General Public
464
 
dnl License but which still want to provide support for the GNU gettext
465
 
dnl functionality.
466
 
dnl Please note that the actual code of the GNU gettext library is covered
467
 
dnl by the GNU Library General Public License, and the rest of the GNU
468
 
dnl gettext package package is covered by the GNU General Public License.
469
 
dnl They are *not* in the public domain.
470
 
 
471
 
dnl Authors:
472
 
dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
473
 
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
474
 
 
475
 
AC_PREREQ([2.50])
476
 
 
477
 
AC_DEFUN([AM_NLS],
478
 
[
479
 
  AC_MSG_CHECKING([whether NLS is requested])
480
 
  dnl Default is enabled NLS
481
 
  AC_ARG_ENABLE([nls],
482
 
    [  --disable-nls           do not use Native Language Support],
483
 
    USE_NLS=$enableval, USE_NLS=yes)
484
 
  AC_MSG_RESULT([$USE_NLS])
485
 
  AC_SUBST([USE_NLS])
486
 
])
487
 
 
488
 
# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
489
 
# serial 1 (pkg-config-0.24)
490
 
491
 
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
492
 
#
493
 
# This program is free software; you can redistribute it and/or modify
494
 
# it under the terms of the GNU General Public License as published by
495
 
# the Free Software Foundation; either version 2 of the License, or
496
 
# (at your option) any later version.
497
 
#
498
 
# This program is distributed in the hope that it will be useful, but
499
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
500
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
501
 
# General Public License for more details.
502
 
#
503
 
# You should have received a copy of the GNU General Public License
504
 
# along with this program; if not, write to the Free Software
505
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
506
 
#
507
 
# As a special exception to the GNU General Public License, if you
508
 
# distribute this file as part of a program that contains a
509
 
# configuration script generated by Autoconf, you may include it under
510
 
# the same distribution terms that you use for the rest of that program.
511
 
 
512
 
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
513
 
# ----------------------------------
514
 
AC_DEFUN([PKG_PROG_PKG_CONFIG],
515
 
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
516
 
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
517
 
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
518
 
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
519
 
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
520
 
 
521
 
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
522
 
        AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
523
 
fi
524
 
if test -n "$PKG_CONFIG"; then
525
 
        _pkg_min_version=m4_default([$1], [0.9.0])
526
 
        AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
527
 
        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
528
 
                AC_MSG_RESULT([yes])
529
 
        else
530
 
                AC_MSG_RESULT([no])
531
 
                PKG_CONFIG=""
532
 
        fi
533
 
fi[]dnl
534
 
])# PKG_PROG_PKG_CONFIG
535
 
 
536
 
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
537
 
#
538
 
# Check to see whether a particular set of modules exists.  Similar
539
 
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
540
 
#
541
 
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
542
 
# only at the first occurence in configure.ac, so if the first place
543
 
# it's called might be skipped (such as if it is within an "if", you
544
 
# have to call PKG_CHECK_EXISTS manually
545
 
# --------------------------------------------------------------
546
 
AC_DEFUN([PKG_CHECK_EXISTS],
547
 
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
548
 
if test -n "$PKG_CONFIG" && \
549
 
    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
550
 
  m4_default([$2], [:])
551
 
m4_ifvaln([$3], [else
552
 
  $3])dnl
553
 
fi])
554
 
 
555
 
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
556
 
# ---------------------------------------------
557
 
m4_define([_PKG_CONFIG],
558
 
[if test -n "$$1"; then
559
 
    pkg_cv_[]$1="$$1"
560
 
 elif test -n "$PKG_CONFIG"; then
561
 
    PKG_CHECK_EXISTS([$3],
562
 
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
563
 
                     [pkg_failed=yes])
564
 
 else
565
 
    pkg_failed=untried
566
 
fi[]dnl
567
 
])# _PKG_CONFIG
568
 
 
569
 
# _PKG_SHORT_ERRORS_SUPPORTED
570
 
# -----------------------------
571
 
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
572
 
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
573
 
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
574
 
        _pkg_short_errors_supported=yes
575
 
else
576
 
        _pkg_short_errors_supported=no
577
 
fi[]dnl
578
 
])# _PKG_SHORT_ERRORS_SUPPORTED
579
 
 
580
 
 
581
 
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
582
 
# [ACTION-IF-NOT-FOUND])
583
 
#
584
 
#
585
 
# Note that if there is a possibility the first call to
586
 
# PKG_CHECK_MODULES might not happen, you should be sure to include an
587
 
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
588
 
#
589
 
#
590
 
# --------------------------------------------------------------
591
 
AC_DEFUN([PKG_CHECK_MODULES],
592
 
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
593
 
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
594
 
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
595
 
 
596
 
pkg_failed=no
597
 
AC_MSG_CHECKING([for $1])
598
 
 
599
 
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
600
 
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
601
 
 
602
 
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
603
 
and $1[]_LIBS to avoid the need to call pkg-config.
604
 
See the pkg-config man page for more details.])
605
 
 
606
 
if test $pkg_failed = yes; then
607
 
        AC_MSG_RESULT([no])
608
 
        _PKG_SHORT_ERRORS_SUPPORTED
609
 
        if test $_pkg_short_errors_supported = yes; then
610
 
                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
611
 
        else 
612
 
                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
613
 
        fi
614
 
        # Put the nasty error message in config.log where it belongs
615
 
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
616
 
 
617
 
        m4_default([$4], [AC_MSG_ERROR(
618
 
[Package requirements ($2) were not met:
619
 
 
620
 
$$1_PKG_ERRORS
621
 
 
622
 
Consider adjusting the PKG_CONFIG_PATH environment variable if you
623
 
installed software in a non-standard prefix.
624
 
 
625
 
_PKG_TEXT])[]dnl
626
 
        ])
627
 
elif test $pkg_failed = untried; then
628
 
        AC_MSG_RESULT([no])
629
 
        m4_default([$4], [AC_MSG_FAILURE(
630
 
[The pkg-config script could not be found or is too old.  Make sure it
631
 
is in your PATH or set the PKG_CONFIG environment variable to the full
632
 
path to pkg-config.
633
 
 
634
 
_PKG_TEXT
635
 
 
636
 
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
637
 
        ])
638
 
else
639
 
        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
640
 
        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
641
 
        AC_MSG_RESULT([yes])
642
 
        $3
643
 
fi[]dnl
644
 
])# PKG_CHECK_MODULES
645
 
 
646
22
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
647
23
#
648
24
# This file is free software; the Free Software Foundation
1670
1046
          AC_MSG_ERROR([Vala $1 not found.])])])])
1671
1047
])
1672
1048
 
 
1049
# nls.m4 serial 5 (gettext-0.18)
 
1050
dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation,
 
1051
dnl Inc.
 
1052
dnl This file is free software; the Free Software Foundation
 
1053
dnl gives unlimited permission to copy and/or distribute it,
 
1054
dnl with or without modifications, as long as this notice is preserved.
 
1055
dnl
 
1056
dnl This file can can be used in projects which are not available under
 
1057
dnl the GNU General Public License or the GNU Library General Public
 
1058
dnl License but which still want to provide support for the GNU gettext
 
1059
dnl functionality.
 
1060
dnl Please note that the actual code of the GNU gettext library is covered
 
1061
dnl by the GNU Library General Public License, and the rest of the GNU
 
1062
dnl gettext package package is covered by the GNU General Public License.
 
1063
dnl They are *not* in the public domain.
 
1064
 
 
1065
dnl Authors:
 
1066
dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
 
1067
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
 
1068
 
 
1069
AC_PREREQ([2.50])
 
1070
 
 
1071
AC_DEFUN([AM_NLS],
 
1072
[
 
1073
  AC_MSG_CHECKING([whether NLS is requested])
 
1074
  dnl Default is enabled NLS
 
1075
  AC_ARG_ENABLE([nls],
 
1076
    [  --disable-nls           do not use Native Language Support],
 
1077
    USE_NLS=$enableval, USE_NLS=yes)
 
1078
  AC_MSG_RESULT([$USE_NLS])
 
1079
  AC_SUBST([USE_NLS])
 
1080
])
 
1081
 
 
1082
# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 
1083
# serial 1 (pkg-config-0.24)
 
1084
 
1085
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
 
1086
#
 
1087
# This program is free software; you can redistribute it and/or modify
 
1088
# it under the terms of the GNU General Public License as published by
 
1089
# the Free Software Foundation; either version 2 of the License, or
 
1090
# (at your option) any later version.
 
1091
#
 
1092
# This program is distributed in the hope that it will be useful, but
 
1093
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
1094
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
1095
# General Public License for more details.
 
1096
#
 
1097
# You should have received a copy of the GNU General Public License
 
1098
# along with this program; if not, write to the Free Software
 
1099
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
1100
#
 
1101
# As a special exception to the GNU General Public License, if you
 
1102
# distribute this file as part of a program that contains a
 
1103
# configuration script generated by Autoconf, you may include it under
 
1104
# the same distribution terms that you use for the rest of that program.
 
1105
 
 
1106
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
 
1107
# ----------------------------------
 
1108
AC_DEFUN([PKG_PROG_PKG_CONFIG],
 
1109
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
 
1110
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
 
1111
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
 
1112
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
 
1113
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
 
1114
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
 
1115
 
 
1116
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 
1117
        AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
 
1118
fi
 
1119
if test -n "$PKG_CONFIG"; then
 
1120
        _pkg_min_version=m4_default([$1], [0.9.0])
 
1121
        AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
 
1122
        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
 
1123
                AC_MSG_RESULT([yes])
 
1124
        else
 
1125
                AC_MSG_RESULT([no])
 
1126
                PKG_CONFIG=""
 
1127
        fi
 
1128
fi[]dnl
 
1129
])# PKG_PROG_PKG_CONFIG
 
1130
 
 
1131
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
1132
#
 
1133
# Check to see whether a particular set of modules exists.  Similar
 
1134
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
 
1135
#
 
1136
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 
1137
# only at the first occurence in configure.ac, so if the first place
 
1138
# it's called might be skipped (such as if it is within an "if", you
 
1139
# have to call PKG_CHECK_EXISTS manually
 
1140
# --------------------------------------------------------------
 
1141
AC_DEFUN([PKG_CHECK_EXISTS],
 
1142
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 
1143
if test -n "$PKG_CONFIG" && \
 
1144
    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
 
1145
  m4_default([$2], [:])
 
1146
m4_ifvaln([$3], [else
 
1147
  $3])dnl
 
1148
fi])
 
1149
 
 
1150
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
 
1151
# ---------------------------------------------
 
1152
m4_define([_PKG_CONFIG],
 
1153
[if test -n "$$1"; then
 
1154
    pkg_cv_[]$1="$$1"
 
1155
 elif test -n "$PKG_CONFIG"; then
 
1156
    PKG_CHECK_EXISTS([$3],
 
1157
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
 
1158
                      test "x$?" != "x0" && pkg_failed=yes ],
 
1159
                     [pkg_failed=yes])
 
1160
 else
 
1161
    pkg_failed=untried
 
1162
fi[]dnl
 
1163
])# _PKG_CONFIG
 
1164
 
 
1165
# _PKG_SHORT_ERRORS_SUPPORTED
 
1166
# -----------------------------
 
1167
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
 
1168
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 
1169
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
 
1170
        _pkg_short_errors_supported=yes
 
1171
else
 
1172
        _pkg_short_errors_supported=no
 
1173
fi[]dnl
 
1174
])# _PKG_SHORT_ERRORS_SUPPORTED
 
1175
 
 
1176
 
 
1177
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
 
1178
# [ACTION-IF-NOT-FOUND])
 
1179
#
 
1180
#
 
1181
# Note that if there is a possibility the first call to
 
1182
# PKG_CHECK_MODULES might not happen, you should be sure to include an
 
1183
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
 
1184
#
 
1185
#
 
1186
# --------------------------------------------------------------
 
1187
AC_DEFUN([PKG_CHECK_MODULES],
 
1188
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 
1189
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
 
1190
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
 
1191
 
 
1192
pkg_failed=no
 
1193
AC_MSG_CHECKING([for $1])
 
1194
 
 
1195
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 
1196
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
1197
 
 
1198
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
 
1199
and $1[]_LIBS to avoid the need to call pkg-config.
 
1200
See the pkg-config man page for more details.])
 
1201
 
 
1202
if test $pkg_failed = yes; then
 
1203
        AC_MSG_RESULT([no])
 
1204
        _PKG_SHORT_ERRORS_SUPPORTED
 
1205
        if test $_pkg_short_errors_supported = yes; then
 
1206
                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
 
1207
        else 
 
1208
                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
 
1209
        fi
 
1210
        # Put the nasty error message in config.log where it belongs
 
1211
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
 
1212
 
 
1213
        m4_default([$4], [AC_MSG_ERROR(
 
1214
[Package requirements ($2) were not met:
 
1215
 
 
1216
$$1_PKG_ERRORS
 
1217
 
 
1218
Consider adjusting the PKG_CONFIG_PATH environment variable if you
 
1219
installed software in a non-standard prefix.
 
1220
 
 
1221
_PKG_TEXT])[]dnl
 
1222
        ])
 
1223
elif test $pkg_failed = untried; then
 
1224
        AC_MSG_RESULT([no])
 
1225
        m4_default([$4], [AC_MSG_FAILURE(
 
1226
[The pkg-config script could not be found or is too old.  Make sure it
 
1227
is in your PATH or set the PKG_CONFIG environment variable to the full
 
1228
path to pkg-config.
 
1229
 
 
1230
_PKG_TEXT
 
1231
 
 
1232
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
 
1233
        ])
 
1234
else
 
1235
        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
 
1236
        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
 
1237
        AC_MSG_RESULT([yes])
 
1238
        $3
 
1239
fi[]dnl
 
1240
])# PKG_CHECK_MODULES
 
1241
 
 
1242
# Copyright (C) 1995-2002 Free Software Foundation, Inc.
 
1243
# Copyright (C) 2001-2003,2004 Red Hat, Inc.
 
1244
#
 
1245
# This file is free software, distributed under the terms of the GNU
 
1246
# General Public License.  As a special exception to the GNU General
 
1247
# Public License, this file may be distributed as part of a program
 
1248
# that contains a configuration script generated by Autoconf, under
 
1249
# the same distribution terms as the rest of that program.
 
1250
#
 
1251
# This file can be copied and used freely without restrictions.  It can
 
1252
# be used in projects which are not available under the GNU Public License
 
1253
# but which still want to provide support for the GNU gettext functionality.
 
1254
#
 
1255
# Macro to add for using GNU gettext.
 
1256
# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
 
1257
#
 
1258
# Modified to never use included libintl. 
 
1259
# Owen Taylor <otaylor@redhat.com>, 12/15/1998
 
1260
#
 
1261
# Major rework to remove unused code
 
1262
# Owen Taylor <otaylor@redhat.com>, 12/11/2002
 
1263
#
 
1264
# Added better handling of ALL_LINGUAS from GNU gettext version 
 
1265
# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
 
1266
#
 
1267
# Modified to require ngettext
 
1268
# Matthias Clasen <mclasen@redhat.com> 08/06/2004
 
1269
#
 
1270
# We need this here as well, since someone might use autoconf-2.5x
 
1271
# to configure GLib then an older version to configure a package
 
1272
# using AM_GLIB_GNU_GETTEXT
 
1273
AC_PREREQ(2.53)
 
1274
 
 
1275
dnl
 
1276
dnl We go to great lengths to make sure that aclocal won't 
 
1277
dnl try to pull in the installed version of these macros
 
1278
dnl when running aclocal in the glib directory.
 
1279
dnl
 
1280
m4_copy([AC_DEFUN],[glib_DEFUN])
 
1281
m4_copy([AC_REQUIRE],[glib_REQUIRE])
 
1282
dnl
 
1283
dnl At the end, if we're not within glib, we'll define the public
 
1284
dnl definitions in terms of our private definitions.
 
1285
dnl
 
1286
 
 
1287
# GLIB_LC_MESSAGES
 
1288
#--------------------
 
1289
glib_DEFUN([GLIB_LC_MESSAGES],
 
1290
  [AC_CHECK_HEADERS([locale.h])
 
1291
    if test $ac_cv_header_locale_h = yes; then
 
1292
    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
 
1293
      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
 
1294
       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
 
1295
    if test $am_cv_val_LC_MESSAGES = yes; then
 
1296
      AC_DEFINE(HAVE_LC_MESSAGES, 1,
 
1297
        [Define if your <locale.h> file defines LC_MESSAGES.])
 
1298
    fi
 
1299
  fi])
 
1300
 
 
1301
# GLIB_PATH_PROG_WITH_TEST
 
1302
#----------------------------
 
1303
dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
 
1304
dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
 
1305
glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
 
1306
[# Extract the first word of "$2", so it can be a program name with args.
 
1307
set dummy $2; ac_word=[$]2
 
1308
AC_MSG_CHECKING([for $ac_word])
 
1309
AC_CACHE_VAL(ac_cv_path_$1,
 
1310
[case "[$]$1" in
 
1311
  /*)
 
1312
  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
 
1313
  ;;
 
1314
  *)
 
1315
  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
 
1316
  for ac_dir in ifelse([$5], , $PATH, [$5]); do
 
1317
    test -z "$ac_dir" && ac_dir=.
 
1318
    if test -f $ac_dir/$ac_word; then
 
1319
      if [$3]; then
 
1320
        ac_cv_path_$1="$ac_dir/$ac_word"
 
1321
        break
 
1322
      fi
 
1323
    fi
 
1324
  done
 
1325
  IFS="$ac_save_ifs"
 
1326
dnl If no 4th arg is given, leave the cache variable unset,
 
1327
dnl so AC_PATH_PROGS will keep looking.
 
1328
ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
 
1329
])dnl
 
1330
  ;;
 
1331
esac])dnl
 
1332
$1="$ac_cv_path_$1"
 
1333
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
 
1334
  AC_MSG_RESULT([$]$1)
 
1335
else
 
1336
  AC_MSG_RESULT(no)
 
1337
fi
 
1338
AC_SUBST($1)dnl
 
1339
])
 
1340
 
 
1341
# GLIB_WITH_NLS
 
1342
#-----------------
 
1343
glib_DEFUN([GLIB_WITH_NLS],
 
1344
  dnl NLS is obligatory
 
1345
  [USE_NLS=yes
 
1346
    AC_SUBST(USE_NLS)
 
1347
 
 
1348
    gt_cv_have_gettext=no
 
1349
 
 
1350
    CATOBJEXT=NONE
 
1351
    XGETTEXT=:
 
1352
    INTLLIBS=
 
1353
 
 
1354
    AC_CHECK_HEADER(libintl.h,
 
1355
     [gt_cv_func_dgettext_libintl="no"
 
1356
      libintl_extra_libs=""
 
1357
 
 
1358
      #
 
1359
      # First check in libc
 
1360
      #
 
1361
      AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
 
1362
        [AC_TRY_LINK([
 
1363
#include <libintl.h>
 
1364
],
 
1365
         [return !ngettext ("","", 1)],
 
1366
          gt_cv_func_ngettext_libc=yes,
 
1367
          gt_cv_func_ngettext_libc=no)
 
1368
        ])
 
1369
  
 
1370
      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
 
1371
              AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
 
1372
                [AC_TRY_LINK([
 
1373
#include <libintl.h>
 
1374
],
 
1375
                  [return !dgettext ("","")],
 
1376
                  gt_cv_func_dgettext_libc=yes,
 
1377
                  gt_cv_func_dgettext_libc=no)
 
1378
                ])
 
1379
      fi
 
1380
  
 
1381
      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
 
1382
        AC_CHECK_FUNCS(bind_textdomain_codeset)
 
1383
      fi
 
1384
 
 
1385
      #
 
1386
      # If we don't have everything we want, check in libintl
 
1387
      #
 
1388
      if test "$gt_cv_func_dgettext_libc" != "yes" \
 
1389
         || test "$gt_cv_func_ngettext_libc" != "yes" \
 
1390
         || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
 
1391
        
 
1392
        AC_CHECK_LIB(intl, bindtextdomain,
 
1393
            [AC_CHECK_LIB(intl, ngettext,
 
1394
                    [AC_CHECK_LIB(intl, dgettext,
 
1395
                                  gt_cv_func_dgettext_libintl=yes)])])
 
1396
 
 
1397
        if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
 
1398
          AC_MSG_CHECKING([if -liconv is needed to use gettext])
 
1399
          AC_MSG_RESULT([])
 
1400
          AC_CHECK_LIB(intl, ngettext,
 
1401
                [AC_CHECK_LIB(intl, dcgettext,
 
1402
                       [gt_cv_func_dgettext_libintl=yes
 
1403
                        libintl_extra_libs=-liconv],
 
1404
                        :,-liconv)],
 
1405
                :,-liconv)
 
1406
        fi
 
1407
 
 
1408
        #
 
1409
        # If we found libintl, then check in it for bind_textdomain_codeset();
 
1410
        # we'll prefer libc if neither have bind_textdomain_codeset(),
 
1411
        # and both have dgettext and ngettext
 
1412
        #
 
1413
        if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
 
1414
          glib_save_LIBS="$LIBS"
 
1415
          LIBS="$LIBS -lintl $libintl_extra_libs"
 
1416
          unset ac_cv_func_bind_textdomain_codeset
 
1417
          AC_CHECK_FUNCS(bind_textdomain_codeset)
 
1418
          LIBS="$glib_save_LIBS"
 
1419
 
 
1420
          if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
 
1421
            gt_cv_func_dgettext_libc=no
 
1422
          else
 
1423
            if test "$gt_cv_func_dgettext_libc" = "yes" \
 
1424
                && test "$gt_cv_func_ngettext_libc" = "yes"; then
 
1425
              gt_cv_func_dgettext_libintl=no
 
1426
            fi
 
1427
          fi
 
1428
        fi
 
1429
      fi
 
1430
 
 
1431
      if test "$gt_cv_func_dgettext_libc" = "yes" \
 
1432
        || test "$gt_cv_func_dgettext_libintl" = "yes"; then
 
1433
        gt_cv_have_gettext=yes
 
1434
      fi
 
1435
  
 
1436
      if test "$gt_cv_func_dgettext_libintl" = "yes"; then
 
1437
        INTLLIBS="-lintl $libintl_extra_libs"
 
1438
      fi
 
1439
  
 
1440
      if test "$gt_cv_have_gettext" = "yes"; then
 
1441
        AC_DEFINE(HAVE_GETTEXT,1,
 
1442
          [Define if the GNU gettext() function is already present or preinstalled.])
 
1443
        GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
 
1444
          [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
 
1445
        if test "$MSGFMT" != "no"; then
 
1446
          glib_save_LIBS="$LIBS"
 
1447
          LIBS="$LIBS $INTLLIBS"
 
1448
          AC_CHECK_FUNCS(dcgettext)
 
1449
          MSGFMT_OPTS=
 
1450
          AC_MSG_CHECKING([if msgfmt accepts -c])
 
1451
          GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[
 
1452
msgid ""
 
1453
msgstr ""
 
1454
"Content-Type: text/plain; charset=UTF-8\n"
 
1455
"Project-Id-Version: test 1.0\n"
 
1456
"PO-Revision-Date: 2007-02-15 12:01+0100\n"
 
1457
"Last-Translator: test <foo@bar.xx>\n"
 
1458
"Language-Team: C <LL@li.org>\n"
 
1459
"MIME-Version: 1.0\n"
 
1460
"Content-Transfer-Encoding: 8bit\n"
 
1461
], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
 
1462
          AC_SUBST(MSGFMT_OPTS)
 
1463
          AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
 
1464
          GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
 
1465
            [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
 
1466
          AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
 
1467
                         return _nl_msg_cat_cntr],
 
1468
            [CATOBJEXT=.gmo 
 
1469
             DATADIRNAME=share],
 
1470
            [case $host in
 
1471
            *-*-solaris*)
 
1472
            dnl On Solaris, if bind_textdomain_codeset is in libc,
 
1473
            dnl GNU format message catalog is always supported,
 
1474
            dnl since both are added to the libc all together.
 
1475
            dnl Hence, we'd like to go with DATADIRNAME=share and
 
1476
            dnl and CATOBJEXT=.gmo in this case.
 
1477
            AC_CHECK_FUNC(bind_textdomain_codeset,
 
1478
              [CATOBJEXT=.gmo 
 
1479
               DATADIRNAME=share],
 
1480
              [CATOBJEXT=.mo
 
1481
               DATADIRNAME=lib])
 
1482
            ;;
 
1483
            *)
 
1484
            CATOBJEXT=.mo
 
1485
            DATADIRNAME=lib
 
1486
            ;;
 
1487
            esac])
 
1488
          LIBS="$glib_save_LIBS"
 
1489
          INSTOBJEXT=.mo
 
1490
        else
 
1491
          gt_cv_have_gettext=no
 
1492
        fi
 
1493
      fi
 
1494
    ])
 
1495
 
 
1496
    if test "$gt_cv_have_gettext" = "yes" ; then
 
1497
      AC_DEFINE(ENABLE_NLS, 1,
 
1498
        [always defined to indicate that i18n is enabled])
 
1499
    fi
 
1500
 
 
1501
    dnl Test whether we really found GNU xgettext.
 
1502
    if test "$XGETTEXT" != ":"; then
 
1503
      dnl If it is not GNU xgettext we define it as : so that the
 
1504
      dnl Makefiles still can work.
 
1505
      if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
 
1506
        : ;
 
1507
      else
 
1508
        AC_MSG_RESULT(
 
1509
          [found xgettext program is not GNU xgettext; ignore it])
 
1510
        XGETTEXT=":"
 
1511
      fi
 
1512
    fi
 
1513
 
 
1514
    # We need to process the po/ directory.
 
1515
    POSUB=po
 
1516
 
 
1517
    AC_OUTPUT_COMMANDS(
 
1518
      [case "$CONFIG_FILES" in *po/Makefile.in*)
 
1519
        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
 
1520
      esac])
 
1521
 
 
1522
    dnl These rules are solely for the distribution goal.  While doing this
 
1523
    dnl we only have to keep exactly one list of the available catalogs
 
1524
    dnl in configure.ac.
 
1525
    for lang in $ALL_LINGUAS; do
 
1526
      GMOFILES="$GMOFILES $lang.gmo"
 
1527
      POFILES="$POFILES $lang.po"
 
1528
    done
 
1529
 
 
1530
    dnl Make all variables we use known to autoconf.
 
1531
    AC_SUBST(CATALOGS)
 
1532
    AC_SUBST(CATOBJEXT)
 
1533
    AC_SUBST(DATADIRNAME)
 
1534
    AC_SUBST(GMOFILES)
 
1535
    AC_SUBST(INSTOBJEXT)
 
1536
    AC_SUBST(INTLLIBS)
 
1537
    AC_SUBST(PO_IN_DATADIR_TRUE)
 
1538
    AC_SUBST(PO_IN_DATADIR_FALSE)
 
1539
    AC_SUBST(POFILES)
 
1540
    AC_SUBST(POSUB)
 
1541
  ])
 
1542
 
 
1543
# AM_GLIB_GNU_GETTEXT
 
1544
# -------------------
 
1545
# Do checks necessary for use of gettext. If a suitable implementation 
 
1546
# of gettext is found in either in libintl or in the C library,
 
1547
# it will set INTLLIBS to the libraries needed for use of gettext
 
1548
# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
 
1549
# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
 
1550
# on various variables needed by the Makefile.in.in installed by 
 
1551
# glib-gettextize.
 
1552
dnl
 
1553
glib_DEFUN([GLIB_GNU_GETTEXT],
 
1554
  [AC_REQUIRE([AC_PROG_CC])dnl
 
1555
   AC_REQUIRE([AC_HEADER_STDC])dnl
 
1556
   
 
1557
   GLIB_LC_MESSAGES
 
1558
   GLIB_WITH_NLS
 
1559
 
 
1560
   if test "$gt_cv_have_gettext" = "yes"; then
 
1561
     if test "x$ALL_LINGUAS" = "x"; then
 
1562
       LINGUAS=
 
1563
     else
 
1564
       AC_MSG_CHECKING(for catalogs to be installed)
 
1565
       NEW_LINGUAS=
 
1566
       for presentlang in $ALL_LINGUAS; do
 
1567
         useit=no
 
1568
         if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
 
1569
           desiredlanguages="$LINGUAS"
 
1570
         else
 
1571
           desiredlanguages="$ALL_LINGUAS"
 
1572
         fi
 
1573
         for desiredlang in $desiredlanguages; do
 
1574
           # Use the presentlang catalog if desiredlang is
 
1575
           #   a. equal to presentlang, or
 
1576
           #   b. a variant of presentlang (because in this case,
 
1577
           #      presentlang can be used as a fallback for messages
 
1578
           #      which are not translated in the desiredlang catalog).
 
1579
           case "$desiredlang" in
 
1580
             "$presentlang"*) useit=yes;;
 
1581
           esac
 
1582
         done
 
1583
         if test $useit = yes; then
 
1584
           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
 
1585
         fi
 
1586
       done
 
1587
       LINGUAS=$NEW_LINGUAS
 
1588
       AC_MSG_RESULT($LINGUAS)
 
1589
     fi
 
1590
 
 
1591
     dnl Construct list of names of catalog files to be constructed.
 
1592
     if test -n "$LINGUAS"; then
 
1593
       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
 
1594
     fi
 
1595
   fi
 
1596
 
 
1597
   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
 
1598
   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
 
1599
   dnl Try to locate is.
 
1600
   MKINSTALLDIRS=
 
1601
   if test -n "$ac_aux_dir"; then
 
1602
     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
 
1603
   fi
 
1604
   if test -z "$MKINSTALLDIRS"; then
 
1605
     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
 
1606
   fi
 
1607
   AC_SUBST(MKINSTALLDIRS)
 
1608
 
 
1609
   dnl Generate list of files to be processed by xgettext which will
 
1610
   dnl be included in po/Makefile.
 
1611
   test -d po || mkdir po
 
1612
   if test "x$srcdir" != "x."; then
 
1613
     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
 
1614
       posrcprefix="$srcdir/"
 
1615
     else
 
1616
       posrcprefix="../$srcdir/"
 
1617
     fi
 
1618
   else
 
1619
     posrcprefix="../"
 
1620
   fi
 
1621
   rm -f po/POTFILES
 
1622
   sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
 
1623
        < $srcdir/po/POTFILES.in > po/POTFILES
 
1624
  ])
 
1625
 
 
1626
# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
 
1627
# -------------------------------
 
1628
# Define VARIABLE to the location where catalog files will
 
1629
# be installed by po/Makefile.
 
1630
glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
 
1631
[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
 
1632
glib_save_prefix="$prefix"
 
1633
glib_save_exec_prefix="$exec_prefix"
 
1634
glib_save_datarootdir="$datarootdir"
 
1635
test "x$prefix" = xNONE && prefix=$ac_default_prefix
 
1636
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
 
1637
datarootdir=`eval echo "${datarootdir}"`
 
1638
if test "x$CATOBJEXT" = "x.mo" ; then
 
1639
  localedir=`eval echo "${libdir}/locale"`
 
1640
else
 
1641
  localedir=`eval echo "${datadir}/locale"`
 
1642
fi
 
1643
prefix="$glib_save_prefix"
 
1644
exec_prefix="$glib_save_exec_prefix"
 
1645
datarootdir="$glib_save_datarootdir"
 
1646
AC_DEFINE_UNQUOTED($1, "$localedir",
 
1647
  [Define the location where the catalogs will be installed])
 
1648
])
 
1649
 
 
1650
dnl
 
1651
dnl Now the definitions that aclocal will find
 
1652
dnl
 
1653
ifdef(glib_configure_ac,[],[
 
1654
AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
 
1655
AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
 
1656
])dnl
 
1657
 
 
1658
# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL])
 
1659
 
1660
# Create a temporary file with TEST-FILE as its contents and pass the
 
1661
# file name to PROGRAM.  Perform ACTION-IF-PASS if PROGRAM exits with
 
1662
# 0 and perform ACTION-IF-FAIL for any other exit status.
 
1663
AC_DEFUN([GLIB_RUN_PROG],
 
1664
[cat >conftest.foo <<_ACEOF
 
1665
$2
 
1666
_ACEOF
 
1667
if AC_RUN_LOG([$1 conftest.foo]); then
 
1668
  m4_ifval([$3], [$3], [:])
 
1669
m4_ifvaln([$4], [else $4])dnl
 
1670
echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD
 
1671
sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD
 
1672
fi])
 
1673
 
 
1674
 
1673
1675
m4_include([m4/intltool.m4])
1674
1676
m4_include([m4/libtool.m4])
1675
1677
m4_include([m4/ltoptions.m4])