2
0

acinclude.m4 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. dnl By default, many hosts won't let programs access large files;
  2. dnl one must use special compiler options to get large-file access to work.
  3. dnl For more details about this brain damage please see:
  4. dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
  5. dnl Written by Paul Eggert <eggert@twinsun.com>.
  6. m4_include([M4/gcc_version.m4])
  7. m4_include([M4/octave.m4])
  8. m4_include([M4/mkoctfile_version.m4])
  9. m4_include([M4/extra_pkg.m4])
  10. m4_include([M4/lrint.m4])
  11. m4_include([M4/lrintf.m4])
  12. m4_include([M4/clang.m4])
  13. m4_include([M4/really_gcc.m4])
  14. m4_include([M4/stack_protect.m4])
  15. m4_include([M4/clip_mode.m4])
  16. m4_include([M4/add_cflags.m4])
  17. m4_include([M4/add_cxxflags.m4])
  18. m4_include([M4/flexible_array.m4])
  19. m4_include([M4/endian.m4])
  20. m4_include([M4/extra_largefile.m4])
  21. dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
  22. dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
  23. AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS],
  24. [AC_CACHE_CHECK([for $1 value to request large file support],
  25. ac_cv_sys_largefile_$1,
  26. [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
  27. ac_cv_sys_largefile_$1=no
  28. ifelse($1, CFLAGS,
  29. [case "$host_os" in
  30. # IRIX 6.2 and later require cc -n32.
  31. changequote(, )dnl
  32. irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
  33. changequote([, ])dnl
  34. if test "$GCC" != yes; then
  35. ac_cv_sys_largefile_CFLAGS=-n32
  36. fi
  37. ac_save_CC="$CC"
  38. CC="$CC $ac_cv_sys_largefile_CFLAGS"
  39. AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
  40. CC="$ac_save_CC"
  41. esac])
  42. }])])
  43. dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
  44. dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
  45. AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
  46. [case $2 in
  47. no) ;;
  48. ?*)
  49. case "[$]$1" in
  50. '') $1=$2 ;;
  51. *) $1=[$]$1' '$2 ;;
  52. esac ;;
  53. esac])
  54. dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
  55. dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
  56. AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
  57. [AC_CACHE_CHECK([for $1], $2,
  58. [$2=no
  59. changequote(, )dnl
  60. $4
  61. for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
  62. case "$ac_flag" in
  63. -D$1)
  64. $2=1 ;;
  65. -D$1=*)
  66. $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
  67. esac
  68. done
  69. changequote([, ])dnl
  70. ])
  71. if test "[$]$2" != no; then
  72. AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
  73. fi])
  74. AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
  75. [AC_REQUIRE([AC_CANONICAL_HOST])
  76. AC_ARG_ENABLE(largefile,
  77. [ --disable-largefile omit support for large files])
  78. if test "$enable_largefile" != no; then
  79. AC_CHECK_TOOL(GETCONF, getconf)
  80. AC_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
  81. AC_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
  82. AC_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
  83. for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
  84. case "$ac_flag" in
  85. no) ;;
  86. -D_FILE_OFFSET_BITS=*) ;;
  87. -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
  88. -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
  89. -D?* | -I?*)
  90. AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
  91. *)
  92. AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
  93. esac
  94. done
  95. AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
  96. AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
  97. AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
  98. ac_cv_sys_file_offset_bits,
  99. [Number of bits in a file offset, on hosts where this is settable.])
  100. [case "$host_os" in
  101. # HP-UX 10.20 and later
  102. hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
  103. ac_cv_sys_file_offset_bits=64 ;;
  104. esac]
  105. AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
  106. ac_cv_sys_largefile_source,
  107. [Define to make fseeko etc. visible, on some hosts.],
  108. [case "$host_os" in
  109. # HP-UX 10.20 and later
  110. hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
  111. ac_cv_sys_largefile_source=1 ;;
  112. esac])
  113. AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
  114. ac_cv_sys_large_files,
  115. [Define for large files, on AIX-style hosts.],
  116. [case "$host_os" in
  117. # AIX 4.2 and later
  118. aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
  119. ac_cv_sys_large_files=1 ;;
  120. esac])
  121. fi
  122. ])
  123. dnl @synopsis AC_C_FIND_ENDIAN
  124. dnl
  125. dnl Determine endian-ness of target processor.
  126. dnl @version 1.1 Mar 03 2002
  127. dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  128. dnl
  129. dnl Majority written from scratch to replace the standard autoconf macro
  130. dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation
  131. dnl of the AC_TRY_RUN macro.
  132. dnl
  133. dnl Permission to use, copy, modify, distribute, and sell this file for any
  134. dnl purpose is hereby granted without fee, provided that the above copyright
  135. dnl and this permission notice appear in all copies. No representations are
  136. dnl made about the suitability of this software for any purpose. It is
  137. dnl provided "as is" without express or implied warranty.
  138. dnl Find endian-ness in the following way:
  139. dnl 1) Look in <endian.h>.
  140. dnl 2) If 1) fails, look in <sys/types.h> and <sys/param.h>.
  141. dnl 3) If 1) and 2) fails and not cross compiling run a test program.
  142. dnl 4) If 1) and 2) fails and cross compiling then guess based on target.
  143. AC_DEFUN([AC_C_FIND_ENDIAN],
  144. [AC_CACHE_CHECK(processor byte ordering,
  145. ac_cv_c_byte_order,
  146. # Initialize to unknown
  147. ac_cv_c_byte_order=unknown
  148. if test x$ac_cv_header_endian_h = xyes ; then
  149. # First try <endian.h> which should set BYTE_ORDER.
  150. [AC_TRY_LINK([
  151. #include <endian.h>
  152. #if BYTE_ORDER != LITTLE_ENDIAN
  153. not big endian
  154. #endif
  155. ], return 0 ;,
  156. ac_cv_c_byte_order=little
  157. )]
  158. [AC_TRY_LINK([
  159. #include <endian.h>
  160. #if BYTE_ORDER != BIG_ENDIAN
  161. not big endian
  162. #endif
  163. ], return 0 ;,
  164. ac_cv_c_byte_order=big
  165. )]
  166. fi
  167. if test $ac_cv_c_byte_order = unknown ; then
  168. [AC_TRY_LINK([
  169. #include <sys/types.h>
  170. #include <sys/param.h>
  171. #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
  172. bogus endian macros
  173. #endif
  174. ], return 0 ;,
  175. [AC_TRY_LINK([
  176. #include <sys/types.h>
  177. #include <sys/param.h>
  178. #if BYTE_ORDER != LITTLE_ENDIAN
  179. not big endian
  180. #endif
  181. ], return 0 ;,
  182. ac_cv_c_byte_order=little
  183. )]
  184. [AC_TRY_LINK([
  185. #include <sys/types.h>
  186. #include <sys/param.h>
  187. #if BYTE_ORDER != LITTLE_ENDIAN
  188. not big endian
  189. #endif
  190. ], return 0 ;,
  191. ac_cv_c_byte_order=little
  192. )]
  193. )]
  194. fi
  195. if test $ac_cv_c_byte_order = unknown ; then
  196. if test $cross_compiling = yes ; then
  197. # This is the last resort. Try to guess the target processor endian-ness
  198. # by looking at the target CPU type.
  199. [
  200. case "$target_cpu" in
  201. alpha* | i?86* | mipsel* | ia64*)
  202. ac_cv_c_big_endian=0
  203. ac_cv_c_little_endian=1
  204. ;;
  205. m68* | mips* | powerpc* | hppa* | sparc*)
  206. ac_cv_c_big_endian=1
  207. ac_cv_c_little_endian=0
  208. ;;
  209. esac
  210. ]
  211. else
  212. AC_TRY_RUN(
  213. [[
  214. int main (void)
  215. { /* Are we little or big endian? From Harbison&Steele. */
  216. union
  217. { long l ;
  218. char c [sizeof (long)] ;
  219. } u ;
  220. u.l = 1 ;
  221. return (u.c [sizeof (long) - 1] == 1);
  222. }
  223. ]], , ac_cv_c_byte_order=big,
  224. ac_cv_c_byte_order=unknown
  225. )
  226. AC_TRY_RUN(
  227. [[int main (void)
  228. { /* Are we little or big endian? From Harbison&Steele. */
  229. union
  230. { long l ;
  231. char c [sizeof (long)] ;
  232. } u ;
  233. u.l = 1 ;
  234. return (u.c [0] == 1);
  235. }]], , ac_cv_c_byte_order=little,
  236. ac_cv_c_byte_order=unknown
  237. )
  238. fi
  239. fi
  240. )
  241. ]
  242. if test $ac_cv_c_byte_order = big ; then
  243. ac_cv_c_big_endian=1
  244. ac_cv_c_little_endian=0
  245. elif test $ac_cv_c_byte_order = little ; then
  246. ac_cv_c_big_endian=0
  247. ac_cv_c_little_endian=1
  248. else
  249. ac_cv_c_big_endian=0
  250. ac_cv_c_little_endian=0
  251. fi
  252. )# AC_C_FIND_ENDIAN
  253. dnl @synopsis AC_C99_FLEXIBLE_ARRAY
  254. dnl
  255. dnl Dose the compiler support the 1999 ISO C Standard "stuct hack".
  256. dnl @version 1.1 Mar 15 2004
  257. dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  258. dnl
  259. dnl Permission to use, copy, modify, distribute, and sell this file for any
  260. dnl purpose is hereby granted without fee, provided that the above copyright
  261. dnl and this permission notice appear in all copies. No representations are
  262. dnl made about the suitability of this software for any purpose. It is
  263. dnl provided "as is" without express or implied warranty.
  264. AC_DEFUN([AC_C99_FLEXIBLE_ARRAY],
  265. [AC_CACHE_CHECK(C99 struct flexible array support,
  266. ac_cv_c99_flexible_array,
  267. # Initialize to unknown
  268. ac_cv_c99_flexible_array=no
  269. AC_TRY_LINK([[
  270. #include <stdlib.h>
  271. typedef struct {
  272. int k;
  273. char buffer [] ;
  274. } MY_STRUCT ;
  275. ]],
  276. [ MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
  277. ac_cv_c99_flexible_array=yes,
  278. ac_cv_c99_flexible_array=no
  279. ))]
  280. ) # AC_C99_FLEXIBLE_ARRAY
  281. dnl @synopsis AC_C99_FUNC_LRINT
  282. dnl
  283. dnl Check whether C99's lrint function is available.
  284. dnl @version 1.3 Feb 12 2002
  285. dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  286. dnl
  287. dnl Permission to use, copy, modify, distribute, and sell this file for any
  288. dnl purpose is hereby granted without fee, provided that the above copyright
  289. dnl and this permission notice appear in all copies. No representations are
  290. dnl made about the suitability of this software for any purpose. It is
  291. dnl provided "as is" without express or implied warranty.
  292. dnl
  293. AC_DEFUN([AC_C99_FUNC_LRINT],
  294. [AC_CACHE_CHECK(for lrint,
  295. ac_cv_c99_lrint,
  296. [
  297. lrint_save_CFLAGS=$CFLAGS
  298. CFLAGS="-lm"
  299. AC_TRY_LINK([
  300. #define _ISOC9X_SOURCE 1
  301. #define _ISOC99_SOURCE 1
  302. #define __USE_ISOC99 1
  303. #define __USE_ISOC9X 1
  304. #include <math.h>
  305. ], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
  306. CFLAGS=$lrint_save_CFLAGS
  307. ])
  308. if test "$ac_cv_c99_lrint" = yes; then
  309. AC_DEFINE(HAVE_LRINT, 1,
  310. [Define if you have C99's lrint function.])
  311. fi
  312. ])# AC_C99_FUNC_LRINT
  313. dnl @synopsis AC_C99_FUNC_LRINTF
  314. dnl
  315. dnl Check whether C99's lrintf function is available.
  316. dnl @version 1.3 Feb 12 2002
  317. dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  318. dnl
  319. dnl Permission to use, copy, modify, distribute, and sell this file for any
  320. dnl purpose is hereby granted without fee, provided that the above copyright
  321. dnl and this permission notice appear in all copies. No representations are
  322. dnl made about the suitability of this software for any purpose. It is
  323. dnl provided "as is" without express or implied warranty.
  324. dnl
  325. AC_DEFUN([AC_C99_FUNC_LRINTF],
  326. [AC_CACHE_CHECK(for lrintf,
  327. ac_cv_c99_lrintf,
  328. [
  329. AC_TRY_LINK([
  330. #define _ISOC9X_SOURCE 1
  331. #define _ISOC99_SOURCE 1
  332. #define __USE_ISOC99 1
  333. #define __USE_ISOC9X 1
  334. #include <math.h>
  335. ], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
  336. ])
  337. if test "$ac_cv_c99_lrintf" = yes; then
  338. AC_DEFINE(HAVE_LRINTF, 1,
  339. [Define if you have C99's lrintf function.])
  340. fi
  341. ])# AC_C99_FUNC_LRINTF
  342. dnl @synopsis AC_C99_FUNC_LLRINT
  343. dnl
  344. dnl Check whether C99's llrint function is available.
  345. dnl @version 1.1 Sep 30 2002
  346. dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  347. dnl
  348. dnl Permission to use, copy, modify, distribute, and sell this file for any
  349. dnl purpose is hereby granted without fee, provided that the above copyright
  350. dnl and this permission notice appear in all copies. No representations are
  351. dnl made about the suitability of this software for any purpose. It is
  352. dnl provided "as is" without express or implied warranty.
  353. dnl
  354. AC_DEFUN([AC_C99_FUNC_LLRINT],
  355. [AC_CACHE_CHECK(for llrint,
  356. ac_cv_c99_llrint,
  357. [
  358. AC_TRY_LINK([
  359. #define _ISOC9X_SOURCE 1
  360. #define _ISOC99_SOURCE 1
  361. #define __USE_ISOC99 1
  362. #define __USE_ISOC9X 1
  363. #include <math.h>
  364. #include <stdint.h>
  365. ], int64_t x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)
  366. ])
  367. if test "$ac_cv_c99_llrint" = yes; then
  368. AC_DEFINE(HAVE_LLRINT, 1,
  369. [Define if you have C99's llrint function.])
  370. fi
  371. ])# AC_C99_FUNC_LLRINT
  372. dnl @synopsis AC_C_CLIP_MODE
  373. dnl
  374. dnl Determine the clipping mode when converting float to int.
  375. dnl @version 1.0 May 17 2003
  376. dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  377. dnl
  378. dnl Permission to use, copy, modify, distribute, and sell this file for any
  379. dnl purpose is hereby granted without fee, provided that the above copyright
  380. dnl and this permission notice appear in all copies. No representations are
  381. dnl made about the suitability of this software for any purpose. It is
  382. dnl provided "as is" without express or implied warranty.
  383. dnl Find the clipping mode in the following way:
  384. dnl 1) If we are not cross compiling test it.
  385. dnl 2) IF we are cross compiling, assume that clipping isn't done correctly.
  386. AC_DEFUN([AC_C_CLIP_MODE],
  387. [AC_CACHE_CHECK(processor clipping capabilities,
  388. ac_cv_c_clip_type,
  389. # Initialize to unknown
  390. ac_cv_c_clip_positive=unknown
  391. ac_cv_c_clip_negative=unknown
  392. if test $ac_cv_c_clip_positive = unknown ; then
  393. AC_TRY_RUN(
  394. [[
  395. #define _ISOC9X_SOURCE 1
  396. #define _ISOC99_SOURCE 1
  397. #define __USE_ISOC99 1
  398. #define __USE_ISOC9X 1
  399. #include <math.h>
  400. int main (void)
  401. { double fval ;
  402. int k, ival ;
  403. fval = 1.0 * 0x7FFFFFFF ;
  404. for (k = 0 ; k < 100 ; k++)
  405. { ival = (lrint (fval)) >> 24 ;
  406. if (ival != 127)
  407. return 1 ;
  408. fval *= 1.2499999 ;
  409. } ;
  410. return 0 ;
  411. }
  412. ]],
  413. ac_cv_c_clip_positive=yes,
  414. ac_cv_c_clip_positive=no,
  415. ac_cv_c_clip_positive=unknown
  416. )
  417. AC_TRY_RUN(
  418. [[
  419. #define _ISOC9X_SOURCE 1
  420. #define _ISOC99_SOURCE 1
  421. #define __USE_ISOC99 1
  422. #define __USE_ISOC9X 1
  423. #include <math.h>
  424. int main (void)
  425. { double fval ;
  426. int k, ival ;
  427. fval = -8.0 * 0x10000000 ;
  428. for (k = 0 ; k < 100 ; k++)
  429. { ival = (lrint (fval)) >> 24 ;
  430. if (ival != -128)
  431. return 1 ;
  432. fval *= 1.2499999 ;
  433. } ;
  434. return 0 ;
  435. }
  436. ]],
  437. ac_cv_c_clip_negative=yes,
  438. ac_cv_c_clip_negative=no,
  439. ac_cv_c_clip_negative=unknown
  440. )
  441. fi
  442. if test $ac_cv_c_clip_positive = yes ; then
  443. ac_cv_c_clip_positive=1
  444. else
  445. ac_cv_c_clip_positive=0
  446. fi
  447. if test $ac_cv_c_clip_negative = yes ; then
  448. ac_cv_c_clip_negative=1
  449. else
  450. ac_cv_c_clip_negative=0
  451. fi
  452. [[
  453. case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in
  454. "00")
  455. ac_cv_c_clip_type="none"
  456. ;;
  457. "10")
  458. ac_cv_c_clip_type="positive"
  459. ;;
  460. "01")
  461. ac_cv_c_clip_type="negative"
  462. ;;
  463. "11")
  464. ac_cv_c_clip_type="both"
  465. ;;
  466. esac
  467. ]]
  468. )
  469. ]
  470. )# AC_C_CLIP_MODE
  471. dnl @synopsis AC_ADD_CFLAGS
  472. dnl
  473. dnl Add the given option to CFLAGS, if it doesn't break the compiler
  474. AC_DEFUN([AC_ADD_CFLAGS],
  475. [AC_MSG_CHECKING([if $CC accepts $1])
  476. ac_add_cflags__old_cflags="$CFLAGS"
  477. CFLAGS="$CFLAGS $1"
  478. AC_TRY_LINK([#include <stdio.h>],
  479. [printf("Hello, World!\n"); return 0;],
  480. AC_MSG_RESULT([yes]),
  481. AC_MSG_RESULT([no])
  482. CFLAGS="$ac_add_cflags__old_cflags")
  483. ])
  484. dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
  485. dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
  486. dnl also defines GSTUFF_PKG_ERRORS on error
  487. AC_DEFUN([PKG_CHECK_MODULES], [
  488. succeeded=no
  489. if test -z "$PKG_CONFIG"; then
  490. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  491. fi
  492. if test "$PKG_CONFIG" = "no" ; then
  493. echo "*** The pkg-config script could not be found. Make sure it is"
  494. echo "*** in your path, or set the PKG_CONFIG environment variable"
  495. echo "*** to the full path to pkg-config."
  496. echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
  497. else
  498. PKG_CONFIG_MIN_VERSION=0.9.0
  499. if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
  500. AC_MSG_CHECKING(for $2)
  501. if $PKG_CONFIG --exists "$2" ; then
  502. AC_MSG_RESULT(yes)
  503. succeeded=yes
  504. AC_MSG_CHECKING($1_CFLAGS)
  505. $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
  506. AC_MSG_RESULT($$1_CFLAGS)
  507. AC_MSG_CHECKING($1_LIBS)
  508. $1_LIBS=`$PKG_CONFIG --libs "$2"`
  509. AC_MSG_RESULT($$1_LIBS)
  510. else
  511. $1_CFLAGS=""
  512. $1_LIBS=""
  513. ## If we have a custom action on failure, don't print errors, but
  514. ## do set a variable so people can do so.
  515. $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
  516. ifelse([$4], ,echo $$1_PKG_ERRORS,)
  517. fi
  518. AC_SUBST($1_CFLAGS)
  519. AC_SUBST($1_LIBS)
  520. else
  521. echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
  522. echo "*** See http://www.freedesktop.org/software/pkgconfig"
  523. fi
  524. fi
  525. if test $succeeded = yes; then
  526. ifelse([$3], , :, [$3])
  527. else
  528. ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
  529. fi
  530. ])
  531. ifelse(dnl
  532. Do not edit or modify anything in this comment block.
  533. The arch-tag line is a file identity tag for the GNU Arch
  534. revision control system.
  535. arch-tag: bc38294d-bb5c-42ad-90b9-779def5eaab7
  536. )dnl