import of readline-4.3
[external/binutils.git] / readline / configure.in
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 AC_REVISION([for Readline 4.3, version 2.45, from autoconf version] AC_ACVERSION)
8
9 AC_INIT(readline, 4.3, bug-readline@gnu.org)
10
11 dnl make sure we are using a recent autoconf version
12 AC_PREREQ(2.50)
13
14 AC_CONFIG_SRCDIR(readline.h)
15 AC_CONFIG_AUX_DIR(./support)
16 AC_CONFIG_HEADERS(config.h)
17
18 dnl update the value of RL_READLINE_VERSION in readline.h when this changes
19 LIBVERSION=4.3
20
21 AC_CANONICAL_HOST
22
23 dnl configure defaults
24 opt_curses=no
25
26 dnl arguments to configure
27 AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
28
29 if test "$opt_curses" = "yes"; then
30         prefer_curses=yes
31 fi
32
33 dnl option parsing for optional features
34 opt_static_libs=yes
35 opt_shared_libs=yes
36
37 AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
38 AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
39
40 echo ""
41 echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
42 echo ""
43
44 # We want these before the checks, so the checks can modify their values.
45 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
46
47 AC_PROG_MAKE_SET
48 AC_PROG_CC
49 dnl AC_AIX
50 AC_MINIX
51
52 # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
53 test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
54
55 AC_PROG_GCC_TRADITIONAL
56 AC_PROG_INSTALL
57 AC_CHECK_PROG(AR, ar, , ar)
58 dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
59 dnl This allows people to set it when running configure or make
60 test -n "$ARFLAGS" || ARFLAGS="cr"
61 AC_PROG_RANLIB
62
63 MAKE_SHELL=/bin/sh
64 AC_SUBST(MAKE_SHELL)
65
66 AC_C_CONST
67 AC_C_PROTOTYPES
68 AC_C_CHAR_UNSIGNED
69
70 AC_TYPE_SIGNAL
71
72 AC_TYPE_SIZE_T
73 AC_CHECK_TYPE(ssize_t, int)
74
75 AC_HEADER_STAT
76 AC_HEADER_DIRENT
77
78 AC_CHECK_FUNCS(lstat memmove putenv select setenv setlocale \
79                 strcasecmp strpbrk tcgetattr vsnprintf isascii isxdigit)
80
81 AC_FUNC_STRCOLL
82
83 AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
84                 limits.h sys/ptem.h sys/pte.h sys/stream.h sys/select.h \
85                 termcap.h termios.h termio.h sys/file.h locale.h memory.h )
86
87 BASH_SYS_SIGNAL_VINTAGE
88 BASH_SYS_REINSTALL_SIGHANDLERS
89
90 BASH_FUNC_POSIX_SETJMP
91 BASH_FUNC_LSTAT
92 BASH_FUNC_STRCOLL
93
94 BASH_CHECK_GETPW_FUNCS
95
96 AC_HEADER_TIOCGWINSZ
97
98 BASH_TYPE_SIGHANDLER
99 BASH_HAVE_TIOCSTAT
100 BASH_HAVE_FIONREAD
101 BASH_CHECK_SPEED_T
102 BASH_STRUCT_WINSIZE
103 BASH_STRUCT_DIRENT_D_INO
104 BASH_STRUCT_DIRENT_D_FILENO
105
106 dnl yuck
107 case "$host_os" in
108 aix*)   prefer_curses=yes ;;
109 esac
110 BASH_CHECK_LIB_TERMCAP
111 if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
112         if test "$prefer_curses" = yes; then
113                 TERMCAP_LIB=-lcurses
114         else
115                 TERMCAP_LIB=-ltermcap   #default
116         fi
117 fi
118
119 BASH_CHECK_MULTIBYTE
120
121 case "$host_cpu" in
122 *cray*) LOCAL_CFLAGS=-DCRAY ;;
123 *s390*) LOCAL_CFLAGS=-fsigned-char ;;
124 esac
125
126 case "$host_os" in
127 isc*)   LOCAL_CFLAGS=-Disc386 ;;
128 esac
129
130 # shared library configuration section
131 #
132 # Shared object configuration section.  These values are generated by
133 # ${srcdir}/support/shobj-conf
134 #
135 if test -f ${srcdir}/support/shobj-conf; then
136         AC_MSG_CHECKING(configuration for building shared libraries)
137         eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
138         AC_SUBST(SHOBJ_CC)
139         AC_SUBST(SHOBJ_CFLAGS)
140         AC_SUBST(SHOBJ_LD)
141         AC_SUBST(SHOBJ_LDFLAGS)
142         AC_SUBST(SHOBJ_XLDFLAGS)
143         AC_SUBST(SHOBJ_LIBS)
144         AC_SUBST(SHOBJ_STATUS)
145         AC_SUBST(SHLIB_STATUS)
146         AC_SUBST(SHLIB_XLDFLAGS)
147         AC_SUBST(SHLIB_LIBSUFF)
148         AC_SUBST(SHLIB_LIBVERSION)
149         AC_SUBST(SHLIB_LIBS)
150         AC_MSG_RESULT($SHLIB_STATUS)
151
152         # SHLIB_STATUS is either `supported' or `unsupported'.  If it's
153         # `unsupported', turn off any default shared library building
154         if test "$SHLIB_STATUS" = 'unsupported'; then
155                 opt_shared_libs=no
156         fi
157
158         # shared library versioning
159         # quoted for m4 so I can use character classes
160         SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
161         SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
162         AC_SUBST(SHLIB_MAJOR)
163         AC_SUBST(SHLIB_MINOR)
164 fi
165
166 if test "$opt_static_libs" = "yes"; then
167         STATIC_TARGET=static
168         STATIC_INSTALL_TARGET=install-static
169 fi
170 if test "$opt_shared_libs" = "yes"; then
171         SHARED_TARGET=shared
172         SHARED_INSTALL_TARGET=install-shared
173 fi
174
175 AC_SUBST(STATIC_TARGET)
176 AC_SUBST(SHARED_TARGET)
177 AC_SUBST(STATIC_INSTALL_TARGET)
178 AC_SUBST(SHARED_INSTALL_TARGET)
179
180 case "$host_os" in
181 msdosdjgpp*)    BUILD_DIR=`pwd.exe` ;;  # to prevent //d/path/file
182 *)              BUILD_DIR=`pwd` ;;
183 esac
184
185 AC_SUBST(BUILD_DIR)
186
187 AC_SUBST(CFLAGS)
188 AC_SUBST(LOCAL_CFLAGS)
189 AC_SUBST(LOCAL_LDFLAGS)
190 AC_SUBST(LOCAL_DEFS)
191
192 AC_SUBST(AR)
193 AC_SUBST(ARFLAGS)
194
195 AC_SUBST(host_cpu)
196 AC_SUBST(host_os)
197
198 AC_SUBST(LIBVERSION)
199
200 AC_SUBST(TERMCAP_LIB)
201
202 AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile],
203 [
204 # Makefile uses this timestamp file to record whether config.h is up to date.
205 echo > stamp-h
206 ])