configure.ac 21 KB

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