Allow PKG_CHECK_MODULES in configure.ac to be commented out easily
authorIvan Maidanski <ivmai@mail.ru>
Mon, 16 Oct 2017 08:00:53 +0000 (11:00 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 16 Oct 2017 08:00:53 +0000 (11:00 +0300)
(code refactoring)

* configure.ac [$with_libatomic_ops!=no && $with_libatomic_ops!=none]
(missing_libatomic_ops): Set to true (before PKG_CHECK_MODULES).
* configure.ac [$missing_libatomic_ops] (PKG_CHECK_MODULES): Set
missing_libatomic_ops back to false if atomic_ops module is not found;
add comment (about pkg-config and the possibility to comment out
PKG_CHECK_MODULES).

configure.ac

index 5826eeb..d56a020 100644 (file)
@@ -997,12 +997,19 @@ fi
 
 # 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".
-# Note: "syntax error near unexpected token ATOMIC_OPS" reported by configure
-# means Autotools pkg.m4 file was not found during aclocal.m4 generation.
+# First, check that libatomic_ops usage is not disabled explicitly.
 missing_libatomic_ops=false
 AS_IF([test x"$with_libatomic_ops" != xno -a x"$with_libatomic_ops" != 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]) ])