2 # Process this file with autoconf to produce a configure script.
4 # This file is part of flex.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
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.
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.
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
25 # autoconf requirements and initialization
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])
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)
40 AM_GNU_GETTEXT([external])
41 AM_GNU_GETTEXT_VERSION([0.18])
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)
47 AM_CONDITIONAL([HAVE_BISON], [test "$YACC" = 'bison -y'])
57 # allow passing a variable `WARNINGFLAGS',
58 # either when invoking `configure', or when invoking `make'
59 # default to something useful if GCC was detected
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"} ])])
67 AC_SUBST([WARNINGFLAGS])
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])
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])
84 AM_CONDITIONAL([CROSS], [test "x$cross_compiling" = xyes])
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)
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)
96 # Check for a m4 that supports -P
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.])
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)],
112 AC_MSG_WARN($INDENT does not appear to be GNU indent; 'make indent' may not function properly)
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)])
120 AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h])
122 # checks for libraries
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.
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])
135 AC_CHECK_LIB(m, log10)
137 # Checks for typedefs, structures, and compiler characteristics.
143 # Checks for library functions.
147 dnl Autoconf bug: AC_FUNC_MALLOC and AC_FUNC_REALLOC might not warn of cross
148 dnl compilation. Workaround this.
150 AS_IF([test "$cross_compiling" = yes],
151 AC_MSG_WARN([result $ac_cv_func_malloc_0_nonnull guessed because of cross compilation]))
153 AS_IF([test "$cross_compiling" = yes],
154 AC_MSG_WARN([result $ac_cv_func_realloc_0_nonnull guessed because of cross compilation]))
156 AC_CHECK_FUNCS([dup2 dnl
163 ], [], [AC_MSG_ERROR(required library function not found on your system)])
165 # Optional library functions
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.
176 examples/fastwc/Makefile
177 examples/manual/Makefile