Skip to content

Commit 0869ea4

Browse files
committed
Remove flex version checks
Remove the flex version checks from configure and meson. The cutoff versions are all so ancient that this is no longer relevant, and what the actual cutoff should be is a bit fuzzy. This also removes the ancient behavior that configure would also accept a "lex" program if it is actuall flex. This aligns the check with meson in this respect. For future reference, as of this commit, these are relevant flex versions: - The hard required minimum is flex 2.5.34 as of commit b1ef489, but this has not actually been tested. - Prior to this, the minimum enforced by configure/meson was flex 2.5.35, which is the oldest present in the buildfarm right now. - As of commit 6fdd5d9, the oldest version that will compile without warnings due to flex-generated code is flex 2.5.36. - The oldest version that probably still has some practical relevance is flex 2.5.37, which ships with CentOS/RHEL 7. Discussion: https://www.postgresql.org/message-id/1a204ccd-7ae6-478c-a431-407b5c48ccc6@eisentraut.org
1 parent b0eff10 commit 0869ea4

File tree

5 files changed

+66
-100
lines changed

5 files changed

+66
-100
lines changed

config/programs.m4

+5-46
Original file line numberDiff line numberDiff line change
@@ -59,57 +59,16 @@ AC_SUBST(BISONFLAGS)
5959
# PGAC_PATH_FLEX
6060
# --------------
6161
# Look for Flex, set the output variable FLEX to its path if found.
62-
# Reject versions before 2.5.35 (the earliest version in the buildfarm
63-
# as of 2022). Also find Flex if its installed under `lex', but do not
64-
# accept other Lex programs.
6562

6663
AC_DEFUN([PGAC_PATH_FLEX],
67-
[AC_CACHE_CHECK([for flex], pgac_cv_path_flex,
68-
[# Let the user override the test
69-
if test -n "$FLEX"; then
70-
pgac_cv_path_flex=$FLEX
71-
else
72-
pgac_save_IFS=$IFS
73-
IFS=$PATH_SEPARATOR
74-
for pgac_dir in $PATH; do
75-
IFS=$pgac_save_IFS
76-
if test -z "$pgac_dir" || test x"$pgac_dir" = x"."; then
77-
pgac_dir=`pwd`
78-
fi
79-
for pgac_prog in flex lex; do
80-
pgac_candidate="$pgac_dir/$pgac_prog"
81-
if test -f "$pgac_candidate" \
82-
&& $pgac_candidate --version </dev/null >/dev/null 2>&1
83-
then
84-
echo '%%' > conftest.l
85-
if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
86-
pgac_flex_version=`$pgac_candidate --version 2>/dev/null`
87-
if echo "$pgac_flex_version" | sed ['s/[.a-z]/ /g'] | $AWK '{ if ([$]1 == 2 && ([$]2 > 5 || ([$]2 == 5 && [$]3 >= 35))) exit 0; else exit 1;}'
88-
then
89-
pgac_cv_path_flex=$pgac_candidate
90-
break 2
91-
else
92-
AC_MSG_ERROR([
93-
*** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
94-
*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version.])
95-
fi
96-
fi
97-
fi
98-
done
99-
done
100-
rm -f conftest.l lex.yy.c
101-
: ${pgac_cv_path_flex=no}
102-
fi
103-
])[]dnl AC_CACHE_CHECK
104-
105-
if test x"$pgac_cv_path_flex" = x"no"; then
64+
[PGAC_PATH_PROGS(FLEX, flex)
65+
if test -z "$FLEX"; then
10666
AC_MSG_ERROR([flex not found])
107-
else
108-
FLEX=$pgac_cv_path_flex
109-
pgac_flex_version=`$FLEX --version 2>/dev/null`
110-
AC_MSG_NOTICE([using $pgac_flex_version])
11167
fi
11268
69+
pgac_flex_version=`$FLEX --version 2>/dev/null`
70+
AC_MSG_NOTICE([using $pgac_flex_version])
71+
11372
AC_SUBST(FLEX)
11473
AC_SUBST(FLEXFLAGS)
11574
])# PGAC_PATH_FLEX

configure

+53-44
Original file line numberDiff line numberDiff line change
@@ -9931,59 +9931,68 @@ if test -z "$BISON"; then
99319931
fi
99329932

99339933

9934-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flex" >&5
9935-
$as_echo_n "checking for flex... " >&6; }
9936-
if ${pgac_cv_path_flex+:} false; then :
9934+
if test -z "$FLEX"; then
9935+
for ac_prog in flex
9936+
do
9937+
# Extract the first word of "$ac_prog", so it can be a program name with args.
9938+
set dummy $ac_prog; ac_word=$2
9939+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
9940+
$as_echo_n "checking for $ac_word... " >&6; }
9941+
if ${ac_cv_path_FLEX+:} false; then :
99379942
$as_echo_n "(cached) " >&6
99389943
else
9939-
# Let the user override the test
9940-
if test -n "$FLEX"; then
9941-
pgac_cv_path_flex=$FLEX
9942-
else
9943-
pgac_save_IFS=$IFS
9944-
IFS=$PATH_SEPARATOR
9945-
for pgac_dir in $PATH; do
9946-
IFS=$pgac_save_IFS
9947-
if test -z "$pgac_dir" || test x"$pgac_dir" = x"."; then
9948-
pgac_dir=`pwd`
9949-
fi
9950-
for pgac_prog in flex lex; do
9951-
pgac_candidate="$pgac_dir/$pgac_prog"
9952-
if test -f "$pgac_candidate" \
9953-
&& $pgac_candidate --version </dev/null >/dev/null 2>&1
9954-
then
9955-
echo '%%' > conftest.l
9956-
if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
9957-
pgac_flex_version=`$pgac_candidate --version 2>/dev/null`
9958-
if echo "$pgac_flex_version" | sed 's/[.a-z]/ /g' | $AWK '{ if ($1 == 2 && ($2 > 5 || ($2 == 5 && $3 >= 35))) exit 0; else exit 1;}'
9959-
then
9960-
pgac_cv_path_flex=$pgac_candidate
9961-
break 2
9962-
else
9963-
as_fn_error $? "
9964-
*** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
9965-
*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version." "$LINENO" 5
9966-
fi
9967-
fi
9968-
fi
9969-
done
9944+
case $FLEX in
9945+
[\\/]* | ?:[\\/]*)
9946+
ac_cv_path_FLEX="$FLEX" # Let the user override the test with a path.
9947+
;;
9948+
*)
9949+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
9950+
for as_dir in $PATH
9951+
do
9952+
IFS=$as_save_IFS
9953+
test -z "$as_dir" && as_dir=.
9954+
for ac_exec_ext in '' $ac_executable_extensions; do
9955+
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
9956+
ac_cv_path_FLEX="$as_dir/$ac_word$ac_exec_ext"
9957+
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
9958+
break 2
9959+
fi
9960+
done
99709961
done
9971-
rm -f conftest.l lex.yy.c
9972-
: ${pgac_cv_path_flex=no}
9962+
IFS=$as_save_IFS
9963+
9964+
;;
9965+
esac
9966+
fi
9967+
FLEX=$ac_cv_path_FLEX
9968+
if test -n "$FLEX"; then
9969+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5
9970+
$as_echo "$FLEX" >&6; }
9971+
else
9972+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9973+
$as_echo "no" >&6; }
99739974
fi
99749975

9976+
9977+
test -n "$FLEX" && break
9978+
done
9979+
9980+
else
9981+
# Report the value of FLEX in configure's output in all cases.
9982+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FLEX" >&5
9983+
$as_echo_n "checking for FLEX... " >&6; }
9984+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5
9985+
$as_echo "$FLEX" >&6; }
99759986
fi
9976-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_path_flex" >&5
9977-
$as_echo "$pgac_cv_path_flex" >&6; }
9978-
if test x"$pgac_cv_path_flex" = x"no"; then
9987+
9988+
if test -z "$FLEX"; then
99799989
as_fn_error $? "flex not found" "$LINENO" 5
9980-
else
9981-
FLEX=$pgac_cv_path_flex
9982-
pgac_flex_version=`$FLEX --version 2>/dev/null`
9983-
{ $as_echo "$as_me:${as_lineno-$LINENO}: using $pgac_flex_version" >&5
9984-
$as_echo "$as_me: using $pgac_flex_version" >&6;}
99859990
fi
99869991

9992+
pgac_flex_version=`$FLEX --version 2>/dev/null`
9993+
{ $as_echo "$as_me:${as_lineno-$LINENO}: using $pgac_flex_version" >&5
9994+
$as_echo "$as_me: using $pgac_flex_version" >&6;}
9995+
99879996

99889997

99899998

doc/src/sgml/installation.sgml

+6-8
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@
100100
<primary>yacc</primary>
101101
</indexterm>
102102

103-
<application>Flex</application> 2.5.35 or later and
104-
<application>Bison</application> 2.3 or later are required. Other
105-
<application>lex</application> and <application>yacc</application>
106-
programs cannot be used.
103+
<application>Flex</application> and <application>Bison</application> are
104+
required. Other <application>lex</application> and
105+
<application>yacc</application> programs cannot be used.
106+
<application>Bison</application> needs to be at least version 2.3.
107107
</para>
108108
</listitem>
109109

@@ -3811,10 +3811,8 @@ make: *** [postgres] Error 1
38113811
<productname>Flex</productname></term>
38123812
<listitem>
38133813
<para>
3814-
<productname>Bison</productname> and <productname>Flex</productname> are
3815-
required. Only <productname>Bison</productname> versions 2.3 and later
3816-
will work. <productname>Flex</productname> must be version 2.5.35 or later.
3817-
Binaries can be downloaded from <ulink
3814+
Binaries for <productname>Bison</productname> and
3815+
<productname>Flex</productname> can be downloaded from <ulink
38183816
url="https://github.com/lexxmark/winflexbison"></ulink>.
38193817
</para>
38203818
</listitem>

meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ endif
334334
# External programs
335335
perl = find_program(get_option('PERL'), required: true, native: true)
336336
python = find_program(get_option('PYTHON'), required: true, native: true)
337-
flex = find_program(get_option('FLEX'), native: true, version: '>= 2.5.35')
337+
flex = find_program(get_option('FLEX'), native: true)
338338
bison = find_program(get_option('BISON'), native: true, version: '>= 2.3')
339339
sed = find_program(get_option('SED'), 'sed', native: true, required: false)
340340
prove = find_program(get_option('PROVE'), native: true, required: false)

src/backend/utils/misc/guc-file.l

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ record_config_file_error(const char *errmsg,
302302
/*
303303
* Flex fatal errors bring us here. Stash the error message and jump back to
304304
* ParseConfigFp(). Assume all msg arguments point to string constants; this
305-
* holds for flex 2.5.35 (earliest we support). Otherwise, we would need to
305+
* holds for all currently known flex versions. Otherwise, we would need to
306306
* copy the message.
307307
*
308308
* We return "int" since this takes the place of calls to fprintf().

0 commit comments

Comments
 (0)