Skip to content

configure.in: cause a reasonable diagnostic if AX_CHECK_COMPILE_FLAG is not available#1056

Merged
RossBencina merged 2 commits into
PortAudio:masterfrom
RossBencina:etter_ax_check_compile_flag_error
Aug 14, 2025
Merged

configure.in: cause a reasonable diagnostic if AX_CHECK_COMPILE_FLAG is not available#1056
RossBencina merged 2 commits into
PortAudio:masterfrom
RossBencina:etter_ax_check_compile_flag_error

Conversation

@RossBencina
Copy link
Copy Markdown
Collaborator

On some platforms the AX_CHECK_COMPILE_FLAG macro (used in our configure.in) is not defined within the base autotools package, but rather in a separate autotools-archive package. If that package is not installed AX_CHECK_COMPILE_FLAG is not defined. This results in the use of AX_CHECK_COMPILE_FLAG being emitted verbatim into ./configure, which in turn results in a cryptic error message:

./configure: line 19323: syntax error near unexpected token `-std=c11,'
./configure: line 19323: `        AX_CHECK_COMPILE_FLAG(-std=c11, CFLAGS="-std=c11 $CFLAGS", CFLAGS="-std=c99 $CFLAGS")'
Error: Process completed with exit code 2.

This patch improves the error diagnostic. The new diagnostic will be emitted at the time that autoreconf is run, and will not allow the ./configure file to be generated if the AX_CHECK_COMPILE_FLAG macro is not defined. The new error is:

configure.ac:10: error: possibly undefined macro: AX_CHECK_COMPILE_FLAG
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf-2.72: error: /usr/bin/autoconf-2.72 failed with exit status: 1

Comment thread configure.in Outdated
AC_PREREQ(2.13)

dnl cause a reasonable diagnostic if AX_CHECK_COMPILE_FLAG is not available
m4_pattern_forbid([AX_CHECK_COMPILE_FLAG])dnl
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The "dnl" at the end seems unnecessary.

Comment thread configure.in Outdated
@RossBencina RossBencina merged commit 8bb3402 into PortAudio:master Aug 14, 2025
11 of 13 checks 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