1
0

configure.ac 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. m4_define([MAJOR_VERSION], 1)
  4. m4_define([MINOR_VERSION], 5)
  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. # Checks for programs.
  12. AC_PROG_CC
  13. AC_PROG_CXX
  14. AC_LIBTOOL_WIN32_DLL
  15. AC_PROG_LIBTOOL
  16. AC_CONFIG_HEADERS([config.h])
  17. AM_INIT_AUTOMAKE(subdir-objects)
  18. AM_PROG_CC_C_O
  19. # needed to handle 64-bit architecture
  20. AC_CHECK_SIZEOF(int)
  21. AC_CHECK_SIZEOF(long)
  22. AC_CHECK_SIZEOF(size_t)
  23. #------------------------------------------------------------------------
  24. # Handle the --prefix=... option
  25. #------------------------------------------------------------------------
  26. if test "${prefix}" = "NONE"; then
  27. prefix=/usr/local
  28. fi
  29. if test "${exec_prefix}" = "NONE"; then
  30. exec_prefix=$prefix
  31. fi
  32. # libdir must be a fully qualified path (not ${exec_prefix}/lib)
  33. eval libdir="$libdir"
  34. ################################
  35. # Deal with debugging options
  36. ################################
  37. AC_ARG_ENABLE(debug,
  38. [AS_HELP_STRING([--enable-debug],
  39. [Turn on debugging including asserts [default=no]])],
  40. [],
  41. [enable_debug=no])
  42. AM_CONDITIONAL(DEBUG,test x$enable_debug = xyes)
  43. ################################
  44. # Check for the LUB library
  45. ################################
  46. LUB_LIBS="-llub"
  47. LUB_CFLAGS=""
  48. if test "x$LUB_LIBS" = "x"; then
  49. AC_MSG_ERROR([Cannot find the "Little Useful Bits" library])
  50. fi
  51. AC_SUBST(LUB_LIBS)
  52. AC_SUBST(LUB_CFLAGS)
  53. ################################
  54. # Check for the KONF library
  55. ################################
  56. KONF_LIBS="-lkonf"
  57. KONF_CFLAGS=""
  58. if test "x$KONF_LIBS" = "x"; then
  59. AC_MSG_ERROR([Cannot find the "CLI config" library])
  60. fi
  61. AC_SUBST(KONF_LIBS)
  62. AC_SUBST(KONF_CFLAGS)
  63. ################################
  64. # Check for the TINYRL library
  65. ################################
  66. TINYRL_LIBS="-ltinyrl"
  67. TINYRL_CFLAGS=""
  68. if test "x$TINYRL_LIBS" = "x"; then
  69. AC_MSG_ERROR([Cannot find the "Tiny Readline" library])
  70. fi
  71. AC_SUBST(TINYRL_LIBS)
  72. AC_SUBST(TINYRL_CFLAGS)
  73. ################################
  74. # Check for the TINYXML library
  75. ################################
  76. TINYXML_LIBS="-ltinyxml"
  77. TINYXML_CXXFLAGS="-std=gnu++98"
  78. if test "x$TINYXML_LIBS" = "x"; then
  79. AC_MSG_ERROR([Cannot find the "Tiny XML" library])
  80. fi
  81. AC_SUBST(TINYXML_LIBS)
  82. AC_SUBST(TINYXML_CXXFLAGS)
  83. ################################
  84. # Check for the PTHREAD library
  85. ################################
  86. AC_ARG_WITH(pthread,
  87. [AS_HELP_STRING([--with-pthread=DIR],
  88. [Use POSIX threads library distribution in DIR])
  89. ])
  90. AC_CHECK_HEADERS(pthread.h,
  91. [AC_CHECK_LIB(pthread,
  92. pthread_create,
  93. [AC_DEFINE([HAVE_LIBPTHREAD], [], [Have POSIX threads library])
  94. if test "x$with_pthread" = "x"; then
  95. PTHREAD_LIBS="-lpthread"
  96. else
  97. PTHREAD_CFLAGS="-I$with_pthread/include"
  98. PTHREAD_LIBS="-L$with_pthread/lib -lpthread"
  99. fi
  100. AC_SUBST(PTHREAD_LIBS)
  101. AC_SUBST(PTHREAD_CFLAGS)
  102. ])
  103. ])
  104. if test "x$PTHREAD_LIBS" = "x"; then
  105. AC_MSG_ERROR([Cannot find the POSIX threads library])
  106. fi
  107. ################################
  108. # Check for the RT library
  109. ################################
  110. AC_ARG_WITH(rt,
  111. [AS_HELP_STRING([--with-rt=DIR],
  112. [Use POSIX real time library distribution in DIR])])
  113. AC_CHECK_LIB(rt,
  114. clock_gettime,
  115. [
  116. AC_DEFINE([HAVE_LIBRT], [], [Have POSIX real time library])
  117. if test "x$with_rt" = "x"; then
  118. RT_LIBS="-lrt"
  119. else
  120. RT_CFLAGS="-I$with_rt/include"
  121. RT_LIBS="-L$with_rt/lib -lrt"
  122. fi
  123. AC_SUBST(RT_LIBS)
  124. AC_SUBST(RT_CFLAGS)
  125. ])
  126. ################################
  127. # Check for the TCL library
  128. ################################
  129. TCL_CONFIG=${libdir}/tclConfig.sh
  130. AC_ARG_WITH(tcl,
  131. [AS_HELP_STRING([--with-tcl=DIR],
  132. [Use TCL library distribution in DIR])],
  133. if test -e $TCL_CONFIG; then
  134. source ${TCL_CONFIG} # get TCL_VERSION
  135. if test "${with_tcl}" = "yes"; then
  136. TCL_CFLAGS="${TCL_INCLUDE_SPEC}"
  137. TCL_LIBS="${TCL_LIB_SPEC}"
  138. else
  139. TCL_CFLAGS="-I${with_tcl}/include"
  140. TCL_LIBS="-L${with_tcl}/lib -ltcl"
  141. fi
  142. CPPFLAGS="$CPPFLAGS $TCL_CFLAGS"
  143. AC_CHECK_HEADERS(tcl.h,
  144. AC_CHECK_LIB(tcl${TCL_VERSION}, Tcl_CreateInterp, [
  145. AC_DEFINE([HAVE_LIBTCL], [], [Have TCL library])
  146. AC_SUBST(TCL_CFLAGS)
  147. AC_SUBST(TCL_LIBS)
  148. AC_SUBST(TCL_VERSION)
  149. have_tcl="yes"
  150. ])
  151. )
  152. fi
  153. )
  154. AM_CONDITIONAL(TCL,test "x${have_tcl}" = "xyes")
  155. ################################
  156. # Check for inclusion of lub_heap
  157. ################################
  158. AC_ARG_ENABLE(lubheap,
  159. [AS_HELP_STRING([--enable-lubheap],
  160. [Replace standard memory libaries with lubheap (EXPERIMENTAL) [default=no]])],
  161. [],
  162. [enable_lubheap=no])
  163. AM_CONDITIONAL(LUBHEAP,test "x$enable_lubheap" = "xyes")
  164. if test "x$enable_lubheap" = "xyes"; then
  165. AC_MSG_WARN([Replacing standard memory libraries with lubheap])
  166. LUBHEAP_LIBS="-llubheap"
  167. LUBHEAP_CFLAGS=""
  168. if test "x$LUBHEAP_LIBS" = "x"; then
  169. AC_MSG_ERROR([Cannot find the "Little Useful Bits Heap" library])
  170. fi
  171. AC_SUBST(LUBHEAP_LIBS)
  172. AC_SUBST(LUBHEAP_CFLAGS)
  173. fi
  174. ################################
  175. # Check for linkage with GPL libraries
  176. ################################
  177. AC_ARG_ENABLE(gpl,
  178. [AS_HELP_STRING([--enable-gpl],
  179. [Link with GPL licenced libraries [default=yes]])],
  180. [],
  181. [enable_gpl=yes])
  182. if test "x$enable_gpl" = "xyes"; then
  183. ################################
  184. # Check for BFD library
  185. ################################
  186. AC_MSG_WARN([Linking with GPL licence libraries])
  187. AC_CHECK_HEADERS(bfd.h,
  188. [AC_CHECK_LIB(bfd,
  189. bfd_init,
  190. [AC_DEFINE([HAVE_LIBBFD],
  191. [],
  192. [Have Binary File Decription library])
  193. BFD_LIBS="-lbfd -liberty"
  194. AC_CHECK_LIB(intl,
  195. libintl_dgettext,
  196. [AC_DEFINE([HAVE_LIBINTL],
  197. [],
  198. [Have native langauage support library])
  199. BFD_LIBS="$BFD_LIBS -lintl"
  200. ])
  201. AC_SUBST(BFD_LIBS)
  202. ])
  203. ])
  204. else
  205. AC_MSG_WARN([Skipping BFD library checks because of GPL Licence])
  206. fi
  207. ################################
  208. # Check for regex.h
  209. ################################
  210. AC_CHECK_HEADERS(regex.h, [],
  211. AC_MSG_ERROR([regex.h not found: regular expressions are not supported]))
  212. ################################
  213. # Check for getopt_long()
  214. ################################
  215. AC_CHECK_HEADERS(getopt.h, [],
  216. AC_MSG_WARN([getopt.h not found: only short parameters can be used on command line]))
  217. ################################
  218. # Check for locale.h
  219. ################################
  220. AC_CHECK_HEADERS(locale.h, [],
  221. AC_MSG_WARN([locale.h not found: the locales is not supported]))
  222. ################################
  223. # Check for CODESET within nl_langinfo
  224. ################################
  225. AM_LANGINFO_CODESET
  226. ################################
  227. # Check for pwd.h and grp.h
  228. ################################
  229. AC_CHECK_HEADERS(pwd.h, [],
  230. AC_MSG_WARN([pwd.h not found: the pwd operations is not supported]))
  231. AC_CHECK_HEADERS(grp.h, [],
  232. AC_MSG_WARN([grp.h not found: the grp operations is not supported]))
  233. ################################
  234. # Check for chroot
  235. ################################
  236. AC_CHECK_FUNCS(chroot, [],
  237. AC_MSG_WARN([chroot() not found: the choot is not supported]))
  238. AC_CONFIG_FILES(Makefile)
  239. AC_OUTPUT