[libdispatch-dev] [PATCH] define autoconf macros to 1

Paolo Bonzini bonzini at gnu.org
Sat Oct 31 04:08:00 PDT 2009


> As I understand it, some of this is simply a feature of the way autoconf
> works: AC_CHECK_DECLS(), used for testing macros, checks conditionally
> define HAVE_DECL_foo, whereas functional checks, such as AC_CHECK_FUNCS(),
> used for testing for functions, defines HAVE_foo unconditionally but with
> a value of 0 or 1.  I'd be quite happy to learn about ways to avoid this
> happening. :-)

I think Kevin was thinking more of these.

---
 configure.ac         |   16 ++++++++--------
 m4/private-extern.m4 |    4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index f40700a..19c4d05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,7 +43,7 @@ AC_ARG_ENABLE([legacy-api],
 
 AS_IF([test "x$enable_legacy_api" != "xyes"],
   [use_legacy_api=false
-    AC_DEFINE(DISPATCH_NO_LEGACY,,[Define to compile out legacy API])],
+    AC_DEFINE(DISPATCH_NO_LEGACY, 1,[Define to compile out legacy API])],
   [use_legacy_api=true]
 )
 AM_CONDITIONAL(USE_LEGACY_API, $use_legacy_api)
@@ -59,7 +59,7 @@ AC_ARG_ENABLE([libdispatch-init-constructor],
 )
 
 AS_IF([test "x$enable_libdispatch_init_constructor" != "xno"],
-  [AC_DEFINE(USE_LIBDISPATCH_INIT_CONSTRUCTOR,,
+  [AC_DEFINE(USE_LIBDISPATCH_INIT_CONSTRUCTOR, 1,
     [Define to tag libdispatch_init as a constructor])]
 )
 
@@ -72,7 +72,7 @@ AC_ARG_ENABLE([apple-crashreporter-info],
 )
 
 AS_IF([test "x$enable_apple_crashreporter_info" = "xyes"],
-  [AC_DEFINE(USE_APPLE_CRASHREPORTER_INFO,,
+  [AC_DEFINE(USE_APPLE_CRASHREPORTER_INFO, 1,
     [Define to use Mac OS X crashreporter info])]
 )
 
@@ -88,7 +88,7 @@ AC_ARG_ENABLE([apple-tsd-optimizations],
 )
 
 AS_IF([test "x$enable_apple_tsd_optimizations" = "xyes"],
-  [AC_DEFINE(USE_APPLE_TSD_OPTIMIZATIONS,,
+  [AC_DEFINE(USE_APPLE_TSD_OPTIMIZATIONS, 1,
     [Define to use non-portable pthread TSD optimizations for Mac OS X)])]
 )
 
@@ -98,7 +98,7 @@ AC_ARG_ENABLE([apple-semaphore-optimizations],
 )
 
 AS_IF([test "x$enable_apple_semaphore_optimizations" = "xyes"],
-  [AC_DEFINE(USE_APPLE_SEMAPHORE_OPTIMIZATIONS,,
+  [AC_DEFINE(USE_APPLE_SEMAPHORE_OPTIMIZATIONS, 1,
     [Define to use non-portablesemaphore optimizations for Mac OS X])]
 )
 
@@ -139,7 +139,7 @@ AC_CHECK_HEADERS([Availability.h pthread_machdep.h pthread_np.h malloc/malloc.h
 # of Machisms, including using Mach ports as event sources, etc.
 #
 AC_CHECK_HEADER([mach/mach.h],
-  [AC_DEFINE(HAVE_MACH,,Define if mach is present)
+  [AC_DEFINE(HAVE_MACH, 1,Define if mach is present)
     use_mig=true],
   [use_mig=false]
 )
@@ -150,7 +150,7 @@ AM_CONDITIONAL(USE_MIG, $use_mig)
 # in support for pthread work queues.
 #
 AC_CHECK_HEADER([pthread_workqueue.h],
-  [AC_DEFINE(HAVE_PTHREAD_WORKQUEUES,,Define if pthread work queues are present)]
+  [AC_DEFINE(HAVE_PTHREAD_WORKQUEUES, 1,Define if pthread work queues are present)]
 )
 
 #
@@ -174,7 +174,7 @@ DISPATCH_C_BLOCKS
 #
 AC_COMPILE_IFELSE([
   AC_LANG_PROGRAM([void __attribute__((__noreturn__)) temp(void) { __builtin_trap(); }], [])], [
-    AC_DEFINE(HAVE_NORETURN_BUILTIN_TRAP,,[Define if __builtin_trap marked noreturn])
+    AC_DEFINE(HAVE_NORETURN_BUILTIN_TRAP, 1,[Define if __builtin_trap marked noreturn])
   ], [])
 
 #
diff --git a/m4/private-extern.m4 b/m4/private-extern.m4
index f227eb6..a2396e9 100644
--- a/m4/private-extern.m4
+++ b/m4/private-extern.m4
@@ -18,9 +18,9 @@ AC_CACHE_CHECK([for __private_extern__],
                     [dispatch_cv_private_extern=no])])
 
 if test $dispatch_cv_private_extern = yes; then
-  AC_DEFINE(HAVE_PRIVATE_EXTERN,, Define if __private_extern__ present)
+  AC_DEFINE(HAVE_PRIVATE_EXTERN, 1, Define if __private_extern__ present)
 elif test $dispatch_cv_hidden_visibility_attribute = yes; then
-  AC_DEFINE(HAVE_PRIVATE_EXTERN,, Define if __private_extern__ present)
+  AC_DEFINE(HAVE_PRIVATE_EXTERN, 1, Define if __private_extern__ present)
   AC_DEFINE([__private_extern__], [extern __attribute__ ((visibility ("hidden")))],
 	    [Define to a replacement for __private_extern])
 else
-- 
1.6.2.5




More information about the libdispatch-dev mailing list