libopts.m4 18 KB

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