configure.in 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. dnl
  2. dnl Configure script for readline library
  3. dnl
  4. dnl report bugs to chet@po.cwru.edu
  5. dnl
  6. dnl Process this file with autoconf to produce a configure script.
  7. # Copyright (C) 1987-2009 Free Software Foundation, Inc.
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation, either version 3 of the License, or
  11. # (at your option) any later version.
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. AC_REVISION([for Readline 6.2, version 2.67])
  19. m4_include([../config/override.m4])
  20. AC_INIT(readline, 6.2, bug-readline@gnu.org)
  21. dnl make sure we are using a recent autoconf version
  22. AC_PREREQ(2.50)
  23. AC_CONFIG_SRCDIR(readline.h)
  24. dnl GDB LOCAL
  25. dnl AC_CONFIG_AUX_DIR(./support)
  26. AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
  27. AC_CONFIG_HEADERS(config.h)
  28. dnl update the value of RL_READLINE_VERSION in readline.h when this changes
  29. LIBVERSION=6.2
  30. AC_CANONICAL_HOST
  31. AC_CANONICAL_BUILD
  32. dnl configure defaults
  33. opt_curses=no
  34. opt_purify=no
  35. dnl arguments to configure
  36. AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
  37. AC_ARG_WITH(purify, AC_HELP_STRING([--with-purify], [configure to postprocess with purify]), opt_purify=$withval)
  38. if test "$opt_curses" = "yes"; then
  39. prefer_curses=yes
  40. fi
  41. if test "$opt_purify" = yes; then
  42. PURIFY="purify"
  43. else
  44. PURIFY=
  45. fi
  46. dnl option parsing for optional features
  47. opt_multibyte=yes
  48. opt_static_libs=yes
  49. opt_shared_libs=no
  50. AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
  51. dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
  52. AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
  53. if test $opt_multibyte = no; then
  54. AC_DEFINE(NO_MULTIBYTE_SUPPORT)
  55. fi
  56. dnl load up the cross-building cache file -- add more cases and cache
  57. dnl files as necessary
  58. dnl Note that host and target machine are the same, and different than the
  59. dnl build machine.
  60. CROSS_COMPILE=
  61. if test "x$cross_compiling" = "xyes"; then
  62. case "${host}" in
  63. *-cygwin*)
  64. cross_cache=${srcdir}/cross-build/cygwin.cache
  65. ;;
  66. *-mingw*)
  67. cross_cache=${srcdir}/cross-build/mingw.cache
  68. ;;
  69. i[[3456]]86-*-beos*)
  70. cross_cache=${srcdir}/cross-build/x86-beos.cache
  71. ;;
  72. *) echo "configure: cross-compiling for $host is not supported" >&2
  73. ;;
  74. esac
  75. if test -n "${cross_cache}" && test -r "${cross_cache}"; then
  76. echo "loading cross-build cache file ${cross_cache}"
  77. . ${cross_cache}
  78. fi
  79. unset cross_cache
  80. CROSS_COMPILE='-DCROSS_COMPILING'
  81. AC_SUBST(CROSS_COMPILE)
  82. fi
  83. echo ""
  84. echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
  85. echo ""
  86. # We want these before the checks, so the checks can modify their values.
  87. test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
  88. AC_PROG_MAKE_SET
  89. AC_PROG_CC
  90. dnl AC_AIX
  91. AC_MINIX
  92. # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
  93. test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
  94. AC_PROG_GCC_TRADITIONAL
  95. AC_PROG_INSTALL
  96. AC_CHECK_PROG(AR, ar, , ar)
  97. dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
  98. dnl This allows people to set it when running configure or make
  99. test -n "$ARFLAGS" || ARFLAGS="cr"
  100. AC_PROG_RANLIB
  101. MAKE_SHELL=/bin/sh
  102. AC_SUBST(MAKE_SHELL)
  103. AC_C_CONST
  104. AC_C_PROTOTYPES
  105. AC_C_CHAR_UNSIGNED
  106. AC_C_VOLATILE
  107. AC_TYPE_SIGNAL
  108. AC_TYPE_SIZE_T
  109. AC_CHECK_TYPE(ssize_t, int)
  110. AC_HEADER_STDC
  111. AC_HEADER_STAT
  112. AC_HEADER_DIRENT
  113. AC_CHECK_FUNCS(fcntl kill lstat)
  114. AC_CHECK_FUNCS(memmove putenv select setenv setlocale \
  115. strcasecmp strpbrk tcgetattr vsnprintf)
  116. AC_CHECK_FUNCS(isascii isxdigit)
  117. AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
  118. AC_FUNC_STRCOLL
  119. AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
  120. limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h)
  121. AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h)
  122. AC_CHECK_HEADERS(sys/ptem.h,,,
  123. [[
  124. #if HAVE_SYS_STREAM_H
  125. # include <sys/stream.h>
  126. #endif
  127. ]])
  128. AC_SYS_LARGEFILE
  129. BASH_SYS_SIGNAL_VINTAGE
  130. BASH_SYS_REINSTALL_SIGHANDLERS
  131. BASH_FUNC_POSIX_SETJMP
  132. BASH_FUNC_LSTAT
  133. BASH_FUNC_STRCOLL
  134. BASH_FUNC_CTYPE_NONASCII
  135. BASH_CHECK_GETPW_FUNCS
  136. AC_HEADER_TIOCGWINSZ
  137. BASH_TYPE_SIG_ATOMIC_T
  138. BASH_TYPE_SIGHANDLER
  139. BASH_HAVE_TIOCSTAT
  140. BASH_HAVE_FIONREAD
  141. BASH_CHECK_SPEED_T
  142. BASH_STRUCT_WINSIZE
  143. BASH_STRUCT_DIRENT_D_INO
  144. BASH_STRUCT_DIRENT_D_FILENO
  145. dnl yuck
  146. case "$host_os" in
  147. aix*) prefer_curses=yes ;;
  148. esac
  149. BASH_CHECK_LIB_TERMCAP
  150. if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
  151. if test "$prefer_curses" = yes; then
  152. TERMCAP_LIB=-lcurses
  153. else
  154. TERMCAP_LIB=-ltermcap #default
  155. fi
  156. fi
  157. BASH_CHECK_MULTIBYTE
  158. case "$host_cpu" in
  159. *cray*) LOCAL_CFLAGS=-DCRAY ;;
  160. *s390*) LOCAL_CFLAGS=-fsigned-char ;;
  161. esac
  162. case "$host_os" in
  163. isc*) LOCAL_CFLAGS=-Disc386 ;;
  164. esac
  165. # shared library configuration section
  166. #
  167. # Shared object configuration section. These values are generated by
  168. # ${srcdir}/support/shobj-conf
  169. #
  170. if test -f ${srcdir}/support/shobj-conf; then
  171. AC_MSG_CHECKING(configuration for building shared libraries)
  172. eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
  173. # case "$SHLIB_LIBS" in
  174. # *curses*|*termcap*|*termlib*) ;;
  175. # *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
  176. # esac
  177. AC_SUBST(SHOBJ_CC)
  178. AC_SUBST(SHOBJ_CFLAGS)
  179. AC_SUBST(SHOBJ_LD)
  180. AC_SUBST(SHOBJ_LDFLAGS)
  181. AC_SUBST(SHOBJ_XLDFLAGS)
  182. AC_SUBST(SHOBJ_LIBS)
  183. AC_SUBST(SHOBJ_STATUS)
  184. AC_SUBST(SHLIB_STATUS)
  185. AC_SUBST(SHLIB_XLDFLAGS)
  186. AC_SUBST(SHLIB_DOT)
  187. AC_SUBST(SHLIB_LIBPREF)
  188. AC_SUBST(SHLIB_LIBSUFF)
  189. AC_SUBST(SHLIB_LIBVERSION)
  190. AC_SUBST(SHLIB_DLLVERSION)
  191. AC_SUBST(SHLIB_LIBS)
  192. AC_MSG_RESULT($SHLIB_STATUS)
  193. # SHLIB_STATUS is either `supported' or `unsupported'. If it's
  194. # `unsupported', turn off any default shared library building
  195. if test "$SHLIB_STATUS" = 'unsupported'; then
  196. opt_shared_libs=no
  197. fi
  198. # shared library versioning
  199. # quoted for m4 so I can use character classes
  200. SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
  201. SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
  202. AC_SUBST(SHLIB_MAJOR)
  203. AC_SUBST(SHLIB_MINOR)
  204. fi
  205. if test "$opt_static_libs" = "yes"; then
  206. STATIC_TARGET=static
  207. STATIC_INSTALL_TARGET=install-static
  208. fi
  209. if test "$opt_shared_libs" = "yes"; then
  210. SHARED_TARGET=shared
  211. SHARED_INSTALL_TARGET=install-shared
  212. fi
  213. AC_SUBST(STATIC_TARGET)
  214. AC_SUBST(SHARED_TARGET)
  215. AC_SUBST(STATIC_INSTALL_TARGET)
  216. AC_SUBST(SHARED_INSTALL_TARGET)
  217. case "$build_os" in
  218. msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
  219. *) BUILD_DIR=`pwd` ;;
  220. esac
  221. case "$BUILD_DIR" in
  222. *\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
  223. *) ;;
  224. esac
  225. AC_SUBST(PURIFY)
  226. AC_SUBST(BUILD_DIR)
  227. AC_SUBST(CFLAGS)
  228. AC_SUBST(LOCAL_CFLAGS)
  229. AC_SUBST(LOCAL_LDFLAGS)
  230. AC_SUBST(LOCAL_DEFS)
  231. AC_SUBST(AR)
  232. AC_SUBST(ARFLAGS)
  233. AC_SUBST(host_cpu)
  234. AC_SUBST(host_os)
  235. AC_SUBST(LIBVERSION)
  236. AC_SUBST(TERMCAP_LIB)
  237. AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile],
  238. [
  239. # Makefile uses this timestamp file to record whether config.h is up to date.
  240. echo > stamp-h
  241. ])