aclocal.m4 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. dnl aclocal.m4 generated automatically by aclocal 1.3
  2. dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
  3. dnl This Makefile.in is free software; the Free Software Foundation
  4. dnl gives unlimited permission to copy and/or distribute it,
  5. dnl with or without modifications, as long as this notice is preserved.
  6. dnl This program is distributed in the hope that it will be useful,
  7. dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  8. dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  9. dnl PARTICULAR PURPOSE.
  10. # Configure paths for GTK+
  11. # Owen Taylor 97-11-3
  12. dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
  13. dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
  14. dnl
  15. AC_DEFUN(AM_PATH_GTK,
  16. [dnl
  17. dnl Get the cflags and libraries from the gtk-config script
  18. dnl
  19. AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
  20. gtk_config_prefix="$withval", gtk_config_prefix="")
  21. AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
  22. gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
  23. AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
  24. , enable_gtktest=yes)
  25. if test x$gtk_config_exec_prefix != x ; then
  26. gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
  27. if test x${GTK_CONFIG+set} != xset ; then
  28. GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
  29. fi
  30. fi
  31. if test x$gtk_config_prefix != x ; then
  32. gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
  33. if test x${GTK_CONFIG+set} != xset ; then
  34. GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
  35. fi
  36. fi
  37. AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
  38. min_gtk_version=ifelse([$1], ,0.99.7,$1)
  39. AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
  40. no_gtk=""
  41. if test "$GTK_CONFIG" = "no" ; then
  42. no_gtk=yes
  43. else
  44. GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
  45. GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
  46. gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
  47. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  48. gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
  49. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  50. gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
  51. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
  52. if test "x$enable_gtktest" = "xyes" ; then
  53. ac_save_CFLAGS="$CFLAGS"
  54. ac_save_LIBS="$LIBS"
  55. CFLAGS="$CFLAGS $GTK_CFLAGS"
  56. LIBS="$LIBS $GTK_LIBS"
  57. dnl
  58. dnl Now check if the installed GTK is sufficiently new. (Also sanity
  59. dnl checks the results of gtk-config to some extent
  60. dnl
  61. rm -f conf.gtktest
  62. AC_TRY_RUN([
  63. #include <gtk/gtk.h>
  64. #include <stdio.h>
  65. int
  66. main ()
  67. {
  68. int major, minor, micro;
  69. char *tmp_version;
  70. system ("touch conf.gtktest");
  71. /* HP/UX 9 (%@#!) writes to sscanf strings */
  72. tmp_version = g_strdup("$min_gtk_version");
  73. if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
  74. printf("%s, bad version string\n", "$min_gtk_version");
  75. exit(1);
  76. }
  77. if ((gtk_major_version != $gtk_config_major_version) ||
  78. (gtk_minor_version != $gtk_config_minor_version) ||
  79. (gtk_micro_version != $gtk_config_micro_version))
  80. {
  81. printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
  82. $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
  83. gtk_major_version, gtk_minor_version, gtk_micro_version);
  84. printf ("*** was found! If gtk-config was correct, then it is best\n");
  85. printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
  86. printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
  87. printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
  88. printf("*** required on your system.\n");
  89. printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
  90. printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
  91. printf("*** before re-running configure\n");
  92. }
  93. else
  94. {
  95. if ((gtk_major_version > major) ||
  96. ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
  97. ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
  98. {
  99. return 0;
  100. }
  101. else
  102. {
  103. printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
  104. gtk_major_version, gtk_minor_version, gtk_micro_version);
  105. printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
  106. major, minor, micro);
  107. printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
  108. printf("***\n");
  109. printf("*** If you have already installed a sufficiently new version, this error\n");
  110. printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
  111. printf("*** being found. The easiest way to fix this is to remove the old version\n");
  112. printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
  113. printf("*** correct copy of gtk-config. (In this case, you will have to\n");
  114. printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
  115. printf("*** so that the correct libraries are found at run-time))\n");
  116. }
  117. }
  118. return 1;
  119. }
  120. ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  121. CFLAGS="$ac_save_CFLAGS"
  122. LIBS="$ac_save_LIBS"
  123. fi
  124. fi
  125. if test "x$no_gtk" = x ; then
  126. AC_MSG_RESULT(yes)
  127. ifelse([$2], , :, [$2])
  128. else
  129. AC_MSG_RESULT(no)
  130. if test "$GTK_CONFIG" = "no" ; then
  131. echo "*** The gtk-config script installed by GTK could not be found"
  132. echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
  133. echo "*** your path, or set the GTK_CONFIG environment variable to the"
  134. echo "*** full path to gtk-config."
  135. else
  136. if test -f conf.gtktest ; then
  137. :
  138. else
  139. echo "*** Could not run GTK test program, checking why..."
  140. CFLAGS="$CFLAGS $GTK_CFLAGS"
  141. LIBS="$LIBS $GTK_LIBS"
  142. AC_TRY_LINK([
  143. #include <gtk/gtk.h>
  144. #include <stdio.h>
  145. ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
  146. [ echo "*** The test program compiled, but did not run. This usually means"
  147. echo "*** that the run-time linker is not finding GTK or finding the wrong"
  148. echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
  149. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  150. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  151. echo "*** is required on your system"
  152. echo "***"
  153. echo "*** If you have an old version installed, it is best to remove it, although"
  154. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
  155. echo "***"
  156. echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
  157. echo "*** came with the system with the command"
  158. echo "***"
  159. echo "*** rpm --erase --nodeps gtk gtk-devel" ],
  160. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  161. echo "*** exact error that occured. This usually means GTK was incorrectly installed"
  162. echo "*** or that you have moved GTK since it was installed. In the latter case, you"
  163. echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
  164. CFLAGS="$ac_save_CFLAGS"
  165. LIBS="$ac_save_LIBS"
  166. fi
  167. fi
  168. GTK_CFLAGS=""
  169. GTK_LIBS=""
  170. ifelse([$3], , :, [$3])
  171. fi
  172. AC_SUBST(GTK_CFLAGS)
  173. AC_SUBST(GTK_LIBS)
  174. rm -f conf.gtktest
  175. ])