Skip to content
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

Autoconf 2.71 #3804

Merged
merged 2 commits into from
Oct 4, 2023
Merged

Autoconf 2.71 #3804

merged 2 commits into from
Oct 4, 2023

Conversation

nigoroll
Copy link
Member

The first commit just pulls in macros from autoconf-archive 2.71
The second commit renovated configure.ac for compatibility with both 2.71 and 2.69, which is kept the minimum in order to not cause too much of a stir.

@nigoroll nigoroll requested a review from dridi April 27, 2022 10:51
@nigoroll nigoroll marked this pull request as draft April 27, 2022 11:06
@nigoroll nigoroll marked this pull request as ready for review April 27, 2022 11:21
@nigoroll nigoroll force-pushed the autoconf-2.71 branch 2 times, most recently from 91f19f9 to 3dcdb13 Compare April 27, 2022 11:35
@nigoroll
Copy link
Member Author

FTR: Apologies for the force-push noise, I had messed up my local repo for a moment.

@nigoroll nigoroll marked this pull request as draft April 28, 2022 08:59
@nigoroll
Copy link
Member Author

I saw this on an older system:

hpack/vhp_gen_hufdec.c: In function 'tbl_free':
hpack/vhp_gen_hufdec.c:102:2: error: 'for' loop initial declarations are only allowed in C99 mode
   for (unsigned i = 0; i < table->n; i++) {

So maybe I misread the documentation?

@nigoroll
Copy link
Member Author

So it seems we need to keep AC_PROG_CC_C99 unless we were willing to require autoconf >= 2.70

@nigoroll nigoroll marked this pull request as ready for review April 28, 2022 09:20
@nigoroll nigoroll force-pushed the autoconf-2.71 branch 2 times, most recently from 2ccdd72 to e65a9d9 Compare April 28, 2022 10:19
@nigoroll nigoroll marked this pull request as draft April 28, 2022 10:41
@nigoroll
Copy link
Member Author

Again back to draft status. I am not so sure about the varnish.m4 changes any more at this point.

varnish.m4 Outdated
@@ -145,15 +145,17 @@ AC_DEFUN([_VARNISH_VMOD_LDFLAGS], [
# _VARNISH_VMOD_CONFIG
# --------------------
AC_DEFUN([_VARNISH_VMOD_CONFIG], [
dnl Check the VMOD toolchain
AC_USE_SYSTEM_EXTENSIONS
Copy link
Member Author

@nigoroll nigoroll Apr 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dridi could I please ask for your advice / opinion about this aspect?
To avoid issues with API headers accidentally making use of GNU/POSIX extensions, I would think that we should also, by default, enable them for vmods.
Yet with a sane vmod configure.ac like the one from a certain development kit, this will lead to the following warnings:

configure.ac:22: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
aclocal.m4:9533: _VARNISH_VMOD_CONFIG is expanded from...
aclocal.m4:9579: _VARNISH_VMOD is expanded from...
aclocal.m4:9763: VARNISH_VMODS is expanded from...
configure.ac:22: the top level
configure.ac:22: warning: AC_LINK_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
aclocal.m4:9533: _VARNISH_VMOD_CONFIG is expanded from...
aclocal.m4:9579: _VARNISH_VMOD is expanded from...
aclocal.m4:9763: VARNISH_VMODS is expanded from...
configure.ac:22: the top level
configure.ac:22: warning: AC_CHECK_INCLUDES_DEFAULT was called before AC_USE_SYSTEM_EXTENSIONS
aclocal.m4:9533: _VARNISH_VMOD_CONFIG is expanded from...
aclocal.m4:9579: _VARNISH_VMOD is expanded from...
aclocal.m4:9763: VARNISH_VMODS is expanded from...
configure.ac:22: the top level

In turn, those can be avoided by the following change to call the VARNISH_* macros before any compiler/linker related macros

diff --git a/configure.ac b/configure.ac
index 178f2e9..2d9e75c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,10 +6,6 @@ AC_CONFIG_HEADERS([config.h])
 
 AM_INIT_AUTOMAKE([1.12 -Wall -Werror foreign parallel-tests])
 AM_SILENT_RULES([yes])
-AM_PROG_AR
-
-LT_PREREQ([2.2.6])
-LT_INIT([dlopen disable-static])
 
 AC_ARG_WITH([rst2man],
        AS_HELP_STRING(
@@ -21,6 +17,11 @@ AC_ARG_WITH([rst2man],
 VARNISH_PREREQ([6.0.0])
 VARNISH_VMODS([test])
 
+AM_PROG_AR
+
+LT_PREREQ([2.2.6])
+LT_INIT([dlopen disable-static])
+
 AC_CONFIG_FILES([
        Makefile
        src/Makefile

but I am not sure if this is the best option.

@nigoroll nigoroll mentioned this pull request Apr 28, 2022
@dridi
Copy link
Member

dridi commented Jun 13, 2022

In varnish.m4, the reason why some macros are not called directly but through AC_REQUIRE instead is to avoid multiple evaluations. For example, a source tree like varnish-modules with multiple VMODs or a hypothetical project where a VMOD interacts with a VUT would result in a more bloated configure script (and maybe other undesirable effects I'm not remembering, like checks appearing several times in the output).

I don't think we can should call AC_LANG(C) on behalf of VMOD/VUT authors, but we can probably safely AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) since I believe a few of our headers contain definitions based on such extensions.

For c99 detection we should probably do something like:

# Check for c99, remove the unset case when AC_PREREQ >= 2.70
ac_prog_cc_stdc=unset
AC_PROG_CC
AS_CASE([$ac_prog_cc_stdc],
       [no|c89], [AC_MSG_ERROR([Support for c99 or later is required])],
       [unset], [AC_PROG_CC_C99])

Just calling AC_PROG_CC is no longer enough, but I don't expect to run into c89-only compilers any time soon. I have not tested the snippet yet, don't assume it works as intended.

Regarding the autoconf archive, I think we are still better off bundling only the things we care about.

nigoroll added a commit to nigoroll/vcdk that referenced this pull request Sep 17, 2022
Working in tandem with varnishcache/varnish-cache#3804

We should add AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) to varnish.m4.
With this change, vcdk generated configure scripts will emit these warnings:

configure.ac:22: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
aclocal.m4:445: _VARNISH_VMOD_CONFIG is expanded from...
aclocal.m4:491: _VARNISH_VMOD is expanded from...
aclocal.m4:675: VARNISH_VMODS is expanded from...
configure.ac:22: the top level
configure.ac:22: warning: AC_LINK_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
aclocal.m4:445: _VARNISH_VMOD_CONFIG is expanded from...
aclocal.m4:491: _VARNISH_VMOD is expanded from...
aclocal.m4:675: VARNISH_VMODS is expanded from...
configure.ac:22: the top level
configure.ac:22: warning: AC_CHECK_INCLUDES_DEFAULT was called before AC_USE_SYSTEM_EXTENSIONS
aclocal.m4:445: _VARNISH_VMOD_CONFIG is expanded from...
aclocal.m4:491: _VARNISH_VMOD is expanded from...
aclocal.m4:675: VARNISH_VMODS is expanded from...
configure.ac:22: the top level

We thus move the respective macros until after implied expansion of
_VARNISH_VMOD_CONFIG.
@nigoroll
Copy link
Member Author

re @dridi

  • regarding AC_REQUIRE(), it seems I was somehow under the impression that vmod autoconf would not work if we used it, but I can not reproduce this any more, so I will assume that I had made some other mistake.
  • regarding AC_LANG(C) for vmods, this is what we had so far. Can there really be vmods without at least some glue code in C?
  • Regarding AC_PROG_CC_C99, we would like to avoid the autoconf warning The macro `AC_PROG_CC_C99' is obsolete.. But if I understand the autoconf code correctly, this warning is already emitted whenever the macro gets expanded, which seems to be the case also for the snippet you have suggested.
    So at this point I would think that just accepting the warning until we require a newer autoconf should be a practical approach which does not cause much harm.

I have force-pushed the branch accordingly after testing with autoconf 2.71 and 2.69

@nigoroll
Copy link
Member Author

Friendly ping to @dridi

@nigoroll nigoroll force-pushed the autoconf-2.71 branch 2 times, most recently from 2ace568 to 19b19d1 Compare June 17, 2023 17:11
@nigoroll nigoroll force-pushed the autoconf-2.71 branch 3 times, most recently from 07c6669 to 004facd Compare June 26, 2023 19:24
@nigoroll nigoroll force-pushed the autoconf-2.71 branch 4 times, most recently from 468477b to ffd4754 Compare July 6, 2023 17:21
@nigoroll nigoroll force-pushed the autoconf-2.71 branch 2 times, most recently from 374df0c to 9947fe2 Compare July 17, 2023 14:34
@nigoroll nigoroll force-pushed the autoconf-2.71 branch 2 times, most recently from de6f65b to 7aad55b Compare August 1, 2023 16:35
@nigoroll nigoroll force-pushed the autoconf-2.71 branch 2 times, most recently from b657681 to 68a4fc5 Compare September 14, 2023 14:41
... except for ax_with_curses.m4 which requires PKG_CHECK_EXISTS which,
apparently, cci does not have

should we consider again to not have them and rather require autoconf-archive
be installed?
this is required for autoconf 2.71, but I have kept the required
version at 2.69 and tested that the changes are compatible.

Most of the changes come from autoupdate, with this change:

AC_PROG_CC_STDC is obsolete, but older autoconf versions
do not set the highest possible c standard.

So we keep AC_PROG_CC_C99 because we actually require
c99, while AC_PROG_CC_STDC could fall back to c89

For varnish.m4, we should apply the same canonical settings
as for varnishd itself
@dridi dridi merged commit 8997e88 into varnishcache:master Oct 4, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants