Minor consistency changes for latest pilex.git/bootstrap Python scanner
[bootstrap_flex.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 # This file is part of flex.
5
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15
16 # Neither the name of the University nor the names of its contributors
17 # may be used to endorse or promote products derived from this software
18 # without specific prior written permission.
19
20 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
21 # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 # PURPOSE.
24
25 # autoconf requirements and initialization
26
27 AC_INIT([the fast lexical analyser generator],[2.6.4],[flex-help@lists.sourceforge.net],[flex])
28 AC_CONFIG_SRCDIR([src/scan.l])
29 AC_CONFIG_AUX_DIR([build-aux])
30 LT_INIT
31 AM_INIT_AUTOMAKE([1.11.3 -Wno-portability foreign check-news std-options dist-lzip parallel-tests subdir-objects])
32 AC_CONFIG_HEADER([src/config.h])
33 AC_CONFIG_LIBOBJ_DIR([lib])
34 AC_CONFIG_MACRO_DIR([m4])
35 SHARED_VERSION_INFO="2:0:0"
36 AC_SUBST(SHARED_VERSION_INFO)
37
38 # checks for programs
39
40 AM_GNU_GETTEXT([external])
41 AM_GNU_GETTEXT_VERSION([0.18])
42 AC_PROG_YACC
43 AS_IF([test "$YACC" != 'bison -y'], [
44         YACC="\${top_srcdir}/build-aux/missing bison -y"
45         AC_MSG_NOTICE(no bison program found: only required for maintainers)
46         ])
47 AM_CONDITIONAL([HAVE_BISON], [test "$YACC" = 'bison -y'])
48 AM_PROG_LEX
49 AC_PROG_CC
50 AX_PROG_CC_FOR_BUILD
51 AC_PROG_CXX
52 AM_PROG_CC_C_O
53 AC_PROG_LN_S
54 AC_PROG_AWK
55 AC_PROG_INSTALL
56
57 # allow passing a variable `WARNINGFLAGS',
58 #   either when invoking `configure', or when invoking `make'
59 # default to something useful if GCC was detected
60
61 AC_ARG_ENABLE([warnings],
62   [AS_HELP_STRING([--enable-warnings],
63                   [enable a bunch of compiler warning flags (defaults to GCC warning flags).])],
64   [AS_IF([test "x$GCC" = xyes],
65     [ : ${WARNINGFLAGS="-Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion -Wno-unused-but-set-variable"} ])])
66
67 AC_SUBST([WARNINGFLAGS])
68
69 AC_ARG_ENABLE([libfl],
70   [AS_HELP_STRING([--disable-libfl],
71                   [do not build -lfl runtime support library])],
72   [], [enable_libfl=yes])
73 AM_CONDITIONAL([ENABLE_LIBFL], [test "x$enable_libfl" = xyes])
74
75 # --disable-bootstrap is intended only to workaround problems with bootstrap
76 # (e.g. when cross-compiling flex or when bootstrapping has bugs).
77 # Ideally we should be able to bootstrap even when cross-compiling.
78 AC_ARG_ENABLE([bootstrap],
79   [AS_HELP_STRING([--disable-bootstrap],
80                   [don't perform a bootstrap when building flex])],
81   [], [enable_bootstrap=yes])
82 AM_CONDITIONAL([ENABLE_BOOTSTRAP], [test "x$enable_bootstrap" = xyes])
83
84 AM_CONDITIONAL([CROSS], [test "x$cross_compiling" = xyes])
85
86 AC_PATH_PROG([HELP2MAN], help2man, [\${top_srcdir}/build-aux/missing help2man])
87   AS_IF([test "$HELP2MAN" = "\${top_srcdir}/build-aux/missing help2man"],
88     AC_MSG_WARN(help2man: program not found: building man page will not work)
89   )
90
91 AC_PATH_PROGS([TEXI2DVI], [gtexi2dvi texi2dvi], [\${top_srcdir}/build-aux/missing texi2dvi])
92   AS_IF([test "$TEXI2DVI" = "\${top_srcdir}/build-aux/missing texi2dvi"],
93     AC_MSG_WARN(texi2dvi: program not found: building pdf version of manual will not work)
94   )
95
96 # Check for a m4 that supports -P
97
98 AC_CACHE_CHECK([for m4 that supports -P], [ac_cv_path_M4],
99 [AC_PATH_PROGS_FEATURE_CHECK([M4], [gm4 gnum4 m4],
100               [[m4out=`echo 'm''4_divnum' | $ac_path_M4 -P`]
101                 [test "x$m4out" = x0 \
102                 && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
103               [AC_MSG_ERROR([could not find m4 that supports -P])])])
104 AC_SUBST([M4], [$ac_cv_path_M4])
105 AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the m4 executable name.])
106
107 AC_PATH_PROG([INDENT], indent, [\${top_srcdir}/build-aux/missing indent])
108   AC_MSG_CHECKING(if $INDENT is GNU indent)
109   AS_IF([$INDENT --version 2>/dev/null | head -n 1 | grep "GNU indent" >/dev/null],
110     [AC_MSG_RESULT(yes)],
111     [AC_MSG_RESULT(no)
112      AC_MSG_WARN($INDENT does not appear to be GNU indent; 'make indent' may not function properly)
113     ])
114
115 # checks for headers
116
117 AC_CHECK_HEADERS([regex.h strings.h sys/stat.h sys/wait.h unistd.h], [],
118   [AC_MSG_ERROR(required header not found on your system)])
119
120 AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h])
121
122 # checks for libraries
123
124 # The test test-pthread uses libpthread, so we check for it here, but
125 # all we need is the preprocessor symbol defined since we don't need
126 # LIBS to include libpthread for building flex.
127
128 LIBPTHREAD=''
129 AC_CHECK_LIB(pthread, pthread_mutex_lock,
130    [AC_CHECK_HEADERS([pthread.h], [LIBPTHREAD=-lpthread],
131       [AC_MSG_WARN([pthread tests will be skipped])])],
132    [AC_MSG_WARN([pthread tests will be skipped])])
133 AC_SUBST([LIBPTHREAD])
134
135 AC_CHECK_LIB(m, log10)
136
137 # Checks for typedefs, structures, and compiler characteristics.
138
139 AC_HEADER_STDBOOL
140 AC_C_CONST
141 AC_TYPE_SIZE_T
142
143 # Checks for library functions.
144
145 AC_FUNC_ALLOCA
146 AC_FUNC_FORK
147 dnl Autoconf bug: AC_FUNC_MALLOC and AC_FUNC_REALLOC might not warn of cross
148 dnl compilation. Workaround this.
149 AC_FUNC_MALLOC
150 AS_IF([test "$cross_compiling" = yes],
151    AC_MSG_WARN([result $ac_cv_func_malloc_0_nonnull guessed because of cross compilation]))
152 AC_FUNC_REALLOC
153 AS_IF([test "$cross_compiling" = yes],
154    AC_MSG_WARN([result $ac_cv_func_realloc_0_nonnull guessed because of cross compilation]))
155
156 AC_CHECK_FUNCS([dup2 dnl
157 memset dnl
158 regcomp dnl
159 strcasecmp dnl
160 strchr dnl
161 strdup dnl
162 strtol dnl
163 ], [], [AC_MSG_ERROR(required library function not found on your system)])
164
165 # Optional library functions
166 AC_CHECK_FUNCS([dnl
167 pow dnl           Used only by "examples/manual/expr"
168 setlocale dnl     Needed only if NLS is enabled
169 reallocarray dnl  OpenBSD function. We have replacement if not available.
170 ])
171
172 AC_CONFIG_FILES(
173 Makefile
174 doc/Makefile
175 examples/Makefile
176 examples/fastwc/Makefile
177 examples/manual/Makefile
178 po/Makefile.in
179 src/Makefile
180 tools/Makefile
181 tests/Makefile
182 )
183
184 AC_OUTPUT