Remove flex version checks
authorPeter Eisentraut <[email protected]>
Fri, 17 Jan 2025 07:35:52 +0000 (08:35 +0100)
committerPeter Eisentraut <[email protected]>
Fri, 17 Jan 2025 08:30:42 +0000 (09:30 +0100)
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 b1ef48980dd,
  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 6fdd5d95634, 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

config/programs.m4
configure
doc/src/sgml/installation.sgml
meson.build
src/backend/utils/misc/guc-file.l

index 490ec9fe9f5d8e1a113bab039f86e5161eda7553..7b55c2664a6cd529b647e4f8c39597aaf0a0c842 100644 (file)
@@ -59,57 +59,16 @@ AC_SUBST(BISONFLAGS)
 # PGAC_PATH_FLEX
 # --------------
 # Look for Flex, set the output variable FLEX to its path if found.
-# Reject versions before 2.5.35 (the earliest version in the buildfarm
-# as of 2022). Also find Flex if its installed under `lex', but do not
-# accept other Lex programs.
 
 AC_DEFUN([PGAC_PATH_FLEX],
-[AC_CACHE_CHECK([for flex], pgac_cv_path_flex,
-[# Let the user override the test
-if test -n "$FLEX"; then
-  pgac_cv_path_flex=$FLEX
-else
-  pgac_save_IFS=$IFS
-  IFS=$PATH_SEPARATOR
-  for pgac_dir in $PATH; do
-    IFS=$pgac_save_IFS
-    if test -z "$pgac_dir" || test x"$pgac_dir" = x"."; then
-      pgac_dir=`pwd`
-    fi
-    for pgac_prog in flex lex; do
-      pgac_candidate="$pgac_dir/$pgac_prog"
-      if test -f "$pgac_candidate" \
-        && $pgac_candidate --version </dev/null >/dev/null 2>&1
-      then
-        echo '%%'  > conftest.l
-        if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
-          pgac_flex_version=`$pgac_candidate --version 2>/dev/null`
-          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;}'
-          then
-            pgac_cv_path_flex=$pgac_candidate
-            break 2
-          else
-            AC_MSG_ERROR([
-*** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
-*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version.])
-          fi
-        fi
-      fi
-    done
-  done
-  rm -f conftest.l lex.yy.c
-  : ${pgac_cv_path_flex=no}
-fi
-])[]dnl AC_CACHE_CHECK
-
-if test x"$pgac_cv_path_flex" = x"no"; then
+[PGAC_PATH_PROGS(FLEX, flex)
+if test -z "$FLEX"; then
   AC_MSG_ERROR([flex not found])
-else
-  FLEX=$pgac_cv_path_flex
-  pgac_flex_version=`$FLEX --version 2>/dev/null`
-  AC_MSG_NOTICE([using $pgac_flex_version])
 fi
 
+pgac_flex_version=`$FLEX --version 2>/dev/null`
+AC_MSG_NOTICE([using $pgac_flex_version])
+
 AC_SUBST(FLEX)
 AC_SUBST(FLEXFLAGS)
 ])# PGAC_PATH_FLEX
index a0b5e10ca39b99de6215e235d7bcb5a03b98ecce..ceeef9b0915dda1421c6c2cb14d5a8cee9dee5cf 100755 (executable)
--- a/configure
+++ b/configure
@@ -9931,59 +9931,68 @@ if test -z "$BISON"; then
 fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flex" >&5
-$as_echo_n "checking for flex... " >&6; }
-if ${pgac_cv_path_flex+:} false; then :
+if test -z "$FLEX"; then
+  for ac_prog in flex
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_FLEX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  # Let the user override the test
-if test -n "$FLEX"; then
-  pgac_cv_path_flex=$FLEX
-else
-  pgac_save_IFS=$IFS
-  IFS=$PATH_SEPARATOR
-  for pgac_dir in $PATH; do
-    IFS=$pgac_save_IFS
-    if test -z "$pgac_dir" || test x"$pgac_dir" = x"."; then
-      pgac_dir=`pwd`
-    fi
-    for pgac_prog in flex lex; do
-      pgac_candidate="$pgac_dir/$pgac_prog"
-      if test -f "$pgac_candidate" \
-        && $pgac_candidate --version </dev/null >/dev/null 2>&1
-      then
-        echo '%%'  > conftest.l
-        if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
-          pgac_flex_version=`$pgac_candidate --version 2>/dev/null`
-          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;}'
-          then
-            pgac_cv_path_flex=$pgac_candidate
-            break 2
-          else
-            as_fn_error $? "
-*** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
-*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version." "$LINENO" 5
-          fi
-        fi
-      fi
-    done
+  case $FLEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FLEX="$FLEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_FLEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
   done
-  rm -f conftest.l lex.yy.c
-  : ${pgac_cv_path_flex=no}
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+FLEX=$ac_cv_path_FLEX
+if test -n "$FLEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5
+$as_echo "$FLEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
+
+  test -n "$FLEX" && break
+done
+
+else
+  # Report the value of FLEX in configure's output in all cases.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FLEX" >&5
+$as_echo_n "checking for FLEX... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5
+$as_echo "$FLEX" >&6; }
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_path_flex" >&5
-$as_echo "$pgac_cv_path_flex" >&6; }
-if test x"$pgac_cv_path_flex" = x"no"; then
+
+if test -z "$FLEX"; then
   as_fn_error $? "flex not found" "$LINENO" 5
-else
-  FLEX=$pgac_cv_path_flex
-  pgac_flex_version=`$FLEX --version 2>/dev/null`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: using $pgac_flex_version" >&5
-$as_echo "$as_me: using $pgac_flex_version" >&6;}
 fi
 
+pgac_flex_version=`$FLEX --version 2>/dev/null`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: using $pgac_flex_version" >&5
+$as_echo "$as_me: using $pgac_flex_version" >&6;}
+
 
 
 
index ebdb5b3bc2d426c51cf3f444f4536a589b15dd29..271615e4a658eee196e3e33bd7d187e6a0437971 100644 (file)
        <primary>yacc</primary>
       </indexterm>
 
-      <application>Flex</application> 2.5.35 or later and
-      <application>Bison</application> 2.3 or later are required.  Other
-      <application>lex</application> and <application>yacc</application>
-      programs cannot be used.
+      <application>Flex</application> and <application>Bison</application> are
+      required.  Other <application>lex</application> and
+      <application>yacc</application> programs cannot be used.
+      <application>Bison</application> needs to be at least version 2.3.
      </para>
     </listitem>
 
@@ -3811,10 +3811,8 @@ make: *** [postgres] Error 1
         <productname>Flex</productname></term>
        <listitem>
        <para>
-        <productname>Bison</productname> and <productname>Flex</productname> are
-        required.  Only <productname>Bison</productname> versions 2.3 and later
-        will work. <productname>Flex</productname> must be version 2.5.35 or later.
-        Binaries can be downloaded from <ulink
+        Binaries for <productname>Bison</productname> and
+        <productname>Flex</productname> can be downloaded from <ulink
         url="https://github.com/lexxmark/winflexbison"></ulink>.
        </para>
        </listitem>
index cfd654d291661f36375ed14e02ee26b77efc6c83..32fc89f3a4b8838f15d383b9fb91540d4ebd83b0 100644 (file)
@@ -334,7 +334,7 @@ endif
 # External programs
 perl = find_program(get_option('PERL'), required: true, native: true)
 python = find_program(get_option('PYTHON'), required: true, native: true)
-flex = find_program(get_option('FLEX'), native: true, version: '>= 2.5.35')
+flex = find_program(get_option('FLEX'), native: true)
 bison = find_program(get_option('BISON'), native: true, version: '>= 2.3')
 sed = find_program(get_option('SED'), 'sed', native: true, required: false)
 prove = find_program(get_option('PROVE'), native: true, required: false)
index c0ecb8b2ce2bebf93e6a639282c8f9f0f56d687b..11a1e2a3f9f9adf7a1e9615ffa2b9243928850c3 100644 (file)
@@ -302,7 +302,7 @@ record_config_file_error(const char *errmsg,
 /*
  * Flex fatal errors bring us here.  Stash the error message and jump back to
  * ParseConfigFp().  Assume all msg arguments point to string constants; this
- * holds for flex 2.5.35 (earliest we support). Otherwise, we would need to
+ * holds for all currently known flex versions. Otherwise, we would need to
  * copy the message.
  *
  * We return "int" since this takes the place of calls to fprintf().