acinclude.m4 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. dnl acinclude.m4. Change *this* file to add new or change macros.
  2. dnl When changes have been made, delete aclocal.m4 and run
  3. dnl "aclocal".
  4. dnl
  5. dnl DO NOT change aclocal.m4 !
  6. dnl
  7. dnl * LA_SEARCH_FILE(variable, filename, PATH)
  8. dnl * Search "filename" in the specified "PATH", "variable" will
  9. dnl * contain the full pathname or the empty string
  10. dnl * PATH is space-separated list of directories.
  11. dnl * by Florian Bomers
  12. AC_DEFUN([LA_SEARCH_FILE],[
  13. $1=
  14. dnl hack: eliminate line feeds in $2
  15. for FILE in $2; do
  16. for DIR in $3; do
  17. dnl use PATH in order
  18. if test ".$1"="." && test -f "$DIR/$FILE"; then
  19. $1=$DIR
  20. fi
  21. done
  22. done
  23. ])
  24. dnl * LA_SEARCH_LIB(lib-variable, include-variable, lib-filename, header-filename, prefix)
  25. dnl * looks for "lib-filename" and "header-filename" in the area of "prefix".
  26. dnl * if found, "lib-variable" and "include-variable" are set to the
  27. dnl * respective paths.
  28. dnl * prefix is a single path
  29. dnl * libs are searched in prefix, prefix/lib, prefix/.., prefix/../lib
  30. dnl * headers are searched in prefix, prefix/include, prefix/.., prefix/../include
  31. dnl *
  32. dnl * If one of them is not found, both "lib-variable", "include-variable" are
  33. dnl * set to the empty string.
  34. dnl *
  35. dnl * TODO: assert function call to verify lib
  36. dnl *
  37. dnl * by Florian Bomers
  38. AC_DEFUN([LA_SEARCH_LIB],[
  39. dnl look for lib
  40. LA_SEARCH_FILE($1, $3, $5 $5/lib $5/.. $5/../lib)
  41. dnl look for header.
  42. LA_SEARCH_FILE($2, $4, $5 $5/include $5/.. $5/../include)
  43. if test ".$1" = "." || test ".$2" = "."; then
  44. $1=
  45. $2=
  46. fi
  47. ])
  48. # alex_IEEE854_FLOAT80
  49. # ------------
  50. AC_DEFUN([alex_IEEE854_FLOAT80],
  51. [AC_CACHE_CHECK(for IEEE854 compliant 80 bit floats, alex_cv_ieee854_float80,
  52. [AC_TRY_RUN([
  53. int float2long_IEEE_compliance ( void )
  54. {
  55. struct {
  56. long padding; /* to prevent unaligned access */
  57. float f;
  58. } s;
  59. s.f = 12582912.; if ( *(long*)(&s.f) != 1262485504l ) return 0;
  60. s.f = 12615679.; if ( *(long*)(&s.f) != 1262518271l ) return 0;
  61. s.f = 13582912.; if ( *(long*)(&s.f) != 1263485504l ) return 0;
  62. s.f = 12550145.; if ( *(long*)(&s.f) != 1262452737l ) return 0;
  63. s.f = 11582912.; if ( *(long*)(&s.f) != 1261485504l ) return 0;
  64. return 1;
  65. }
  66. int main(void)
  67. {
  68. int retval;
  69. retval = float2long_IEEE_compliance();
  70. /* no error return -> success */
  71. return !retval;
  72. }
  73. ], alex_cv_ieee854_float80=yes, alex_cv_ieee854_float80=no,
  74. [AC_MSG_WARN(can't check for IEEE854 compliant 80 bit floats)]
  75. )])]) # alex_IEEE854_FLOAT80
  76. # Configure paths for GTK+
  77. # Owen Taylor 97-11-3
  78. dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
  79. dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
  80. dnl
  81. AC_DEFUN([AM_PATH_GTK],
  82. [dnl
  83. dnl Get the cflags and libraries from the gtk-config script
  84. dnl
  85. AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
  86. gtk_config_prefix="$withval", gtk_config_prefix="")
  87. AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
  88. gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
  89. AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
  90. , enable_gtktest=yes)
  91. for module in . $4
  92. do
  93. case "$module" in
  94. gthread)
  95. gtk_config_args="$gtk_config_args gthread"
  96. ;;
  97. esac
  98. done
  99. if test x$gtk_config_exec_prefix != x ; then
  100. gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
  101. if test x${GTK_CONFIG+set} != xset ; then
  102. GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
  103. fi
  104. fi
  105. if test x$gtk_config_prefix != x ; then
  106. gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
  107. if test x${GTK_CONFIG+set} != xset ; then
  108. GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
  109. fi
  110. fi
  111. AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
  112. min_gtk_version=ifelse([$1], ,0.99.7,$1)
  113. AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
  114. no_gtk=""
  115. if test "$GTK_CONFIG" = "no" ; then
  116. no_gtk=yes
  117. else
  118. GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
  119. GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
  120. gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
  121. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  122. gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
  123. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  124. gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
  125. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
  126. if test "x$enable_gtktest" = "xyes" ; then
  127. ac_save_CFLAGS="$CFLAGS"
  128. ac_save_LIBS="$LIBS"
  129. CFLAGS="$CFLAGS $GTK_CFLAGS"
  130. LIBS="$GTK_LIBS $LIBS"
  131. dnl
  132. dnl Now check if the installed GTK is sufficiently new. (Also sanity
  133. dnl checks the results of gtk-config to some extent
  134. dnl
  135. rm -f conf.gtktest
  136. AC_TRY_RUN([
  137. #include <gtk/gtk.h>
  138. #include <stdio.h>
  139. #include <stdlib.h>
  140. int
  141. main ()
  142. {
  143. int major, minor, micro;
  144. char *tmp_version;
  145. system ("touch conf.gtktest");
  146. /* HP/UX 9 (%@#!) writes to sscanf strings */
  147. tmp_version = g_strdup("$min_gtk_version");
  148. if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
  149. printf("%s, bad version string\n", "$min_gtk_version");
  150. exit(1);
  151. }
  152. if ((gtk_major_version != $gtk_config_major_version) ||
  153. (gtk_minor_version != $gtk_config_minor_version) ||
  154. (gtk_micro_version != $gtk_config_micro_version))
  155. {
  156. printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
  157. $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
  158. gtk_major_version, gtk_minor_version, gtk_micro_version);
  159. printf ("*** was found! If gtk-config was correct, then it is best\n");
  160. printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
  161. printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
  162. printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
  163. printf("*** required on your system.\n");
  164. printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
  165. printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
  166. printf("*** before re-running configure\n");
  167. }
  168. #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
  169. else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
  170. (gtk_minor_version != GTK_MINOR_VERSION) ||
  171. (gtk_micro_version != GTK_MICRO_VERSION))
  172. {
  173. printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
  174. GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
  175. printf("*** library (version %d.%d.%d)\n",
  176. gtk_major_version, gtk_minor_version, gtk_micro_version);
  177. }
  178. #endif /* defined (GTK_MAJOR_VERSION) ... */
  179. else
  180. {
  181. if ((gtk_major_version > major) ||
  182. ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
  183. ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
  184. {
  185. return 0;
  186. }
  187. else
  188. {
  189. printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
  190. gtk_major_version, gtk_minor_version, gtk_micro_version);
  191. printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
  192. major, minor, micro);
  193. printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
  194. printf("***\n");
  195. printf("*** If you have already installed a sufficiently new version, this error\n");
  196. printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
  197. printf("*** being found. The easiest way to fix this is to remove the old version\n");
  198. printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
  199. printf("*** correct copy of gtk-config. (In this case, you will have to\n");
  200. printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
  201. printf("*** so that the correct libraries are found at run-time))\n");
  202. }
  203. }
  204. return 1;
  205. }
  206. ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  207. CFLAGS="$ac_save_CFLAGS"
  208. LIBS="$ac_save_LIBS"
  209. fi
  210. fi
  211. if test "x$no_gtk" = x ; then
  212. AC_MSG_RESULT(yes)
  213. ifelse([$2], , :, [$2])
  214. else
  215. AC_MSG_RESULT(no)
  216. if test "$GTK_CONFIG" = "no" ; then
  217. echo "*** The gtk-config script installed by GTK could not be found"
  218. echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
  219. echo "*** your path, or set the GTK_CONFIG environment variable to the"
  220. echo "*** full path to gtk-config."
  221. else
  222. if test -f conf.gtktest ; then
  223. :
  224. else
  225. echo "*** Could not run GTK test program, checking why..."
  226. CFLAGS="$CFLAGS $GTK_CFLAGS"
  227. LIBS="$LIBS $GTK_LIBS"
  228. AC_TRY_LINK([
  229. #include <gtk/gtk.h>
  230. #include <stdio.h>
  231. ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
  232. [ echo "*** The test program compiled, but did not run. This usually means"
  233. echo "*** that the run-time linker is not finding GTK or finding the wrong"
  234. echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
  235. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  236. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  237. echo "*** is required on your system"
  238. echo "***"
  239. echo "*** If you have an old version installed, it is best to remove it, although"
  240. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
  241. echo "***"
  242. echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
  243. echo "*** came with the system with the command"
  244. echo "***"
  245. echo "*** rpm --erase --nodeps gtk gtk-devel" ],
  246. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  247. echo "*** exact error that occured. This usually means GTK was incorrectly installed"
  248. echo "*** or that you have moved GTK since it was installed. In the latter case, you"
  249. echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
  250. CFLAGS="$ac_save_CFLAGS"
  251. LIBS="$ac_save_LIBS"
  252. fi
  253. fi
  254. GTK_CFLAGS=""
  255. GTK_LIBS=""
  256. ifelse([$3], , :, [$3])
  257. fi
  258. AC_SUBST(GTK_CFLAGS)
  259. AC_SUBST(GTK_LIBS)
  260. rm -f conf.gtktest
  261. ])