~ubuntu-branches/ubuntu/oneiric/groundhog/oneiric

« back to all changes in this revision

Viewing changes to acinclude.m4

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2004-08-20 23:12:32 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040820231232-18s0op2f9g21ag1z
Tags: 1.4-6
Update Policy Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl aclocal.m4 generated automatically by aclocal 1.4-p1
 
2
 
 
3
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 
4
dnl This file is free software; the Free Software Foundation
 
5
dnl gives unlimited permission to copy and/or distribute it,
 
6
dnl with or without modifications, as long as this notice is preserved.
 
7
 
 
8
dnl This program is distributed in the hope that it will be useful,
 
9
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
 
10
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 
11
dnl PARTICULAR PURPOSE.
 
12
 
 
13
# Do all the work for Automake.  This macro actually does too much --
 
14
# some checks are only needed if your package does certain things.
 
15
# But this isn't really a big deal.
 
16
 
 
17
# serial 1
 
18
 
 
19
dnl Usage:
 
20
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
 
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 or 
 
27
dnl gthread 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
         gobject) 
 
44
             pkg_config_args="$pkg_config_args gobject-2.0"
 
45
         ;;
 
46
         gthread) 
 
47
             pkg_config_args="$pkg_config_args gthread-2.0"
 
48
         ;;
 
49
      esac
 
50
  done
 
51
 
 
52
  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
 
53
 
 
54
  no_glib=""
 
55
 
 
56
  if test x$PKG_CONFIG != xno ; then
 
57
    if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
 
58
      :
 
59
    else
 
60
      echo *** pkg-config too old; version 0.7 or better required.
 
61
      no_glib=yes
 
62
      PKG_CONFIG=no
 
63
    fi
 
64
  else
 
65
    no_glib=yes
 
66
  fi
 
67
 
 
68
  min_glib_version=ifelse([$1], ,2.0.0,$1)
 
69
  AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
 
70
 
 
71
  if test x$PKG_CONFIG != xno ; then
 
72
    ## don't try to run the test against uninstalled libtool libs
 
73
    if $PKG_CONFIG --uninstalled $pkg_config_args; then
 
74
          echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
 
75
          enable_glibtest=no
 
76
    fi
 
77
 
 
78
    if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
 
79
          :
 
80
    else
 
81
          no_glib=yes
 
82
    fi
 
83
  fi
 
84
 
 
85
  if test x"$no_glib" = x ; then
 
86
    GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
 
87
    GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
 
88
    GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-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
  int major, minor, micro;
 
117
  char *tmp_version;
 
118
 
 
119
  system ("touch conf.glibtest");
 
120
 
 
121
  /* HP/UX 9 (%@#!) writes to sscanf strings */
 
122
  tmp_version = g_strdup("$min_glib_version");
 
123
  if (sscanf(tmp_version, "%d.%d.%d", &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 (%d.%d.%d) was found.\n",
 
163
               glib_major_version, glib_minor_version, glib_micro_version);
 
164
        printf("*** You need a version of GLIB newer than %d.%d.%d. 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
          CFLAGS="$CFLAGS $GLIB_CFLAGS"
 
198
          LIBS="$LIBS $GLIB_LIBS"
 
199
          AC_TRY_LINK([
 
200
#include <glib.h>
 
201
#include <stdio.h>
 
202
],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
 
203
        [ echo "*** The test program compiled, but did not run. This usually means"
 
204
          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
 
205
          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
 
206
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
 
207
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
 
208
          echo "*** is required on your system"
 
209
          echo "***"
 
210
          echo "*** If you have an old version installed, it is best to remove it, although"
 
211
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
 
212
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
 
213
          echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
 
214
          echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
 
215
          echo "*** may want to edit the pkg-config script: $PKG_CONFIG" ])
 
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
     ifelse([$3], , :, [$3])
 
226
  fi
 
227
  AC_SUBST(GLIB_CFLAGS)
 
228
  AC_SUBST(GLIB_LIBS)
 
229
  AC_SUBST(GLIB_GENMARSHAL)
 
230
  AC_SUBST(GOBJECT_QUERY)
 
231
  AC_SUBST(GLIB_MKENUMS)
 
232
  rm -f conf.glibtest
 
233
])
 
234
 
 
235
# Configure paths for GTK+
 
236
# Owen Taylor     1997-2001
 
237
 
 
238
dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
 
239
dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, 
 
240
dnl pass to pkg-config
 
241
dnl
 
242
AC_DEFUN(AM_PATH_GTK_2_0,
 
243
[dnl 
 
244
dnl Get the cflags and libraries from pkg-config
 
245
dnl
 
246
AC_ARG_ENABLE(gtktest, [  --disable-gtktest       do not try to compile and run a test GTK+ program],
 
247
                    , enable_gtktest=yes)
 
248
 
 
249
  pkg_config_args=gtk+-2.0
 
250
  for module in . $4
 
251
  do
 
252
      case "$module" in
 
253
         gthread) 
 
254
             pkg_config_args="$pkg_config_args gthread-2.0"
 
255
         ;;
 
256
      esac
 
257
  done
 
258
 
 
259
  no_gtk=""
 
260
 
 
261
  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
 
262
 
 
263
  if test x$PKG_CONFIG != xno ; then
 
264
    if pkg-config --atleast-pkgconfig-version 0.7 ; then
 
265
      :
 
266
    else
 
267
      echo *** pkg-config too old; version 0.7 or better required.
 
268
      no_gtk=yes
 
269
      PKG_CONFIG=no
 
270
    fi
 
271
  else
 
272
    no_gtk=yes
 
273
  fi
 
274
 
 
275
  min_gtk_version=ifelse([$1], ,2.0.0,$1)
 
276
  AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
 
277
 
 
278
  if test x$PKG_CONFIG != xno ; then
 
279
    ## don't try to run the test against uninstalled libtool libs
 
280
    if $PKG_CONFIG --uninstalled $pkg_config_args; then
 
281
          echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
 
282
          enable_gtktest=no
 
283
    fi
 
284
 
 
285
    if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
 
286
          :
 
287
    else
 
288
          no_gtk=yes
 
289
    fi
 
290
  fi
 
291
 
 
292
  if test x"$no_gtk" = x ; then
 
293
    GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
 
294
    GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
 
295
    gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
 
296
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 
297
    gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
 
298
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 
299
    gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
 
300
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 
301
    if test "x$enable_gtktest" = "xyes" ; then
 
302
      ac_save_CFLAGS="$CFLAGS"
 
303
      ac_save_LIBS="$LIBS"
 
304
      CFLAGS="$CFLAGS $GTK_CFLAGS"
 
305
      LIBS="$GTK_LIBS $LIBS"
 
306
dnl
 
307
dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
 
308
dnl checks the results of pkg-config to some extent)
 
309
dnl
 
310
      rm -f conf.gtktest
 
311
      AC_TRY_RUN([
 
312
#include <gtk/gtk.h>
 
313
#include <stdio.h>
 
314
#include <stdlib.h>
 
315
 
 
316
int 
 
317
main ()
 
318
{
 
319
  int major, minor, micro;
 
320
  char *tmp_version;
 
321
 
 
322
  system ("touch conf.gtktest");
 
323
 
 
324
  /* HP/UX 9 (%@#!) writes to sscanf strings */
 
325
  tmp_version = g_strdup("$min_gtk_version");
 
326
  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
 
327
     printf("%s, bad version string\n", "$min_gtk_version");
 
328
     exit(1);
 
329
   }
 
330
 
 
331
  if ((gtk_major_version != $gtk_config_major_version) ||
 
332
      (gtk_minor_version != $gtk_config_minor_version) ||
 
333
      (gtk_micro_version != $gtk_config_micro_version))
 
334
    {
 
335
      printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
 
336
             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
 
337
             gtk_major_version, gtk_minor_version, gtk_micro_version);
 
338
      printf ("*** was found! If pkg-config was correct, then it is best\n");
 
339
      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
 
340
      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
 
341
      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
 
342
      printf("*** required on your system.\n");
 
343
      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
 
344
      printf("*** to point to the correct configuration files\n");
 
345
    } 
 
346
  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
 
347
           (gtk_minor_version != GTK_MINOR_VERSION) ||
 
348
           (gtk_micro_version != GTK_MICRO_VERSION))
 
349
    {
 
350
      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
 
351
             GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
 
352
      printf("*** library (version %d.%d.%d)\n",
 
353
             gtk_major_version, gtk_minor_version, gtk_micro_version);
 
354
    }
 
355
  else
 
356
    {
 
357
      if ((gtk_major_version > major) ||
 
358
        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
 
359
        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
 
360
      {
 
361
        return 0;
 
362
       }
 
363
     else
 
364
      {
 
365
        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
 
366
               gtk_major_version, gtk_minor_version, gtk_micro_version);
 
367
        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
 
368
               major, minor, micro);
 
369
        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
 
370
        printf("***\n");
 
371
        printf("*** If you have already installed a sufficiently new version, this error\n");
 
372
        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
 
373
        printf("*** being found. The easiest way to fix this is to remove the old version\n");
 
374
        printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
 
375
        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
 
376
        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
 
377
        printf("*** so that the correct libraries are found at run-time))\n");
 
378
      }
 
379
    }
 
380
  return 1;
 
381
}
 
382
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
 
383
       CFLAGS="$ac_save_CFLAGS"
 
384
       LIBS="$ac_save_LIBS"
 
385
     fi
 
386
  fi
 
387
  if test "x$no_gtk" = x ; then
 
388
     AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
 
389
     ifelse([$2], , :, [$2])     
 
390
  else
 
391
     AC_MSG_RESULT(no)
 
392
     if test "$PKG_CONFIG" = "no" ; then
 
393
       echo "*** A new enough version of pkg-config was not found."
 
394
       echo "*** See http://pkgconfig.sourceforge.net"
 
395
     else
 
396
       if test -f conf.gtktest ; then
 
397
        :
 
398
       else
 
399
          echo "*** Could not run GTK+ test program, checking why..."
 
400
          CFLAGS="$CFLAGS $GTK_CFLAGS"
 
401
          LIBS="$LIBS $GTK_LIBS"
 
402
          AC_TRY_LINK([
 
403
#include <gtk/gtk.h>
 
404
#include <stdio.h>
 
405
],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
 
406
        [ echo "*** The test program compiled, but did not run. This usually means"
 
407
          echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
 
408
          echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
 
409
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
 
410
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
 
411
          echo "*** is required on your system"
 
412
          echo "***"
 
413
          echo "*** If you have an old version installed, it is best to remove it, although"
 
414
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
 
415
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
 
416
          echo "*** exact error that occured. This usually means GTK+ was incorrectly installed"
 
417
          echo "*** or that you have moved GTK+ since it was installed. In the latter case, you"
 
418
          echo "*** may want to edit the pkg-config script: $PKG_CONFIG" ])
 
419
          CFLAGS="$ac_save_CFLAGS"
 
420
          LIBS="$ac_save_LIBS"
 
421
       fi
 
422
     fi
 
423
     GTK_CFLAGS=""
 
424
     GTK_LIBS=""
 
425
     ifelse([$3], , :, [$3])
 
426
  fi
 
427
  AC_SUBST(GTK_CFLAGS)
 
428
  AC_SUBST(GTK_LIBS)
 
429
  rm -f conf.gtktest
 
430
])
 
431
 
 
432
 
 
433
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
 
434
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
 
435
dnl also defines GSTUFF_PKG_ERRORS on error
 
436
AC_DEFUN(PKG_CHECK_MODULES, [
 
437
  succeeded=no
 
438
 
 
439
  if test -z "$PKG_CONFIG"; then
 
440
    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
 
441
  fi
 
442
 
 
443
  if test "$PKG_CONFIG" = "no" ; then
 
444
     echo "*** The pkg-config script could not be found. Make sure it is"
 
445
     echo "*** in your path, or set the PKG_CONFIG environment variable"
 
446
     echo "*** to the full path to pkg-config."
 
447
     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
 
448
  else
 
449
     PKG_CONFIG_MIN_VERSION=0.9.0
 
450
     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
 
451
        AC_MSG_CHECKING(for $2)
 
452
 
 
453
        if $PKG_CONFIG --exists "$2" ; then
 
454
            AC_MSG_RESULT(yes)
 
455
            succeeded=yes
 
456
 
 
457
            AC_MSG_CHECKING($1_CFLAGS)
 
458
            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
 
459
            AC_MSG_RESULT($$1_CFLAGS)
 
460
 
 
461
            AC_MSG_CHECKING($1_LIBS)
 
462
            $1_LIBS=`$PKG_CONFIG --libs "$2"`
 
463
            AC_MSG_RESULT($$1_LIBS)
 
464
        else
 
465
            $1_CFLAGS=""
 
466
            $1_LIBS=""
 
467
            ## If we have a custom action on failure, don't print errors, but 
 
468
            ## do set a variable so people can do so.
 
469
            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
 
470
            ifelse([$4], ,echo $$1_PKG_ERRORS,)
 
471
        fi
 
472
 
 
473
        AC_SUBST($1_CFLAGS)
 
474
        AC_SUBST($1_LIBS)
 
475
     else
 
476
        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
 
477
        echo "*** See http://www.freedesktop.org/software/pkgconfig"
 
478
     fi
 
479
  fi
 
480
 
 
481
  if test $succeeded = yes; then
 
482
     ifelse([$3], , :, [$3])
 
483
  else
 
484
     ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
 
485
  fi
 
486
])
 
487