1
0

configure.ac 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. m4_define([MAJOR_VERSION], 1)
  4. m4_define([MINOR_VERSION], 6)
  5. m4_define([MICRO_VERSION], 0)
  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. # Check for system extensions (_POSIX_THREAD_SEMANTICS for Solaris)
  12. AC_USE_SYSTEM_EXTENSIONS
  13. # Checks for programs.
  14. AC_PROG_CC
  15. AC_LIBTOOL_WIN32_DLL
  16. AC_PROG_LIBTOOL
  17. AC_CONFIG_HEADERS([config.h])
  18. AM_INIT_AUTOMAKE(subdir-objects)
  19. AM_PROG_CC_C_O
  20. # needed to handle 64-bit architecture
  21. AC_CHECK_SIZEOF(int)
  22. AC_CHECK_SIZEOF(long)
  23. AC_CHECK_SIZEOF(size_t)
  24. #------------------------------------------------------------------------
  25. # Handle the --prefix=... option
  26. #------------------------------------------------------------------------
  27. if test "${prefix}" = "NONE"; then
  28. prefix=/usr/local
  29. fi
  30. if test "${exec_prefix}" = "NONE"; then
  31. exec_prefix=$prefix
  32. fi
  33. # libdir must be a fully qualified path (not ${exec_prefix}/lib)
  34. eval libdir="$libdir"
  35. ################################
  36. # Deal with debugging options
  37. ################################
  38. AC_ARG_ENABLE(debug,
  39. [AS_HELP_STRING([--enable-debug],
  40. [Turn on debugging including asserts [default=no]])],
  41. [],
  42. [enable_debug=no])
  43. AM_CONDITIONAL(DEBUG,test x$enable_debug = xyes)
  44. ################################
  45. # Check for the roxml library
  46. ################################
  47. AC_ARG_WITH(roxml,
  48. [AS_HELP_STRING([--with-roxml=DIR],
  49. [Use roxml as the XML parser implementation [default=no]])],
  50. [use_roxml=$withval],
  51. [use_roxml=no])
  52. AC_ARG_WITH(libxml2,
  53. [AS_HELP_STRING([--with-libxml2=DIR],
  54. [Use libxml2 as the XML parser implementation [default=yes]])],
  55. [use_libxml2=$withval],
  56. [use_libxml2=yes])
  57. if test "x$use_roxml" != "xno"; then
  58. if test "x$use_libxml2" != "xno"; then
  59. AC_MSG_WARN([both roxml and libxml2 are selected. I choose roxml])
  60. use_libxml2=no
  61. fi
  62. else
  63. if test "x$use_libxml2" = "xno"; then
  64. AC_MSG_WARN([neither roxml nor libxml2 are selected. I choose libxml2])
  65. use_libxml2=yes
  66. fi
  67. fi
  68. XML_LDFLAGS=""
  69. XML_CFLAGS=""
  70. XML_LIBS=""
  71. AC_MSG_CHECKING([for libroxml support])
  72. case x$use_roxml in
  73. xno)
  74. AC_MSG_RESULT([no])
  75. ;;
  76. xyes)
  77. # the library is installed in the standard path
  78. XML_LDFLAGS="`pkg-config libroxml --libs-only-L`"
  79. XML_CFLAGS="`pkg-config libroxml --cflags`"
  80. XML_LIBS="`pkg-config libroxml --libs-only-l`"
  81. AC_MSG_RESULT([yes])
  82. AC_DEFINE([HAVE_LIB_ROXML],
  83. [],
  84. [Define to 1 if you want to use libroxml to parse clish XML files])
  85. ;;
  86. *)
  87. # this is very likely to be a source directory, so
  88. # let's consider that it's a valid one
  89. XML_LDFLAGS="-L${use_roxml}"
  90. XML_CFLAGS="-I${use_roxml}/inc"
  91. XML_LIBS="-lroxml"
  92. AC_MSG_RESULT([yes (lib in ${use_roxml}, includes in ${use_roxml}/inc)])
  93. AC_DEFINE([HAVE_LIB_ROXML],
  94. [],
  95. [Define to 1 if you want to use libroxml to parse clish XML files])
  96. ;;
  97. esac
  98. AC_MSG_CHECKING([for libxml2 support])
  99. case x$use_libxml2 in
  100. xno)
  101. AC_MSG_RESULT([no])
  102. ;;
  103. xyes)
  104. # the library is installed in the standard path
  105. XML_LDFLAGS="`pkg-config libxml-2.0 --libs-only-L`"
  106. XML_CFLAGS="`pkg-config libxml-2.0 --cflags`"
  107. XML_LIBS="`pkg-config libxml-2.0 --libs-only-l`"
  108. AC_MSG_RESULT([yes])
  109. AC_DEFINE([HAVE_LIB_LIBXML2],
  110. [],
  111. [Define to 1 if you want to use libxml2 to parse clish XML files])
  112. ;;
  113. *)
  114. # this is very likely to be a source directory, so
  115. # let's consider that it's a valid one
  116. XML_LDFLAGS="-L${use_libxml2}"
  117. XML_CFLAGS="-I${use_libxml2}"
  118. XML_LIBS="-lxml2"
  119. AC_MSG_RESULT([yes (lib and includes in ${use_libxml2}])
  120. AC_DEFINE([HAVE_LIB_LIBXML2],
  121. [],
  122. [Define to 1 if you want to use libxml2 to parse clish XML files])
  123. ;;
  124. esac
  125. AC_SUBST(XML_LIBS)
  126. AC_SUBST(XML_LDFLAGS)
  127. AC_SUBST(XML_CFLAGS)
  128. ################################
  129. # Check for the LUB library
  130. ################################
  131. LUB_LIBS="-llub"
  132. LUB_CFLAGS=""
  133. if test "x$LUB_LIBS" = "x"; then
  134. AC_MSG_ERROR([Cannot find the "Little Useful Bits" library])
  135. fi
  136. AC_SUBST(LUB_LIBS)
  137. AC_SUBST(LUB_CFLAGS)
  138. ################################
  139. # Check for the KONF library
  140. ################################
  141. KONF_LIBS="-lkonf"
  142. KONF_CFLAGS=""
  143. if test "x$KONF_LIBS" = "x"; then
  144. AC_MSG_ERROR([Cannot find the "CLI config" library])
  145. fi
  146. AC_SUBST(KONF_LIBS)
  147. AC_SUBST(KONF_CFLAGS)
  148. ################################
  149. # Check for the TINYRL library
  150. ################################
  151. TINYRL_LIBS="-ltinyrl"
  152. TINYRL_CFLAGS=""
  153. if test "x$TINYRL_LIBS" = "x"; then
  154. AC_MSG_ERROR([Cannot find the "Tiny Readline" library])
  155. fi
  156. AC_SUBST(TINYRL_LIBS)
  157. AC_SUBST(TINYRL_CFLAGS)
  158. ################################
  159. # Search for network functions (like connect())
  160. ################################
  161. AC_SEARCH_LIBS([socket], [socket])
  162. ################################
  163. # Check for regex.h
  164. ################################
  165. AC_CHECK_HEADERS(regex.h, [],
  166. AC_MSG_ERROR([regex.h not found: regular expressions are not supported]))
  167. ################################
  168. # Check for getopt_long()
  169. ################################
  170. AC_CHECK_HEADERS(getopt.h, [],
  171. AC_MSG_WARN([getopt.h not found: only short parameters can be used on command line]))
  172. ################################
  173. # Check for locale.h
  174. ################################
  175. AC_CHECK_HEADERS(locale.h, [],
  176. AC_MSG_WARN([locale.h not found: the locales is not supported]))
  177. ################################
  178. # Check for CODESET within nl_langinfo
  179. ################################
  180. AM_LANGINFO_CODESET
  181. ################################
  182. # Check for pwd.h and grp.h
  183. ################################
  184. AC_CHECK_HEADERS(pwd.h, [],
  185. AC_MSG_WARN([pwd.h not found: the pwd operations is not supported]))
  186. AC_CHECK_HEADERS(grp.h, [],
  187. AC_MSG_WARN([grp.h not found: the grp operations is not supported]))
  188. ################################
  189. # Check for chroot
  190. ################################
  191. AC_CHECK_FUNCS(chroot, [],
  192. AC_MSG_WARN([chroot() not found: the choot is not supported]))
  193. AC_CONFIG_FILES(Makefile)
  194. AC_OUTPUT