1
0

configure.ac 21 KB

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