1
0

configure.ac 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. m4_define([MAJOR_VERSION], 1)
  4. m4_define([MINOR_VERSION], 2)
  5. m4_define([MICRO_VERSION], 1)
  6. AC_PREREQ(2.59)
  7. AC_INIT([clish],
  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. . ${TCL_CONFIG}; # get TCL_VERSION
  135. AC_CHECK_HEADERS(tcl.h,
  136. AC_CHECK_LIB(tcl,
  137. Tcl_CreateInterp,
  138. [if test x$with_tcl = x; then
  139. TCL_LIBS="-ltcl"
  140. else
  141. TCL_CFLAGS="-I${TCL_DIR}/include"
  142. TCL_LIBS="-L${TCL_DIR}/lib -ltcl"
  143. fi
  144. ])
  145. )
  146. if test x$TCL_LIBS != x; then
  147. AC_DEFINE([HAVE_LIBTCL], [], [Have TCL library])
  148. AC_SUBST(TCL_CFLAGS)
  149. AC_SUBST(TCL_LIBS)
  150. AC_SUBST(TCL_VERSION)
  151. fi
  152. fi
  153. ################################
  154. # Check for inclusion of lub_heap
  155. ################################
  156. AC_ARG_ENABLE(lubheap,
  157. [AS_HELP_STRING([--enable-lubheap],
  158. [Replace standard memory libaries with lubheap (EXPERIMENTAL) [default=no]])],
  159. [],
  160. [enable_lubheap=no])
  161. AM_CONDITIONAL(LUBHEAP,test x$enable_lubheap = xyes)
  162. if test x$enable_lubheap = xyes; then
  163. AC_MSG_WARN([Replacing standard memory libraries with lubheap])
  164. LUBHEAP_LIBS="-llubheap"
  165. LUBHEAP_CFLAGS=""
  166. if test x$LUBHEAP_LIBS = x; then
  167. AC_MSG_ERROR([Cannot find the "Little Useful Bits Heap" library])
  168. fi
  169. AC_SUBST(LUBHEAP_LIBS)
  170. AC_SUBST(LUBHEAP_CFLAGS)
  171. fi
  172. ################################
  173. # Check for linkage with GPL libraries
  174. ################################
  175. AC_ARG_ENABLE(gpl,
  176. [AS_HELP_STRING([--enable-gpl],
  177. [Link with GPL licenced libraries [default=yes]])],
  178. [],
  179. [enable_gpl=yes])
  180. if test x$enable_gpl = xyes; then
  181. ################################
  182. # Check for BFD library
  183. ################################
  184. AC_MSG_WARN([Linking with GPL licence libraries])
  185. AC_CHECK_HEADERS(bfd.h,
  186. [AC_CHECK_LIB(bfd,
  187. bfd_init,
  188. [AC_DEFINE([HAVE_LIBBFD],
  189. [],
  190. [Have Binary File Decription library])
  191. BFD_LIBS="-lbfd -liberty"
  192. AC_CHECK_LIB(intl,
  193. libintl_dgettext,
  194. [AC_DEFINE([HAVE_LIBINTL],
  195. [],
  196. [Have native langauage support library])
  197. BFD_LIBS="$BFD_LIBS -lintl"
  198. ])
  199. AC_SUBST(BFD_LIBS)
  200. ])
  201. ])
  202. else
  203. AC_MSG_WARN([Skipping BFD library checks because of GPL Licence])
  204. fi
  205. AC_CONFIG_FILES(Makefile)
  206. AC_OUTPUT