From: Ivan Maidanski Date: Sun, 1 Sep 2013 16:06:38 +0000 (+0400) Subject: Prevent misleading AC_MSG_ERROR/AS_IF errors reported in configure.ac X-Git-Tag: gc7_4_0~27 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29952ea40a4ae4261905f6ac486a0dace6d866e3;p=gc Prevent misleading AC_MSG_ERROR/AS_IF errors reported in configure.ac * configure.ac (PKG_CHECK_MODULES): Move AS_IF and AC_MSG_ERROR out of ACTION-IF-NOT-FOUND argument (setting "missing_libatomic_ops" variable instead) to prevent misleading "possibly undefined macro: AC_MSG_ERROR, AS_IF" error reported by Autoconf (pointing to code lines where these macros first occur) in case of PKG_CHECK_MODULES is not defined in aclocal.m4; add comment about missing Autotools pkg.m4 file. --- diff --git a/configure.ac b/configure.ac index fb06a33a..c6bcb37f 100644 --- a/configure.ac +++ b/configure.ac @@ -870,11 +870,16 @@ AC_ARG_WITH([libatomic-ops], # Check for an external libatomic_ops if the answer was yes or check. If not # found, fail on yes, and convert check to no. +# Note: "syntax error near unexpected token ATOMIC_OPS" reported by configure +# means Autotools pkg.m4 file was not found during aclocal.m4 generation. +missing_libatomic_ops=false AS_IF([test x"$with_libatomic_ops" != xno], [ PKG_CHECK_MODULES([ATOMIC_OPS], [atomic_ops], [], + [ missing_libatomic_ops=true ]) ]) +AS_IF([test x$missing_libatomic_ops = xtrue ], [ AS_IF([test x"$with_libatomic_ops" != xcheck], - [AC_MSG_ERROR([A external libatomic_ops was not found.])]) - with_libatomic_ops=no ]) ]) + [ AC_MSG_ERROR([An external libatomic_ops was not found]) ]) + with_libatomic_ops=no ]) # If we have neither an external or an internal version, offer a useful hint # and exit.