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])
29 AC_CONFIG_SRCDIR([src/scan.l])
30 AC_CONFIG_AUX_DIR([build-aux])
31 AC_USE_SYSTEM_EXTENSIONS
33 AM_INIT_AUTOMAKE([1.15 -Wno-portability foreign std-options dist-lzip parallel-tests subdir-objects])
34 AC_CONFIG_HEADER([src/config.h])
35 AC_CONFIG_LIBOBJ_DIR([lib])
36 AC_CONFIG_MACRO_DIR([m4])
37 SHARED_VERSION_INFO="2:0:0"
38 AC_SUBST(SHARED_VERSION_INFO)
42 AM_GNU_GETTEXT([external])
43 AM_GNU_GETTEXT_VERSION([0.19.7])
45 AS_IF([test "$YACC" != 'bison -y'], [
46 YACC="\${top_srcdir}/build-aux/missing bison -y"
47 AC_MSG_NOTICE(no bison program found: only required for maintainers)
49 AM_CONDITIONAL([HAVE_BISON], [test "$YACC" = 'bison -y'])
59 pkgconfigdir=${libdir}/pkgconfig
60 AC_SUBST(pkgconfigdir)
62 # allow passing a variable `WARNINGFLAGS',
63 # either when invoking `configure', or when invoking `make'
64 # default to something useful if GCC was detected
66 AC_ARG_ENABLE([warnings],
67 [AS_HELP_STRING([--enable-warnings],
68 [enable a bunch of compiler warning flags (defaults to GCC warning flags).])],
69 [AS_IF([test "x$GCC" = xyes],
70 [ : ${WARNINGFLAGS="-Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion -Wno-unused-but-set-variable"} ])])
72 AC_SUBST([WARNINGFLAGS])
74 AC_ARG_ENABLE([libfl],
75 [AS_HELP_STRING([--disable-libfl],
76 [do not build -lfl runtime support library])],
77 [], [enable_libfl=yes])
78 AM_CONDITIONAL([ENABLE_LIBFL], [test "x$enable_libfl" = xyes])
80 # --disable-bootstrap is intended only to workaround problems with bootstrap
81 # (e.g. when cross-compiling flex or when bootstrapping has bugs).
82 # Ideally we should be able to bootstrap even when cross-compiling.
83 AC_ARG_ENABLE([bootstrap],
84 [AS_HELP_STRING([--disable-bootstrap],
85 [don't perform a bootstrap when building flex])],
86 [], [enable_bootstrap=yes])
87 AM_CONDITIONAL([ENABLE_BOOTSTRAP], [test "x$enable_bootstrap" = xyes])
89 AM_CONDITIONAL([CROSS], [test "x$cross_compiling" = xyes])
91 AC_PATH_PROG([HELP2MAN], help2man, [\${top_srcdir}/build-aux/missing help2man])
92 AS_IF([test "$HELP2MAN" = "\${top_srcdir}/build-aux/missing help2man"],
93 AC_MSG_WARN(help2man: program not found: building man page will not work)
96 AC_PATH_PROGS([TEXI2DVI], [gtexi2dvi texi2dvi], [\${top_srcdir}/build-aux/missing texi2dvi])
97 AS_IF([test "$TEXI2DVI" = "\${top_srcdir}/build-aux/missing texi2dvi"],
98 AC_MSG_WARN(texi2dvi: program not found: building pdf version of manual will not work)
101 # Check for a m4 that supports -P
103 AC_CACHE_CHECK([for m4 that supports -P], [ac_cv_path_M4],
104 [AC_PATH_PROGS_FEATURE_CHECK([M4], [gm4 gnum4 m4],
105 [[m4out=`echo 'm''4_divnum' | $ac_path_M4 -P`]
106 [test "x$m4out" = x0 \
107 && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
108 [AC_MSG_ERROR([could not find m4 that supports -P])])])
109 AC_SUBST([M4], [$ac_cv_path_M4])
110 AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the m4 executable name.])
112 AC_PATH_PROG([INDENT], indent, [\${top_srcdir}/build-aux/missing indent])
113 AC_MSG_CHECKING(if $INDENT is GNU indent)
114 AS_IF([$INDENT --version 2>/dev/null | head -n 1 | grep "GNU indent" >/dev/null],
115 [AC_MSG_RESULT(yes)],
117 AC_MSG_WARN($INDENT does not appear to be GNU indent; 'make indent' may not function properly)
122 AC_CHECK_HEADERS([regex.h strings.h sys/stat.h sys/wait.h unistd.h], [],
123 [AC_MSG_ERROR(required header not found on your system)])
125 AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h])
127 # checks for libraries
129 # The test test-pthread uses libpthread, so we check for it here, but
130 # all we need is the preprocessor symbol defined since we don't need
131 # LIBS to include libpthread for building flex.
134 AC_CHECK_LIB(pthread, pthread_mutex_lock,
135 [AC_CHECK_HEADERS([pthread.h], [LIBPTHREAD=-lpthread],
136 [AC_MSG_WARN([pthread tests will be skipped])])],
137 [AC_MSG_WARN([pthread tests will be skipped])])
138 AC_SUBST([LIBPTHREAD])
140 AC_CHECK_LIB(m, log10)
142 # Checks for typedefs, structures, and compiler characteristics.
148 # Checks for library functions.
152 dnl Autoconf bug: AC_FUNC_MALLOC and AC_FUNC_REALLOC might not warn of cross
153 dnl compilation. Workaround this.
155 AS_IF([test "$cross_compiling" = yes],
156 AC_MSG_WARN([result $ac_cv_func_malloc_0_nonnull guessed because of cross compilation]))
158 AS_IF([test "$cross_compiling" = yes],
159 AC_MSG_WARN([result $ac_cv_func_realloc_0_nonnull guessed because of cross compilation]))
161 AC_CHECK_FUNCS([dup2 dnl
168 ], [], [AC_MSG_ERROR(required library function not found on your system)])
170 # Optional library functions
172 pow dnl Used only by "examples/manual/expr"
173 setlocale dnl Needed only if NLS is enabled
174 reallocarr dnl NetBSD function. Use reallocarray if not available.
175 reallocarray dnl OpenBSD function. We have replacement if not available.
182 examples/fastwc/Makefile
183 examples/manual/Makefile