source: trunk/indexers/mgpp/aclocal.m4@ 8950

Last change on this file since 8950 was 3365, checked in by kjdon, 22 years ago

Initial revision

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 KB
Line 
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
11AC_DEFUN(fp_C_PROTOTYPES,
12[AC_REQUIRE([fp_PROG_CC_STDC])
13AC_MSG_CHECKING([for function prototypes])
14if test "$ac_cv_prog_cc_stdc" != no; then
15 AC_MSG_RESULT(yes)
16 AC_DEFINE(PROTOTYPES)
17 U= ANSI2KNR=
18else
19 AC_MSG_RESULT(no)
20 U=_ ANSI2KNR=ansi2knr
21fi
22AC_SUBST(U)dnl
23AC_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
46AC_DEFUN(fp_PROG_CC_STDC,
47[AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
48AC_CACHE_VAL(ac_cv_prog_cc_stdc,
49[ac_cv_prog_cc_stdc=no
50ac_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
57for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc
58do
59 CFLAGS="$ac_save_CFLAGS $ac_arg"
60 AC_TRY_COMPILE(
61[#if !defined(__STDC__) || __STDC__ != 1
62choke me
63#endif
64], [int test (int i, double x);
65struct s1 {int (*f) (int a);};
66struct s2 {int (*f) (double a);};],
67[ac_cv_prog_cc_stdc="$ac_arg"; break])
68done
69CFLAGS="$ac_save_CFLAGS"
70])
71AC_MSG_RESULT($ac_cv_prog_cc_stdc)
72case "x$ac_cv_prog_cc_stdc" in
73 x|xno) ;;
74 *) CC="$CC $ac_cv_prog_cc_stdc" ;;
75esac
76])
77
78## --------------------------------------------------------- ##
79## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
80## substitution. ##
81## --------------------------------------------------------- ##
82
83AC_DEFUN(fp_PROG_INSTALL,
84[AC_PROG_INSTALL
85test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755'
86AC_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
107AC_DEFUN(fp_WITH_DMALLOC,
108[AC_MSG_CHECKING(if malloc debugging is wanted)
109AC_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"
117else
118 AC_MSG_RESULT(no)
119fi], [AC_MSG_RESULT(no)])
120])
121
122## --------------------------------- ##
123## Check if --with-regex was given. ##
124## --------------------------------- ##
125
126AC_DEFUN(fp_WITH_REGEX,
127[AC_MSG_CHECKING(which of rx or regex is wanted)
128AC_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)
134 LIBOBJS="$LIBOBJS regex.o"
135fi])
136if 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)
145 [LIBOBJS="$LIBOBJS regex.o"]
146 else
147 [LIBOBJS="$LIBOBJS rx.o"]
148 fi]
149 )
150fi
151AC_SUBST(LIBOBJS)dnl
152])
153
154
155## --------------------------------------- ##
156## Check if --with-gnu-readline was given. ##
157## --------------------------------------- ##
158
159AC_DEFUN(fp_WITH_GNU_READLINE,
160[AC_MSG_CHECKING(whether GNU readline requested)
161 AC_ARG_WITH(gnu_readline,
162 [ --with-gnu-readline compile with GNU readline support],
163 [if test "$withval" = yes; then
164 AC_MSG_RESULT(yes)
165 ac_with_gnu_readline=1
166 else
167 AC_MSG_RESULT(no)
168 fi],
169 AC_MSG_RESULT(no))
170
171 if test -n "$ac_with_gnu_readline"; then
172 AC_CHECK_HEADER(readline/readline.h, ac_mg_readline_header_found=1,
173 AC_MSG_WARN(Can't find GNU readline headers; configuring without \
174GNU readline support))
175 if test -n "$ac_mg_readline_header_found"; then
176 # first check whether we can find the readline library itself
177 AC_CHECK_LIB(readline, main,
178 [ac_mg_readline_lib_found=1
179 AC_DEFINE(WITH_GNU_READLINE)
180 LIBS="$LIBS -lreadline"],
181 AC_MSG_WARN(Can't find GNU readline library; configuring without \
182GNU readline support))
183 if test -n "$ac_mg_readline_lib_found"; then
184 # on some systems, readline needs curses. It is difficult to
185 # determine whether this is necessary on the current system,
186 # since other undefined symbols can be turned up by an
187 # AC_CHECK_LIB(readline, readline) test that are actually defined
188 # by mg itself (e.g. xmalloc, xrealloc). So, if we find libcurses,
189 # we just bung it on and hope for the best.
190 AC_CHECK_LIB(curses, main,
191 LIBS="$LIBS -lcurses")
192 fi
193 fi
194 fi
195])
196
197
198
199#AC_DEFUN(fp_WITH_GNU_READLINE,
200#[AC_MSG_CHECKING(whether GNU readline requested)
201# AC_ARG_WITH(gnu-readline,
202# [ --with-gnu-readline compile with GNU readline support],
203# [if test "$withval" = yes; then
204# AC_MSG_RESULT(yes)
205# ac_with_gnu_readline=1
206# else
207# AC_MSG_RESULT(no)
208# fi],
209# AC_MSG_RESULT(no))
210# if test -n "$ac_with_gnu_readline"; then
211# AC_CHECK_LIB(readline, main,
212# AC_CHECK_HEADER(readline/readline.h,
213# [AC_DEFINE(WITH_GNU_READLINE)
214## curses required on some systems (DEC OSF/1), but not on others (GNU/Linux,
215## Solaris 2.6). Forcing its inclusion is unsophisticated; if it causes
216## any actual problems on any UNIX platforms, let the maintainer know.
217# LIBS="$LIBS -lreadline -lcurses"],
218# AC_MSG_WARN(Can't find GNU readline headers: configuring \
219#without GNU readline support)
220# ),
221# AC_MSG_WARN(Can't find GNU readline library: configuring \
222#without GNU readline support)
223# )
224# fi
225#])
Note: See TracBrowser for help on using the repository browser.