[3365] | 1 | # Local additions to Autoconf macros.
|
---|
| 2 | # Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
|
---|
| 3 | # François Pinard <[email protected]>, 1992.
|
---|
| 4 |
|
---|
| 5 | # [TS:Aug/95] - chopped out the NLS stuff which I don't support
|
---|
| 6 |
|
---|
| 7 | ## ------------------------------- ##
|
---|
| 8 | ## Check for function prototypes. ##
|
---|
| 9 | ## ------------------------------- ##
|
---|
| 10 |
|
---|
| 11 | AC_DEFUN(fp_C_PROTOTYPES,
|
---|
| 12 | [AC_REQUIRE([fp_PROG_CC_STDC])
|
---|
| 13 | AC_MSG_CHECKING([for function prototypes])
|
---|
| 14 | if test "$ac_cv_prog_cc_stdc" != no; then
|
---|
| 15 | AC_MSG_RESULT(yes)
|
---|
| 16 | AC_DEFINE(PROTOTYPES)
|
---|
| 17 | U= ANSI2KNR=
|
---|
| 18 | else
|
---|
| 19 | AC_MSG_RESULT(no)
|
---|
| 20 | U=_ ANSI2KNR=ansi2knr
|
---|
| 21 | fi
|
---|
| 22 | AC_SUBST(U)dnl
|
---|
| 23 | AC_SUBST(ANSI2KNR)dnl
|
---|
| 24 | ])
|
---|
| 25 |
|
---|
| 26 | ## ----------------------------------------- ##
|
---|
| 27 | ## ANSIfy the C compiler whenever possible. ##
|
---|
| 28 | ## ----------------------------------------- ##
|
---|
| 29 |
|
---|
| 30 | # @defmac AC_PROG_CC_STDC
|
---|
| 31 | # @maindex PROG_CC_STDC
|
---|
| 32 | # @ovindex CC
|
---|
| 33 | # If the C compiler in not in ANSI C mode by default, try to add an option
|
---|
| 34 | # to output variable @code{CC} to make it so. This macro tries various
|
---|
| 35 | # options that select ANSI C on some system or another. It considers the
|
---|
| 36 | # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
|
---|
| 37 | # handles function prototypes correctly.
|
---|
| 38 | #
|
---|
| 39 | # If you use this macro, you should check after calling it whether the C
|
---|
| 40 | # compiler has been set to accept ANSI C; if not, the shell variable
|
---|
| 41 | # @code{ac_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
|
---|
| 42 | # code in ANSI C, you can make an un-ANSIfied copy of it by using the
|
---|
| 43 | # program @code{ansi2knr}, which comes with Ghostscript.
|
---|
| 44 | # @end defmac
|
---|
| 45 |
|
---|
| 46 | AC_DEFUN(fp_PROG_CC_STDC,
|
---|
| 47 | [AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
|
---|
| 48 | AC_CACHE_VAL(ac_cv_prog_cc_stdc,
|
---|
| 49 | [ac_cv_prog_cc_stdc=no
|
---|
| 50 | ac_save_CFLAGS="$CFLAGS"
|
---|
| 51 | # Don't try gcc -ansi; that turns off useful extensions and
|
---|
| 52 | # breaks some systems' header files.
|
---|
| 53 | # AIX -qlanglvl=ansi
|
---|
| 54 | # Ultrix and OSF/1 -std1
|
---|
| 55 | # HP-UX -Aa -D_HPUX_SOURCE
|
---|
| 56 | # SVR4 -Xc
|
---|
| 57 | for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc
|
---|
| 58 | do
|
---|
| 59 | CFLAGS="$ac_save_CFLAGS $ac_arg"
|
---|
| 60 | AC_TRY_COMPILE(
|
---|
| 61 | [#if !defined(__STDC__) || __STDC__ != 1
|
---|
| 62 | choke me
|
---|
| 63 | #endif
|
---|
| 64 | ], [int test (int i, double x);
|
---|
| 65 | struct s1 {int (*f) (int a);};
|
---|
| 66 | struct s2 {int (*f) (double a);};],
|
---|
| 67 | [ac_cv_prog_cc_stdc="$ac_arg"; break])
|
---|
| 68 | done
|
---|
| 69 | CFLAGS="$ac_save_CFLAGS"
|
---|
| 70 | ])
|
---|
| 71 | AC_MSG_RESULT($ac_cv_prog_cc_stdc)
|
---|
| 72 | case "x$ac_cv_prog_cc_stdc" in
|
---|
| 73 | x|xno) ;;
|
---|
| 74 | *) CC="$CC $ac_cv_prog_cc_stdc" ;;
|
---|
| 75 | esac
|
---|
| 76 | ])
|
---|
| 77 |
|
---|
| 78 | ## --------------------------------------------------------- ##
|
---|
| 79 | ## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
|
---|
| 80 | ## substitution. ##
|
---|
| 81 | ## --------------------------------------------------------- ##
|
---|
| 82 |
|
---|
| 83 | AC_DEFUN(fp_PROG_INSTALL,
|
---|
| 84 | [AC_PROG_INSTALL
|
---|
| 85 | test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755'
|
---|
| 86 | AC_SUBST(INSTALL_SCRIPT)dnl
|
---|
| 87 | ])
|
---|
| 88 |
|
---|
| 89 | ## ----------------------------------- ##
|
---|
| 90 | ## Check if --with-dmalloc was given. ##
|
---|
| 91 | ## ----------------------------------- ##
|
---|
| 92 |
|
---|
| 93 | # I just checked, and GNU rx seems to work fine with a slightly
|
---|
| 94 | # modified GNU m4. So, I put out the test below in my aclocal.m4,
|
---|
| 95 | # and will try to use it in my things. The idea is to distribute
|
---|
| 96 | # rx.[hc] and regex.[hc] together, for a while. The WITH_REGEX symbol
|
---|
| 97 | # (which should also be documented in acconfig.h) is used to decide
|
---|
| 98 | # which of regex.h or rx.h should be included in the application.
|
---|
| 99 | #
|
---|
| 100 | # If `./configure --with-regex' is given, the package will use
|
---|
| 101 | # the older regex. Else, a check is made to see if rx is already
|
---|
| 102 | # installed, as with newer Linux'es. If not found, the package will
|
---|
| 103 | # use the rx from the distribution. If found, the package will use
|
---|
| 104 | # the system's rx which, on Linux at least, will result in a smaller
|
---|
| 105 | # executable file.
|
---|
| 106 |
|
---|
| 107 | AC_DEFUN(fp_WITH_DMALLOC,
|
---|
| 108 | [AC_MSG_CHECKING(if malloc debugging is wanted)
|
---|
| 109 | AC_ARG_WITH(dmalloc,
|
---|
| 110 | [ --with-dmalloc use dmalloc, as in
|
---|
| 111 | ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
|
---|
| 112 | [if test "$withval" = yes; then
|
---|
| 113 | AC_MSG_RESULT(yes)
|
---|
| 114 | AC_DEFINE(WITH_DMALLOC)
|
---|
| 115 | LIBS="$LIBS -ldmalloc"
|
---|
| 116 | LDFLAGS="$LDFLAGS -g"
|
---|
| 117 | else
|
---|
| 118 | AC_MSG_RESULT(no)
|
---|
| 119 | fi], [AC_MSG_RESULT(no)])
|
---|
| 120 | ])
|
---|
| 121 |
|
---|
| 122 | ## --------------------------------- ##
|
---|
| 123 | ## Check if --with-regex was given. ##
|
---|
| 124 | ## --------------------------------- ##
|
---|
| 125 |
|
---|
| 126 | AC_DEFUN(fp_WITH_REGEX,
|
---|
| 127 | [AC_MSG_CHECKING(which of rx or regex is wanted)
|
---|
| 128 | AC_ARG_WITH(regex,
|
---|
| 129 | [ --with-regex use older regex in lieu of GNU rx for matching],
|
---|
| 130 | [if test "$withval" = yes; then
|
---|
| 131 | ac_with_regex=1
|
---|
| 132 | AC_MSG_RESULT(regex)
|
---|
| 133 | AC_DEFINE(WITH_REGEX)
|
---|
[10711] | 134 | AC_LIBOBJ([regex])
|
---|
[3365] | 135 | fi])
|
---|
| 136 | if test -z "$ac_with_regex"; then
|
---|
| 137 | AC_MSG_RESULT(rx)
|
---|
| 138 | AC_CHECK_FUNC(re_rx_search, ,
|
---|
| 139 | [AC_CHECK_SIZEOF(unsigned char *, unsigned char *)
|
---|
| 140 | if test "$ac_cv_sizeof_unsigned_char_p" = 8
|
---|
| 141 | then
|
---|
| 142 | AC_MSG_WARN(I'm forcing you to use regex because I can't
|
---|
| 143 | find a local rx library and the one included with this
|
---|
| 144 | distribution doesn't work on 64-bit machines like yours)
|
---|
[10711] | 145 | AC_LIBOBJ([regex])
|
---|
[3365] | 146 | else
|
---|
[10711] | 147 | AC_LIBOBJ([rx])
|
---|
[3365] | 148 | fi]
|
---|
| 149 | )
|
---|
| 150 | fi
|
---|
| 151 | ])
|
---|
| 152 |
|
---|
| 153 |
|
---|
| 154 | ## --------------------------------------- ##
|
---|
| 155 | ## Check if --with-gnu-readline was given. ##
|
---|
| 156 | ## --------------------------------------- ##
|
---|
| 157 |
|
---|
| 158 | AC_DEFUN(fp_WITH_GNU_READLINE,
|
---|
| 159 | [AC_MSG_CHECKING(whether GNU readline requested)
|
---|
| 160 | AC_ARG_WITH(gnu_readline,
|
---|
| 161 | [ --with-gnu-readline compile with GNU readline support],
|
---|
| 162 | [if test "$withval" = yes; then
|
---|
| 163 | AC_MSG_RESULT(yes)
|
---|
| 164 | ac_with_gnu_readline=1
|
---|
| 165 | else
|
---|
| 166 | AC_MSG_RESULT(no)
|
---|
| 167 | fi],
|
---|
| 168 | AC_MSG_RESULT(no))
|
---|
| 169 |
|
---|
| 170 | if test -n "$ac_with_gnu_readline"; then
|
---|
| 171 | AC_CHECK_HEADER(readline/readline.h, ac_mg_readline_header_found=1,
|
---|
| 172 | AC_MSG_WARN(Can't find GNU readline headers; configuring without \
|
---|
| 173 | GNU readline support))
|
---|
| 174 | if test -n "$ac_mg_readline_header_found"; then
|
---|
| 175 | # first check whether we can find the readline library itself
|
---|
| 176 | AC_CHECK_LIB(readline, main,
|
---|
| 177 | [ac_mg_readline_lib_found=1
|
---|
| 178 | AC_DEFINE(WITH_GNU_READLINE)
|
---|
| 179 | LIBS="$LIBS -lreadline"],
|
---|
| 180 | AC_MSG_WARN(Can't find GNU readline library; configuring without \
|
---|
| 181 | GNU readline support))
|
---|
| 182 | if test -n "$ac_mg_readline_lib_found"; then
|
---|
| 183 | # on some systems, readline needs curses. It is difficult to
|
---|
| 184 | # determine whether this is necessary on the current system,
|
---|
| 185 | # since other undefined symbols can be turned up by an
|
---|
| 186 | # AC_CHECK_LIB(readline, readline) test that are actually defined
|
---|
| 187 | # by mg itself (e.g. xmalloc, xrealloc). So, if we find libcurses,
|
---|
| 188 | # we just bung it on and hope for the best.
|
---|
| 189 | AC_CHECK_LIB(curses, main,
|
---|
| 190 | LIBS="$LIBS -lcurses")
|
---|
| 191 | fi
|
---|
| 192 | fi
|
---|
| 193 | fi
|
---|
| 194 | ])
|
---|
| 195 |
|
---|
| 196 |
|
---|
| 197 |
|
---|
| 198 | #AC_DEFUN(fp_WITH_GNU_READLINE,
|
---|
| 199 | #[AC_MSG_CHECKING(whether GNU readline requested)
|
---|
| 200 | # AC_ARG_WITH(gnu-readline,
|
---|
| 201 | # [ --with-gnu-readline compile with GNU readline support],
|
---|
| 202 | # [if test "$withval" = yes; then
|
---|
| 203 | # AC_MSG_RESULT(yes)
|
---|
| 204 | # ac_with_gnu_readline=1
|
---|
| 205 | # else
|
---|
| 206 | # AC_MSG_RESULT(no)
|
---|
| 207 | # fi],
|
---|
| 208 | # AC_MSG_RESULT(no))
|
---|
| 209 | # if test -n "$ac_with_gnu_readline"; then
|
---|
| 210 | # AC_CHECK_LIB(readline, main,
|
---|
| 211 | # AC_CHECK_HEADER(readline/readline.h,
|
---|
| 212 | # [AC_DEFINE(WITH_GNU_READLINE)
|
---|
| 213 | ## curses required on some systems (DEC OSF/1), but not on others (GNU/Linux,
|
---|
| 214 | ## Solaris 2.6). Forcing its inclusion is unsophisticated; if it causes
|
---|
| 215 | ## any actual problems on any UNIX platforms, let the maintainer know.
|
---|
| 216 | # LIBS="$LIBS -lreadline -lcurses"],
|
---|
| 217 | # AC_MSG_WARN(Can't find GNU readline headers: configuring \
|
---|
| 218 | #without GNU readline support)
|
---|
| 219 | # ),
|
---|
| 220 | # AC_MSG_WARN(Can't find GNU readline library: configuring \
|
---|
| 221 | #without GNU readline support)
|
---|
| 222 | # )
|
---|
| 223 | # fi
|
---|
| 224 | #])
|
---|