source: trunk/third/sawfish/aclocal.m4 @ 18410

Revision 18410, 11.9 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18409, which included commits to RCS files with non-trunk default branches.
Line 
1dnl aclocal.m4 generated automatically by aclocal 1.4-p6
2
3dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13
14dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
15dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
16dnl also defines GSTUFF_PKG_ERRORS on error
17AC_DEFUN(PKG_CHECK_MODULES, [
18  succeeded=no
19
20  if test -z "$PKG_CONFIG"; then
21    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
22  fi
23
24  if test "$PKG_CONFIG" = "no" ; then
25     echo "*** The pkg-config script could not be found. Make sure it is"
26     echo "*** in your path, or set the PKG_CONFIG environment variable"
27     echo "*** to the full path to pkg-config."
28     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
29  else
30     PKG_CONFIG_MIN_VERSION=0.9.0
31     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
32        AC_MSG_CHECKING(for $2)
33
34        if $PKG_CONFIG --exists "$2" ; then
35            AC_MSG_RESULT(yes)
36            succeeded=yes
37
38            AC_MSG_CHECKING($1_CFLAGS)
39            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
40            AC_MSG_RESULT($$1_CFLAGS)
41
42            AC_MSG_CHECKING($1_LIBS)
43            $1_LIBS=`$PKG_CONFIG --libs "$2"`
44            AC_MSG_RESULT($$1_LIBS)
45        else
46            $1_CFLAGS=""
47            $1_LIBS=""
48            ## If we have a custom action on failure, don't print errors, but
49            ## do set a variable so people can do so.
50            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
51            ifelse([$4], ,echo $$1_PKG_ERRORS,)
52        fi
53
54        AC_SUBST($1_CFLAGS)
55        AC_SUBST($1_LIBS)
56     else
57        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
58        echo "*** See http://www.freedesktop.org/software/pkgconfig"
59     fi
60  fi
61
62  if test $succeeded = yes; then
63     ifelse([$3], , :, [$3])
64  else
65     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])
66  fi
67])
68
69
70
71dnl Configure paths for librep
72dnl $Id: aclocal.m4,v 1.1.1.3 2003-01-05 00:33:46 ghudson Exp $
73dnl
74dnl AM_PATH_REP([MINIMUM_VERSION])
75dnl Test for librep, define REP_VERSION, REP_CFLAGS, REP_LIBS and REP_EXECDIR
76dnl
77AC_DEFUN(AM_PATH_REP,
78[dnl
79  AC_ARG_WITH(rep_prefix,[  --with-rep-prefix=PFX   Prefix where rep is installed (optional)],
80              [rep_prefix="$withval"], [rep_prefix=""])
81  if test "x$rep_prefix" = "x"; then
82    rep_config="rep-config"
83  else
84    rep_config="${rep_prefix}/bin/rep-config"
85  fi
86  min_rep_version=ifelse([$1], ,0.1,$1)
87  AC_MSG_CHECKING(for rep - version >= $min_rep_version)
88  rep_version=`$rep_config --version`
89  if test $? -eq 0; then
90    rep_major=`echo $rep_version \
91        | sed -e 's/\([[0-9]]*\)\..*/\1/'`
92    rep_minor=`echo $rep_version \
93        | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
94    min_rep_major=`echo $min_rep_version \
95        | sed -e 's/\([[0-9]]*\)\..*/\1/'`
96    min_rep_minor=`echo $min_rep_version \
97        | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
98    if test '(' $rep_major -gt $min_rep_major ')' \
99        -o '(' $rep_major -eq $min_rep_major \
100               -a $rep_minor -ge $min_rep_minor ')';
101    then
102      REP_VERSION="${rep_version}"
103      REP_CFLAGS="`$rep_config --cflags`"
104      REP_LIBS="`$rep_config --libs`"
105      REP_EXECDIR="`$rep_config --execdir`"
106      AC_SUBST(REP_VERSION)
107      AC_SUBST(REP_CFLAGS)
108      AC_SUBST(REP_LIBS)
109      AC_SUBST(REP_EXECDIR)
110      AC_MSG_RESULT([version ${rep_version}])
111    else
112      AC_MSG_ERROR([version ${rep_version}; require $min_rep_version])
113    fi
114  else
115    AC_MSG_ERROR([can't find librep; is it installed?])
116  fi
117
118  dnl scan for GNU msgfmt
119  AC_MSG_CHECKING(for GNU msgfmt)
120  REP_MSGFMT=
121  for p in `echo "$PATH" | sed -e 's/:/ /g'`; do
122    if test -x $p/msgfmt; then
123      if $p/msgfmt --version 2>&1 | grep GNU >/dev/null; then
124        REP_MSGFMT=$p/msgfmt
125      fi
126    fi
127  done
128  if test x$REP_MSGFMT != x; then
129    AC_MSG_RESULT($REP_MSGFMT)
130  else
131    AC_MSG_RESULT(unavailable, disabling i18n)
132    REP_MSGFMT=true
133  fi
134  AC_SUBST(REP_MSGFMT)
135])
136
137# Configure paths for GTK+
138# Owen Taylor     1997-2001
139
140dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
141dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
142dnl pass to pkg-config
143dnl
144AC_DEFUN(AM_PATH_GTK_2_0,
145[dnl
146dnl Get the cflags and libraries from pkg-config
147dnl
148AC_ARG_ENABLE(gtktest, [  --disable-gtktest       do not try to compile and run a test GTK+ program],
149                    , enable_gtktest=yes)
150
151  pkg_config_args=gtk+-2.0
152  for module in . $4
153  do
154      case "$module" in
155         gthread)
156             pkg_config_args="$pkg_config_args gthread-2.0"
157         ;;
158      esac
159  done
160
161  no_gtk=""
162
163  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
164
165  if test x$PKG_CONFIG != xno ; then
166    if pkg-config --atleast-pkgconfig-version 0.7 ; then
167      :
168    else
169      echo *** pkg-config too old; version 0.7 or better required.
170      no_gtk=yes
171      PKG_CONFIG=no
172    fi
173  else
174    no_gtk=yes
175  fi
176
177  min_gtk_version=ifelse([$1], ,2.0.0,$1)
178  AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
179
180  if test x$PKG_CONFIG != xno ; then
181    ## don't try to run the test against uninstalled libtool libs
182    if $PKG_CONFIG --uninstalled $pkg_config_args; then
183          echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
184          enable_gtktest=no
185    fi
186
187    if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
188          :
189    else
190          no_gtk=yes
191    fi
192  fi
193
194  if test x"$no_gtk" = x ; then
195    GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
196    GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
197    gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
198           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
199    gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
200           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
201    gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
202           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
203    if test "x$enable_gtktest" = "xyes" ; then
204      ac_save_CFLAGS="$CFLAGS"
205      ac_save_LIBS="$LIBS"
206      CFLAGS="$CFLAGS $GTK_CFLAGS"
207      LIBS="$GTK_LIBS $LIBS"
208dnl
209dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
210dnl checks the results of pkg-config to some extent)
211dnl
212      rm -f conf.gtktest
213      AC_TRY_RUN([
214#include <gtk/gtk.h>
215#include <stdio.h>
216#include <stdlib.h>
217
218int
219main ()
220{
221  int major, minor, micro;
222  char *tmp_version;
223
224  system ("touch conf.gtktest");
225
226  /* HP/UX 9 (%@#!) writes to sscanf strings */
227  tmp_version = g_strdup("$min_gtk_version");
228  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
229     printf("%s, bad version string\n", "$min_gtk_version");
230     exit(1);
231   }
232
233  if ((gtk_major_version != $gtk_config_major_version) ||
234      (gtk_minor_version != $gtk_config_minor_version) ||
235      (gtk_micro_version != $gtk_config_micro_version))
236    {
237      printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
238             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
239             gtk_major_version, gtk_minor_version, gtk_micro_version);
240      printf ("*** was found! If pkg-config was correct, then it is best\n");
241      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
242      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
243      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
244      printf("*** required on your system.\n");
245      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
246      printf("*** to point to the correct configuration files\n");
247    }
248  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
249           (gtk_minor_version != GTK_MINOR_VERSION) ||
250           (gtk_micro_version != GTK_MICRO_VERSION))
251    {
252      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
253             GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
254      printf("*** library (version %d.%d.%d)\n",
255             gtk_major_version, gtk_minor_version, gtk_micro_version);
256    }
257  else
258    {
259      if ((gtk_major_version > major) ||
260        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
261        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
262      {
263        return 0;
264       }
265     else
266      {
267        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
268               gtk_major_version, gtk_minor_version, gtk_micro_version);
269        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
270               major, minor, micro);
271        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
272        printf("***\n");
273        printf("*** If you have already installed a sufficiently new version, this error\n");
274        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
275        printf("*** being found. The easiest way to fix this is to remove the old version\n");
276        printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
277        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
278        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
279        printf("*** so that the correct libraries are found at run-time))\n");
280      }
281    }
282  return 1;
283}
284],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
285       CFLAGS="$ac_save_CFLAGS"
286       LIBS="$ac_save_LIBS"
287     fi
288  fi
289  if test "x$no_gtk" = x ; then
290     AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
291     ifelse([$2], , :, [$2])     
292  else
293     AC_MSG_RESULT(no)
294     if test "$PKG_CONFIG" = "no" ; then
295       echo "*** A new enough version of pkg-config was not found."
296       echo "*** See http://pkgconfig.sourceforge.net"
297     else
298       if test -f conf.gtktest ; then
299        :
300       else
301          echo "*** Could not run GTK+ test program, checking why..."
302          ac_save_CFLAGS="$CFLAGS"
303          ac_save_LIBS="$LIBS"
304          CFLAGS="$CFLAGS $GTK_CFLAGS"
305          LIBS="$LIBS $GTK_LIBS"
306          AC_TRY_LINK([
307#include <gtk/gtk.h>
308#include <stdio.h>
309],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
310        [ echo "*** The test program compiled, but did not run. This usually means"
311          echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
312          echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
313          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
314          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
315          echo "*** is required on your system"
316          echo "***"
317          echo "*** If you have an old version installed, it is best to remove it, although"
318          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
319        [ echo "*** The test program failed to compile or link. See the file config.log for the"
320          echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
321          CFLAGS="$ac_save_CFLAGS"
322          LIBS="$ac_save_LIBS"
323       fi
324     fi
325     GTK_CFLAGS=""
326     GTK_LIBS=""
327     ifelse([$3], , :, [$3])
328  fi
329  AC_SUBST(GTK_CFLAGS)
330  AC_SUBST(GTK_LIBS)
331  rm -f conf.gtktest
332])
333
Note: See TracBrowser for help on using the repository browser.