1 # Configure paths for GTK--
2 # Erik Andersen 30 May 1998
3 # Modified by Tero Pulkkinen (added the compiler checks... I hope they work..)
4 # Modified by Thomas Langen 16 Jan 2000 (corrected CXXFLAGS)
6 dnl Test for GTKMM, and define GTKMM_CFLAGS and GTKMM_LIBS
7 dnl to be used as follows:
8 dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
10 AC_DEFUN([AM_PATH_GTKMM],
12 dnl Get the cflags and libraries from the gtkmm-config script
14 AC_ARG_WITH(gtkmm-prefix,[ --with-gtkmm-prefix=PREFIX
15 Prefix where GTK-- is installed (optional)],
16 gtkmm_config_prefix="$withval", gtkmm_config_prefix="")
17 AC_ARG_WITH(gtkmm-exec-prefix,[ --with-gtkmm-exec-prefix=PREFIX
18 Exec prefix where GTK-- is installed (optional)],
19 gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="")
20 AC_ARG_ENABLE(gtkmmtest, [ --disable-gtkmmtest Do not try to compile and run a test GTK-- program],
21 , enable_gtkmmtest=yes)
23 if test x$gtkmm_config_exec_prefix != x ; then
24 gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix"
25 if test x${GTKMM_CONFIG+set} != xset ; then
26 GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config
29 if test x$gtkmm_config_prefix != x ; then
30 gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix"
31 if test x${GTKMM_CONFIG+set} != xset ; then
32 GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config
36 AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
37 min_gtkmm_version=ifelse([$1], ,0.10.0,$1)
39 AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version)
42 if test "$GTKMM_CONFIG" = "no" ; then
47 GTKMM_CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags`
48 GTKMM_LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs`
49 gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
50 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
51 gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
52 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
53 gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
54 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
55 if test "x$enable_gtkmmtest" = "xyes" ; then
56 ac_save_CXXFLAGS="$CXXFLAGS"
58 CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS"
59 LIBS="$LIBS $GTKMM_LIBS"
61 dnl Now check if the installed GTK-- is sufficiently new. (Also sanity
62 dnl checks the results of gtkmm-config to some extent
73 int major, minor, micro;
76 system ("touch conf.gtkmmtest");
78 /* HP/UX 0 (%@#!) writes to sscanf strings */
79 tmp_version = g_strdup("$min_gtkmm_version");
80 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
81 printf("%s, bad version string\n", "$min_gtkmm_version");
85 if ((gtkmm_major_version != $gtkmm_config_major_version) ||
86 (gtkmm_minor_version != $gtkmm_config_minor_version) ||
87 (gtkmm_micro_version != $gtkmm_config_micro_version))
89 printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n",
90 $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version,
91 gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
92 printf ("*** was found! If gtkmm-config was correct, then it is best\n");
93 printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n");
94 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
95 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
96 printf("*** required on your system.\n");
97 printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n");
98 printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n");
99 printf("*** before re-running configure\n");
101 /* GTK-- does not have the GTKMM_*_VERSION constants */
103 else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) ||
104 (gtkmm_minor_version != GTKMM_MINOR_VERSION) ||
105 (gtkmm_micro_version != GTKMM_MICRO_VERSION))
107 printf("*** GTK-- header files (version %d.%d.%d) do not match\n",
108 GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION);
109 printf("*** library (version %d.%d.%d)\n",
110 gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
115 if ((gtkmm_major_version > major) ||
116 ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) ||
117 ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro)))
123 printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n",
124 gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
125 printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n",
126 major, minor, micro);
127 printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n");
129 printf("*** If you have already installed a sufficiently new version, this error\n");
130 printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n");
131 printf("*** being found. The easiest way to fix this is to remove the old version\n");
132 printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n");
133 printf("*** correct copy of gtkmm-config. (In this case, you will have to\n");
134 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
135 printf("*** so that the correct libraries are found at run-time))\n");
140 ],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
141 CXXFLAGS="$ac_save_CXXFLAGS"
145 if test "x$no_gtkmm" = x ; then
147 ifelse([$2], , :, [$2])
150 if test "$GTKMM_CONFIG" = "no" ; then
151 echo "*** The gtkmm-config script installed by GTK-- could not be found"
152 echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in"
153 echo "*** your path, or set the GTKMM_CONFIG environment variable to the"
154 echo "*** full path to gtkmm-config."
155 echo "*** The gtkmm-config script was not available in GTK-- versions"
156 echo "*** prior to 0.9.12. Perhaps you need to update your installed"
157 echo "*** version to 0.9.12 or later"
159 if test -f conf.gtkmmtest ; then
162 echo "*** Could not run GTK-- test program, checking why..."
163 CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS"
164 LIBS="$LIBS $GTKMM_LIBS"
168 ], [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ],
169 [ echo "*** The test program compiled, but did not run. This usually means"
170 echo "*** that the run-time linker is not finding GTK-- or finding the wrong"
171 echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your"
172 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
173 echo "*** to the installed location Also, make sure you have run ldconfig if that"
174 echo "*** is required on your system"
176 echo "*** If you have an old version installed, it is best to remove it, although"
177 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
178 [ echo "*** The test program failed to compile or link. See the file config.log for the"
179 echo "*** exact error that occured. This usually means GTK-- was incorrectly installed"
180 echo "*** or that you have moved GTK-- since it was installed. In the latter case, you"
181 echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ])
182 CXXFLAGS="$ac_save_CXXFLAGS"
188 ifelse([$3], , :, [$3])
191 AC_SUBST(GTKMM_CFLAGS)