77 Commits

Author SHA1 Message Date
Explorer09
7191257ddc build: Update ax_prog_cc_for_build.m4 with upstream
The ax_prog_cc_for_build.m4 module from upstream contains a typo fix.
Beyond that, there are no code changes.
2024-11-03 07:14:29 -05:00
Explorer09
74a132156c fix(build): Replace obsolete Autoconf macros
Replace two obsolete Autoconf macro uses that would trigger warnings in
Autoconf 2.70.

The minimum required versions of the Autotools remain the same.
2024-05-10 16:59:02 -04:00
Explorer09
bbe2a15e2d build: Add BUILD_OBJEXT sanity check 2024-05-10 12:52:44 -04:00
Alex Richardson
bf23944911 Fix -Wundef warnings by using #ifdef instead of #if
This also brings back the check for __func__ that was deleted in commit
9b41a091bcb2fb9bd2b6db79d06a0c976d1a5663
2024-04-25 14:56:00 -04:00
Explorer09
b162ab50f4 build: config_for_build.h for cross, bootstrap config.
This should be enough to fix the main bug as reported in #314.
Other cross-compile limitations may still exist.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-03-30 10:15:55 -04:00
Simon Sobisch
f1c2570502 removed output-beautification of YACC and INDENT
per request from @Explorer09
saving one code line and its comment two times
2023-03-01 20:52:25 -05:00
Simon Sobisch
bf59176220 remove hard-wired bison lookup, check for "GNU Bison" in $YACC's version output instead
additional:
* don't check for GNU indent if indent-check already found no indent
* use common wording to check "*whether* $BINARY is GNU stuff"
2023-03-01 20:52:25 -05:00
Will Estes
3a24fa0366
Merge pull request #399 from Explorer09/autotools-version
build: correct and document minimum Autotools reqirement in configure.ac
2023-01-15 09:27:49 -05:00
Explorer09
dada40b50f Remove manual m4 search code. No more stat() dependency.
This reverts commit c34590c4bf067d4e749e5298a8ce9f90072d6332
and all search code patches that followed it.

The execvp() would do the $PATH searching of m4 for flex. There's no
need to duplicate the effort.

Another reason for the removal is to remove dependency on stat()
system call, which would cause a problem in a 32-bit OS accessing a
filesystem with 64-bit inode number (see #413).

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2021-06-07 08:39:52 +08:00
Explorer09
0954f389d3 build: correct and document minimum Autotools reqirement in configure.ac
A build test is done to determine the minimum versions of the configure
tools (Autoconf, Automake, Libtool & gettext) that can successfully
build flex in the current state of the code. This commit would help
builders to figure out whether their build tools are still compatible
for building flex, or they need tools upgrade, especially when they
patch flex and need to regenerate configure script for any reason.

This commit resolves version requirement debates as in #374.

A summary of version requirements: Autoconf 2.62, Libtool 2.2,
Automake 1.11.3 and gettext 0.19.6.

Signed-off-by: Kang-che Sung <explorer09@gmail.com>
2018-10-25 06:44:30 +08:00
Explorer09
c42de062bb build: Move dnl comments out of AC_CHECK_FUNCS
Due to a bug, autoheader (2.69) will treat M4 dnl comments in a quoted
argument of AC_CHECK_FUNCS as function tokens and generate a lot of
redundant and useless HAVE_* macros in config.h.in.
(Examples: HAVE_DNL, HAVE_AVAILABLE_, HAVE_BY)

It seems to be this commit dbb4e94dc7bacbcfd4acef4f085ef752fe1aa03f of
mine that revealed this autoheader bug, and the affected config.h.in
had been shipped within flex-2.6.4 release tarball.

I have reported the autoheader bug here:
<https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html>

As a workaround, let's move comments out of AC_CHECK_FUNCS.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-02-28 19:30:56 -05:00
Explorer09
24fd055133 build: AC_USE_SYSTEM_EXTENSIONS in configure.ac.
This would, e.g. define _GNU_SOURCE in config.h, enabling the
reallocarray() prototype in glibc 2.26+ on Linux systems with that
version of glibc.

Fixes #241.
2017-09-04 11:22:30 -04:00
Explorer09
7e06407175 Move libfl.pc.in to src subdirectory. 2017-08-27 00:17:57 +08:00
Tyler Slabinski
c1ed5df2f6 Create libfl.pc target for pkgconfig 2017-08-24 07:52:13 -04:00
Will Estes
19cffb0ff0 build: require automake, gettext versions as per maintainer dev setup 2017-07-13 15:14:58 -04:00
Will Estes
2ae437ad54 build: remove automake check-news 2017-05-19 08:03:48 -04:00
Thomas Klausner
2b290d8ebd scanner: Use reallocarr() when available.
NetBSD had a crash during build. Since the provided substitute for
reallocarray() wasn't working, use NetBSD's reallocarr(). Let
configure choose that function whenever it is available. Use
reallocarray if available. Still fallback if neither is available.

Fixes #219
2017-05-19 07:29:15 -04:00
Explorer09
2592576239 build: do not generate lib/Makefile.in.
Files in lib/ are picked up and built using makefile directives in
src/Makefile.am. Remove the need to generate lib/Makefile.in and the
stub lib/Makefile.am.
2017-05-03 13:14:16 -04:00
Simon Sobisch
c2ceb3e129 build: use lowest versions for gettext, automake. 2017-05-02 14:56:59 -04:00
Simon Sobisch
634ef8a945 build: list earliest useable versions for automake 2017-05-02 14:43:49 -04:00
Alastair Hughes
89f10ee36f build: support cross compiling.
Check for cross compiling. If cross compiling, build stage1flex using a
custom link command.
We also override LDADD since that adds the replacement implementations
that are cross compiled, and instead always use the replacement library
implementations.

We don't use BUILD_OBJEXT and BUILD_EXEEXT since it seems that automake
does not support these.

Fixes #78.
2017-02-23 14:07:56 -05:00
Explorer09
d1b195b671 build: Include <strings.h>; add strcasecmp() check to configure.
strings.h (not string.h) is the standard-defined include header for
strcasecmp(). Include <strings.h> for portability (even though glibc
exposes strcasecmp() declaration also in <string.h> by default).
2017-02-17 16:56:21 -05:00
Explorer09
dbb4e94dc7 build: Let configure error if missing required functions, headers..
`configure` will now error if a required header or function is not
found on the system.

Also add comments on optional functions checks.

Add sys/stats.h and sys/wait.h to list of required headers in
configure.

This fixes issue #180.
2017-02-17 16:55:33 -05:00
Explorer09
122e58965a test: skip pthread test when needed files missing.
"Unlisting" the pthread test when libpthread is not available is never
a good idea. Should let it compile into a stub program that returns
the "skip" status.

configure.ac and tests/Makefile.am are edited so that pthread test can
be built anyway, but only works (not as the stub) when both pthread.h
and libpthread are detected on the system.

Also fix a small typo in tests/pthread.l comments.
2017-02-16 09:33:35 -05:00
Explorer09
546851ba35 build: remove repeated bison detection from configure.
AC_PROG_YACC already detects the bison program. We can just use it,
and make notice if [ $YACC != 'bison -y' ]

Remove unused AC_SUBST([BISON], ...).

Add AM_CONDITIONAL([HAVE_BISON], ...) so that we can skip bison tests
in testsuite when bison is absent.

We don't make any attempt to detect other yacc implementations since
flex is developed with bison. While it would be possible, the need
isn't there right now. It would be possible to add a --with-parser
option that defaulted to bison if such a need cropped up.
2017-01-25 10:29:26 -05:00
Explorer09
9c54eb6e30 build: detect overflow for [re]allocate_array.
Use reallocarray() when we have it (i.e. in OpenBSD system). When we
don't, use equivalent overflow detection for our allocate_array and
reallocate_array functions.

Remove lib/reallocarray.c from our LIBOBJS as we no longer need it.

Provide a fallback SIZE_MAX macro definition in flexint.h (not
preprocessor friendly, but enough for our reallocate_array use case).
2017-01-24 07:36:50 -05:00
Will Estes
7e4d538724 doc: v2.6.4 2017-01-23 14:25:11 -05:00
Explorer09
8db5267af4 build: Simplify indent program detection 2017-01-12 18:01:57 -05:00
Explorer09
adddfba7ab build: New configure option '--disable-bootstrap'.
If configure is run with '--disable-bootstrap', then stage1flex won't
be built and stage1scan.c will be generated by sed'ing scan.c.

This option is intended to workaround bootstrap bugs rather than to
fix the bootstrapping issues which are proving subtler and harder to
fix than anyone would like.
2016-12-29 17:26:07 -05:00
Explorer09
935478c3fe build: allow building libfl even with --disable-libfl.
For various reasons, we may wish to build libfl explicitly even when
configure has been run with the --disable-libfl option. This is
possible, now, via 'make -C src libfl.la'.
2016-12-29 17:19:53 -05:00
Explorer09
44fa758931 build: warn about cross compiling with *alloc 2016-11-24 18:48:28 -05:00
Explorer09
713f5a0cb4 build: Link $(LIBOBJS) from src/ dir, remove libcompat.la.
The libcompat.la library was small and less friendly to bootstrapping
and cross compilation. Now, we will simply link individual object
files as needed, which is simpler.
2016-11-24 18:45:07 -05:00
Explorer09
5d71e9ffb9 build: Add --disable-libfl configure option.
Disabling libfl is useful when building flex for a cross-toolchain.

Fixes: GH-99
2016-11-14 14:23:27 -05:00
Thomas Klausner
0af671a275 Fix unportable test(1) operator.
"==" is only supported by bash, "=" is the standard comparison
operator.
2016-11-06 22:32:43 +01:00
Alastair Hughes
75f4305eed build: fix false negatives for help2man and texi2dvi
HELP2MAN and TEXI2DVI (or the corresponding ac_prog variables) will
never be zero length as they fall back to the missing script; check for
the fall back and warn on that instead of always warning.
2016-10-29 09:11:20 -04:00
Will Estes
31cc18ebd0 build: version 2.6.3 begins 2016-10-25 09:53:50 -04:00
Will Estes
2ecf674239 build: switch xz to lzip 2016-10-24 18:26:22 -04:00
Will Estes
7dcb10c048 build: for automake, flex is foreign 2016-10-19 17:00:50 -04:00
rlar
f1ce47684c configure option --enable-warnings' and WARNINGFLAGS'
`WARNINGFLAGS' can be passed when invoking `configure'
 and when invoking `make'

if configure switch `--enable-warnings' was given
  then default to something useful if we have `GCC'

`WARNINGFLAGS' is not used when compiling `stage1flex'
  to avoid unnecessary clutter
2016-03-31 07:11:51 -04:00
Will Estes
42325b8b39 mention v2.6.2; summarize changes since 2.6.1 2016-03-18 15:25:10 -04:00
Robert Larice
197b523555 Suppress portability warnings in Makefile generation 2016-03-16 08:23:01 -04:00
Will Estes
aa4eac68e7 build: Removed bzip2 distribiution archive 2016-02-27 15:45:34 -05:00
Will Estes
782ee061ec removed obsolete program check 2016-02-27 15:41:59 -05:00
Will Estes
0e2b8c0f95 Made some program checks more robust 2016-02-27 15:35:33 -05:00
Will Estes
3efb40df0e Removed no longer needed header checks 2015-12-27 14:05:51 -05:00
Will Estes
5b856d1fa3 Checked for reallocarray() with AC_REPLACE_FUNCS 2015-12-27 13:57:13 -05:00
Will Estes
ed855892c7 build: reformatted AC_CHECK_FUNCS for readability 2015-12-19 16:17:31 -05:00
Mike Frysinger
ff622ae961 configure: fixed realloc test.
The [] characters are used for quoting in m4, so the attempt to use
them in place of `test` fails yielding the warning at build time:

.../flex/configure: line 20222: no: command not found
2015-12-13 19:01:29 -05:00
Michael McConville
77e54b25ee Added new function reallocarray.
This is taken from OpenSSH Portable, which in turn takes it from
OpenBSD.

reallocarray wraps the stdlib's realloc function. It takes two size
arguments and checks for overflow, like calloc, but doesn't zero the
memory. Therefore, it allows us to do overflow-safe array reallocations
and overflow-safe unzeroed array allocations, which the stdlib
allocation functions don't.

We have a bunch of specific array allocation macros, none of
which check for overflow. reallocarray should be able to replace them.
2015-12-12 15:25:40 -05:00
Will Estes
965c9fa979 Mentioned v2.6.1; documented some changes since v2.6.0 2015-12-11 10:57:46 -05:00