| 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.0, version 2.14, from autoconf version] AC_ACVERSION) |
| 8 | LIBVERSION=4.0 |
| 9 | |
| 10 | AC_INIT(readline.h) |
| 11 | AC_CONFIG_HEADER(config.h) |
| 12 | |
| 13 | dnl make sure we are using a recent autoconf version |
| 14 | AC_PREREQ(2.10) |
| 15 | |
| 16 | dnl AC_CONFIG_AUX_DIR(./support) |
| 17 | |
| 18 | AC_CANONICAL_HOST |
| 19 | |
| 20 | dnl configure defaults |
| 21 | opt_curses=no |
| 22 | opt_shared=no |
| 23 | |
| 24 | dnl arguments to configure |
| 25 | AC_ARG_WITH(curses, --with-curses use the curses library instead of the termcap library,opt_curses=$withval) |
| 26 | |
| 27 | if test "$opt_curses" = "yes"; then |
| 28 | prefer_curses=yes |
| 29 | fi |
| 30 | |
| 31 | # We want these before the checks, so the checks can modify their values. |
| 32 | test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1 |
| 33 | |
| 34 | AC_PROG_CC |
| 35 | AC_MINIX |
| 36 | |
| 37 | dnl BEGIN changes for CYGNUS cross-building for Cygwin |
| 38 | |
| 39 | dnl load up the cross-building cache file -- add more cases and cache |
| 40 | dnl files as necessary |
| 41 | if test "x$cross_compiling" = "xyes"; then |
| 42 | case "${host}" in |
| 43 | *-cygwin*) |
| 44 | cross_cache=${srcdir}/cross-build/cygwin.cache |
| 45 | if test -r "${cross_cache}"; then |
| 46 | echo "loading cross-build cache file ${cross_cache}" |
| 47 | . ${cross_cache} |
| 48 | fi |
| 49 | LOCAL_CFLAGS="$LOCAL_CFLAGS -I${srcdir}/../libtermcap" |
| 50 | unset cross_cache |
| 51 | ;; |
| 52 | *) echo "configure: cross-compiling for a non-cygwin target is not supported" >&2 |
| 53 | ;; |
| 54 | esac |
| 55 | fi |
| 56 | |
| 57 | if test "x$cross_compiling" = "xyes"; then |
| 58 | CROSS_COMPILING_FLAG=-DCROSS_COMPILING |
| 59 | else |
| 60 | CROSS_COMPILING_FLAG= |
| 61 | fi |
| 62 | AC_SUBST(CROSS_COMPILING_FLAG) |
| 63 | |
| 64 | if test -z "$CC_FOR_BUILD"; then |
| 65 | if test "x$cross_compiling" = "xno"; then |
| 66 | CC_FOR_BUILD='$(CC)' |
| 67 | else |
| 68 | CC_FOR_BUILD=gcc |
| 69 | fi |
| 70 | fi |
| 71 | AC_SUBST(CC_FOR_BUILD) |
| 72 | |
| 73 | dnl END changes for CYGNUS cross-building for Cygwin |
| 74 | |
| 75 | # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS. |
| 76 | test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O" |
| 77 | |
| 78 | AC_PROG_GCC_TRADITIONAL |
| 79 | AC_PROG_INSTALL |
| 80 | AC_CHECK_PROG(AR, ar, ar) |
| 81 | dnl Set default for ARFLAGS, since autoconf does not have a macro for it. |
| 82 | dnl This allows people to set it when running configure or make |
| 83 | test -n "$ARFLAGS" || ARFLAGS="cr" |
| 84 | AC_PROG_RANLIB |
| 85 | |
| 86 | MAKE_SHELL=/bin/sh |
| 87 | AC_SUBST(MAKE_SHELL) |
| 88 | |
| 89 | AC_RETSIGTYPE |
| 90 | |
| 91 | AC_HEADER_STAT |
| 92 | AC_HEADER_DIRENT |
| 93 | |
| 94 | AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat) |
| 95 | |
| 96 | AC_FUNC_STRCOLL |
| 97 | |
| 98 | AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h stdarg.h string.h \ |
| 99 | sys/ptem.h sys/pte.h sys/stream.h sys/select.h \ |
| 100 | termcap.h termios.h termio.h sys/file.h locale.h) |
| 101 | |
| 102 | BASH_SIGNAL_CHECK |
| 103 | BASH_REINSTALL_SIGHANDLERS |
| 104 | |
| 105 | BASH_FUNC_POSIX_SETJMP |
| 106 | BASH_FUNC_LSTAT |
| 107 | BASH_CHECK_GETPW_FUNCS |
| 108 | BASH_FUNC_STRCOLL |
| 109 | |
| 110 | BASH_TYPE_SIGHANDLER |
| 111 | BASH_HAVE_TIOCGWINSZ |
| 112 | BASH_HAVE_TIOCSTAT |
| 113 | BASH_HAVE_FIONREAD |
| 114 | BASH_MISC_SPEED_T |
| 115 | BASH_STRUCT_WINSIZE |
| 116 | BASH_STRUCT_DIRENT_D_INO |
| 117 | BASH_STRUCT_DIRENT_D_FILENO |
| 118 | |
| 119 | dnl yuck |
| 120 | case "$host_os" in |
| 121 | aix*) prefer_curses=yes ;; |
| 122 | esac |
| 123 | BASH_CHECK_LIB_TERMCAP |
| 124 | if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then |
| 125 | TERMCAP_LIB=-ltermcap #default |
| 126 | fi |
| 127 | |
| 128 | case "$host_cpu" in |
| 129 | *cray*) LOCAL_CFLAGS=-DCRAY ;; |
| 130 | esac |
| 131 | |
| 132 | case "$host_os" in |
| 133 | isc*) LOCAL_CFLAGS=-Disc386 ;; |
| 134 | esac |
| 135 | |
| 136 | # shared library configuration section |
| 137 | # |
| 138 | # Shared object configuration section. These values are generated by |
| 139 | # ${srcdir}/support/shobj-conf |
| 140 | # |
| 141 | if test -f ${srcdir}/support/shobj-conf; then |
| 142 | AC_MSG_CHECKING(configuration for building shared libraries) |
| 143 | eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C ${CC} -c ${host_cpu} -o ${host_os} -v ${host_vendor}` |
| 144 | AC_SUBST(SHOBJ_CC) |
| 145 | AC_SUBST(SHOBJ_CFLAGS) |
| 146 | AC_SUBST(SHOBJ_LD) |
| 147 | AC_SUBST(SHOBJ_LDFLAGS) |
| 148 | AC_SUBST(SHOBJ_XLDFLAGS) |
| 149 | AC_SUBST(SHOBJ_LIBS) |
| 150 | AC_SUBST(SHOBJ_STATUS) |
| 151 | AC_SUBST(SHLIB_STATUS) |
| 152 | AC_SUBST(SHLIB_XLDFLAGS) |
| 153 | AC_SUBST(SHLIB_LIBSUFF) |
| 154 | AC_SUBST(SHLIB_LIBVERSION) |
| 155 | AC_SUBST(SHLIB_LIBS) |
| 156 | AC_MSG_RESULT($SHLIB_STATUS) |
| 157 | fi |
| 158 | |
| 159 | BUILD_DIR=`pwd` |
| 160 | AC_SUBST(BUILD_DIR) |
| 161 | |
| 162 | AC_SUBST(CFLAGS) |
| 163 | AC_SUBST(LOCAL_CFLAGS) |
| 164 | AC_SUBST(LOCAL_LDFLAGS) |
| 165 | AC_SUBST(LOCAL_DEFS) |
| 166 | |
| 167 | AC_SUBST(AR) |
| 168 | AC_SUBST(ARFLAGS) |
| 169 | |
| 170 | AC_SUBST(host_cpu) |
| 171 | AC_SUBST(host_os) |
| 172 | |
| 173 | AC_SUBST(LIBVERSION) |
| 174 | |
| 175 | AC_SUBST(TERMCAP_LIB) |
| 176 | |
| 177 | AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile], |
| 178 | [ |
| 179 | # Makefile uses this timestamp file to record whether config.h is up to date. |
| 180 | echo > stamp-h |
| 181 | ]) |