libopts.m4 19 KB

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