Skip to content

8.2 buildconf warning with autoconf 2.71 #11279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

andypost
Copy link
Contributor

backport commites from #9483 to 8.2 branch

petk added 2 commits May 19, 2023 21:28
To make sure that compiler supports C99 before Autoconf 2.69, this was
needed. But with Autoconf 2.70 and later the macro is obsolete because
the checks are done in AC_PROG_CC and warnings are emitted when building
configure script.

Fixes part of phpGH-9483
@petk
Copy link
Member

petk commented May 20, 2023

This looks good to me for PHP 8.2. I've tested locally and works ok. The PR should target PHP-8.2.

@andypost andypost changed the base branch from master to PHP-8.2 May 20, 2023 13:07
@Girgias
Copy link
Member

Girgias commented May 20, 2023

@ramsey @adoy @saundefined what is your opinion on this as RMs?

@saundefined
Copy link
Member

LGTM for PHP 8.2,
but let's wait for Pierrick and Ben's opinion

@adoy
Copy link
Member

adoy commented May 21, 2023

I'm not an autoconf expert but it looks good to me too. I'm ok to merge this in 8.2 :) Thanks for your work.

@andypost
Copy link
Contributor Author

andypost commented May 29, 2023

Maybe it possible to backport to 8.1 as well?

Ref #11207 (comment)

@petk
Copy link
Member

petk commented May 30, 2023

@andypost technically I agree that this should go to the current maintained branch, yes, that is PHP 8.1. But I should recheck the patch a bit for PHP 8.1. There might be even more to add there.

@petk
Copy link
Member

petk commented May 30, 2023

This works fine for PHP-8.1 branch also, yes. As you've mentioned the AS_ECHO patch would need to be added also:

Autoconf PHP 8.1 patch
diff --git a/build/libtool.m4 b/build/libtool.m4
index 91a1f9022f..8ee7b45301 100644
--- a/build/libtool.m4
+++ b/build/libtool.m4
@@ -271,7 +271,7 @@ $rm -r conftest*
 
 dnl autoconf 2.13 compatibility
 dnl _LT_AC_TRY_LINK()
-AC_DEFUN(_LT_AC_TRY_LINK, [
+AC_DEFUN([_LT_AC_TRY_LINK], [
 cat > conftest.$ac_ext <<EOF
 dnl This sometimes fails to find confdefs.h, for some reason.
 dnl [#]line __oline__ "[$]0"
@@ -675,10 +675,9 @@ s390*-*linux*|sparc*-*linux*)
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
-    [AC_LANG_SAVE
-     AC_LANG_C
-     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
-     AC_LANG_RESTORE])
+    [AC_LANG_PUSH([C])
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+    AC_LANG_POP([C])])
   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
     CFLAGS="$SAVE_CFLAGS"
@@ -1197,7 +1196,7 @@ if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks"
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   AC_MSG_RESULT([$hard_links])
   if test "$hard_links" = no; then
-    AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe])
+    AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe])
     need_locks=warn
   fi
 else
@@ -1935,15 +1934,15 @@ AC_ARG_WITH([tags],
 
 if test -f "$ltmain" && test -n "$tagnames"; then
   if test ! -f "${ofile}"; then
-    AC_MSG_WARN([output file \`$ofile' does not exist])
+    AC_MSG_WARN([output file '$ofile' does not exist])
   fi
 
   if test -z "$LTCC"; then
     eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
     if test -z "$LTCC"; then
-      AC_MSG_WARN([output file \`$ofile' does not look like a libtool script])
+      AC_MSG_WARN([output file '$ofile' does not look like a libtool script])
     else
-      AC_MSG_WARN([using \`LTCC=$LTCC', extracted from \`$ofile'])
+      AC_MSG_WARN([using 'LTCC=$LTCC', extracted from '$ofile'])
     fi
   fi
   if test -z "$LTCFLAGS"; then
@@ -1966,7 +1965,7 @@ if test -f "$ltmain" && test -n "$tagnames"; then
 
     if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
     then
-      AC_MSG_ERROR([tag name \"$tagname\" already exists])
+      AC_MSG_ERROR([tag name "$tagname" already exists])
     fi
 
     # Update the list of available tags.
@@ -2738,8 +2737,7 @@ fi
 AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
 AC_DEFUN([_LT_AC_LANG_C_CONFIG],
 [lt_save_CC="$CC"
-AC_LANG_SAVE
-AC_LANG_C
+AC_LANG_PUSH([C])
 
 # Source file extension for C test sources.
 ac_ext=c
@@ -2807,7 +2805,7 @@ AC_MSG_RESULT([$enable_static])
 
 AC_LIBTOOL_CONFIG($1)
 
-AC_LANG_RESTORE
+AC_LANG_POP([C])
 CC="$lt_save_CC"
 ])# AC_LIBTOOL_LANG_C_CONFIG
 
@@ -2819,8 +2817,7 @@ CC="$lt_save_CC"
 # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
 AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
 AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
-[AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
+[AC_LANG_PUSH([C++])
 AC_REQUIRE([AC_PROG_CXX])
 AC_REQUIRE([_LT_AC_PROG_CXXCPP])
 
@@ -3806,7 +3803,7 @@ AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
 
 AC_LIBTOOL_CONFIG($1)
 
-AC_LANG_RESTORE
+AC_LANG_POP([C++])
 CC=$lt_save_CC
 LDCXX=$LD
 LD=$lt_save_LD
diff --git a/build/php.m4 b/build/php.m4
index 01b8250598..7f99af0bee 100644
--- a/build/php.m4
+++ b/build/php.m4
@@ -2152,7 +2152,7 @@ EOF
    else
     break
    fi
-   $as_echo "$CURRENT_ARG \\" >>$1
+   AS_ECHO(["$CURRENT_ARG \\"]) >>$1
    CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS $CURRENT_ARG"
   done
   echo '"[$]@"' >> $1
diff --git a/configure.ac b/configure.ac
index baf8651f04..cb5de7240c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -128,7 +128,9 @@ PKG_PROG_PKG_CONFIG
 AC_PROG_CC([cc gcc])
 PHP_DETECT_ICC
 PHP_DETECT_SUNCC
-AC_PROG_CC_C99
+
+dnl AC_PROG_CC_C99 is obsolete with autoconf >= 2.70 yet necessary for <= 2.69.
+m4_version_prereq([2.70],,[AC_PROG_CC_C99])
 AC_PROG_CPP
 AC_USE_SYSTEM_EXTENSIONS
 AC_PROG_LN_S

@andypost
Copy link
Contributor Author

Is there chance to get this in for the next releases?

@ramsey
Copy link
Member

ramsey commented Jul 4, 2023

This looks good for me for 8.1. Any objections, @patrickallaert?

@petk
Copy link
Member

petk commented Jul 5, 2023

@ramsey, @patrickallaert thank you. Just a side note to not forget. The patch for PHP-8.1 is in the comments. It includes also one additional patch for AS_ECHO to not emit warnings in the configure building process.

@ramsey
Copy link
Member

ramsey commented Jul 5, 2023

Shouldn't this be merged to PHP-8.1 first and then down to PHP-8.2 and master?

@petk
Copy link
Member

petk commented Jul 5, 2023

Yes. Maybe the simplest would be to create a PR for PHP-8.1 and when merging to PHP-8.2 the AS_ECHO is already applied (so one merge conflict to resolve in 8.2 and master is already done).

@petk
Copy link
Member

petk commented Jul 5, 2023

So, basically this needs to be merged to PHP-8.1 and above: #11602 Thanks!

@petk
Copy link
Member

petk commented Jul 10, 2023

This has been added in 41a3573 thank to @ramsey

Thank you @andypost for reporting!

@petk petk closed this Jul 10, 2023
@andypost andypost deleted the libtool-82 branch July 10, 2023 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants