build adjustments: CARES_SYMBOL_HIDING no longer defined in config files
authorYang Tse <yangsita@gmail.com>
Tue, 17 Apr 2012 10:46:22 +0000 (12:46 +0200)
committerYang Tse <yangsita@gmail.com>
Tue, 17 Apr 2012 11:29:59 +0000 (13:29 +0200)
configure script now provides conditional definitions for Makefile.am
that result in CARES_SYMBOL_HIDING being defined by resulting makefiles
when appropriate.

Makefile.am
m4/cares-confopts.m4

index 08d6a586c29f3bd63eb24a7e37e602d11609b7e5..edf7b59b0cdfa3edd57bf5fc13548aa46e2c9c27 100644 (file)
@@ -103,6 +103,8 @@ libcares_la_LDFLAGS = $(UNDEF) $(VER)
 # Add -Werror if defined
 CFLAGS += @CARES_CFLAG_EXTRAS@
 
+CFLAG_CARES_SYMBOL_HIDING = @CFLAG_CARES_SYMBOL_HIDING@
+
 # For Windows build targets, when building or using static c-ares
 if USE_CPPFLAG_CARES_STATICLIB
 AM_CPPFLAGS = -DCARES_STATICLIB
@@ -110,12 +112,21 @@ else
 AM_CPPFLAGS =
 endif
 
-# For Windows build targets, when building c-ares library
+if DOING_CARES_SYMBOL_HIDING
+if USE_CPPFLAG_CARES_BUILDING_LIBRARY
+libcares_la_CPPFLAGS = $(AM_CPPFLAGS) -DCARES_SYMBOL_HIDING -DCARES_BUILDING_LIBRARY
+else
+libcares_la_CPPFLAGS = $(AM_CPPFLAGS) -DCARES_SYMBOL_HIDING
+endif
+libcares_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_CARES_SYMBOL_HIDING)
+else
 if USE_CPPFLAG_CARES_BUILDING_LIBRARY
 libcares_la_CPPFLAGS = $(AM_CPPFLAGS) -DCARES_BUILDING_LIBRARY
 else
 libcares_la_CPPFLAGS = $(AM_CPPFLAGS)
 endif
+libcares_la_CFLAGS = $(AM_CFLAGS)
+endif
 
 # Makefile.inc provides the CSOURCES and HHEADERS defines
 include Makefile.inc
index f2ab45fa965bb211a8ebe64c5c2efb4286292a3e..c2c37f641d9558fb6438cdc1d8b54b8d734b6fd8 100644 (file)
@@ -1,7 +1,7 @@
 #***************************************************************************
 # $Id$
 #
-# Copyright (C) 2008 - 2010 by Daniel Stenberg et al
+# Copyright (C) 2008 - 2012 by Daniel Stenberg et al
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose and without fee is hereby granted, provided
@@ -16,7 +16,7 @@
 #***************************************************************************
 
 # File version for 'aclocal' use. Keep it a single number.
-# serial 9
+# serial 10
 
 
 dnl CARES_CHECK_OPTION_CURLDEBUG
@@ -330,23 +330,26 @@ dnl -------------------------------------------------
 dnl Depending on --enable-symbol-hiding or --disable-symbol-hiding
 dnl configure option, and compiler capability to actually honor such
 dnl option, this will modify compiler flags as appropriate and also
-dnl provide needed definitions for configuration file.
+dnl provide needed definitions for configuration and Makefile.am files.
 dnl This macro should not be used until all compilation tests have
 dnl been done to prevent interferences on other tests.
 
 AC_DEFUN([CARES_CONFIGURE_SYMBOL_HIDING], [
   AC_MSG_CHECKING([whether hiding of library internal symbols will actually happen])
+  CFLAG_CARES_SYMBOL_HIDING=""
+  doing_symbol_hiding="no"
   if test x"$ac_cv_native_windows" != "xyes" &&
     test "$want_symbol_hiding" = "yes" &&
     test "$supports_symbol_hiding" = "yes"; then
-    CFLAGS="$CFLAGS $symbol_hiding_CFLAGS"
-    AC_DEFINE_UNQUOTED(CARES_SYMBOL_HIDING, 1,
-      [Define to 1 to enable hiding of library internal symbols.])
+    doing_symbol_hiding="yes"
+    CFLAG_CARES_SYMBOL_HIDING="$symbol_hiding_CFLAGS"
     AC_DEFINE_UNQUOTED(CARES_SYMBOL_SCOPE_EXTERN, $symbol_hiding_EXTERN,
       [Definition to make a library symbol externally visible.])
     AC_MSG_RESULT([yes])
   else
     AC_MSG_RESULT([no])
   fi
+  AM_CONDITIONAL(DOING_CARES_SYMBOL_HIDING, test x$doing_symbol_hiding = xyes)
+  AC_SUBST(CFLAG_CARES_SYMBOL_HIDING)
 ])