]> granicus.if.org Git - gc/commitdiff
Prevent misleading AC_MSG_ERROR/AS_IF errors reported in configure.ac
authorIvan Maidanski <ivmai@mail.ru>
Sun, 1 Sep 2013 16:06:38 +0000 (20:06 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 2 Sep 2013 08:45:37 +0000 (12:45 +0400)
* 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.

configure.ac

index fb06a33a0ed33b250694bd0139b8ea64639f3ecc..c6bcb37f16fe9cdeb64aa9c1c8dbce6e69ebb17e 100644 (file)
@@ -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.