configure.ac 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. m4_define([MAJOR_VERSION], 3)
  4. m4_define([MINOR_VERSION], 0)
  5. m4_define([MICRO_VERSION], 0)
  6. AC_PREREQ(2.59)
  7. AC_INIT([klish],
  8. [MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION],
  9. [serj.kalichev at gmail dot com])
  10. AC_CONFIG_AUX_DIR(aux_scripts)
  11. AC_CONFIG_MACRO_DIR([m4])
  12. # Values for SONAME. See -version-info for details.
  13. AC_SUBST(SONAME_CURRENT, 1)
  14. AC_SUBST(SONAME_REVISION, 0)
  15. AC_SUBST(SONAME_AGE, 0)
  16. # Check for system extensions (_POSIX_THREAD_SEMANTICS for Solaris)
  17. AC_USE_SYSTEM_EXTENSIONS
  18. # Checks for programs.
  19. AC_PROG_CC
  20. AC_LIBTOOL_WIN32_DLL
  21. AC_PROG_LIBTOOL
  22. AC_CONFIG_HEADERS([config.h])
  23. AM_INIT_AUTOMAKE(subdir-objects)
  24. AM_PROG_CC_C_O
  25. # Dir for libc replacements
  26. AC_CONFIG_LIBOBJ_DIR([libc])
  27. # needed to handle 64-bit architecture
  28. AC_CHECK_SIZEOF(int)
  29. AC_CHECK_SIZEOF(long)
  30. AC_CHECK_SIZEOF(size_t)
  31. #########################################
  32. # See if linker supports version scripts
  33. #########################################
  34. # Check if LD supports linker scripts,
  35. # and define automake conditional HAVE_LD_VERSION_SCRIPT if so.
  36. AC_ARG_ENABLE([ld-version-script],
  37. AS_HELP_STRING([--enable-ld-version-script],
  38. [enable linker version script (default is enabled when possible)]),
  39. [have_ld_version_script=$enableval], [])
  40. if test -z "$have_ld_version_script"; then
  41. AC_MSG_CHECKING([if LD -Wl,--version-script works])
  42. save_LDFLAGS="$LDFLAGS"
  43. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  44. cat > conftest.map <<EOF
  45. VERS_1 {
  46. global: sym;
  47. };
  48. VERS_2 {
  49. global: sym;
  50. } VERS_1;
  51. EOF
  52. AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
  53. [have_ld_version_script=yes], [have_ld_version_script=no])
  54. rm -f conftest.map
  55. LDFLAGS="$save_LDFLAGS"
  56. AC_MSG_RESULT($have_ld_version_script)
  57. fi
  58. AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
  59. ################################
  60. # Deal with debugging options
  61. ################################
  62. AC_ARG_ENABLE(debug,
  63. [AS_HELP_STRING([--enable-debug],
  64. [Turn on debugging including asserts [default=no]])],
  65. [],
  66. [enable_debug=no])
  67. AM_CONDITIONAL(DEBUG,test x$enable_debug = xyes)
  68. ################################
  69. # Compile in testc tests
  70. ################################
  71. AC_ARG_ENABLE(testc,
  72. [AS_HELP_STRING([--enable-testc],
  73. [Enable testc tests compiling [default=no]])],
  74. [],
  75. [enable_testc=no])
  76. AM_CONDITIONAL(TESTC,test x$enable_testc = xyes)
  77. ################################
  78. # Check for mandatory faux library
  79. ################################
  80. AC_ARG_WITH(faux,
  81. [AS_HELP_STRING([--with-faux=DIR],
  82. [Search DIR directory for faux library files [default=yes]])],
  83. [use_faux=$withval],
  84. [use_faux=yes])
  85. AS_IF([test x$use_faux != xyes],
  86. [
  87. CPPFLAGS="-I${use_faux} ${CPPFLAGS}"
  88. LDFLAGS="-L${use_faux}/.libs ${LDFLAGS}"
  89. ]
  90. )
  91. AC_CHECK_HEADERS([faux/faux.h],
  92. [],
  93. [AC_MSG_ERROR([cannot find <faux/faux.h> header file])]
  94. )
  95. AC_SEARCH_LIBS([faux_zmalloc], [faux],
  96. [],
  97. [AC_MSG_ERROR([cannot find working faux library])]
  98. )
  99. ################################
  100. # Check for Lua support
  101. ################################
  102. AC_ARG_WITH(lua,
  103. [AS_HELP_STRING([--with-lua=DIR],
  104. [Build Lua ACTION plugin [default=no]])],
  105. [use_lua=$withval],
  106. [use_lua=no])
  107. AM_CONDITIONAL(WITH_LUA,test x$use_lua != xno)
  108. if test x$use_lua != xno; then
  109. if test x$use_lua != xyes; then
  110. CPPFLAGS="${CPPFLAGS} -I$use_lua/include"
  111. LDFLAGS="${LDFLAGS} -L$use_lua/lib"
  112. fi
  113. LUA_VERSION="5.1"
  114. AX_LUA_HEADERS()
  115. AX_LUA_LIBS()
  116. fi
  117. ################################
  118. # Check for the roxml library
  119. ################################
  120. AC_ARG_WITH(libroxml,
  121. [AS_HELP_STRING([--with-libroxml=DIR],
  122. [Use roxml as the XML parser implementation [default=no]])],
  123. [use_roxml=$withval],
  124. [use_roxml=no])
  125. AC_ARG_WITH(libexpat,
  126. [AS_HELP_STRING([--with-libexpat=DIR],
  127. [Use expat as the XML parser implementation [default=no]])],
  128. [use_expat=$withval],
  129. [use_expat=no])
  130. AC_ARG_WITH(libxml2,
  131. [AS_HELP_STRING([--with-libxml2=DIR],
  132. [Use libxml2 as the XML parser implementation [default=no]])],
  133. [use_libxml2=$withval],
  134. [use_libxml2=no])
  135. # select the default xml backend
  136. sel_xml_backends=""
  137. xml_backend=""
  138. found_xml_backend=""
  139. count_xml_backends=0
  140. if test "x$use_libxml2" != "xno"; then
  141. sel_xml_backends="$sel_xml_backends libxml2"
  142. xml_backend="libxml2"
  143. count_xml_backends=$((count_xml_backends + 1))
  144. fi
  145. if test "x$use_roxml" != "xno"; then
  146. sel_xml_backends="$sel_xml_backends roxml"
  147. xml_backend="roxml"
  148. count_xml_backends=$((count_xml_backends + 1))
  149. fi
  150. if test "x$use_expat" != "xno"; then
  151. sel_xml_backends="$sel_xml_backends expat"
  152. xml_backend="expat"
  153. count_xml_backends=$((count_xml_backends + 1))
  154. fi
  155. if test $count_xml_backends -gt 1; then
  156. AC_MSG_WARN([Multiple XML backend has been selected ($sel_xml_backends). I choose $xml_backend])
  157. fi
  158. if test "x$xml_backend" = "x"; then
  159. xml_backend="auto"
  160. AC_MSG_WARN([No XML backend has been selected: auto check])
  161. fi
  162. case x$xml_backend in
  163. xroxml)
  164. use_libxml2="no"
  165. use_expat="no"
  166. ;;
  167. xlibxml2)
  168. use_roxml="no"
  169. use_expat="no"
  170. ;;
  171. xexpat)
  172. use_libxml2="no"
  173. use_roxml="no"
  174. ;;
  175. esac
  176. XML_LDFLAGS=""
  177. XML_CFLAGS=""
  178. XML_LIBS=""
  179. if test "$xml_backend" = "expat" -o "$xml_backend" = "auto"; then
  180. if test "$xml_backend" = "auto"; then
  181. # on auto select, we try to detect the library
  182. use_expat="yes"
  183. fi
  184. case x$use_expat in
  185. xyes)
  186. # we choose to NOT rely on pkg-config on this one. Instead, we
  187. # check for the library and the header file - that should be
  188. # enough.
  189. AC_CHECK_HEADER([expat.h],
  190. [expat_h_found=yes],
  191. [expat_h_found=no],
  192. [/* force include check */])
  193. if test "x$expat_h_found" != "xyes"; then
  194. AC_CHECK_HEADER([bsdxml.h],
  195. [expat_h_found=yes],
  196. [expat_h_found=no],
  197. [/* force include check */])
  198. if test "x$expat_h_found" != "xyes"; then
  199. if test "$xml_backend" = "auto"; then
  200. AC_MSG_WARN([cannot find <expat.h> header file])
  201. else
  202. AC_MSG_ERROR([cannot find <expat.h> header file])
  203. fi
  204. fi
  205. fi
  206. XML_CFLAGS=""
  207. AC_CHECK_LIB([expat],
  208. [XML_ParserCreate],
  209. [expat_lib_found=yes],
  210. [expat_lib_found=no],
  211. [])
  212. if test "x$expat_lib_found" != "xyes"; then
  213. AC_CHECK_LIB([bsdxml],
  214. [XML_ParserCreate],
  215. [expat_lib_found=yes],
  216. [expat_lib_found=no],
  217. [])
  218. if test "x$expat_lib_found" != "xno"; then
  219. XML_LIBS="-lbsdxml"
  220. AC_DEFINE([HAVE_LIB_BSDXML],
  221. [],
  222. [libbsdxml-based XML backend])
  223. else
  224. if test "$xml_backend" = "auto"; then
  225. AC_MSG_WARN([cannot find expat library])
  226. else
  227. AC_MSG_ERROR([cannot find expat library])
  228. fi
  229. fi
  230. else
  231. XML_LIBS="-lexpat"
  232. fi
  233. XML_LDFLAGS=""
  234. AC_DEFINE([HAVE_LIB_EXPAT],
  235. [],
  236. [libexpat-based XML backend])
  237. xml_backend="found"
  238. found_xml_backend="expat"
  239. ;;
  240. *)
  241. # this is probably broken. We consider that the user supplied path is
  242. # a non-standard path. But we're not going to check anything.
  243. AC_MSG_WARN([--with-expat=DIR is probably broken, just trying])
  244. XML_LDFLAGS="-L${use_expat}/lib"
  245. XML_CFLAGS="-I${use_expat}/include"
  246. XML_LIBS="-lexpat"
  247. AC_MSG_CHECKING([for expat support])
  248. AC_MSG_RESULT([yes])
  249. AC_MSG_NOTICE([headers for expat hopefully in ${use_expat}/include])
  250. AC_MSG_NOTICE([library expat hopefully in ${use_expat}/lib])
  251. AC_DEFINE([HAVE_LIB_EXPAT],
  252. [],
  253. [expat-based XML backend])
  254. xml_backend="found"
  255. found_xml_backend="expat"
  256. ;;
  257. esac
  258. else
  259. AC_MSG_CHECKING([for libexpat support])
  260. AC_MSG_RESULT([no])
  261. fi
  262. if test "$xml_backend" = "roxml" -o "$xml_backend" = "auto"; then
  263. if test "$xml_backend" = "auto"; then
  264. # on auto select, we try to detect the library
  265. use_roxml="yes"
  266. fi
  267. case x$use_roxml in
  268. xyes)
  269. # we choose to NOT rely on pkg-config on this one. We may do it as
  270. # libroxml provides a .pc file but some environment (both cross-compile
  271. # or native environment) may lack this support. The good thing is that
  272. # it doesn't add much complexity to the configure.ac file (and we
  273. # may move these tests to another m4 file later).
  274. # the header is installed in the standard path
  275. AC_CHECK_HEADER([roxml.h],
  276. [roxml_h_found=yes],
  277. [roxml_h_found=no],
  278. [/* force include check */])
  279. if test "x$roxml_h_found" != "xyes"; then
  280. if test "$xml_backend" = "auto"; then
  281. AC_MSG_WARN([cannot find <roxml.h> header file])
  282. else
  283. AC_MSG_ERROR([cannot find <roxml.h> header file])
  284. fi
  285. fi
  286. XML_CFLAGS=""
  287. # the library is installed in the standard path
  288. AC_CHECK_LIB([roxml],
  289. [roxml_load_doc],
  290. [roxml_lib_found=yes],
  291. [roxml_lib_found=no],
  292. [])
  293. if test "x$roxml_lib_found" != "xyes"; then
  294. if test "$xml_backend" = "auto"; then
  295. AC_MSG_WARN([cannot find roxml library])
  296. else
  297. AC_MSG_ERROR([cannot find roxml library])
  298. fi
  299. fi
  300. XML_LDFLAGS=""
  301. XML_LIBS="-lroxml"
  302. AC_DEFINE([HAVE_LIB_ROXML],
  303. [],
  304. [libroxml-based XML backend])
  305. xml_backend="found"
  306. found_xml_backend="roxml"
  307. ;;
  308. *)
  309. # first, we check if we're not looking for an alternate include
  310. # directory -for example, if the user feeds the script with the
  311. # option --with-roxml=/usr/local
  312. # NOTE: we search for include/roxml.h and inc/roxml.h to defeat
  313. # the caching algorithm of the configure script. If someone knows
  314. # a better way, please do not hesitate
  315. roxml_CFLAGS="$CFLAGS"
  316. CFLAGS="$CFLAGS -I${use_roxml}"
  317. AC_CHECK_HEADER([include/roxml.h],
  318. [roxml_h_found=yes],
  319. [roxml_h_found=no],
  320. [/* force include check */])
  321. if test "x$roxml_h_found" = "xno"; then
  322. # the directory might be a source directory, so check
  323. # if the include file is to be found here
  324. AC_CHECK_HEADER([inc/roxml.h],
  325. [roxml_h_found=yes],
  326. [roxml_h_found=no],
  327. [/* force include check */])
  328. if test "x$roxml_h_found" = "xno"; then
  329. if test "$xml_backend" = "auto"; then
  330. AC_MSG_WARN([cannot find <roxml.h> header file])
  331. else
  332. AC_MSG_ERROR([cannot find <roxml.h> header file])
  333. fi
  334. fi
  335. XML_CFLAGS="-I${use_roxml}/inc"
  336. AC_MSG_NOTICE([header file <roxml.h> found in ${use_roxml}/inc])
  337. else
  338. XML_CFLAGS="-I${use_roxml}/include"
  339. AC_MSG_NOTICE([header file <roxml.h> found in ${use_roxml}/include])
  340. fi
  341. CFLAGS="$roxml_CFLAGS"
  342. # we're doing both previous checks, but we are trying to find a library
  343. # now, so the check themselves are a bit different
  344. # NOTE: we search for roxml_load_doc and roxml_close to defeat
  345. # the caching algorithm of the configure script. If someone knows
  346. # a better way, please do not hesitate.
  347. roxml_LDFLAGS="$LDFLAGS"
  348. LDFLAGS="$LDFLAGS -L${use_roxml}/lib"
  349. AC_CHECK_LIB([roxml],
  350. [roxml_load_doc],
  351. [roxml_lib_found=yes],
  352. [roxml_lib_found=no],
  353. [])
  354. LDFLAGS=$roxml_LDFLAGS
  355. if test "x$roxml_lib_found" = "xno"; then
  356. LDFLAGS="$LDFLAGS -L${use_roxml}"
  357. AC_CHECK_LIB([roxml],
  358. [roxml_close],
  359. [roxml_lib_found=yes],
  360. [roxml_lib_found=no],
  361. [])
  362. LDFLAGS=$roxml_LDFLAGS
  363. if test "x$roxml_lib_found" = "xno"; then
  364. if test "$xml_backend" = "auto"; then
  365. AC_MSG_WARN([cannot find roxml library])
  366. else
  367. AC_MSG_ERROR([cannot find roxml library])
  368. fi
  369. fi
  370. XML_LDFLAGS="-L${use_roxml}"
  371. XML_LIBS="-lroxml"
  372. AC_MSG_NOTICE([library libroxml found in ${use_roxml}])
  373. else
  374. XML_LDFLAGS="-L${use_roxml}/lib"
  375. XML_LIBS="-lroxml"
  376. AC_MSG_NOTICE([library libroxml found in ${use_roxml}/lib])
  377. fi
  378. AC_DEFINE([HAVE_LIB_ROXML],
  379. [],
  380. [libroxml-based XML backend])
  381. xml_backend="found"
  382. found_xml_backend="roxml"
  383. ;;
  384. esac
  385. else
  386. AC_MSG_CHECKING([for libroxml support])
  387. AC_MSG_RESULT([no])
  388. fi
  389. if test "$xml_backend" = "libxml2" -o "$xml_backend" = "auto"; then
  390. if test "$xml_backend" = "auto"; then
  391. # on auto select, we try to detect the library
  392. use_libxml2="yes"
  393. fi
  394. case x$use_libxml2 in
  395. xyes)
  396. # I would love to avoid using pkg-config (which may not be available on
  397. # some compilation environment) but doing so really add a lot of
  398. # complexity to the system, as the headers don't lie in a standard
  399. # directory (they lie in a subdirectory of a standard include directory;
  400. # not the same thing for configure scripts).
  401. XML_CFLAGS="`pkg-config libxml-2.0 --cflags`"
  402. XML_LDFLAGS="`pkg-config libxml-2.0 --libs-only-L`"
  403. XML_LIBS="`pkg-config libxml-2.0 --libs-only-l`"
  404. AC_CHECK_LIB([xml2],
  405. [xmlNewDoc],
  406. [libxml2_lib_found=yes],
  407. [libxml2_lib_found=no],
  408. [])
  409. if test "x$libxml2_lib_found" != "xyes"; then
  410. if test "$xml_backend" = "auto"; then
  411. AC_MSG_WARN([cannot find libxml2 library])
  412. else
  413. AC_MSG_ERROR([cannot find libxml2 library])
  414. fi
  415. fi
  416. # the header file is installed in a subdirectory of one of the standard
  417. # include directory. This might prove to be a problem if the cross-
  418. # compile environment is not complete enough (i.e. if it misses
  419. # pkg-config, or if pkg-config returns wrong values). In most cases, the
  420. # environment is likely to be OK so we will never hit any issue.
  421. xml2_CFLAGS="$CFLAGS"
  422. CFLAGS="$CFLAGS $XML_CFLAGS"
  423. AC_CHECK_HEADER([libxml/tree.h],
  424. [libxml2_h_found=yes],
  425. [libxml2_h_found=no],
  426. [/* force include check */])
  427. CFLAGS="$xml2_CFLAGS"
  428. if test "x$libxml2_h_found" != "xyes"; then
  429. if test "$xml_backend" = "auto"; then
  430. AC_MSG_WARN([cannot find libxml2 headers])
  431. else
  432. AC_MSG_ERROR([cannot find libxml2 headers])
  433. fi
  434. fi
  435. AC_DEFINE([HAVE_LIB_LIBXML2],
  436. [],
  437. [libxml2-based XML backend])
  438. xml_backend="found"
  439. found_xml_backend="libxml2"
  440. ;;
  441. *)
  442. # this is probably broken. We consider that the user supplied path is
  443. # a non-standard path. But we're not going to check anything.
  444. AC_MSG_WARN([--with-libxml2=DIR is probably broken, just trying])
  445. XML_LDFLAGS="-L${use_libxml2}/lib"
  446. XML_CFLAGS="-I${use_libxml2}/include/libxml2"
  447. XML_LIBS="-lxml2"
  448. AC_MSG_CHECKING([for libxml2 support])
  449. AC_MSG_RESULT([yes])
  450. AC_MSG_NOTICE([headers for libxml2 hopefully in ${use_libxml2}/include/libxml2])
  451. AC_MSG_NOTICE([library libxml2 hopefully in ${use_libxml2}/lib])
  452. AC_DEFINE([HAVE_LIB_LIBXML2],
  453. [],
  454. [libxml2-based XML backend])
  455. xml_backend="found"
  456. found_xml_backend="libxml2"
  457. ;;
  458. esac
  459. else
  460. # not selected? We print a small message
  461. AC_MSG_CHECKING([for libxml2 support])
  462. AC_MSG_RESULT([no])
  463. fi
  464. if test "$xml_backend" != "found"; then
  465. AC_MSG_ERROR([Failed to find a suitable XML backend])
  466. fi
  467. if test $count_xml_backends -eq 0; then
  468. AC_MSG_NOTICE([I found a suitable XML backend: $found_xml_backend])
  469. fi
  470. # LIBXSLT
  471. AC_ARG_WITH(libxslt,
  472. [AS_HELP_STRING([--with-libxslt=DIR],
  473. [Use libxslt as the XSLT transform engine [default=no]. Depend on libxml2 library.])],
  474. [use_libxslt=$withval],
  475. [use_libxslt=no])
  476. if test "x$use_libxslt" != "xno" -a "$found_xml_backend" != "libxml2"; then
  477. AC_MSG_ERROR([The libxml2 is necessary for libxslt])
  478. fi
  479. ################################
  480. # Check for the libxslt transform engine
  481. ################################
  482. if test x$use_libxslt != xno; then
  483. AC_CHECK_LIB([xslt], [xsltApplyStylesheet], [libxslt_lib_found=yes], [libxslt_lib_found=no])
  484. if test "x$libxslt_lib_found" != "xyes"; then
  485. AC_MSG_ERROR([Can't find an XSLT library])
  486. fi
  487. XSLT_CFLAGS="`pkg-config libxslt --cflags 2>/dev/null`"
  488. XSLT_LDFLAGS="`pkg-config libxslt --libs-only-L 2>/dev/null`"
  489. XSLT_LIBS="`pkg-config libxslt --libs-only-l 2>/dev/null`"
  490. if test "x${XSLT_LIBS}" = "x"; then
  491. XSLT_LIBS="-lxslt"
  492. fi
  493. XML_CFLAGS="${XML_CFLAGS} ${XSLT_CFLAGS}"
  494. XML_LDFLAGS="${XML_LDFLAGS} ${XSLT_LDFLAGS}"
  495. XML_LIBS="${XML_LIBS} ${XSLT_LIBS}"
  496. AC_DEFINE([HAVE_LIB_LIBXSLT], [], [libxslt XML transform engine])
  497. fi
  498. ################################
  499. # Common XML related subst
  500. ################################
  501. AC_SUBST(XML_LIBS)
  502. AC_SUBST(XML_LDFLAGS)
  503. AC_SUBST(XML_CFLAGS)
  504. ################################
  505. # Search for network functions (like connect())
  506. ################################
  507. AC_SEARCH_LIBS([socket], [socket])
  508. ################################
  509. # Check for regex.h
  510. ################################
  511. AC_CHECK_HEADERS(regex.h, [],
  512. AC_MSG_ERROR([regex.h not found: regular expressions are not supported]))
  513. ################################
  514. # Internal getopt()
  515. ################################
  516. AC_ARG_WITH(internal-getopt,
  517. [AS_HELP_STRING([--with-internal-getopt],
  518. [Use internal implementation of getopt [default=no]])],
  519. [],
  520. [with_internal_getopt=no])
  521. if test x$with_internal_getopt != xno; then
  522. AC_DEFINE([WITH_INTERNAL_GETOPT], [1], [Use internal getopt() implementation])
  523. AC_LIBOBJ([getopt])
  524. AC_MSG_WARN([Use internal implementation of getopt() and getopt_long()])
  525. else
  526. AC_CHECK_HEADERS(getopt.h, [found_getopt_h=yes],
  527. AC_MSG_WARN([getopt.h not found: only short parameters can be used on command line]))
  528. fi
  529. AC_MSG_CHECKING([for getopt_long()])
  530. if test x$with_internal_getopt = xyes -o x$found_getopt_h = xyes; then
  531. AC_DEFINE([HAVE_GETOPT_LONG], [1], [getopt_long() function])
  532. AC_MSG_RESULT([yes])
  533. else
  534. AC_MSG_RESULT([no])
  535. fi
  536. ################################
  537. # Check for locale.h
  538. ################################
  539. AC_CHECK_HEADERS(locale.h, [],
  540. AC_MSG_WARN([locale.h not found: the locales is not supported]))
  541. ################################
  542. # Check for CODESET within nl_langinfo
  543. ################################
  544. AC_DEFUN([AM_LANGINFO_CODESET],
  545. [
  546. AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
  547. [AC_TRY_LINK([#include <langinfo.h>],
  548. [char* cs = nl_langinfo(CODESET); return !cs;],
  549. [am_cv_langinfo_codeset=yes],
  550. [am_cv_langinfo_codeset=no])
  551. ])
  552. if test $am_cv_langinfo_codeset = yes; then
  553. AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
  554. [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
  555. fi
  556. ])
  557. AM_LANGINFO_CODESET
  558. ################################
  559. # Check for pwd.h and grp.h
  560. ################################
  561. AC_CHECK_HEADERS(pwd.h, [],
  562. AC_MSG_WARN([pwd.h not found: the pwd operations is not supported]))
  563. AC_CHECK_HEADERS(grp.h, [],
  564. AC_MSG_WARN([grp.h not found: the grp operations is not supported]))
  565. ################################
  566. # Check for chroot
  567. ################################
  568. AC_CHECK_FUNCS(chroot, [],
  569. AC_MSG_WARN([chroot() not found: the choot is not supported]))
  570. ################################
  571. # Check for dlopen
  572. ################################
  573. CLISH_PLUGIN_BUILTIN_LIST=
  574. CLISH_PLUGIN_BUILTIN_DEFS=
  575. CLISH_PLUGIN_BUILTIN_LIBS=
  576. AC_DEFUN([AC_PLUGIN_BUILTIN],
  577. [
  578. CLISH_PLUGIN_BUILTIN_LIBS="$CLISH_PLUGIN_BUILTIN_LIBS clish_plugin_$1.la"
  579. CLISH_PLUGIN_BUILTIN_DEFS="$CLISH_PLUGIN_BUILTIN_DEFS CLISH_PLUGIN_INIT($1);"
  580. CLISH_PLUGIN_BUILTIN_LIST="$CLISH_PLUGIN_BUILTIN_LIST { \"$1\", clish_plugin_$1_init },"
  581. ])
  582. AC_CHECK_HEADERS(dlfcn.h, [
  583. AC_SEARCH_LIBS([dlopen], [dl dld], [], [
  584. AC_MSG_ERROR([unable to find the dlopen() function])
  585. ])
  586. ],[
  587. AC_MSG_WARN([dlfcn.h not found: the dl operations is not supported])
  588. AC_PLUGIN_BUILTIN([clish])
  589. if test x$use_lua != xno; then
  590. AC_PLUGIN_BUILTIN([lua])
  591. fi
  592. ])
  593. AC_SUBST([CLISH_PLUGIN_BUILTIN_LIST])
  594. AC_SUBST([CLISH_PLUGIN_BUILTIN_DEFS])
  595. AC_SUBST([CLISH_PLUGIN_BUILTIN_LIBS])
  596. #AC_CONFIG_FILES([clish/plugin_builtin.c])
  597. AC_CONFIG_FILES([Makefile])
  598. AC_OUTPUT