]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Re-work test for extended regex
authorNick Porter <nick@portercomputing.co.uk>
Tue, 20 Aug 2024 09:48:11 +0000 (10:48 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 20 Aug 2024 09:48:11 +0000 (10:48 +0100)
So it doesn't hang on "lean" CI builds

configure
configure.ac

index 1e0d2f59ac391479cbf5c294412f1ed9707ca157..80419fb1c54d4e404b7254f8aee31bb29c8282eb 100755 (executable)
--- a/configure
+++ b/configure
@@ -15867,17 +15867,34 @@ smart_prefix=
     REGEX=yes
     { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for extended regular expressions" >&5
 printf %s "checking for extended regular expressions... " >&6; }
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+    if test "$cross_compiling" = yes
+then :
+  { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See 'config.log' for more details" "$LINENO" 5; }
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-        #include <regex.h>
-        #ifdef REG_EXTENDED
-        yes
-        #endif
+          #include <stdlib.h>
+          #include <regex.h>
 
+int
+main (void)
+{
+
+          #ifdef REG_EXTENDED
+          exit(1);
+          #endif
+
+
+  ;
+  return 0;
+}
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP_TRADITIONAL "yes" >/dev/null 2>&1
+if ac_fn_c_try_run "$LINENO"
 then :
 
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -15894,7 +15911,10 @@ printf "%s\n" "no" >&6; }
      ;;
 esac
 fi
-rm -rf conftest*
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
+fi
 
 
                 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for regcomp in -lregex" >&5
index 20e0be2dad65b2aa35a324e660c594068e732298..5d6c019f6bf56d9a295bbf6fc3394ada9ee6386d 100644 (file)
@@ -2272,13 +2272,19 @@ if test "x$REGEX" = "x"; then
   if test "x$ac_cv_header_regex_h" = "xyes"; then
     REGEX=yes
     AC_MSG_CHECKING([for extended regular expressions])
-    AC_EGREP_CPP(yes,
-      [
-        #include <regex.h>
-        #ifdef REG_EXTENDED
-        yes
-        #endif
-      ],
+
+    AC_RUN_IFELSE(
+      [AC_LANG_PROGRAM(
+        [[
+         #include <stdlib.h>
+          #include <regex.h>
+        ]],
+       [[
+          #ifdef REG_EXTENDED
+          exit(1);
+          #endif
+       ]]
+      )],
       [
         AC_MSG_RESULT(yes)
         AC_DEFINE(HAVE_REG_EXTENDED, [1], [define this if we have REG_EXTENDED (from <regex.h>)])