Remove definition of g_hash_table_freeze and g_hash_table_thaw. Instead
[platform/upstream/glib.git] / glib-2.0.m4
1 # Configure paths for GLIB
2 # Owen Taylor     1997-2001
3
4 dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
5 dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or 
6 dnl gthread is specified in MODULES, pass to pkg-config
7 dnl
8 AC_DEFUN(AM_PATH_GLIB_2_0,
9 [dnl 
10 dnl Get the cflags and libraries from pkg-config
11 dnl
12 AC_ARG_ENABLE(glibtest, [  --disable-glibtest       Do not try to compile and run a test GLIB program],
13                     , enable_glibtest=yes)
14
15   pkg_config_args=glib-2.0
16   for module in . $4
17   do
18       case "$module" in
19          gmodule) 
20              pkg_config_args="$pkg_config_args gmodule-2.0"
21          ;;
22          gobject) 
23              pkg_config_args="$pkg_config_args gobject-2.0"
24          ;;
25          gthread) 
26              pkg_config_args="$pkg_config_args gthread-2.0"
27          ;;
28       esac
29   done
30
31   AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
32
33   min_glib_version=ifelse([$1], ,1.3.3,$1)
34   AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
35
36   no_glib=""
37
38   if test x$PKG_CONFIG != xno ; then
39     if pkg-config --atleast-pkgconfig-version 0.5 ; then
40       :
41     else
42       echo *** pkg-config too old; version 0.5 or better required.
43       no_glib=yes
44       PKG_CONFIG=no
45     fi
46   fi
47
48   if test x"$no_glib" = x ; then
49     GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
50     GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
51     glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
52            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
53     glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
54            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
55     glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
56            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
57     if test "x$enable_glibtest" = "xyes" ; then
58       ac_save_CFLAGS="$CFLAGS"
59       ac_save_LIBS="$LIBS"
60       CFLAGS="$CFLAGS $GLIB_CFLAGS"
61       LIBS="$GLIB_LIBS $LIBS"
62 dnl
63 dnl Now check if the installed GLIB is sufficiently new. (Also sanity
64 dnl checks the results of pkg-config to some extent)
65 dnl
66       rm -f conf.glibtest
67       AC_TRY_RUN([
68 #include <glib.h>
69 #include <stdio.h>
70 #include <stdlib.h>
71
72 int 
73 main ()
74 {
75   int major, minor, micro;
76   char *tmp_version;
77
78   system ("touch conf.glibtest");
79
80   /* HP/UX 9 (%@#!) writes to sscanf strings */
81   tmp_version = g_strdup("$min_glib_version");
82   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
83      printf("%s, bad version string\n", "$min_glib_version");
84      exit(1);
85    }
86
87   if ((glib_major_version != $glib_config_major_version) ||
88       (glib_minor_version != $glib_config_minor_version) ||
89       (glib_micro_version != $glib_config_micro_version))
90     {
91       printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
92              $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
93              glib_major_version, glib_minor_version, glib_micro_version);
94       printf ("*** was found! If pkg-config was correct, then it is best\n");
95       printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
96       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
97       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
98       printf("*** required on your system.\n");
99       printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
100       printf("*** to point to the correct configuration files\n");
101     } 
102   else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
103            (glib_minor_version != GLIB_MINOR_VERSION) ||
104            (glib_micro_version != GLIB_MICRO_VERSION))
105     {
106       printf("*** GLIB header files (version %d.%d.%d) do not match\n",
107              GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
108       printf("*** library (version %d.%d.%d)\n",
109              glib_major_version, glib_minor_version, glib_micro_version);
110     }
111   else
112     {
113       if ((glib_major_version > major) ||
114         ((glib_major_version == major) && (glib_minor_version > minor)) ||
115         ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
116       {
117         return 0;
118        }
119      else
120       {
121         printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
122                glib_major_version, glib_minor_version, glib_micro_version);
123         printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
124                major, minor, micro);
125         printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
126         printf("***\n");
127         printf("*** If you have already installed a sufficiently new version, this error\n");
128         printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
129         printf("*** being found. The easiest way to fix this is to remove the old version\n");
130         printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
131         printf("*** correct copy of pkg-config. (In this case, you will have to\n");
132         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
133         printf("*** so that the correct libraries are found at run-time))\n");
134       }
135     }
136   return 1;
137 }
138 ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
139        CFLAGS="$ac_save_CFLAGS"
140        LIBS="$ac_save_LIBS"
141      fi
142   fi
143   if test "x$no_glib" = x ; then
144      AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
145      ifelse([$2], , :, [$2])     
146   else
147      AC_MSG_RESULT(no)
148      if test "$PKG_CONFIG" = "no" ; then
149        echo "*** A new enough version of pkg-config was not found."
150        echo "*** See http://pkgconfig.sourceforge.net"
151      else
152        if test -f conf.glibtest ; then
153         :
154        else
155           echo "*** Could not run GLIB test program, checking why..."
156           CFLAGS="$CFLAGS $GLIB_CFLAGS"
157           LIBS="$LIBS $GLIB_LIBS"
158           AC_TRY_LINK([
159 #include <glib.h>
160 #include <stdio.h>
161 ],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
162         [ echo "*** The test program compiled, but did not run. This usually means"
163           echo "*** that the run-time linker is not finding GLIB or finding the wrong"
164           echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
165           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
166           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
167           echo "*** is required on your system"
168           echo "***"
169           echo "*** If you have an old version installed, it is best to remove it, although"
170           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
171         [ echo "*** The test program failed to compile or link. See the file config.log for the"
172           echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
173           echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
174           echo "*** may want to edit the pkg-config script: $PKG_CONFIG" ])
175           CFLAGS="$ac_save_CFLAGS"
176           LIBS="$ac_save_LIBS"
177        fi
178      fi
179      GLIB_CFLAGS=""
180      GLIB_LIBS=""
181      ifelse([$3], , :, [$3])
182   fi
183   AC_SUBST(GLIB_CFLAGS)
184   AC_SUBST(GLIB_LIBS)
185   rm -f conf.glibtest
186 ])