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