1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/crossref.c])
4 AM_INIT_AUTOMAKE(cscope, 15.8a)
5 AC_CONFIG_HEADERS([config.h:config.h.in])
9 dnl User specification of lexer
11 dnl User specification of yacc
14 dnl Checks for programs.
20 AM_CONDITIONAL(USING_LEX, test "x$LEX" = "xlex")
21 if test "x$LEX" = "xlex" ; then AC_DEFINE(USING_LEX, 1,
22 [Define this if the scanner is run through lex, not flex])
26 dnl === BEGIN CURSES CHECK
27 dnl Curses detection: Munged from Midnight Commander's configure.in
32 dnl - Determine which version of curses is installed on your system
33 dnl and set the -I/-L/-l compiler entries and add a few preprocessor
35 dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that
36 dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in
38 dnl - Modify the following configure variables (these are the only
39 dnl curses.m4 variables you can access from within configure.in)
40 dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if
41 dnl an ncurses.h that's been renamed to curses.h
43 dnl CURSES_LIBS - sets -L and -l's appropriately
44 dnl CFLAGS - if --with-sco, add -D_SVID3
45 dnl has_curses - exports result of tests to rest of configure
49 dnl 1) Add lines indicated below to acconfig.h
50 dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in
51 dnl 3) Instead of #include <curses.h> you should use the following to
52 dnl properly locate ncurses or curses header file
54 dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
55 dnl #include <ncurses.h>
57 dnl #include <curses.h>
60 dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags
61 dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS
63 dnl Notes with automake:
64 dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from
66 dnl - your Makefile.am can look something like this
67 dnl -----------------------------------------------
68 dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR)
70 dnl CURSES_TARGETS=name_of_curses_prog
72 dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS)
73 dnl other_programs_SOURCES = blah blah blah
74 dnl name_of_curses_prog_SOURCES = blah blah blah
75 dnl other_programs_LDADD = blah
76 dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS)
77 dnl -----------------------------------------------
80 dnl The following lines should be added to acconfig.h:
81 dnl ==================================================
83 dnl /*=== Curses version detection defines ===*/
84 dnl /* Found some version of curses that we're going to use */
87 dnl /* Use SunOS SysV curses? */
88 dnl #undef USE_SUNOS_CURSES
90 dnl /* Use old BSD curses - not used right now */
91 dnl #undef USE_BSD_CURSES
93 dnl /* Use SystemV curses? */
94 dnl #undef USE_SYSV_CURSES
96 dnl /* Use Ncurses? */
97 dnl #undef USE_NCURSES
99 dnl /* If you Curses does not have color define this one */
100 dnl #undef NO_COLOR_CURSES
102 dnl /* Define if you want to turn on SCO-specific code */
103 dnl #undef SCO_FLAVOR
105 dnl /* Set to reflect version of ncurses *
106 dnl * 0 = version 1.*
107 dnl * 1 = version 1.9.9g
108 dnl * 2 = version 4.0/4.1 */
109 dnl #undef NCURSES_970530
111 dnl /*=== End new stuff for acconfig.h ===*/
115 AC_DEFUN([AC_CHECK_CURSES],[
122 AC_SUBST(CURSES_LIBS)
123 AC_SUBST(CURSES_INCLUDEDIR)
126 [ --with-sco Use this to turn on SCO-specific code],[
127 if test x$withval = xyes; then
128 AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
129 CFLAGS="$CFLAGS -D_SVID3"
133 AC_ARG_WITH(sunos-curses,
134 [ --with-sunos-curses Used to force SunOS 4.x curses],[
135 if test x$withval = xyes; then
140 AC_ARG_WITH(osf1-curses,
141 [ --with-osf1-curses Used to force OSF/1 curses],[
142 if test x$withval = xyes; then
148 [ --with-vcurses[=incdir] Used to force SysV curses],
149 if test x$withval != xyes; then
150 CURSES_INCLUDEDIR="-I$withval"
156 [ --with-ncurses[=dir] Compile with ncurses/locate base dir],
157 if test x$withval = xno ; then
159 elif test x$withval != xyes ; then
160 CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
161 CURSES_INCLUDEDIR="-I$withval/include"
163 screen_manager="ncurses"
164 AC_DEFINE(USE_NCURSES, 1, [Use Ncurses?])
165 AC_DEFINE(HAS_CURSES, 1, [Found some version of curses that we're going to use])
179 AC_DEFUN([AC_USE_SUNOS_CURSES], [
181 screen_manager="SunOS 4.x /usr/5include curses"
182 AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
183 AC_DEFINE(USE_SUNOS_CURSES, 1, [Use SunOS SysV curses?])
184 AC_DEFINE(HAS_CURSES)
186 AC_DEFINE(NO_COLOR_CURSES, 1, [If your Curses does not have color define this one])
187 AC_DEFINE(USE_SYSV_CURSES, 1, [Use SystemV curses?])
188 CURSES_INCLUDEDIR="-I/usr/5include"
189 CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
190 AC_MSG_RESULT(Please note that some screen refreshs may fail)
193 AC_DEFUN([AC_USE_OSF1_CURSES], [
194 AC_MSG_RESULT(Using OSF1 curses)
196 screen_manager="OSF1 curses"
197 AC_DEFINE(HAS_CURSES)
199 AC_DEFINE(NO_COLOR_CURSES)
200 AC_DEFINE(USE_SYSV_CURSES)
201 CURSES_LIBS="-lcurses"
204 AC_DEFUN([AC_USE_SYSV_CURSES], [
205 AC_MSG_RESULT(Using SysV curses)
206 AC_DEFINE(HAS_CURSES)
208 AC_DEFINE(USE_SYSV_CURSES)
210 screen_manager="SysV/curses"
211 CURSES_LIBS="-lcurses"
214 dnl AC_ARG_WITH(bsd-curses,
215 dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
216 dnl search_ncurses=false
217 dnl screen_manager="Ultrix/cursesX"
218 dnl if test $system = ULTRIX
220 dnl THIS_CURSES=cursesX
222 dnl THIS_CURSES=curses
225 dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap"
226 dnl AC_DEFINE(HAS_CURSES)
228 dnl AC_DEFINE(USE_BSD_CURSES)
229 dnl AC_MSG_RESULT(Please note that some screen refreshs may fail)
230 dnl AC_MSG_WARN([Use of the bsdcurses extension has some])
231 dnl AC_MSG_WARN([display/input problems.])
232 dnl AC_MSG_WARN([Reconsider using xcurses])
237 dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
239 AC_DEFUN([AC_NCURSES], [
244 AC_MSG_RESULT(Found ncurses on $1/$2)
246 CURSES_INCLUDEDIR="$4"
249 AC_DEFINE(HAS_CURSES)
251 AC_DEFINE(USE_NCURSES)
256 AC_DEFUN([AC_SEARCH_NCURSES], [
257 AS_MESSAGE(checking "location of ncurses.h file"...)
259 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
260 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
261 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
262 AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
264 AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
266 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
269 dnl We couldn't find ncurses, try SysV curses
273 AC_EGREP_HEADER(init_color, curses.h,
275 AC_EGREP_CPP(USE_NCURSES,[
282 CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
283 AC_DEFINE(HAS_CURSES)
285 AC_DEFINE(USE_NCURSES)
287 screen_manager="ncurses installed as curses"
292 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
293 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
294 dnl should be replaced by a more fine grained selection routine
298 if test -f /usr/5include/curses.h
303 # check for ncurses version, to properly ifdef mouse-fix
304 AC_MSG_CHECKING(for ncurses version)
305 ncurses_version=unknown
306 cat > conftest.$ac_ext <<EOF
307 [#]line __oline__ "configure"
308 #include "confdefs.h"
309 #ifdef RENAMED_NCURSES
315 VERSION:NCURSES_VERSION
317 if (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD() |
318 egrep "VERSION:" >conftest.out 2>&1; then
320 ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
324 AC_MSG_RESULT($ncurses_version)
325 case "$ncurses_version" in
329 AC_DEFINE(NCURSES_970530,2,
330 [Set to reflect version of ncurses:
333 2 = version 4.0/4.1])
336 AC_DEFINE(NCURSES_970530,1)
339 AC_DEFINE(NCURSES_970530,0)
344 dnl === END CURSES CHECK
347 AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true)
349 dnl Checks for libraries.
350 dnl Replace `main' with a function in -lcurses:
351 dnl AC_CHECK_LIB(curses, main)
353 AC_CHECK_HEADER(regex.h, [], [
354 AC_MSG_ERROR([necessary header <regex.h> not found])
357 dnl Cygwin is a bit peculiar: it has the regcomp() functions, but in a
358 dnl separate library, so we have to check for that:
359 AC_CHECK_LIB(regex, regcomp)
361 dnl Check for a GNOME installation
363 AC_DEFUN([AC_CHECK_GNOME],[
365 AC_CHECK_PROG(gnome1, gnome-config, true)
366 AC_CHECK_PROG(gnome2, pkg-config, true)
368 if test x$gnome1 = xtrue; then
372 if test x$gnome2 = xtrue; then
376 AM_CONDITIONAL(USING_GNOME2, pkg-config --exists gtk+-2.0)
377 AM_CONDITIONAL(HAS_GNOME, test "$has_gnome" = true)
378 AM_CONDITIONAL(GNOME_LINUX, test "$host_os" = Linux)
382 dnl Checks for header files.
385 AC_CHECK_HEADERS(fcntl.h sys/window.h sys/termios.h unistd.h signal.h floss.h io.h)
387 dnl Checks for typedefs, structures, and compiler characteristics.
392 AC_CHECK_TYPE(sighandler_t,[],[],[
396 dnl This test was ripped from gnuplot's configure.in:
397 AC_MSG_CHECKING(for sigsetjmp)
398 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <setjmp.h>]], [[jmp_buf env; sigsetjmp(env, 1);]])],[AC_MSG_RESULT(yes)
399 AC_DEFINE(HAVE_SIGSETJMP,1,
400 [ Define if we have sigsetjmp(). ])],[AC_MSG_RESULT(no)])
402 dnl Checks for library functions.
404 AC_CHECK_FUNCS(strchr memcpy memset setmode _setmode)
405 AC_CHECK_FUNCS(getcwd regcmp regcomp strerror lstat)
406 AC_CHECK_FUNCS(fixkeypad getopt_long)
414 AC_DEFINE(Linux, 1, [We're using some variant of Linux])
416 netbsd*|freebsd*|darwin*)
417 AC_DEFINE(BSD, 1, [We're using a BSD-flavoured Unix])
421 AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile contrib/Makefile])