[Use an external libatomic_ops? (default: check)])],
[], [with_libatomic_ops=check])
-# 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.
+# Check for an external libatomic_ops if the above answer is "yes" or "check".
+# If not found, fail on "yes", and convert "check" to "no".
+# First, check that libatomic_ops usage is not disabled explicitly.
missing_libatomic_ops=false
AS_IF([test x"$with_libatomic_ops" != xno -a x"$THREADS" != xnone],
- [ PKG_CHECK_MODULES([ATOMIC_OPS], [atomic_ops], [],
- [ missing_libatomic_ops=true ]) ])
+ [ missing_libatomic_ops=true ])
+
+# Note: "syntax error near unexpected token ATOMIC_OPS" reported by configure
+# means Autotools pkg.m4 file was not found during aclocal.m4 generation;
+# in this case, most probably, you should run pkg-config once before running
+# autogen.sh (autoreconf); alternatively, comment out the following 3 lines.
+AS_IF([test x$missing_libatomic_ops = xtrue],
+ [ PKG_CHECK_MODULES([ATOMIC_OPS], [atomic_ops],
+ [ missing_libatomic_ops=false ], [ [] ]) ])
+
# Retry with AC_CHECK_HEADER if PKG_CHECK_MODULES failed.
AS_IF([test x$missing_libatomic_ops = xtrue],
[ AC_CHECK_HEADER([atomic_ops.h], [missing_libatomic_ops=false]) ])