configure.ac 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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], 7)
  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_PROG_CXX
  16. AC_LIBTOOL_WIN32_DLL
  17. AC_PROG_LIBTOOL
  18. AC_CONFIG_HEADERS([config.h])
  19. AM_INIT_AUTOMAKE(subdir-objects)
  20. AM_PROG_CC_C_O
  21. # needed to handle 64-bit architecture
  22. AC_CHECK_SIZEOF(int)
  23. AC_CHECK_SIZEOF(long)
  24. AC_CHECK_SIZEOF(size_t)
  25. #------------------------------------------------------------------------
  26. # Handle the --prefix=... option
  27. #------------------------------------------------------------------------
  28. if test "${prefix}" = "NONE"; then
  29. prefix=/usr/local
  30. fi
  31. if test "${exec_prefix}" = "NONE"; then
  32. exec_prefix=$prefix
  33. fi
  34. # libdir must be a fully qualified path (not ${exec_prefix}/lib)
  35. eval libdir="$libdir"
  36. ################################
  37. # Deal with debugging options
  38. ################################
  39. AC_ARG_ENABLE(debug,
  40. [AS_HELP_STRING([--enable-debug],
  41. [Turn on debugging including asserts [default=no]])],
  42. [],
  43. [enable_debug=no])
  44. AM_CONDITIONAL(DEBUG,test x$enable_debug = xyes)
  45. ################################
  46. # Check for the LUB library
  47. ################################
  48. LUB_LIBS="-llub"
  49. LUB_CFLAGS=""
  50. if test "x$LUB_LIBS" = "x"; then
  51. AC_MSG_ERROR([Cannot find the "Little Useful Bits" library])
  52. fi
  53. AC_SUBST(LUB_LIBS)
  54. AC_SUBST(LUB_CFLAGS)
  55. ################################
  56. # Check for the KONF library
  57. ################################
  58. KONF_LIBS="-lkonf"
  59. KONF_CFLAGS=""
  60. if test "x$KONF_LIBS" = "x"; then
  61. AC_MSG_ERROR([Cannot find the "CLI config" library])
  62. fi
  63. AC_SUBST(KONF_LIBS)
  64. AC_SUBST(KONF_CFLAGS)
  65. ################################
  66. # Check for the TINYRL library
  67. ################################
  68. TINYRL_LIBS="-ltinyrl"
  69. TINYRL_CFLAGS=""
  70. if test "x$TINYRL_LIBS" = "x"; then
  71. AC_MSG_ERROR([Cannot find the "Tiny Readline" library])
  72. fi
  73. AC_SUBST(TINYRL_LIBS)
  74. AC_SUBST(TINYRL_CFLAGS)
  75. ################################
  76. # Check for the TINYXML library
  77. ################################
  78. TINYXML_LIBS="-ltinyxml"
  79. TINYXML_CXXFLAGS="-std=gnu++98"
  80. if test "x$TINYXML_LIBS" = "x"; then
  81. AC_MSG_ERROR([Cannot find the "Tiny XML" library])
  82. fi
  83. AC_SUBST(TINYXML_LIBS)
  84. AC_SUBST(TINYXML_CXXFLAGS)
  85. ################################
  86. # Search for network functions (like connect())
  87. ################################
  88. AC_SEARCH_LIBS([socket], [socket])
  89. ################################
  90. # Check for regex.h
  91. ################################
  92. AC_CHECK_HEADERS(regex.h, [],
  93. AC_MSG_ERROR([regex.h not found: regular expressions are not supported]))
  94. ################################
  95. # Check for getopt_long()
  96. ################################
  97. AC_CHECK_HEADERS(getopt.h, [],
  98. AC_MSG_WARN([getopt.h not found: only short parameters can be used on command line]))
  99. ################################
  100. # Check for locale.h
  101. ################################
  102. AC_CHECK_HEADERS(locale.h, [],
  103. AC_MSG_WARN([locale.h not found: the locales is not supported]))
  104. ################################
  105. # Check for CODESET within nl_langinfo
  106. ################################
  107. AM_LANGINFO_CODESET
  108. ################################
  109. # Check for pwd.h and grp.h
  110. ################################
  111. AC_CHECK_HEADERS(pwd.h, [],
  112. AC_MSG_WARN([pwd.h not found: the pwd operations is not supported]))
  113. AC_CHECK_HEADERS(grp.h, [],
  114. AC_MSG_WARN([grp.h not found: the grp operations is not supported]))
  115. ################################
  116. # Check for chroot
  117. ################################
  118. AC_CHECK_FUNCS(chroot, [],
  119. AC_MSG_WARN([chroot() not found: the choot is not supported]))
  120. AC_CONFIG_FILES(Makefile)
  121. AC_OUTPUT