diff options
Diffstat (limited to 'm4/glib-2.0.m4')
-rw-r--r-- | m4/glib-2.0.m4 | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/m4/glib-2.0.m4 b/m4/glib-2.0.m4 index 4b19019..5fc357c 100644 --- a/m4/glib-2.0.m4 +++ b/m4/glib-2.0.m4 | |||
@@ -2,7 +2,7 @@ | |||
2 | # Owen Taylor 1997-2001 | 2 | # Owen Taylor 1997-2001 |
3 | 3 | ||
4 | # Increment this whenever this file is changed. | 4 | # Increment this whenever this file is changed. |
5 | #serial 1 | 5 | #serial 4 |
6 | 6 | ||
7 | dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) | 7 | dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) |
8 | dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject, | 8 | dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject, |
@@ -12,10 +12,16 @@ AC_DEFUN([AM_PATH_GLIB_2_0], | |||
12 | [dnl | 12 | [dnl |
13 | dnl Get the cflags and libraries from pkg-config | 13 | dnl Get the cflags and libraries from pkg-config |
14 | dnl | 14 | dnl |
15 | |||
16 | dnl We can't use PKG_PREREQ because that needs 0.29. | ||
17 | m4_ifndef([PKG_PROG_PKG_CONFIG], | ||
18 | [pkg.m4 version 0.28 or later is required]) | ||
19 | |||
15 | AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], | 20 | AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], |
16 | , enable_glibtest=yes) | 21 | , enable_glibtest=yes) |
17 | 22 | ||
18 | pkg_config_args=glib-2.0 | 23 | min_glib_version=ifelse([$1], [], [2.0.0], [$1]) |
24 | pkg_config_args="glib-2.0 >= $min_glib_version" | ||
19 | for module in . $4 | 25 | for module in . $4 |
20 | do | 26 | do |
21 | case "$module" in | 27 | case "$module" in |
@@ -46,7 +52,15 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run | |||
46 | PKG_CONFIG=no | 52 | PKG_CONFIG=no |
47 | fi | 53 | fi |
48 | 54 | ||
49 | min_glib_version=ifelse([$1], ,2.0.0,$1) | 55 | dnl For GLIB_CFLAGS and GLIB_LIBS |
56 | PKG_CHECK_MODULES([GLIB], [$pkg_config_args], [:], [:]) | ||
57 | |||
58 | dnl For the tools | ||
59 | PKG_CHECK_VAR([GLIB_GENMARSHAL], [glib-2.0], [glib_genmarshal]) | ||
60 | PKG_CHECK_VAR([GOBJECT_QUERY], [glib-2.0], [gobject_query]) | ||
61 | PKG_CHECK_VAR([GLIB_MKENUMS], [glib-2.0], [glib_mkenums]) | ||
62 | PKG_CHECK_VAR([GLIB_COMPILE_RESOURCES], [gio-2.0], [glib_compile_resources]) | ||
63 | |||
50 | AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) | 64 | AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) |
51 | 65 | ||
52 | if test x$PKG_CONFIG != xno ; then | 66 | if test x$PKG_CONFIG != xno ; then |
@@ -64,13 +78,6 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run | |||
64 | fi | 78 | fi |
65 | 79 | ||
66 | if test x"$no_glib" = x ; then | 80 | if test x"$no_glib" = x ; then |
67 | GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` | ||
68 | GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` | ||
69 | GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` | ||
70 | GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` | ||
71 | |||
72 | GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` | ||
73 | GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` | ||
74 | glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ | 81 | glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ |
75 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | 82 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
76 | glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ | 83 | glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ |
@@ -83,11 +90,11 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run | |||
83 | CFLAGS="$CFLAGS $GLIB_CFLAGS" | 90 | CFLAGS="$CFLAGS $GLIB_CFLAGS" |
84 | LIBS="$GLIB_LIBS $LIBS" | 91 | LIBS="$GLIB_LIBS $LIBS" |
85 | dnl | 92 | dnl |
86 | dnl Now check if the installed GLIB is sufficiently new. (Also sanity | 93 | dnl Now check if the installed GLib is sufficiently new. (Also sanity |
87 | dnl checks the results of pkg-config to some extent) | 94 | dnl checks the results of pkg-config to some extent) |
88 | dnl | 95 | dnl |
89 | rm -f conf.glibtest | 96 | rm -f conf.glibtest |
90 | AC_TRY_RUN([ | 97 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
91 | #include <glib.h> | 98 | #include <glib.h> |
92 | #include <stdio.h> | 99 | #include <stdio.h> |
93 | #include <stdlib.h> | 100 | #include <stdlib.h> |
@@ -113,7 +120,7 @@ main (void) | |||
113 | glib_major_version, glib_minor_version, glib_micro_version); | 120 | glib_major_version, glib_minor_version, glib_micro_version); |
114 | printf ("*** was found! If pkg-config was correct, then it is best\n"); | 121 | printf ("*** was found! If pkg-config was correct, then it is best\n"); |
115 | printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); | 122 | printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); |
116 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | 123 | printf("*** by modifying your LD_LIBRARY_PATH environment variable, or by editing\n"); |
117 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | 124 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); |
118 | printf("*** required on your system.\n"); | 125 | printf("*** required on your system.\n"); |
119 | printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); | 126 | printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); |
@@ -123,7 +130,7 @@ main (void) | |||
123 | (glib_minor_version != GLIB_MINOR_VERSION) || | 130 | (glib_minor_version != GLIB_MINOR_VERSION) || |
124 | (glib_micro_version != GLIB_MICRO_VERSION)) | 131 | (glib_micro_version != GLIB_MICRO_VERSION)) |
125 | { | 132 | { |
126 | printf("*** GLIB header files (version %d.%d.%d) do not match\n", | 133 | printf("*** GLib header files (version %d.%d.%d) do not match\n", |
127 | GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); | 134 | GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); |
128 | printf("*** library (version %d.%d.%d)\n", | 135 | printf("*** library (version %d.%d.%d)\n", |
129 | glib_major_version, glib_minor_version, glib_micro_version); | 136 | glib_major_version, glib_minor_version, glib_micro_version); |
@@ -138,24 +145,24 @@ main (void) | |||
138 | } | 145 | } |
139 | else | 146 | else |
140 | { | 147 | { |
141 | printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n", | 148 | printf("\n*** An old version of GLib (%u.%u.%u) was found.\n", |
142 | glib_major_version, glib_minor_version, glib_micro_version); | 149 | glib_major_version, glib_minor_version, glib_micro_version); |
143 | printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n", | 150 | printf("*** You need a version of GLib newer than %u.%u.%u. The latest version of\n", |
144 | major, minor, micro); | 151 | major, minor, micro); |
145 | printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); | 152 | printf("*** GLib is always available from ftp://ftp.gtk.org.\n"); |
146 | printf("***\n"); | 153 | printf("***\n"); |
147 | printf("*** If you have already installed a sufficiently new version, this error\n"); | 154 | printf("*** If you have already installed a sufficiently new version, this error\n"); |
148 | printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); | 155 | printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); |
149 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); | 156 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
150 | printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); | 157 | printf("*** of GLib, but you can also set the PKG_CONFIG environment to point to the\n"); |
151 | printf("*** correct copy of pkg-config. (In this case, you will have to\n"); | 158 | printf("*** correct copy of pkg-config. (In this case, you will have to\n"); |
152 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | 159 | printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n"); |
153 | printf("*** so that the correct libraries are found at run-time))\n"); | 160 | printf("*** so that the correct libraries are found at run-time))\n"); |
154 | } | 161 | } |
155 | } | 162 | } |
156 | return 1; | 163 | return 1; |
157 | } | 164 | } |
158 | ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | 165 | ]])],[],[no_glib=yes],[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
159 | CFLAGS="$ac_save_CFLAGS" | 166 | CFLAGS="$ac_save_CFLAGS" |
160 | LIBS="$ac_save_LIBS" | 167 | LIBS="$ac_save_LIBS" |
161 | fi | 168 | fi |
@@ -172,18 +179,18 @@ main (void) | |||
172 | if test -f conf.glibtest ; then | 179 | if test -f conf.glibtest ; then |
173 | : | 180 | : |
174 | else | 181 | else |
175 | echo "*** Could not run GLIB test program, checking why..." | 182 | echo "*** Could not run GLib test program, checking why..." |
176 | ac_save_CFLAGS="$CFLAGS" | 183 | ac_save_CFLAGS="$CFLAGS" |
177 | ac_save_LIBS="$LIBS" | 184 | ac_save_LIBS="$LIBS" |
178 | CFLAGS="$CFLAGS $GLIB_CFLAGS" | 185 | CFLAGS="$CFLAGS $GLIB_CFLAGS" |
179 | LIBS="$LIBS $GLIB_LIBS" | 186 | LIBS="$LIBS $GLIB_LIBS" |
180 | AC_TRY_LINK([ | 187 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
181 | #include <glib.h> | 188 | #include <glib.h> |
182 | #include <stdio.h> | 189 | #include <stdio.h> |
183 | ], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], | 190 | ]], [[ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ]])], |
184 | [ echo "*** The test program compiled, but did not run. This usually means" | 191 | [ echo "*** The test program compiled, but did not run. This usually means" |
185 | echo "*** that the run-time linker is not finding GLIB or finding the wrong" | 192 | echo "*** that the run-time linker is not finding GLib or finding the wrong" |
186 | echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" | 193 | echo "*** version of GLib. If it is not finding GLib, you'll need to set your" |
187 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | 194 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
188 | echo "*** to the installed location Also, make sure you have run ldconfig if that" | 195 | echo "*** to the installed location Also, make sure you have run ldconfig if that" |
189 | echo "*** is required on your system" | 196 | echo "*** is required on your system" |
@@ -191,7 +198,7 @@ main (void) | |||
191 | echo "*** If you have an old version installed, it is best to remove it, although" | 198 | echo "*** If you have an old version installed, it is best to remove it, although" |
192 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], | 199 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], |
193 | [ echo "*** The test program failed to compile or link. See the file config.log for the" | 200 | [ echo "*** The test program failed to compile or link. See the file config.log for the" |
194 | echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) | 201 | echo "*** exact error that occurred. This usually means GLib is incorrectly installed."]) |
195 | CFLAGS="$ac_save_CFLAGS" | 202 | CFLAGS="$ac_save_CFLAGS" |
196 | LIBS="$ac_save_LIBS" | 203 | LIBS="$ac_save_LIBS" |
197 | fi | 204 | fi |
@@ -204,11 +211,5 @@ main (void) | |||
204 | GLIB_COMPILE_RESOURCES="" | 211 | GLIB_COMPILE_RESOURCES="" |
205 | ifelse([$3], , :, [$3]) | 212 | ifelse([$3], , :, [$3]) |
206 | fi | 213 | fi |
207 | AC_SUBST(GLIB_CFLAGS) | ||
208 | AC_SUBST(GLIB_LIBS) | ||
209 | AC_SUBST(GLIB_GENMARSHAL) | ||
210 | AC_SUBST(GOBJECT_QUERY) | ||
211 | AC_SUBST(GLIB_MKENUMS) | ||
212 | AC_SUBST(GLIB_COMPILE_RESOURCES) | ||
213 | rm -f conf.glibtest | 214 | rm -f conf.glibtest |
214 | ]) | 215 | ]) |