acinclude.m4 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. ## Add your own autoconf macros here.
  2. ## Find the install dirs for the python installation.
  3. ## By James Henstridge
  4. dnl a macro to check for ability to create python extensions
  5. dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
  6. dnl function also defines PYTHON_INCLUDES
  7. AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
  8. [AC_REQUIRE([AM_PATH_PYTHON])
  9. AC_MSG_CHECKING(for headers required to compile python extensions)
  10. dnl deduce PYTHON_INCLUDES
  11. py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
  12. py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
  13. PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
  14. if test "$py_prefix" != "$py_exec_prefix"; then
  15. PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
  16. fi
  17. AC_SUBST(PYTHON_INCLUDES)
  18. dnl check if the headers exist:
  19. save_CPPFLAGS="$CPPFLAGS"
  20. CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
  21. AC_TRY_CPP([#include <Python.h>],dnl
  22. [AC_MSG_RESULT(found)
  23. $1],dnl
  24. [AC_MSG_RESULT(not found)
  25. $2])
  26. CPPFLAGS="$save_CPPFLAGS"
  27. ])
  28. # Configure paths for gimp-print
  29. # Roger Leigh -- Sat, 10 Feb 2001
  30. # (based on gimpprint.m4 by Owen Taylor 97-11-3)
  31. dnl AM_PATH_GIMPPRINT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
  32. dnl Test for GIMP-PRINT, and define GIMPPRINT_CFLAGS and GIMPPRINT_LIBS
  33. dnl
  34. AC_DEFUN([AM_PATH_GIMPPRINT],
  35. [dnl
  36. dnl Get the cflags and libraries from the gimpprint-config script
  37. dnl
  38. AC_ARG_WITH(gimpprint-prefix,[ --with-gimpprint-prefix=PFX Prefix where GIMP-PRINT is installed (optional)],
  39. gimpprint_config_prefix="$withval", gimpprint_config_prefix="")
  40. AC_ARG_WITH(gimpprint-exec-prefix,[ --with-gimpprint-exec-prefix=PFX Exec prefix where GIMP-PRINT is installed
  41. (optional)],
  42. gimpprint_config_exec_prefix="$withval", gimpprint_config_exec_prefix="")
  43. AC_ARG_ENABLE(gimpprinttest, [ --disable-gimpprinttest Do not try to compile and run a test GIMP-PRINT
  44. program],
  45. , enable_gimpprinttest=yes)
  46. if test x$gimpprint_config_exec_prefix != x ; then
  47. gimpprint_config_args="$gimpprint_config_args --exec-prefix=$gimpprint_config_exec_prefix"
  48. if test x${GIMPPRINT_CONFIG+set} != xset ; then
  49. GIMPPRINT_CONFIG=$gimpprint_config_exec_prefix/bin/gimpprint-config
  50. fi
  51. fi
  52. if test x$gimpprint_config_prefix != x ; then
  53. gimpprint_config_args="$gimpprint_config_args --prefix=$gimpprint_config_prefix"
  54. if test x${GIMPPRINT_CONFIG+set} != xset ; then
  55. GIMPPRINT_CONFIG=$gimpprint_config_prefix/bin/gimpprint-config
  56. fi
  57. fi
  58. AC_PATH_PROG(GIMPPRINT_CONFIG, gimpprint-config, no)
  59. min_gimpprint_version=ifelse([$1], ,4.1.4,$1)
  60. AC_MSG_CHECKING(for GIMP-PRINT - version >= $min_gimpprint_version)
  61. no_gimpprint=""
  62. if test "$GIMPPRINT_CONFIG" = "no" ; then
  63. no_gimpprint=yes
  64. else
  65. GIMPPRINT_CFLAGS=`$GIMPPRINT_CONFIG $gimpprint_config_args --cflags`
  66. GIMPPRINT_LIBS=`$GIMPPRINT_CONFIG $gimpprint_config_args --libs`
  67. gimpprint_config_major_version=`$GIMPPRINT_CONFIG $gimpprint_config_args --version | \
  68. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  69. gimpprint_config_minor_version=`$GIMPPRINT_CONFIG $gimpprint_config_args --version | \
  70. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  71. gimpprint_config_micro_version=`$GIMPPRINT_CONFIG $gimpprint_config_args --version | \
  72. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
  73. if test "x$enable_gimpprinttest" = "xyes" ; then
  74. ac_save_CFLAGS="$CFLAGS"
  75. ac_save_LIBS="$LIBS"
  76. CFLAGS="$CFLAGS $GIMPPRINT_CFLAGS"
  77. LIBS="$GIMPPRINT_LIBS $LIBS"
  78. dnl
  79. dnl Now check if the installed GIMP-PRINT is sufficiently new. (Also sanity
  80. dnl checks the results of gimpprint-config to some extent
  81. dnl
  82. rm -f conf.gimpprinttest
  83. AC_TRY_RUN([
  84. #include <gimp-print/gimp-print.h>
  85. #include <stdio.h>
  86. #include <stdlib.h>
  87. #include <string.h>
  88. int
  89. main ()
  90. {
  91. int major, minor, micro;
  92. char *tmp_version;
  93. system ("touch conf.gimpprinttest");
  94. /* HP/UX 9 (%@#!) writes to sscanf strings */
  95. tmp_version = strdup("$min_gimpprint_version");
  96. if (!tmp_version) {
  97. exit(1);
  98. }
  99. if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
  100. printf("%s, bad version string\n", "$min_gimpprint_version");
  101. exit(1);
  102. }
  103. if ((gimpprint_major_version != $gimpprint_config_major_version) ||
  104. (gimpprint_minor_version != $gimpprint_config_minor_version) ||
  105. (gimpprint_micro_version != $gimpprint_config_micro_version))
  106. {
  107. printf("\n*** 'gimpprint-config --version' returned %d.%d.%d, but GIMP-PRINT (%d.%d.%d)\n",
  108. $gimpprint_config_major_version, $gimpprint_config_minor_version, $gimpprint_config_micro_version,
  109. gimpprint_major_version, gimpprint_minor_version, gimpprint_micro_version);
  110. printf ("*** was found! If gimpprint-config was correct, then it is best\n");
  111. printf ("*** to remove the old version of GIMP-PRINT. You may also be able to fix the\n");
  112. printf("*** error by modifying your LD_LIBRARY_PATH enviroment variable, or by\n");
  113. printf("*** editing /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
  114. printf("*** required on your system.\n");
  115. printf("*** If gimpprint-config was wrong, set the environment variable GIMPPRINT_CONFIG\n");
  116. printf("*** to point to the correct copy of gimpprint-config, and remove the file\n");
  117. printf("*** config.cache before re-running configure\n");
  118. }
  119. #if defined (GIMPPRINT_MAJOR_VERSION) && defined (GIMPPRINT_MINOR_VERSION) && defined (GIMPPRINT_MICRO_VERSION)
  120. else if ((gimpprint_major_version != GIMPPRINT_MAJOR_VERSION) ||
  121. (gimpprint_minor_version != GIMPPRINT_MINOR_VERSION) ||
  122. (gimpprint_micro_version != GIMPPRINT_MICRO_VERSION))
  123. {
  124. printf("\n*** GIMP-PRINT header files (version %d.%d.%d) do not match\n",
  125. GIMPPRINT_MAJOR_VERSION, GIMPPRINT_MINOR_VERSION, GIMPPRINT_MICRO_VERSION);
  126. printf("*** library (version %d.%d.%d)\n",
  127. gimpprint_major_version, gimpprint_minor_version, gimpprint_micro_version);
  128. }
  129. #endif /* defined (GIMPPRINT_MAJOR_VERSION) ... */
  130. else
  131. {
  132. if ((gimpprint_major_version > major) ||
  133. ((gimpprint_major_version == major) && (gimpprint_minor_version > minor)) ||
  134. ((gimpprint_major_version == major) && (gimpprint_minor_version == minor) && (gimpprint_micro_version >= micro)))
  135. {
  136. return 0;
  137. }
  138. else
  139. {
  140. printf("\n*** An old version of GIMP-PRINT (%d.%d.%d) was found.\n",
  141. gimpprint_major_version, gimpprint_minor_version, gimpprint_micro_version);
  142. printf("*** You need a version of GIMP-PRINT newer than %d.%d.%d. The latest version of\n",
  143. major, minor, micro);
  144. printf("*** GIMP-PRINT is always available from\n");
  145. printf("*** http://sourceforge.net/project/showfiles.php?group_id=1537.\n");
  146. printf("***\n");
  147. printf("*** If you have already installed a sufficiently new version, this error\n");
  148. printf("*** probably means that the wrong copy of the gimpprint-config shell script is\n");
  149. printf("*** being found. The easiest way to fix this is to remove the old version\n");
  150. printf("*** of GIMP-PRINT, but you can also set the GIMPPRINT_CONFIG environment to\n");
  151. printf("*** point to the correct copy of gimpprint-config. (In this case, you will have\n");
  152. printf("*** to modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
  153. printf("*** so that the correct libraries are found at run-time))\n");
  154. }
  155. }
  156. return 1;
  157. }
  158. ],, no_gimpprint=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  159. CFLAGS="$ac_save_CFLAGS"
  160. LIBS="$ac_save_LIBS"
  161. fi
  162. fi
  163. if test "x$no_gimpprint" = x ; then
  164. AC_MSG_RESULT(yes)
  165. ifelse([$2], , :, [$2])
  166. else
  167. AC_MSG_RESULT(no)
  168. if test "$GIMPPRINT_CONFIG" = "no" ; then
  169. echo "*** The gimpprint-config script installed by GIMP-PRINT could not be found"
  170. echo "*** If GIMP-PRINT was installed in PREFIX, make sure PREFIX/bin is in"
  171. echo "*** your path, or set the GIMPPRINT_CONFIG environment variable to the"
  172. echo "*** full path to gimpprint-config."
  173. else
  174. if test -f conf.gimpprinttest ; then
  175. :
  176. else
  177. echo "*** Could not run GIMP-PRINT test program, checking why..."
  178. CFLAGS="$CFLAGS $GIMPPRINT_CFLAGS"
  179. LIBS="$LIBS $GIMPPRINT_LIBS"
  180. AC_TRY_LINK([
  181. #include <gimp-print/gimp-print.h>
  182. #include <stdio.h>
  183. #include <string.h>
  184. ], [ return ((gimpprint_major_version) || (gimpprint_minor_version) || (gimpprint_micro_version)); ],
  185. [ echo "*** The test program compiled, but did not run. This usually means"
  186. echo "*** that the run-time linker is not finding GIMP-PRINT or finding the wrong"
  187. echo "*** version of GIMP-PRINT. If it is not finding GIMP-PRINT, you'll need to set"
  188. echo "*** your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  189. echo "*** to the installed location Also, make sure you have run ldconfig if that"
  190. echo "*** is required on your system"
  191. echo "***"
  192. echo "*** If you have an old version installed, it is best to remove it, although"
  193. echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
  194. [ echo "*** The test program failed to compile or link. See the file config.log for the"
  195. echo "*** exact error that occured. This usually means GIMP-PRINT was incorrectly"
  196. echo "*** installed or that you have moved GIMP-PRINT since it was installed. In the"
  197. echo "*** latter case, you may want to edit the gimpprint-config script:"
  198. echo "*** $GIMPPRINT_CONFIG" ])
  199. CFLAGS="$ac_save_CFLAGS"
  200. LIBS="$ac_save_LIBS"
  201. fi
  202. fi
  203. GIMPPRINT_CFLAGS=""
  204. GIMPPRINT_LIBS=""
  205. ifelse([$3], , :, [$3])
  206. fi
  207. AC_SUBST(GIMPPRINT_CFLAGS)
  208. AC_SUBST(GIMPPRINT_LIBS)
  209. rm -f conf.gimpprinttest
  210. ])
  211. dnl Configure Paths for Alsa
  212. dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
  213. dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
  214. dnl Jaroslav Kysela <perex@suse.cz>
  215. dnl Last modification: alsa.m4,v 1.23 2004/01/16 18:14:22 tiwai Exp
  216. dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
  217. dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
  218. dnl enables arguments --with-alsa-prefix=
  219. dnl --with-alsa-enc-prefix=
  220. dnl --disable-alsatest
  221. dnl
  222. dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
  223. dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
  224. dnl
  225. AC_DEFUN([AM_PATH_ALSA],
  226. [dnl Save the original CFLAGS, LDFLAGS, and LIBS
  227. alsa_save_CFLAGS="$CFLAGS"
  228. alsa_save_LDFLAGS="$LDFLAGS"
  229. alsa_save_LIBS="$LIBS"
  230. alsa_found=yes
  231. dnl
  232. dnl Get the cflags and libraries for alsa
  233. dnl
  234. AC_ARG_WITH(alsa-prefix,
  235. [ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)],
  236. [alsa_prefix="$withval"], [alsa_prefix=""])
  237. AC_ARG_WITH(alsa-inc-prefix,
  238. [ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)],
  239. [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
  240. dnl FIXME: this is not yet implemented
  241. AC_ARG_ENABLE(alsatest,
  242. [ --disable-alsatest Do not try to compile and run a test Alsa program],
  243. [enable_alsatest="$enableval"],
  244. [enable_alsatest=yes])
  245. dnl Add any special include directories
  246. AC_MSG_CHECKING(for ALSA CFLAGS)
  247. if test "$alsa_inc_prefix" != "" ; then
  248. ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
  249. CFLAGS="$CFLAGS -I$alsa_inc_prefix"
  250. fi
  251. AC_MSG_RESULT($ALSA_CFLAGS)
  252. CFLAGS="$alsa_save_CFLAGS"
  253. dnl add any special lib dirs
  254. AC_MSG_CHECKING(for ALSA LDFLAGS)
  255. if test "$alsa_prefix" != "" ; then
  256. ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
  257. LDFLAGS="$LDFLAGS $ALSA_LIBS"
  258. fi
  259. dnl add the alsa library
  260. ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
  261. LIBS=`echo $LIBS | sed 's/-lm//'`
  262. LIBS=`echo $LIBS | sed 's/-ldl//'`
  263. LIBS=`echo $LIBS | sed 's/-lpthread//'`
  264. LIBS=`echo $LIBS | sed 's/ //'`
  265. LIBS="$ALSA_LIBS $LIBS"
  266. AC_MSG_RESULT($ALSA_LIBS)
  267. dnl Check for a working version of libasound that is of the right version.
  268. min_alsa_version=ifelse([$1], ,0.1.1,$1)
  269. AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
  270. no_alsa=""
  271. alsa_min_major_version=`echo $min_alsa_version | \
  272. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  273. alsa_min_minor_version=`echo $min_alsa_version | \
  274. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  275. alsa_min_micro_version=`echo $min_alsa_version | \
  276. sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
  277. AC_LANG_SAVE
  278. AC_LANG_C
  279. AC_TRY_COMPILE([
  280. #include <alsa/asoundlib.h>
  281. ], [
  282. /* ensure backward compatibility */
  283. #if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
  284. #define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
  285. #endif
  286. #if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
  287. #define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
  288. #endif
  289. #if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
  290. #define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
  291. #endif
  292. # if(SND_LIB_MAJOR > $alsa_min_major_version)
  293. exit(0);
  294. # else
  295. # if(SND_LIB_MAJOR < $alsa_min_major_version)
  296. # error not present
  297. # endif
  298. # if(SND_LIB_MINOR > $alsa_min_minor_version)
  299. exit(0);
  300. # else
  301. # if(SND_LIB_MINOR < $alsa_min_minor_version)
  302. # error not present
  303. # endif
  304. # if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
  305. # error not present
  306. # endif
  307. # endif
  308. # endif
  309. exit(0);
  310. ],
  311. [AC_MSG_RESULT(found.)],
  312. [AC_MSG_RESULT(not present.)
  313. ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
  314. alsa_found=no]
  315. )
  316. AC_LANG_RESTORE
  317. dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
  318. if test "x$enable_alsatest" = "xyes"; then
  319. AC_CHECK_LIB([asound], [snd_ctl_open],,
  320. [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
  321. alsa_found=no]
  322. )
  323. fi
  324. LDFLAGS="$alsa_save_LDFLAGS"
  325. LIBS="$alsa_save_LIBS"
  326. if test "x$alsa_found" = "xyes" ; then
  327. ifelse([$2], , :, [$2])
  328. else
  329. ALSA_CFLAGS=""
  330. ALSA_LIBS=""
  331. ifelse([$3], , :, [$3])
  332. fi
  333. dnl That should be it. Now just export out symbols:
  334. AC_SUBST(ALSA_CFLAGS)
  335. AC_SUBST(ALSA_LIBS)
  336. ])
  337. dnl The following lines were copied from gtk-doc.m4
  338. dnl Usage:
  339. dnl GTK_DOC_CHECK([minimum-gtk-doc-version])
  340. AC_DEFUN([GTK_DOC_CHECK],
  341. [
  342. AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
  343. AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
  344. dnl for overriding the documentation installation directory
  345. AC_ARG_WITH(html-dir,
  346. AC_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
  347. [with_html_dir='${datadir}/gtk-doc/html'])
  348. HTML_DIR="$with_html_dir"
  349. AC_SUBST(HTML_DIR)
  350. dnl enable/disable documentation building
  351. AC_ARG_ENABLE(gtk-doc,
  352. AC_HELP_STRING([--enable-gtk-doc],
  353. [use gtk-doc to build documentation (default=no)]),,
  354. enable_gtk_doc=no)
  355. have_gtk_doc=no
  356. if test x$enable_gtk_doc = xyes; then
  357. if test -z "$PKG_CONFIG"; then
  358. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  359. fi
  360. if test "$PKG_CONFIG" != "no" && $PKG_CONFIG --exists gtk-doc; then
  361. have_gtk_doc=yes
  362. fi
  363. dnl do we want to do a version check?
  364. ifelse([$1],[],,
  365. [gtk_doc_min_version=$1
  366. if test "$have_gtk_doc" = yes; then
  367. AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
  368. if $PKG_CONFIG --atleast-version $gtk_doc_min_version gtk-doc; then
  369. AC_MSG_RESULT(yes)
  370. else
  371. AC_MSG_RESULT(no)
  372. have_gtk_doc=no
  373. fi
  374. fi
  375. ])
  376. if test "$have_gtk_doc" != yes; then
  377. enable_gtk_doc=no
  378. fi
  379. fi
  380. AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
  381. AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
  382. ])