configure.ac 22 KB

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