~ubuntu-branches/ubuntu/trusty/gnome-shell/trusty-proposed

« back to all changes in this revision

Viewing changes to aclocal.m4

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2013-02-21 11:55:19 UTC
  • mfrom: (1.1.48)
  • Revision ID: package-import@ubuntu.com-20130221115519-ds607jwrcatdfvse
Tags: 3.6.3.1-0ubuntu1
* New upstream release (LP: #1128804)
* debian/patches:
  - git_messagetray_fix_expansion.patch, Drop applied upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
# Configure paths for GLIB
 
23
# Owen Taylor     1997-2001
 
24
 
 
25
dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
 
26
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
 
27
dnl gthread, or gio is specified in MODULES, pass to pkg-config
 
28
dnl
 
29
AC_DEFUN([AM_PATH_GLIB_2_0],
 
30
[dnl 
 
31
dnl Get the cflags and libraries from pkg-config
 
32
dnl
 
33
AC_ARG_ENABLE(glibtest, [  --disable-glibtest      do not try to compile and run a test GLIB program],
 
34
                    , enable_glibtest=yes)
 
35
 
 
36
  pkg_config_args=glib-2.0
 
37
  for module in . $4
 
38
  do
 
39
      case "$module" in
 
40
         gmodule) 
 
41
             pkg_config_args="$pkg_config_args gmodule-2.0"
 
42
         ;;
 
43
         gmodule-no-export) 
 
44
             pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
 
45
         ;;
 
46
         gobject) 
 
47
             pkg_config_args="$pkg_config_args gobject-2.0"
 
48
         ;;
 
49
         gthread) 
 
50
             pkg_config_args="$pkg_config_args gthread-2.0"
 
51
         ;;
 
52
         gio*) 
 
53
             pkg_config_args="$pkg_config_args $module-2.0"
 
54
         ;;
 
55
      esac
 
56
  done
 
57
 
 
58
  PKG_PROG_PKG_CONFIG([0.16])
 
59
 
 
60
  no_glib=""
 
61
 
 
62
  if test "x$PKG_CONFIG" = x ; then
 
63
    no_glib=yes
 
64
    PKG_CONFIG=no
 
65
  fi
 
66
 
 
67
  min_glib_version=ifelse([$1], ,2.0.0,$1)
 
68
  AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
 
69
 
 
70
  if test x$PKG_CONFIG != xno ; then
 
71
    ## don't try to run the test against uninstalled libtool libs
 
72
    if $PKG_CONFIG --uninstalled $pkg_config_args; then
 
73
          echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
 
74
          enable_glibtest=no
 
75
    fi
 
76
 
 
77
    if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
 
78
          :
 
79
    else
 
80
          no_glib=yes
 
81
    fi
 
82
  fi
 
83
 
 
84
  if test x"$no_glib" = x ; then
 
85
    GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
 
86
    GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
 
87
    GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
 
88
    GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
 
89
 
 
90
    GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
 
91
    GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
 
92
    glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
 
93
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 
94
    glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
 
95
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 
96
    glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
 
97
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 
98
    if test "x$enable_glibtest" = "xyes" ; then
 
99
      ac_save_CFLAGS="$CFLAGS"
 
100
      ac_save_LIBS="$LIBS"
 
101
      CFLAGS="$CFLAGS $GLIB_CFLAGS"
 
102
      LIBS="$GLIB_LIBS $LIBS"
 
103
dnl
 
104
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
 
105
dnl checks the results of pkg-config to some extent)
 
106
dnl
 
107
      rm -f conf.glibtest
 
108
      AC_TRY_RUN([
 
109
#include <glib.h>
 
110
#include <stdio.h>
 
111
#include <stdlib.h>
 
112
 
 
113
int 
 
114
main ()
 
115
{
 
116
  unsigned int major, minor, micro;
 
117
  char *tmp_version;
 
118
 
 
119
  fclose (fopen ("conf.glibtest", "w"));
 
120
 
 
121
  /* HP/UX 9 (%@#!) writes to sscanf strings */
 
122
  tmp_version = g_strdup("$min_glib_version");
 
123
  if (sscanf(tmp_version, "%u.%u.%u", &major, &minor, &micro) != 3) {
 
124
     printf("%s, bad version string\n", "$min_glib_version");
 
125
     exit(1);
 
126
   }
 
127
 
 
128
  if ((glib_major_version != $glib_config_major_version) ||
 
129
      (glib_minor_version != $glib_config_minor_version) ||
 
130
      (glib_micro_version != $glib_config_micro_version))
 
131
    {
 
132
      printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
 
133
             $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
 
134
             glib_major_version, glib_minor_version, glib_micro_version);
 
135
      printf ("*** was found! If pkg-config was correct, then it is best\n");
 
136
      printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
 
137
      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
 
138
      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
 
139
      printf("*** required on your system.\n");
 
140
      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
 
141
      printf("*** to point to the correct configuration files\n");
 
142
    } 
 
143
  else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
 
144
           (glib_minor_version != GLIB_MINOR_VERSION) ||
 
145
           (glib_micro_version != GLIB_MICRO_VERSION))
 
146
    {
 
147
      printf("*** GLIB header files (version %d.%d.%d) do not match\n",
 
148
             GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
 
149
      printf("*** library (version %d.%d.%d)\n",
 
150
             glib_major_version, glib_minor_version, glib_micro_version);
 
151
    }
 
152
  else
 
153
    {
 
154
      if ((glib_major_version > major) ||
 
155
        ((glib_major_version == major) && (glib_minor_version > minor)) ||
 
156
        ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
 
157
      {
 
158
        return 0;
 
159
       }
 
160
     else
 
161
      {
 
162
        printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n",
 
163
               glib_major_version, glib_minor_version, glib_micro_version);
 
164
        printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n",
 
165
               major, minor, micro);
 
166
        printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
 
167
        printf("***\n");
 
168
        printf("*** If you have already installed a sufficiently new version, this error\n");
 
169
        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
 
170
        printf("*** being found. The easiest way to fix this is to remove the old version\n");
 
171
        printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
 
172
        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
 
173
        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
 
174
        printf("*** so that the correct libraries are found at run-time))\n");
 
175
      }
 
176
    }
 
177
  return 1;
 
178
}
 
179
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
 
180
       CFLAGS="$ac_save_CFLAGS"
 
181
       LIBS="$ac_save_LIBS"
 
182
     fi
 
183
  fi
 
184
  if test "x$no_glib" = x ; then
 
185
     AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
 
186
     ifelse([$2], , :, [$2])     
 
187
  else
 
188
     AC_MSG_RESULT(no)
 
189
     if test "$PKG_CONFIG" = "no" ; then
 
190
       echo "*** A new enough version of pkg-config was not found."
 
191
       echo "*** See http://www.freedesktop.org/software/pkgconfig/"
 
192
     else
 
193
       if test -f conf.glibtest ; then
 
194
        :
 
195
       else
 
196
          echo "*** Could not run GLIB test program, checking why..."
 
197
          ac_save_CFLAGS="$CFLAGS"
 
198
          ac_save_LIBS="$LIBS"
 
199
          CFLAGS="$CFLAGS $GLIB_CFLAGS"
 
200
          LIBS="$LIBS $GLIB_LIBS"
 
201
          AC_TRY_LINK([
 
202
#include <glib.h>
 
203
#include <stdio.h>
 
204
],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
 
205
        [ echo "*** The test program compiled, but did not run. This usually means"
 
206
          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
 
207
          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
 
208
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
 
209
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
 
210
          echo "*** is required on your system"
 
211
          echo "***"
 
212
          echo "*** If you have an old version installed, it is best to remove it, although"
 
213
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
 
214
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
 
215
          echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
 
216
          CFLAGS="$ac_save_CFLAGS"
 
217
          LIBS="$ac_save_LIBS"
 
218
       fi
 
219
     fi
 
220
     GLIB_CFLAGS=""
 
221
     GLIB_LIBS=""
 
222
     GLIB_GENMARSHAL=""
 
223
     GOBJECT_QUERY=""
 
224
     GLIB_MKENUMS=""
 
225
     GLIB_COMPILE_RESOURCES=""
 
226
     ifelse([$3], , :, [$3])
 
227
  fi
 
228
  AC_SUBST(GLIB_CFLAGS)
 
229
  AC_SUBST(GLIB_LIBS)
 
230
  AC_SUBST(GLIB_GENMARSHAL)
 
231
  AC_SUBST(GOBJECT_QUERY)
 
232
  AC_SUBST(GLIB_MKENUMS)
 
233
  AC_SUBST(GLIB_COMPILE_RESOURCES)
 
234
  rm -f conf.glibtest
 
235
])
 
236
 
 
237
dnl GLIB_GSETTINGS
 
238
dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
 
239
dnl the schema should be compiled
 
240
dnl
 
241
 
 
242
AC_DEFUN([GLIB_GSETTINGS],
 
243
[
 
244
  m4_pattern_allow([AM_V_GEN])
 
245
  AC_ARG_ENABLE(schemas-compile,
 
246
                AS_HELP_STRING([--disable-schemas-compile],
 
247
                               [Disable regeneration of gschemas.compiled on install]),
 
248
                [case ${enableval} in
 
249
                  yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE=""  ;;
 
250
                  no)  GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
 
251
                  *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;;
 
252
                 esac])
 
253
  AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
 
254
  PKG_PROG_PKG_CONFIG([0.16])
 
255
  AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
 
256
  if test x$cross_compiling != xyes; then
 
257
    GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
 
258
  else
 
259
    AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
 
260
  fi
 
261
  AC_SUBST(GLIB_COMPILE_SCHEMAS)
 
262
  if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
 
263
    ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])
 
264
  else
 
265
    ifelse([$1],,[:],[$1])
 
266
  fi
 
267
 
 
268
  GSETTINGS_RULES='
 
269
.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas
 
270
 
 
271
mostlyclean-am: clean-gsettings-schemas
 
272
 
 
273
gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
 
274
 
 
275
%.gschema.valid: %.gschema.xml $(gsettings__enum_file)
 
276
        $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch [$]@
 
277
 
 
278
all-am: $(gsettings_SCHEMAS:.xml=.valid)
 
279
uninstall-am: uninstall-gsettings-schemas
 
280
install-data-am: install-gsettings-schemas
 
281
 
 
282
.SECONDARY: $(gsettings_SCHEMAS)
 
283
 
 
284
install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file)
 
285
        @$(NORMAL_INSTALL)
 
286
        if test -n "$^"; then \
 
287
                test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \
 
288
                $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \
 
289
                test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \
 
290
        fi
 
291
 
 
292
uninstall-gsettings-schemas:
 
293
        @$(NORMAL_UNINSTALL)
 
294
        @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \
 
295
        files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
 
296
        test -n "$$files" || exit 0; \
 
297
        echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
 
298
        cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
 
299
        test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
 
300
 
 
301
clean-gsettings-schemas:
 
302
        rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file)
 
303
 
 
304
ifdef gsettings_ENUM_NAMESPACE
 
305
$(gsettings__enum_file): $(gsettings_ENUM_FILES)
 
306
        $(AM_V_GEN) glib-mkenums --comments '\''<!-- @comment@ -->'\'' --fhead "<schemalist>" --vhead "  <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod "    <value nick='\''@valuenick@'\'' value='\''@valuenum@'\''/>" --vtail "  </@type@>" --ftail "</schemalist>" [$]^ > [$]@.tmp && mv [$]@.tmp [$]@
 
307
endif
 
308
'
 
309
  _GSETTINGS_SUBST(GSETTINGS_RULES)
 
310
])
 
311
 
 
312
dnl _GSETTINGS_SUBST(VARIABLE)
 
313
dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
 
314
AC_DEFUN([_GSETTINGS_SUBST],
 
315
[
 
316
AC_SUBST([$1])
 
317
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
 
318
]
 
319
)
 
320
 
 
321
dnl -*- mode: autoconf -*-
 
322
dnl Copyright 2009 Johan Dahlin
 
323
dnl
 
324
dnl This file is free software; the author(s) gives unlimited
 
325
dnl permission to copy and/or distribute it, with or without
 
326
dnl modifications, as long as this notice is preserved.
 
327
dnl
 
328
 
 
329
# serial 1
 
330
 
 
331
m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
 
332
[
 
333
    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
 
334
    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
 
335
    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
 
336
 
 
337
    dnl enable/disable introspection
 
338
    m4_if([$2], [require],
 
339
    [dnl
 
340
        enable_introspection=yes
 
341
    ],[dnl
 
342
        AC_ARG_ENABLE(introspection,
 
343
                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
 
344
                                 [Enable introspection for this build]),, 
 
345
                                 [enable_introspection=auto])
 
346
    ])dnl
 
347
 
 
348
    AC_MSG_CHECKING([for gobject-introspection])
 
349
 
 
350
    dnl presence/version checking
 
351
    AS_CASE([$enable_introspection],
 
352
    [no], [dnl
 
353
        found_introspection="no (disabled, use --enable-introspection to enable)"
 
354
    ],dnl
 
355
    [yes],[dnl
 
356
        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
 
357
                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
 
358
        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
 
359
                         found_introspection=yes,
 
360
                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
 
361
    ],dnl
 
362
    [auto],[dnl
 
363
        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
 
364
        dnl Canonicalize enable_introspection
 
365
        enable_introspection=$found_introspection
 
366
    ],dnl
 
367
    [dnl        
 
368
        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
 
369
    ])dnl
 
370
 
 
371
    AC_MSG_RESULT([$found_introspection])
 
372
 
 
373
    INTROSPECTION_SCANNER=
 
374
    INTROSPECTION_COMPILER=
 
375
    INTROSPECTION_GENERATE=
 
376
    INTROSPECTION_GIRDIR=
 
377
    INTROSPECTION_TYPELIBDIR=
 
378
    if test "x$found_introspection" = "xyes"; then
 
379
       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
 
380
       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
 
381
       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
 
382
       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
 
383
       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
 
384
       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
 
385
       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
 
386
       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
 
387
    fi
 
388
    AC_SUBST(INTROSPECTION_SCANNER)
 
389
    AC_SUBST(INTROSPECTION_COMPILER)
 
390
    AC_SUBST(INTROSPECTION_GENERATE)
 
391
    AC_SUBST(INTROSPECTION_GIRDIR)
 
392
    AC_SUBST(INTROSPECTION_TYPELIBDIR)
 
393
    AC_SUBST(INTROSPECTION_CFLAGS)
 
394
    AC_SUBST(INTROSPECTION_LIBS)
 
395
    AC_SUBST(INTROSPECTION_MAKEFILE)
 
396
 
 
397
    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
 
398
])
 
399
 
 
400
 
 
401
dnl Usage:
 
402
dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
 
403
 
 
404
AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
 
405
[
 
406
  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
 
407
])
 
408
 
 
409
dnl Usage:
 
410
dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
 
411
 
 
412
 
 
413
AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
 
414
[
 
415
  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
 
416
])
 
417
 
 
418
# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 
419
# serial 1 (pkg-config-0.24)
 
420
 
421
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
 
422
#
 
423
# This program is free software; you can redistribute it and/or modify
 
424
# it under the terms of the GNU General Public License as published by
 
425
# the Free Software Foundation; either version 2 of the License, or
 
426
# (at your option) any later version.
 
427
#
 
428
# This program is distributed in the hope that it will be useful, but
 
429
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
430
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
431
# General Public License for more details.
 
432
#
 
433
# You should have received a copy of the GNU General Public License
 
434
# along with this program; if not, write to the Free Software
 
435
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
436
#
 
437
# As a special exception to the GNU General Public License, if you
 
438
# distribute this file as part of a program that contains a
 
439
# configuration script generated by Autoconf, you may include it under
 
440
# the same distribution terms that you use for the rest of that program.
 
441
 
 
442
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
 
443
# ----------------------------------
 
444
AC_DEFUN([PKG_PROG_PKG_CONFIG],
 
445
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
 
446
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
 
447
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
 
448
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
 
449
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
 
450
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
 
451
 
 
452
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 
453
        AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
 
454
fi
 
455
if test -n "$PKG_CONFIG"; then
 
456
        _pkg_min_version=m4_default([$1], [0.9.0])
 
457
        AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
 
458
        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
 
459
                AC_MSG_RESULT([yes])
 
460
        else
 
461
                AC_MSG_RESULT([no])
 
462
                PKG_CONFIG=""
 
463
        fi
 
464
fi[]dnl
 
465
])# PKG_PROG_PKG_CONFIG
 
466
 
 
467
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
468
#
 
469
# Check to see whether a particular set of modules exists.  Similar
 
470
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
 
471
#
 
472
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 
473
# only at the first occurence in configure.ac, so if the first place
 
474
# it's called might be skipped (such as if it is within an "if", you
 
475
# have to call PKG_CHECK_EXISTS manually
 
476
# --------------------------------------------------------------
 
477
AC_DEFUN([PKG_CHECK_EXISTS],
 
478
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 
479
if test -n "$PKG_CONFIG" && \
 
480
    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
 
481
  m4_default([$2], [:])
 
482
m4_ifvaln([$3], [else
 
483
  $3])dnl
 
484
fi])
 
485
 
 
486
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
 
487
# ---------------------------------------------
 
488
m4_define([_PKG_CONFIG],
 
489
[if test -n "$$1"; then
 
490
    pkg_cv_[]$1="$$1"
 
491
 elif test -n "$PKG_CONFIG"; then
 
492
    PKG_CHECK_EXISTS([$3],
 
493
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
 
494
                      test "x$?" != "x0" && pkg_failed=yes ],
 
495
                     [pkg_failed=yes])
 
496
 else
 
497
    pkg_failed=untried
 
498
fi[]dnl
 
499
])# _PKG_CONFIG
 
500
 
 
501
# _PKG_SHORT_ERRORS_SUPPORTED
 
502
# -----------------------------
 
503
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
 
504
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 
505
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
 
506
        _pkg_short_errors_supported=yes
 
507
else
 
508
        _pkg_short_errors_supported=no
 
509
fi[]dnl
 
510
])# _PKG_SHORT_ERRORS_SUPPORTED
 
511
 
 
512
 
 
513
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
 
514
# [ACTION-IF-NOT-FOUND])
 
515
#
 
516
#
 
517
# Note that if there is a possibility the first call to
 
518
# PKG_CHECK_MODULES might not happen, you should be sure to include an
 
519
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
 
520
#
 
521
#
 
522
# --------------------------------------------------------------
 
523
AC_DEFUN([PKG_CHECK_MODULES],
 
524
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 
525
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
 
526
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
 
527
 
 
528
pkg_failed=no
 
529
AC_MSG_CHECKING([for $1])
 
530
 
 
531
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 
532
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
533
 
 
534
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
 
535
and $1[]_LIBS to avoid the need to call pkg-config.
 
536
See the pkg-config man page for more details.])
 
537
 
 
538
if test $pkg_failed = yes; then
 
539
        AC_MSG_RESULT([no])
 
540
        _PKG_SHORT_ERRORS_SUPPORTED
 
541
        if test $_pkg_short_errors_supported = yes; then
 
542
                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
 
543
        else 
 
544
                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
 
545
        fi
 
546
        # Put the nasty error message in config.log where it belongs
 
547
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
 
548
 
 
549
        m4_default([$4], [AC_MSG_ERROR(
 
550
[Package requirements ($2) were not met:
 
551
 
 
552
$$1_PKG_ERRORS
 
553
 
 
554
Consider adjusting the PKG_CONFIG_PATH environment variable if you
 
555
installed software in a non-standard prefix.
 
556
 
 
557
_PKG_TEXT])[]dnl
 
558
        ])
 
559
elif test $pkg_failed = untried; then
 
560
        AC_MSG_RESULT([no])
 
561
        m4_default([$4], [AC_MSG_FAILURE(
 
562
[The pkg-config script could not be found or is too old.  Make sure it
 
563
is in your PATH or set the PKG_CONFIG environment variable to the full
 
564
path to pkg-config.
 
565
 
 
566
_PKG_TEXT
 
567
 
 
568
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
 
569
        ])
 
570
else
 
571
        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
 
572
        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
 
573
        AC_MSG_RESULT([yes])
 
574
        $3
 
575
fi[]dnl
 
576
])# PKG_CHECK_MODULES
 
577
 
 
578
 
 
579
# PKG_INSTALLDIR(DIRECTORY)
 
580
# -------------------------
 
581
# Substitutes the variable pkgconfigdir as the location where a module
 
582
# should install pkg-config .pc files. By default the directory is
 
583
# $libdir/pkgconfig, but the default can be changed by passing
 
584
# DIRECTORY. The user can override through the --with-pkgconfigdir
 
585
# parameter.
 
586
AC_DEFUN([PKG_INSTALLDIR],
 
587
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
 
588
m4_pushdef([pkg_description],
 
589
    [pkg-config installation directory @<:@]pkg_default[@:>@])
 
590
AC_ARG_WITH([pkgconfigdir],
 
591
    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
 
592
    [with_pkgconfigdir=]pkg_default)
 
593
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
 
594
m4_popdef([pkg_default])
 
595
m4_popdef([pkg_description])
 
596
]) dnl PKG_INSTALLDIR
 
597
 
 
598
 
 
599
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
 
600
# -------------------------
 
601
# Substitutes the variable noarch_pkgconfigdir as the location where a
 
602
# module should install arch-independent pkg-config .pc files. By
 
603
# default the directory is $datadir/pkgconfig, but the default can be
 
604
# changed by passing DIRECTORY. The user can override through the
 
605
# --with-noarch-pkgconfigdir parameter.
 
606
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
 
607
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
 
608
m4_pushdef([pkg_description],
 
609
    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
 
610
AC_ARG_WITH([noarch-pkgconfigdir],
 
611
    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
 
612
    [with_noarch_pkgconfigdir=]pkg_default)
 
613
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
 
614
m4_popdef([pkg_default])
 
615
m4_popdef([pkg_description])
 
616
]) dnl PKG_NOARCH_INSTALLDIR
 
617
 
22
618
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
23
619
#
24
620
# This file is free software; the Free Software Foundation
1362
1958
AC_SUBST([am__untar])
1363
1959
]) # _AM_PROG_TAR
1364
1960
 
1365
 
# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1366
 
# serial 1 (pkg-config-0.24)
1367
 
1368
 
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1369
 
#
1370
 
# This program is free software; you can redistribute it and/or modify
1371
 
# it under the terms of the GNU General Public License as published by
1372
 
# the Free Software Foundation; either version 2 of the License, or
1373
 
# (at your option) any later version.
1374
 
#
1375
 
# This program is distributed in the hope that it will be useful, but
1376
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
1377
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1378
 
# General Public License for more details.
1379
 
#
1380
 
# You should have received a copy of the GNU General Public License
1381
 
# along with this program; if not, write to the Free Software
1382
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1383
 
#
1384
 
# As a special exception to the GNU General Public License, if you
1385
 
# distribute this file as part of a program that contains a
1386
 
# configuration script generated by Autoconf, you may include it under
1387
 
# the same distribution terms that you use for the rest of that program.
1388
 
 
1389
 
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1390
 
# ----------------------------------
1391
 
AC_DEFUN([PKG_PROG_PKG_CONFIG],
1392
 
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1393
 
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1394
 
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1395
 
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1396
 
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1397
 
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1398
 
 
1399
 
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1400
 
        AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1401
 
fi
1402
 
if test -n "$PKG_CONFIG"; then
1403
 
        _pkg_min_version=m4_default([$1], [0.9.0])
1404
 
        AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1405
 
        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1406
 
                AC_MSG_RESULT([yes])
1407
 
        else
1408
 
                AC_MSG_RESULT([no])
1409
 
                PKG_CONFIG=""
1410
 
        fi
1411
 
fi[]dnl
1412
 
])# PKG_PROG_PKG_CONFIG
1413
 
 
1414
 
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1415
 
#
1416
 
# Check to see whether a particular set of modules exists.  Similar
1417
 
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1418
 
#
1419
 
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1420
 
# only at the first occurence in configure.ac, so if the first place
1421
 
# it's called might be skipped (such as if it is within an "if", you
1422
 
# have to call PKG_CHECK_EXISTS manually
1423
 
# --------------------------------------------------------------
1424
 
AC_DEFUN([PKG_CHECK_EXISTS],
1425
 
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1426
 
if test -n "$PKG_CONFIG" && \
1427
 
    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1428
 
  m4_default([$2], [:])
1429
 
m4_ifvaln([$3], [else
1430
 
  $3])dnl
1431
 
fi])
1432
 
 
1433
 
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1434
 
# ---------------------------------------------
1435
 
m4_define([_PKG_CONFIG],
1436
 
[if test -n "$$1"; then
1437
 
    pkg_cv_[]$1="$$1"
1438
 
 elif test -n "$PKG_CONFIG"; then
1439
 
    PKG_CHECK_EXISTS([$3],
1440
 
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1441
 
                      test "x$?" != "x0" && pkg_failed=yes ],
1442
 
                     [pkg_failed=yes])
1443
 
 else
1444
 
    pkg_failed=untried
1445
 
fi[]dnl
1446
 
])# _PKG_CONFIG
1447
 
 
1448
 
# _PKG_SHORT_ERRORS_SUPPORTED
1449
 
# -----------------------------
1450
 
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1451
 
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1452
 
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1453
 
        _pkg_short_errors_supported=yes
1454
 
else
1455
 
        _pkg_short_errors_supported=no
1456
 
fi[]dnl
1457
 
])# _PKG_SHORT_ERRORS_SUPPORTED
1458
 
 
1459
 
 
1460
 
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1461
 
# [ACTION-IF-NOT-FOUND])
1462
 
#
1463
 
#
1464
 
# Note that if there is a possibility the first call to
1465
 
# PKG_CHECK_MODULES might not happen, you should be sure to include an
1466
 
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1467
 
#
1468
 
#
1469
 
# --------------------------------------------------------------
1470
 
AC_DEFUN([PKG_CHECK_MODULES],
1471
 
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1472
 
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1473
 
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1474
 
 
1475
 
pkg_failed=no
1476
 
AC_MSG_CHECKING([for $1])
1477
 
 
1478
 
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1479
 
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1480
 
 
1481
 
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1482
 
and $1[]_LIBS to avoid the need to call pkg-config.
1483
 
See the pkg-config man page for more details.])
1484
 
 
1485
 
if test $pkg_failed = yes; then
1486
 
        AC_MSG_RESULT([no])
1487
 
        _PKG_SHORT_ERRORS_SUPPORTED
1488
 
        if test $_pkg_short_errors_supported = yes; then
1489
 
                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1490
 
        else 
1491
 
                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1492
 
        fi
1493
 
        # Put the nasty error message in config.log where it belongs
1494
 
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1495
 
 
1496
 
        m4_default([$4], [AC_MSG_ERROR(
1497
 
[Package requirements ($2) were not met:
1498
 
 
1499
 
$$1_PKG_ERRORS
1500
 
 
1501
 
Consider adjusting the PKG_CONFIG_PATH environment variable if you
1502
 
installed software in a non-standard prefix.
1503
 
 
1504
 
_PKG_TEXT])[]dnl
1505
 
        ])
1506
 
elif test $pkg_failed = untried; then
1507
 
        AC_MSG_RESULT([no])
1508
 
        m4_default([$4], [AC_MSG_FAILURE(
1509
 
[The pkg-config script could not be found or is too old.  Make sure it
1510
 
is in your PATH or set the PKG_CONFIG environment variable to the full
1511
 
path to pkg-config.
1512
 
 
1513
 
_PKG_TEXT
1514
 
 
1515
 
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1516
 
        ])
1517
 
else
1518
 
        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1519
 
        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1520
 
        AC_MSG_RESULT([yes])
1521
 
        $3
1522
 
fi[]dnl
1523
 
])# PKG_CHECK_MODULES
1524
 
 
1525
 
 
1526
 
# PKG_INSTALLDIR(DIRECTORY)
1527
 
# -------------------------
1528
 
# Substitutes the variable pkgconfigdir as the location where a module
1529
 
# should install pkg-config .pc files. By default the directory is
1530
 
# $libdir/pkgconfig, but the default can be changed by passing
1531
 
# DIRECTORY. The user can override through the --with-pkgconfigdir
1532
 
# parameter.
1533
 
AC_DEFUN([PKG_INSTALLDIR],
1534
 
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1535
 
m4_pushdef([pkg_description],
1536
 
    [pkg-config installation directory @<:@]pkg_default[@:>@])
1537
 
AC_ARG_WITH([pkgconfigdir],
1538
 
    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1539
 
    [with_pkgconfigdir=]pkg_default)
1540
 
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1541
 
m4_popdef([pkg_default])
1542
 
m4_popdef([pkg_description])
1543
 
]) dnl PKG_INSTALLDIR
1544
 
 
1545
 
 
1546
 
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
1547
 
# -------------------------
1548
 
# Substitutes the variable noarch_pkgconfigdir as the location where a
1549
 
# module should install arch-independent pkg-config .pc files. By
1550
 
# default the directory is $datadir/pkgconfig, but the default can be
1551
 
# changed by passing DIRECTORY. The user can override through the
1552
 
# --with-noarch-pkgconfigdir parameter.
1553
 
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
1554
 
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1555
 
m4_pushdef([pkg_description],
1556
 
    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1557
 
AC_ARG_WITH([noarch-pkgconfigdir],
1558
 
    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1559
 
    [with_noarch_pkgconfigdir=]pkg_default)
1560
 
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1561
 
m4_popdef([pkg_default])
1562
 
m4_popdef([pkg_description])
1563
 
]) dnl PKG_NOARCH_INSTALLDIR
1564
 
 
1565
 
# Configure paths for GLIB
1566
 
# Owen Taylor     1997-2001
1567
 
 
1568
 
dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
1569
 
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
1570
 
dnl gthread, or gio is specified in MODULES, pass to pkg-config
1571
 
dnl
1572
 
AC_DEFUN([AM_PATH_GLIB_2_0],
1573
 
[dnl 
1574
 
dnl Get the cflags and libraries from pkg-config
1575
 
dnl
1576
 
AC_ARG_ENABLE(glibtest, [  --disable-glibtest      do not try to compile and run a test GLIB program],
1577
 
                    , enable_glibtest=yes)
1578
 
 
1579
 
  pkg_config_args=glib-2.0
1580
 
  for module in . $4
1581
 
  do
1582
 
      case "$module" in
1583
 
         gmodule) 
1584
 
             pkg_config_args="$pkg_config_args gmodule-2.0"
1585
 
         ;;
1586
 
         gmodule-no-export) 
1587
 
             pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
1588
 
         ;;
1589
 
         gobject) 
1590
 
             pkg_config_args="$pkg_config_args gobject-2.0"
1591
 
         ;;
1592
 
         gthread) 
1593
 
             pkg_config_args="$pkg_config_args gthread-2.0"
1594
 
         ;;
1595
 
         gio*) 
1596
 
             pkg_config_args="$pkg_config_args $module-2.0"
1597
 
         ;;
1598
 
      esac
1599
 
  done
1600
 
 
1601
 
  PKG_PROG_PKG_CONFIG([0.16])
1602
 
 
1603
 
  no_glib=""
1604
 
 
1605
 
  if test "x$PKG_CONFIG" = x ; then
1606
 
    no_glib=yes
1607
 
    PKG_CONFIG=no
1608
 
  fi
1609
 
 
1610
 
  min_glib_version=ifelse([$1], ,2.0.0,$1)
1611
 
  AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
1612
 
 
1613
 
  if test x$PKG_CONFIG != xno ; then
1614
 
    ## don't try to run the test against uninstalled libtool libs
1615
 
    if $PKG_CONFIG --uninstalled $pkg_config_args; then
1616
 
          echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
1617
 
          enable_glibtest=no
1618
 
    fi
1619
 
 
1620
 
    if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
1621
 
          :
1622
 
    else
1623
 
          no_glib=yes
1624
 
    fi
1625
 
  fi
1626
 
 
1627
 
  if test x"$no_glib" = x ; then
1628
 
    GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
1629
 
    GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
1630
 
    GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
1631
 
    GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
1632
 
 
1633
 
    GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
1634
 
    GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
1635
 
    glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
1636
 
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1637
 
    glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
1638
 
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1639
 
    glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
1640
 
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1641
 
    if test "x$enable_glibtest" = "xyes" ; then
1642
 
      ac_save_CFLAGS="$CFLAGS"
1643
 
      ac_save_LIBS="$LIBS"
1644
 
      CFLAGS="$CFLAGS $GLIB_CFLAGS"
1645
 
      LIBS="$GLIB_LIBS $LIBS"
1646
 
dnl
1647
 
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
1648
 
dnl checks the results of pkg-config to some extent)
1649
 
dnl
1650
 
      rm -f conf.glibtest
1651
 
      AC_TRY_RUN([
1652
 
#include <glib.h>
1653
 
#include <stdio.h>
1654
 
#include <stdlib.h>
1655
 
 
1656
 
int 
1657
 
main ()
1658
 
{
1659
 
  unsigned int major, minor, micro;
1660
 
  char *tmp_version;
1661
 
 
1662
 
  fclose (fopen ("conf.glibtest", "w"));
1663
 
 
1664
 
  /* HP/UX 9 (%@#!) writes to sscanf strings */
1665
 
  tmp_version = g_strdup("$min_glib_version");
1666
 
  if (sscanf(tmp_version, "%u.%u.%u", &major, &minor, &micro) != 3) {
1667
 
     printf("%s, bad version string\n", "$min_glib_version");
1668
 
     exit(1);
1669
 
   }
1670
 
 
1671
 
  if ((glib_major_version != $glib_config_major_version) ||
1672
 
      (glib_minor_version != $glib_config_minor_version) ||
1673
 
      (glib_micro_version != $glib_config_micro_version))
1674
 
    {
1675
 
      printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
1676
 
             $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
1677
 
             glib_major_version, glib_minor_version, glib_micro_version);
1678
 
      printf ("*** was found! If pkg-config was correct, then it is best\n");
1679
 
      printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
1680
 
      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1681
 
      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1682
 
      printf("*** required on your system.\n");
1683
 
      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
1684
 
      printf("*** to point to the correct configuration files\n");
1685
 
    } 
1686
 
  else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
1687
 
           (glib_minor_version != GLIB_MINOR_VERSION) ||
1688
 
           (glib_micro_version != GLIB_MICRO_VERSION))
1689
 
    {
1690
 
      printf("*** GLIB header files (version %d.%d.%d) do not match\n",
1691
 
             GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
1692
 
      printf("*** library (version %d.%d.%d)\n",
1693
 
             glib_major_version, glib_minor_version, glib_micro_version);
1694
 
    }
1695
 
  else
1696
 
    {
1697
 
      if ((glib_major_version > major) ||
1698
 
        ((glib_major_version == major) && (glib_minor_version > minor)) ||
1699
 
        ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
1700
 
      {
1701
 
        return 0;
1702
 
       }
1703
 
     else
1704
 
      {
1705
 
        printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n",
1706
 
               glib_major_version, glib_minor_version, glib_micro_version);
1707
 
        printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n",
1708
 
               major, minor, micro);
1709
 
        printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
1710
 
        printf("***\n");
1711
 
        printf("*** If you have already installed a sufficiently new version, this error\n");
1712
 
        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
1713
 
        printf("*** being found. The easiest way to fix this is to remove the old version\n");
1714
 
        printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
1715
 
        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
1716
 
        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1717
 
        printf("*** so that the correct libraries are found at run-time))\n");
1718
 
      }
1719
 
    }
1720
 
  return 1;
1721
 
}
1722
 
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1723
 
       CFLAGS="$ac_save_CFLAGS"
1724
 
       LIBS="$ac_save_LIBS"
1725
 
     fi
1726
 
  fi
1727
 
  if test "x$no_glib" = x ; then
1728
 
     AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
1729
 
     ifelse([$2], , :, [$2])     
1730
 
  else
1731
 
     AC_MSG_RESULT(no)
1732
 
     if test "$PKG_CONFIG" = "no" ; then
1733
 
       echo "*** A new enough version of pkg-config was not found."
1734
 
       echo "*** See http://www.freedesktop.org/software/pkgconfig/"
1735
 
     else
1736
 
       if test -f conf.glibtest ; then
1737
 
        :
1738
 
       else
1739
 
          echo "*** Could not run GLIB test program, checking why..."
1740
 
          ac_save_CFLAGS="$CFLAGS"
1741
 
          ac_save_LIBS="$LIBS"
1742
 
          CFLAGS="$CFLAGS $GLIB_CFLAGS"
1743
 
          LIBS="$LIBS $GLIB_LIBS"
1744
 
          AC_TRY_LINK([
1745
 
#include <glib.h>
1746
 
#include <stdio.h>
1747
 
],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
1748
 
        [ echo "*** The test program compiled, but did not run. This usually means"
1749
 
          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
1750
 
          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
1751
 
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1752
 
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1753
 
          echo "*** is required on your system"
1754
 
          echo "***"
1755
 
          echo "*** If you have an old version installed, it is best to remove it, although"
1756
 
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
1757
 
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
1758
 
          echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
1759
 
          CFLAGS="$ac_save_CFLAGS"
1760
 
          LIBS="$ac_save_LIBS"
1761
 
       fi
1762
 
     fi
1763
 
     GLIB_CFLAGS=""
1764
 
     GLIB_LIBS=""
1765
 
     GLIB_GENMARSHAL=""
1766
 
     GOBJECT_QUERY=""
1767
 
     GLIB_MKENUMS=""
1768
 
     GLIB_COMPILE_RESOURCES=""
1769
 
     ifelse([$3], , :, [$3])
1770
 
  fi
1771
 
  AC_SUBST(GLIB_CFLAGS)
1772
 
  AC_SUBST(GLIB_LIBS)
1773
 
  AC_SUBST(GLIB_GENMARSHAL)
1774
 
  AC_SUBST(GOBJECT_QUERY)
1775
 
  AC_SUBST(GLIB_MKENUMS)
1776
 
  AC_SUBST(GLIB_COMPILE_RESOURCES)
1777
 
  rm -f conf.glibtest
1778
 
])
1779
 
 
1780
 
dnl GLIB_GSETTINGS
1781
 
dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
1782
 
dnl the schema should be compiled
1783
 
dnl
1784
 
 
1785
 
AC_DEFUN([GLIB_GSETTINGS],
1786
 
[
1787
 
  m4_pattern_allow([AM_V_GEN])
1788
 
  AC_ARG_ENABLE(schemas-compile,
1789
 
                AS_HELP_STRING([--disable-schemas-compile],
1790
 
                               [Disable regeneration of gschemas.compiled on install]),
1791
 
                [case ${enableval} in
1792
 
                  yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE=""  ;;
1793
 
                  no)  GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
1794
 
                  *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;;
1795
 
                 esac])
1796
 
  AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
1797
 
  PKG_PROG_PKG_CONFIG([0.16])
1798
 
  AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
1799
 
  if test x$cross_compiling != xyes; then
1800
 
    GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
1801
 
  else
1802
 
    AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
1803
 
  fi
1804
 
  AC_SUBST(GLIB_COMPILE_SCHEMAS)
1805
 
  if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
1806
 
    ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])
1807
 
  else
1808
 
    ifelse([$1],,[:],[$1])
1809
 
  fi
1810
 
 
1811
 
  GSETTINGS_RULES='
1812
 
.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas
1813
 
 
1814
 
mostlyclean-am: clean-gsettings-schemas
1815
 
 
1816
 
gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
1817
 
 
1818
 
%.gschema.valid: %.gschema.xml $(gsettings__enum_file)
1819
 
        $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch [$]@
1820
 
 
1821
 
all-am: $(gsettings_SCHEMAS:.xml=.valid)
1822
 
uninstall-am: uninstall-gsettings-schemas
1823
 
install-data-am: install-gsettings-schemas
1824
 
 
1825
 
.SECONDARY: $(gsettings_SCHEMAS)
1826
 
 
1827
 
install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file)
1828
 
        @$(NORMAL_INSTALL)
1829
 
        if test -n "$^"; then \
1830
 
                test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \
1831
 
                $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \
1832
 
                test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \
1833
 
        fi
1834
 
 
1835
 
uninstall-gsettings-schemas:
1836
 
        @$(NORMAL_UNINSTALL)
1837
 
        @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \
1838
 
        files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
1839
 
        test -n "$$files" || exit 0; \
1840
 
        echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
1841
 
        cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
1842
 
        test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
1843
 
 
1844
 
clean-gsettings-schemas:
1845
 
        rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file)
1846
 
 
1847
 
ifdef gsettings_ENUM_NAMESPACE
1848
 
$(gsettings__enum_file): $(gsettings_ENUM_FILES)
1849
 
        $(AM_V_GEN) glib-mkenums --comments '\''<!-- @comment@ -->'\'' --fhead "<schemalist>" --vhead "  <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod "    <value nick='\''@valuenick@'\'' value='\''@valuenum@'\''/>" --vtail "  </@type@>" --ftail "</schemalist>" [$]^ > [$]@.tmp && mv [$]@.tmp [$]@
1850
 
endif
1851
 
'
1852
 
  _GSETTINGS_SUBST(GSETTINGS_RULES)
1853
 
])
1854
 
 
1855
 
dnl _GSETTINGS_SUBST(VARIABLE)
1856
 
dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
1857
 
AC_DEFUN([_GSETTINGS_SUBST],
1858
 
[
1859
 
AC_SUBST([$1])
1860
 
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
1861
 
]
1862
 
)
1863
 
 
1864
 
dnl -*- mode: autoconf -*-
1865
 
dnl Copyright 2009 Johan Dahlin
1866
 
dnl
1867
 
dnl This file is free software; the author(s) gives unlimited
1868
 
dnl permission to copy and/or distribute it, with or without
1869
 
dnl modifications, as long as this notice is preserved.
1870
 
dnl
1871
 
 
1872
 
# serial 1
1873
 
 
1874
 
m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
1875
 
[
1876
 
    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
1877
 
    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
1878
 
    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
1879
 
 
1880
 
    dnl enable/disable introspection
1881
 
    m4_if([$2], [require],
1882
 
    [dnl
1883
 
        enable_introspection=yes
1884
 
    ],[dnl
1885
 
        AC_ARG_ENABLE(introspection,
1886
 
                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
1887
 
                                 [Enable introspection for this build]),, 
1888
 
                                 [enable_introspection=auto])
1889
 
    ])dnl
1890
 
 
1891
 
    AC_MSG_CHECKING([for gobject-introspection])
1892
 
 
1893
 
    dnl presence/version checking
1894
 
    AS_CASE([$enable_introspection],
1895
 
    [no], [dnl
1896
 
        found_introspection="no (disabled, use --enable-introspection to enable)"
1897
 
    ],dnl
1898
 
    [yes],[dnl
1899
 
        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
1900
 
                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
1901
 
        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
1902
 
                         found_introspection=yes,
1903
 
                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
1904
 
    ],dnl
1905
 
    [auto],[dnl
1906
 
        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
1907
 
        dnl Canonicalize enable_introspection
1908
 
        enable_introspection=$found_introspection
1909
 
    ],dnl
1910
 
    [dnl        
1911
 
        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
1912
 
    ])dnl
1913
 
 
1914
 
    AC_MSG_RESULT([$found_introspection])
1915
 
 
1916
 
    INTROSPECTION_SCANNER=
1917
 
    INTROSPECTION_COMPILER=
1918
 
    INTROSPECTION_GENERATE=
1919
 
    INTROSPECTION_GIRDIR=
1920
 
    INTROSPECTION_TYPELIBDIR=
1921
 
    if test "x$found_introspection" = "xyes"; then
1922
 
       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
1923
 
       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
1924
 
       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
1925
 
       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
1926
 
       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
1927
 
       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
1928
 
       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
1929
 
       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
1930
 
    fi
1931
 
    AC_SUBST(INTROSPECTION_SCANNER)
1932
 
    AC_SUBST(INTROSPECTION_COMPILER)
1933
 
    AC_SUBST(INTROSPECTION_GENERATE)
1934
 
    AC_SUBST(INTROSPECTION_GIRDIR)
1935
 
    AC_SUBST(INTROSPECTION_TYPELIBDIR)
1936
 
    AC_SUBST(INTROSPECTION_CFLAGS)
1937
 
    AC_SUBST(INTROSPECTION_LIBS)
1938
 
    AC_SUBST(INTROSPECTION_MAKEFILE)
1939
 
 
1940
 
    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
1941
 
])
1942
 
 
1943
 
 
1944
 
dnl Usage:
1945
 
dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
1946
 
 
1947
 
AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
1948
 
[
1949
 
  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
1950
 
])
1951
 
 
1952
 
dnl Usage:
1953
 
dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
1954
 
 
1955
 
 
1956
 
AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
1957
 
[
1958
 
  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
1959
 
])
1960
 
 
1961
1961
m4_include([m4/gettext.m4])
1962
1962
m4_include([m4/gtk-doc.m4])
1963
1963
m4_include([m4/iconv.m4])