libopts.m4 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. dnl -*- buffer-read-only: t -*- vi: set ro:
  2. dnl
  3. dnl DO NOT EDIT THIS FILE (libopts.m4)
  4. dnl
  5. dnl It has been AutoGen-ed August 8, 2009 at 10:14:46 AM by AutoGen 5.9.9
  6. dnl From the definitions libopts.def
  7. dnl and the template file conftest.tpl
  8. dnl
  9. dnl do always before generated macros:
  10. dnl
  11. AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
  12. [if test X${INVOKE_LIBOPTS_MACROS_FIRST_done} != Xyes ; then]
  13. # =================
  14. # AC_HEADER_STDC
  15. # =================
  16. AC_HEADER_STDC
  17. # =================
  18. # AC_HEADER_DIRENT
  19. # =================
  20. AC_HEADER_DIRENT
  21. # =================
  22. # AC_CHECK_HEADERS
  23. # =================
  24. AC_CHECK_HEADERS(dlfcn.h errno.h fcntl.h libgen.h memory.h netinet/in.h \
  25. setjmp.h sys/mman.h sys/param.h sys/poll.h sys/procset.h sys/select.h \
  26. sys/socket.h sys/stropts.h sys/time.h sys/un.h sys/wait.h unistd.h \
  27. utime.h sysexits.h)
  28. # --------------------------------------------
  29. # Verify certain entries from AC_CHECK_HEADERS
  30. # --------------------------------------------
  31. [for f in sys_types sys_mman sys_param sys_stat sys_wait \
  32. string errno stdlib memory setjmp
  33. do eval as_ac_var=\${ac_cv_header_${f}_h+set}
  34. test "${as_ac_var}" = set] || \
  35. AC_MSG_ERROR([You must have ${f}.h on your system])
  36. done
  37. # ================================================
  38. # AC_CHECK_HEADERS: stdarg.h is present define HAVE_STDARG_H, otherwise
  39. # if varargs.h is present define HAVE_VARARGS_H.
  40. # ================================================
  41. AC_CHECK_HEADERS(stdarg.h varargs.h, break)
  42. [if test `eval echo '${'$as_ac_Header'}'` != yes; then]
  43. AC_MSG_ERROR([You must have stdarg.h or varargs.h on your system])
  44. fi
  45. # ================================================
  46. # Similarly for the string.h and strings.h headers
  47. # ================================================
  48. AC_CHECK_HEADERS(string.h strings.h, break)
  49. [if test `eval echo '${'$as_ac_Header'}'` != yes; then]
  50. AC_MSG_ERROR([You must have string.h or strings.h on your system])
  51. fi
  52. # =====================
  53. # ...and limits headers
  54. # =====================
  55. AC_CHECK_HEADERS(limits.h sys/limits.h values.h, break)
  56. [if test `eval echo '${'$as_ac_Header'}'` != yes; then]
  57. AC_MSG_ERROR([You must have one of limits.h, sys/limits.h or values.h])
  58. fi
  59. # ----------------------------------------------------------------------
  60. # check for various programs used during the build.
  61. # On OS/X, "wchar.h" needs "runetype.h" to work properly.
  62. # ----------------------------------------------------------------------
  63. AC_CHECK_HEADERS([runetype.h wchar.h], [], [],[
  64. AC_INCLUDES_DEFAULT
  65. #if HAVE_RUNETYPE_H
  66. # include <runetype.h>
  67. #endif
  68. ])
  69. # ----------------------------------------------------------------------
  70. # Checks for typedefs
  71. # ----------------------------------------------------------------------
  72. AC_CHECK_TYPES(wchar_t)
  73. AC_CHECK_TYPES(wint_t, [], [], [
  74. AC_INCLUDES_DEFAULT
  75. #if HAVE_RUNETYPE_H
  76. # include <runetype.h>
  77. #endif
  78. #if HAVE_WCHAR_H
  79. # include <wchar.h>
  80. #endif
  81. ])
  82. # ========================
  83. # ...and int types headers
  84. # ========================
  85. AC_CHECK_HEADERS(stdint.h inttypes.h, break)
  86. AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
  87. intptr_t, uintptr_t, uint_t, pid_t, size_t])
  88. # =====
  89. # sizes
  90. # =====
  91. AC_CHECK_SIZEOF(char*, 4)
  92. AC_CHECK_SIZEOF(int, 4)
  93. AC_CHECK_SIZEOF(long, 4)
  94. AC_CHECK_SIZEOF(short, 2)
  95. # ----------------------------------------------------------------------
  96. # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
  97. # ----------------------------------------------------------------------
  98. AC_CHECK_LIB(gen, pathfind)
  99. AC_FUNC_VPRINTF
  100. AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr \
  101. strrchr strsignal])
  102. [ INVOKE_LIBOPTS_MACROS_FIRST_done=yes
  103. fi]])
  104. dnl
  105. dnl @synopsis INVOKE_LIBOPTS_MACROS
  106. dnl
  107. dnl This macro will invoke the AutoConf macros specified in libopts.def
  108. dnl that have not been disabled with "omit-invocation".
  109. dnl
  110. AC_DEFUN([LIBOPTS_WITH_REGEX_HEADER],[
  111. AC_ARG_WITH([regex-header],
  112. AC_HELP_STRING([--with-regex-header], [a reg expr header is specified]),
  113. [libopts_cv_with_regex_header=${with_regex_header}],
  114. AC_CACHE_CHECK([whether a reg expr header is specified], libopts_cv_with_regex_header,
  115. libopts_cv_with_regex_header=no)
  116. ) # end of AC_ARG_WITH
  117. if test "X${libopts_cv_with_regex_header}" != Xno
  118. then
  119. AC_DEFINE_UNQUOTED([REGEX_HEADER],[<${libopts_cv_with_regex_header}>])
  120. else
  121. AC_DEFINE([REGEX_HEADER],[<regex.h>],[name of regex header file])
  122. fi
  123. ]) # end of AC_DEFUN of LIBOPTS_WITH_REGEX_HEADER
  124. AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
  125. AC_ARG_WITH([libregex],
  126. AC_HELP_STRING([--with-libregex], [libregex installation prefix]),
  127. [libopts_cv_with_libregex_root=${with_libregex}],
  128. AC_CACHE_CHECK([whether with-libregex was specified], libopts_cv_with_libregex_root,
  129. libopts_cv_with_libregex_root=no)
  130. ) # end of AC_ARG_WITH libregex
  131. if test "${with_libguile+set}" = set && \
  132. test "${withval}" = no
  133. then ## disabled by request
  134. libopts_cv_with_libregex_root=no
  135. libopts_cv_with_libregex_cflags=no
  136. libopts_cv_with_libregex_libs=no
  137. else
  138. AC_ARG_WITH([libregex-cflags],
  139. AC_HELP_STRING([--with-libregex-cflags], [libregex compile flags]),
  140. [libopts_cv_with_libregex_cflags=${with_regex_cflags}],
  141. AC_CACHE_CHECK([whether with-libregex-cflags was specified], libopts_cv_with_libregex_cflags,
  142. libopts_cv_with_libregex_cflags=no)
  143. ) # end of AC_ARG_WITH libregex-cflags
  144. AC_ARG_WITH([libregex-libs],
  145. AC_HELP_STRING([--with-libregex-libs], [libregex link command arguments]),
  146. [libopts_cv_with_libregex_libs=${with_regex_libs}],
  147. AC_CACHE_CHECK([whether with-libregex-libs was specified], libopts_cv_with_libregex_libs,
  148. libopts_cv_with_libregex_libs=no)
  149. ) # end of AC_ARG_WITH libregex-libs
  150. case "X${libopts_cv_with_libregex_cflags}" in
  151. Xyes|Xno|X )
  152. case "X${libopts_cv_with_libregex_root}" in
  153. Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;;
  154. * ) libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;;
  155. esac
  156. esac
  157. case "X${libopts_cv_with_libregex_libs}" in
  158. Xyes|Xno|X )
  159. case "X${libopts_cv_with_libregex_root}" in
  160. Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;;
  161. * ) libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex";;
  162. esac
  163. esac
  164. libopts_save_CPPFLAGS="${CPPFLAGS}"
  165. libopts_save_LIBS="${LIBS}"
  166. fi ## disabled by request
  167. case "X${libopts_cv_with_libregex_cflags}" in
  168. Xyes|Xno|X )
  169. libopts_cv_with_libregex_cflags="" ;;
  170. * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;;
  171. esac
  172. case "X${libopts_cv_with_libregex_libs}" in
  173. Xyes|Xno|X )
  174. libopts_cv_with_libregex_libs="" ;;
  175. * )
  176. LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;;
  177. esac
  178. LIBREGEX_CFLAGS=""
  179. LIBREGEX_LIBS=""
  180. AC_MSG_CHECKING([whether libregex functions properly])
  181. AC_CACHE_VAL([libopts_cv_with_libregex],[
  182. AC_TRY_RUN([@%:@include <stdio.h>
  183. @%:@include <stdlib.h>
  184. @%:@include <sys/types.h>
  185. @%:@include REGEX_HEADER
  186. static regex_t re;
  187. void comp_re( char const* pzPat ) {
  188. int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE );
  189. if (res == 0) return;
  190. exit( res ); }
  191. int main() {
  192. regmatch_t m@<:@2@:>@;
  193. comp_re( "^.*\@S|@" );
  194. comp_re( "()|no.*" );
  195. comp_re( "." );
  196. if (regexec( &re, "X", 2, m, 0 ) != 0) return 1;
  197. if ((m@<:@0@:>@.rm_so != 0) || (m@<:@0@:>@.rm_eo != 1)) {
  198. fputs( "error: regex -->.<-- did not match\n", stderr );
  199. return 1;
  200. }
  201. return 0; }],
  202. [libopts_cv_with_libregex=yes], [libopts_cv_with_libregex=no],
  203. [libopts_cv_with_libregex=no]) # end of AC_TRY_RUN
  204. ]) # end of AC_CACHE_VAL for libopts_cv_with_libregex
  205. AC_MSG_RESULT([${libopts_cv_with_libregex}])
  206. if test "X${libopts_cv_with_libregex}" != Xno
  207. then
  208. AC_DEFINE([WITH_LIBREGEX],[1],
  209. [Define this if a working libregex can be found])
  210. else
  211. CPPFLAGS="${libopts_save_CPPFLAGS}"
  212. LIBS="${libopts_save_LIBS}"
  213. fi
  214. ]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX
  215. AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
  216. AC_MSG_CHECKING([whether pathfind(3) works])
  217. AC_CACHE_VAL([libopts_cv_run_pathfind],[
  218. AC_TRY_RUN([@%:@include <string.h>
  219. @%:@include <stdlib.h>
  220. int main (int argc, char** argv) {
  221. char* pz = pathfind( getenv( "PATH" ), "sh", "x" );
  222. return (pz == 0) ? 1 : 0;
  223. }],
  224. [libopts_cv_run_pathfind=yes],[libopts_cv_run_pathfind=no],[libopts_cv_run_pathfind=no]
  225. ) # end of TRY_RUN
  226. ]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind
  227. AC_MSG_RESULT([${libopts_cv_run_pathfind}])
  228. if test "X${libopts_cv_run_pathfind}" != Xno
  229. then
  230. AC_DEFINE([HAVE_PATHFIND],[1],
  231. [Define this if pathfind(3) works])
  232. fi
  233. ]) # end of AC_DEFUN of LIBOPTS_RUN_PATHFIND
  234. AC_DEFUN([LIBOPTS_TEST_DEV_ZERO],[
  235. AC_MSG_CHECKING([whether /dev/zero is readable device])
  236. AC_CACHE_VAL([libopts_cv_test_dev_zero],[
  237. libopts_cv_test_dev_zero=`exec 2> /dev/null
  238. dzero=\`ls -lL /dev/zero | egrep ^c......r\`
  239. test -z "${dzero}" && exit 1
  240. echo ${dzero}`
  241. if test $? -ne 0
  242. then libopts_cv_test_dev_zero=no
  243. elif test -z "$libopts_cv_test_dev_zero"
  244. then libopts_cv_test_dev_zero=no
  245. fi
  246. ]) # end of CACHE_VAL of libopts_cv_test_dev_zero
  247. AC_MSG_RESULT([${libopts_cv_test_dev_zero}])
  248. if test "X${libopts_cv_test_dev_zero}" != Xno
  249. then
  250. AC_DEFINE([HAVE_DEV_ZERO],[1],
  251. [Define this if /dev/zero is readable device])
  252. fi
  253. ]) # end of AC_DEFUN of LIBOPTS_TEST_DEV_ZERO
  254. AC_DEFUN([LIBOPTS_RUN_REALPATH],[
  255. AC_MSG_CHECKING([whether we have a functional realpath(3C)])
  256. AC_CACHE_VAL([libopts_cv_run_realpath],[
  257. AC_TRY_RUN([@%:@include <limits.h>
  258. @%:@include <stdlib.h>
  259. int main (int argc, char** argv) {
  260. @%:@ifndef PATH_MAX
  261. choke me!!
  262. @%:@else
  263. char zPath@<:@PATH_MAX+1@:>@;
  264. @%:@endif
  265. char *pz = realpath(argv@<:@0@:>@, zPath);
  266. return (pz == zPath) ? 0 : 1;
  267. }],
  268. [libopts_cv_run_realpath=yes],[libopts_cv_run_realpath=no],[libopts_cv_run_realpath=no]
  269. ) # end of TRY_RUN
  270. ]) # end of AC_CACHE_VAL for libopts_cv_run_realpath
  271. AC_MSG_RESULT([${libopts_cv_run_realpath}])
  272. if test "X${libopts_cv_run_realpath}" != Xno
  273. then
  274. AC_DEFINE([HAVE_REALPATH],[1],
  275. [Define this if we have a functional realpath(3C)])
  276. fi
  277. ]) # end of AC_DEFUN of LIBOPTS_RUN_REALPATH
  278. AC_DEFUN([LIBOPTS_RUN_STRFTIME],[
  279. AC_MSG_CHECKING([whether strftime() works])
  280. AC_CACHE_VAL([libopts_cv_run_strftime],[
  281. AC_TRY_RUN([@%:@include <time.h>
  282. @%:@include <string.h>
  283. char t_buf@<:@ 64 @:>@;
  284. int main() {
  285. static char const z@<:@@:>@ = "Thursday Aug 28 240";
  286. struct tm tm;
  287. tm.tm_sec = 36; /* seconds after the minute @<:@0, 61@:>@ */
  288. tm.tm_min = 44; /* minutes after the hour @<:@0, 59@:>@ */
  289. tm.tm_hour = 12; /* hour since midnight @<:@0, 23@:>@ */
  290. tm.tm_mday = 28; /* day of the month @<:@1, 31@:>@ */
  291. tm.tm_mon = 7; /* months since January @<:@0, 11@:>@ */
  292. tm.tm_year = 86; /* years since 1900 */
  293. tm.tm_wday = 4; /* days since Sunday @<:@0, 6@:>@ */
  294. tm.tm_yday = 239; /* days since January 1 @<:@0, 365@:>@ */
  295. tm.tm_isdst = 1; /* flag for daylight savings time */
  296. strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm );
  297. return (strcmp( t_buf, z ) != 0); }],
  298. [libopts_cv_run_strftime=yes],[libopts_cv_run_strftime=no],[libopts_cv_run_strftime=no]
  299. ) # end of TRY_RUN
  300. ]) # end of AC_CACHE_VAL for libopts_cv_run_strftime
  301. AC_MSG_RESULT([${libopts_cv_run_strftime}])
  302. if test "X${libopts_cv_run_strftime}" != Xno
  303. then
  304. AC_DEFINE([HAVE_STRFTIME],[1],
  305. [Define this if strftime() works])
  306. fi
  307. ]) # end of AC_DEFUN of LIBOPTS_RUN_STRFTIME
  308. AC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[
  309. AC_MSG_CHECKING([whether fopen accepts "b" mode])
  310. AC_CACHE_VAL([libopts_cv_run_fopen_binary],[
  311. AC_TRY_RUN([@%:@include <stdio.h>
  312. int main (int argc, char** argv) {
  313. FILE* fp = fopen("conftest.@S|@ac_ext", "rb");
  314. return (fp == NULL) ? 1 : fclose(fp); }],
  315. [libopts_cv_run_fopen_binary=yes],[libopts_cv_run_fopen_binary=no],[libopts_cv_run_fopen_binary=no]
  316. ) # end of TRY_RUN
  317. ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary
  318. AC_MSG_RESULT([${libopts_cv_run_fopen_binary}])
  319. if test "X${libopts_cv_run_fopen_binary}" != Xno
  320. then
  321. AC_DEFINE([FOPEN_BINARY_FLAG],"b",
  322. [fopen(3) accepts a 'b' in the mode flag])
  323. else
  324. AC_DEFINE([FOPEN_BINARY_FLAG],"",
  325. [fopen(3) accepts a 'b' in the mode flag])
  326. fi
  327. ]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_BINARY
  328. AC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[
  329. AC_MSG_CHECKING([whether fopen accepts "t" mode])
  330. AC_CACHE_VAL([libopts_cv_run_fopen_text],[
  331. AC_TRY_RUN([@%:@include <stdio.h>
  332. int main (int argc, char** argv) {
  333. FILE* fp = fopen("conftest.@S|@ac_ext", "rt");
  334. return (fp == NULL) ? 1 : fclose(fp); }],
  335. [libopts_cv_run_fopen_text=yes],[libopts_cv_run_fopen_text=no],[libopts_cv_run_fopen_text=no]
  336. ) # end of TRY_RUN
  337. ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text
  338. AC_MSG_RESULT([${libopts_cv_run_fopen_text}])
  339. if test "X${libopts_cv_run_fopen_text}" != Xno
  340. then
  341. AC_DEFINE([FOPEN_TEXT_FLAG],"t",
  342. [fopen(3) accepts a 't' in the mode flag])
  343. else
  344. AC_DEFINE([FOPEN_TEXT_FLAG],"",
  345. [fopen(3) accepts a 't' in the mode flag])
  346. fi
  347. ]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_TEXT
  348. AC_DEFUN([LIBOPTS_DISABLE_OPTIONAL_ARGS],[
  349. AC_ARG_ENABLE([optional-args],
  350. AC_HELP_STRING([--disable-optional-args], [not wanting optional option args]),
  351. [libopts_cv_enable_optional_args=${enable_optional_args}],
  352. AC_CACHE_CHECK([whether not wanting optional option args], libopts_cv_enable_optional_args,
  353. libopts_cv_enable_optional_args=yes)
  354. ) # end of AC_ARG_ENABLE
  355. if test "X${libopts_cv_enable_optional_args}" = Xno
  356. then
  357. AC_DEFINE([NO_OPTIONAL_OPT_ARGS], [1],
  358. [Define this if optional arguments are disallowed])
  359. fi
  360. ]) # end of AC_DEFUN of LIBOPTS_DISABLE_OPTIONAL_ARGS
  361. AC_DEFUN([INVOKE_LIBOPTS_MACROS],[
  362. INVOKE_LIBOPTS_MACROS_FIRST
  363. # Check to see if a reg expr header is specified.
  364. LIBOPTS_WITH_REGEX_HEADER
  365. # Check to see if a working libregex can be found.
  366. LIBOPTS_WITHLIB_REGEX
  367. # Check to see if pathfind(3) works.
  368. LIBOPTS_RUN_PATHFIND
  369. # Check to see if /dev/zero is readable device.
  370. LIBOPTS_TEST_DEV_ZERO
  371. # Check to see if we have a functional realpath(3C).
  372. LIBOPTS_RUN_REALPATH
  373. # Check to see if strftime() works.
  374. LIBOPTS_RUN_STRFTIME
  375. # Check to see if fopen accepts "b" mode.
  376. LIBOPTS_RUN_FOPEN_BINARY
  377. # Check to see if fopen accepts "t" mode.
  378. LIBOPTS_RUN_FOPEN_TEXT
  379. # Check to see if not wanting optional option args.
  380. LIBOPTS_DISABLE_OPTIONAL_ARGS
  381. ]) # end AC_DEFUN of INVOKE_LIBOPTS_MACROS
  382. dnl @synopsis LIBOPTS_CHECK
  383. dnl
  384. dnl Time-stamp: "2009-07-22 18:50:49 bkorb"
  385. dnl Last Committed: $Date: 2009/07/23 02:05:55 $
  386. dnl
  387. dnl If autoopts-config works, add the linking information to LIBS.
  388. dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all
  389. dnl the config tests that the library needs. Invoke the
  390. dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts.
  391. dnl
  392. dnl This file is part of AutoGen.
  393. dnl AutoGen copyright (c) 1992-2009 by Bruce Korb - all rights reserved
  394. dnl
  395. dnl AutoGen is free software: you can redistribute it and/or modify it
  396. dnl under the terms of the GNU General Public License as published by the
  397. dnl Free Software Foundation, either version 3 of the License, or
  398. dnl (at your option) any later version.
  399. dnl
  400. dnl AutoGen is distributed in the hope that it will be useful, but
  401. dnl WITHOUT ANY WARRANTY; without even the implied warranty of
  402. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  403. dnl See the GNU General Public License for more details.
  404. dnl
  405. dnl You should have received a copy of the GNU General Public License along
  406. dnl with this program. If not, see <http://www.gnu.org/licenses/>.
  407. dnl
  408. dnl Default to system libopts
  409. dnl
  410. AC_DEFUN([LIBOPTS_CHECK],[
  411. [NEED_LIBOPTS_DIR='']
  412. m4_pushdef([AO_Libopts_Dir],
  413. [ifelse($1, , [libopts], [$1])])
  414. AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
  415. AC_ARG_ENABLE([local-libopts],
  416. AC_HELP_STRING([--enable-local-libopts],
  417. [Force using the supplied libopts tearoff code]),[
  418. if test x$enableval = xyes ; then
  419. AC_MSG_NOTICE([Using supplied libopts tearoff])
  420. LIBOPTS_LDADD='$(top_builddir)/AO_Libopts_Dir/libopts.la'
  421. LIBOPTS_CFLAGS='-I$(top_srcdir)/AO_Libopts_Dir'
  422. NEED_LIBOPTS_DIR=true
  423. fi])
  424. AC_ARG_ENABLE([libopts-install],
  425. AC_HELP_STRING([--disable-libopts-install],
  426. [Do not install libopts with client installation]))
  427. AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" != Xno])
  428. [if test -z "${NEED_LIBOPTS_DIR}" ; then]
  429. AC_MSG_CHECKING([whether autoopts-config can be found])
  430. AC_ARG_WITH([autoopts-config],
  431. AC_HELP_STRING([--with-autoopts-config],
  432. [specify the config-info script]),
  433. [lo_cv_with_autoopts_config=${with_autoopts_config}],
  434. AC_CACHE_CHECK([whether autoopts-config is specified],
  435. [lo_cv_with_autoopts_config],
  436. [if autoopts-config --help 2>/dev/null 1>&2
  437. then lo_cv_with_autoopts_config=autoopts-config
  438. elif libopts-config --help 2>/dev/null 1>&2
  439. then lo_cv_with_autoopts_config=libopts-config
  440. else lo_cv_with_autoopts_config=no ; fi])
  441. ) # end of AC_ARG_WITH
  442. AC_CACHE_VAL([lo_cv_test_autoopts],[
  443. if test -z "${lo_cv_with_autoopts_config}" \
  444. -o X"${lo_cv_with_autoopts_config}" = Xno
  445. then
  446. if autoopts-config --help 2>/dev/null 1>&2
  447. then lo_cv_with_autoopts_config=autoopts-config
  448. elif libopts-config --help 2>/dev/null 1>&2
  449. then lo_cv_with_autoopts_config=libopts-config
  450. else lo_cv_with_autoopts_config=false ; fi
  451. fi
  452. lo_cv_test_autoopts=`
  453. ${lo_cv_with_autoopts_config} --libs` 2> /dev/null
  454. if test $? -ne 0 -o -z "${lo_cv_test_autoopts}"
  455. then lo_cv_test_autoopts=no ; fi
  456. ]) # end of CACHE_VAL
  457. AC_MSG_RESULT([${lo_cv_test_autoopts}])
  458. [if test "X${lo_cv_test_autoopts}" != Xno
  459. then
  460. LIBOPTS_LDADD="${lo_cv_test_autoopts}"
  461. LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`"
  462. else
  463. LIBOPTS_LDADD='$(top_builddir)/]AO_Libopts_Dir[/libopts.la'
  464. LIBOPTS_CFLAGS='-I$(top_srcdir)/]AO_Libopts_Dir['
  465. NEED_LIBOPTS_DIR=true
  466. fi
  467. fi # end of if test -z "${NEED_LIBOPTS_DIR}"]
  468. AM_CONDITIONAL([NEED_LIBOPTS], [test -n "${NEED_LIBOPTS_DIR}"])
  469. AC_SUBST(LIBOPTS_LDADD)
  470. AC_SUBST(LIBOPTS_CFLAGS)
  471. AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
  472. AC_CONFIG_FILES(AO_Libopts_Dir/Makefile)
  473. m4_popdef([AO_Libopts_Dir])
  474. [if test -n "${NEED_LIBOPTS_DIR}" ; then]
  475. INVOKE_LIBOPTS_MACROS
  476. else
  477. INVOKE_LIBOPTS_MACROS_FIRST
  478. [fi
  479. # end of AC_DEFUN of LIBOPTS_CHECK]
  480. ])