|
| 1 | +############################################################# |
| 2 | +# |
| 3 | +# Checking for Gnat |
| 4 | +# |
| 5 | +############################################################# |
| 6 | + |
| 7 | +conftest_ok="conftest.ok" |
| 8 | + |
| 9 | +AC_DEFUN(AM_PATH_GNAT, |
| 10 | +[ |
| 11 | + AC_PATH_PROG(GNATMAKE, gnatmake, no) |
| 12 | +
|
| 13 | + if test x$GNATMAKE = xno ; then |
| 14 | + AC_MSG_ERROR(I could not find gnatmake. See the file 'INSTALL' for more details.) |
| 15 | + fi |
| 16 | +
|
| 17 | + AC_MSG_CHECKING(that your gnat compiler works with a simple example) |
| 18 | +
|
| 19 | + rm -f conftest.adb |
| 20 | + cat << EOF > conftest.adb |
| 21 | +with Ada.Text_IO; |
| 22 | +
|
| 23 | +procedure Conftest is |
| 24 | + Conftest_Ok : Ada.Text_IO.File_Type; |
| 25 | +begin |
| 26 | + Ada.Text_IO.Create (File => Conftest_Ok, |
| 27 | + Name => "$conftest_ok"); |
| 28 | + Ada.Text_IO.Close (Conftest_Ok); |
| 29 | +end Conftest; |
| 30 | +EOF |
| 31 | +
|
| 32 | + $GNATMAKE conftest > /dev/null 2>&1 |
| 33 | +
|
| 34 | + if ! test -x conftest ; then |
| 35 | + AC_MSG_RESULT(no) |
| 36 | + AC_MSG_ERROR($GNATMAKE test failed at compile time! Check your configuration.) |
| 37 | + fi |
| 38 | +
|
| 39 | + ./conftest |
| 40 | +
|
| 41 | + if ! test -f $conftest_ok; then |
| 42 | + AC_MSG_RESULT(no) |
| 43 | + AC_MSG_ERROR($GNATMAKE test failed at run time! Check your configuration.) |
| 44 | + fi |
| 45 | +
|
| 46 | + AC_MSG_RESULT(yes) |
| 47 | +]) |
| 48 | + |
| 49 | +############################################################# |
| 50 | +# |
| 51 | +# Checking for Gnat |
| 52 | +# |
| 53 | +############################################################# |
| 54 | + |
| 55 | +AC_DEFUN(AM_PATH_PERL, |
| 56 | +[ |
| 57 | + AC_PATH_PROGS(PERL, perl5 perl) |
| 58 | + |
| 59 | + ### We don't really have any need for a specific version |
| 60 | + ### of perl for the moment, so we don't verify it. |
| 61 | +
|
| 62 | +]) |
| 63 | + |
| 64 | +############################################################# |
| 65 | +# |
| 66 | +# Configure paths for GTK+ |
| 67 | +# Extracted from the aclocal.m4 file of gimp-1.0.0 |
| 68 | +# |
| 69 | +############################################################# |
| 70 | + |
| 71 | +dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
| 72 | +dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS |
| 73 | +dnl |
| 74 | +AC_DEFUN(AM_PATH_GTK, |
| 75 | +[dnl |
| 76 | +dnl Get the cflags and libraries from the gtk-config script |
| 77 | +dnl |
| 78 | +AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], |
| 79 | + gtk_config_prefix="$withval", gtk_config_prefix="") |
| 80 | +AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], |
| 81 | + gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") |
| 82 | +AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], |
| 83 | + , enable_gtktest=yes) |
| 84 | +
|
| 85 | + if test x$gtk_config_exec_prefix != x ; then |
| 86 | + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" |
| 87 | + if test x${GTK_CONFIG+set} != xset ; then |
| 88 | + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config |
| 89 | + fi |
| 90 | + fi |
| 91 | + if test x$gtk_config_prefix != x ; then |
| 92 | + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" |
| 93 | + if test x${GTK_CONFIG+set} != xset ; then |
| 94 | + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config |
| 95 | + fi |
| 96 | + fi |
| 97 | +
|
| 98 | + AC_PATH_PROG(GTK_CONFIG, gtk-config, no) |
| 99 | + min_gtk_version=ifelse([$1], ,1.1.15,$1) |
| 100 | + AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) |
| 101 | + no_gtk="" |
| 102 | + if test "$GTK_CONFIG" = "no" ; then |
| 103 | + no_gtk=yes |
| 104 | + else |
| 105 | + GTK_PREFIX=`$GTK_CONFIG $gtk_config_args --prefix` |
| 106 | + GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` |
| 107 | + GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` |
| 108 | + gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ |
| 109 | + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
| 110 | + gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ |
| 111 | + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
| 112 | + gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ |
| 113 | + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
| 114 | + if test "x$enable_gtktest" = "xyes" ; then |
| 115 | + ac_save_CFLAGS="$CFLAGS" |
| 116 | + ac_save_LIBS="$LIBS" |
| 117 | + CFLAGS="$CFLAGS $GTK_CFLAGS" |
| 118 | + LIBS="$LIBS $GTK_LIBS" |
| 119 | +dnl |
| 120 | +dnl Now check if the installed GTK is sufficiently new. (Also sanity |
| 121 | +dnl checks the results of gtk-config to some extent |
| 122 | +dnl |
| 123 | + rm -f conf.gtktest |
| 124 | + AC_TRY_RUN([ |
| 125 | +#include <gtk/gtk.h> |
| 126 | +#include <stdio.h> |
| 127 | +
|
| 128 | +int |
| 129 | +main () |
| 130 | +{ |
| 131 | + int major, minor, micro; |
| 132 | + char *tmp_version; |
| 133 | +
|
| 134 | + system ("touch conf.gtktest"); |
| 135 | +
|
| 136 | + /* HP/UX 9 (%@#!) writes to sscanf strings */ |
| 137 | + tmp_version = g_strdup("$min_gtk_version"); |
| 138 | + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
| 139 | + printf("%s, bad version string\n", "$min_gtk_version"); |
| 140 | + exit(1); |
| 141 | + } |
| 142 | +
|
| 143 | + if ((gtk_major_version != $gtk_config_major_version) || |
| 144 | + (gtk_minor_version != $gtk_config_minor_version) || |
| 145 | + (gtk_micro_version != $gtk_config_micro_version)) |
| 146 | + { |
| 147 | + printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", |
| 148 | + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, |
| 149 | + gtk_major_version, gtk_minor_version, gtk_micro_version); |
| 150 | + printf ("*** was found! If gtk-config was correct, then it is best\n"); |
| 151 | + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); |
| 152 | + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); |
| 153 | + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); |
| 154 | + printf("*** required on your system.\n"); |
| 155 | + printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); |
| 156 | + printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); |
| 157 | + printf("*** before re-running configure\n"); |
| 158 | + } |
| 159 | + else |
| 160 | + { |
| 161 | + if ((gtk_major_version > major) || |
| 162 | + ((gtk_major_version == major) && (gtk_minor_version > minor)) || |
| 163 | + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) |
| 164 | + { |
| 165 | + return 0; |
| 166 | + } |
| 167 | + else |
| 168 | + { |
| 169 | + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", |
| 170 | + gtk_major_version, gtk_minor_version, gtk_micro_version); |
| 171 | + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", |
| 172 | + major, minor, micro); |
| 173 | + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); |
| 174 | + printf("***\n"); |
| 175 | + printf("*** If you have already installed a sufficiently new version, this error\n"); |
| 176 | + printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); |
| 177 | + printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
| 178 | + printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); |
| 179 | + printf("*** correct copy of gtk-config. (In this case, you will have to\n"); |
| 180 | + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
| 181 | + printf("*** so that the correct libraries are found at run-time))\n"); |
| 182 | + } |
| 183 | + } |
| 184 | + return 1; |
| 185 | +} |
| 186 | +],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
| 187 | + CFLAGS="$ac_save_CFLAGS" |
| 188 | + LIBS="$ac_save_LIBS" |
| 189 | + fi |
| 190 | + fi |
| 191 | + if test "x$no_gtk" = x ; then |
| 192 | + AC_MSG_RESULT(yes) |
| 193 | + ifelse([$2], , :, [$2]) |
| 194 | + else |
| 195 | + AC_MSG_RESULT(no) |
| 196 | + if test "$GTK_CONFIG" = "no" ; then |
| 197 | + echo "*** The gtk-config script installed by GTK could not be found" |
| 198 | + echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" |
| 199 | + echo "*** your path, or set the GTK_CONFIG environment variable to the" |
| 200 | + echo "*** full path to gtk-config." |
| 201 | + else |
| 202 | + if test -f conf.gtktest ; then |
| 203 | + : |
| 204 | + else |
| 205 | + echo "*** Could not run GTK test program, checking why..." |
| 206 | + CFLAGS="$CFLAGS $GTK_CFLAGS" |
| 207 | + LIBS="$LIBS $GTK_LIBS" |
| 208 | + AC_TRY_LINK([ |
| 209 | +#include <gtk/gtk.h> |
| 210 | +#include <stdio.h> |
| 211 | +], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], |
| 212 | + [ echo "*** The test program compiled, but did not run. This usually means" |
| 213 | + echo "*** that the run-time linker is not finding GTK or finding the wrong" |
| 214 | + echo "*** version of GTK. If it is not finding GTK, you'll need to set your" |
| 215 | + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
| 216 | + echo "*** to the installed location Also, make sure you have run ldconfig if that" |
| 217 | + echo "*** is required on your system" |
| 218 | + echo "***" |
| 219 | + echo "*** If you have an old version installed, it is best to remove it, although" |
| 220 | + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" |
| 221 | + echo "***" |
| 222 | + echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" |
| 223 | + echo "*** came with the system with the command" |
| 224 | + echo "***" |
| 225 | + echo "*** rpm --erase --nodeps gtk gtk-devel" ], |
| 226 | + [ echo "*** The test program failed to compile or link. See the file config.log for the" |
| 227 | + echo "*** exact error that occured. This usually means GTK was incorrectly installed" |
| 228 | + echo "*** or that you have moved GTK since it was installed. In the latter case, you" |
| 229 | + echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) |
| 230 | + CFLAGS="$ac_save_CFLAGS" |
| 231 | + LIBS="$ac_save_LIBS" |
| 232 | + fi |
| 233 | + fi |
| 234 | + GTK_CFLAGS="" |
| 235 | + GTK_LIBS="" |
| 236 | + ifelse([$3], , :, [$3]) |
| 237 | + fi |
| 238 | + AC_SUBST(GTK_PREFIX) |
| 239 | + AC_SUBST(GTK_CFLAGS) |
| 240 | + AC_SUBST(GTK_LIBS) |
| 241 | + rm -f conf.gtktest |
| 242 | +]) |
| 243 | + |
0 commit comments