From cee552689ab178a4ad446c87ac82e4e8c410f751 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 4 Jul 2013 18:46:07 +0200 Subject: [PATCH] [buddy] Probe for -fvisibility and -fvisibility-inlines-hidden. * configure.ac: Check gcc and g++ for -fvisibility and -fvisibility-inlines-hidden. Add these options to CFLAGS and CXXFLAGS. * m4/ax_check_compile_flag.m4: New file. * src/Makefile.am: Build BuDDy as a single library, reverting part of the changes introduced in my previous patch to this file. Since the options are set in CFLAGS/CXXFLAGS, there is no possibility for -fvisibility-inlines-hidden to be passed to the C compiler. --- buddy/configure.ac | 13 +++++++++++++ buddy/m4/ax_check_compile_flag.m4 | 1 + buddy/src/Makefile.am | 16 ++++------------ 3 files changed, 18 insertions(+), 12 deletions(-) create mode 120000 buddy/m4/ax_check_compile_flag.m4 diff --git a/buddy/configure.ac b/buddy/configure.ac index f25b548ad..877b01f27 100644 --- a/buddy/configure.ac +++ b/buddy/configure.ac @@ -20,6 +20,18 @@ AC_PROG_CXX LT_INIT([win32-dll]) +# Use -Werror since using -fvisibility under MinGW is only a warning. +# (The option is ignored anyway since this does not make sense under windows). +AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden], + [CFLAGS="$CFLAGS -fvisibility=hidden"]) +AC_LANG(C++) +AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden], + [CXXFLAGS="$CXXFLAGS -fvisibility=hidden" + AX_CHECK_COMPILE_FLAG([-fvisibility-inlines-hidden], + [CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"])]) +AC_LANG(C) + + adl_ENABLE_DEBUG ad_GCC_OPTIM adl_NDEBUG @@ -31,6 +43,7 @@ if test x$enable_warnings = xyes; then CF_GCC_WARNINGS fi + AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ diff --git a/buddy/m4/ax_check_compile_flag.m4 b/buddy/m4/ax_check_compile_flag.m4 new file mode 120000 index 000000000..4392cc400 --- /dev/null +++ b/buddy/m4/ax_check_compile_flag.m4 @@ -0,0 +1 @@ +../../m4/ax_check_compile_flag.m4 \ No newline at end of file diff --git a/buddy/src/Makefile.am b/buddy/src/Makefile.am index bceb49525..40538b9fa 100644 --- a/buddy/src/Makefile.am +++ b/buddy/src/Makefile.am @@ -1,29 +1,21 @@ include_HEADERS = bdd.h fdd.h bvec.h -BUDDY_FLAGS = -I$(top_builddir) -DVERSION=23 \ - -fvisibility=hidden -DBUDDY_DLL_EXPORTS -DBUDDY_DLL +BUDDY_FLAGS = -I$(top_builddir) -DVERSION=23 -DBUDDY_DLL_EXPORTS -DBUDDY_DLL -# Compile the C++ part of the library with -# -fvisibility-inlines-hidden, this option is not valid for C. lib_LTLIBRARIES = libbdd.la -libbdd_la_CPPFLAGS = $(BUDDY_FLAGS) -fvisibility-inlines-hidden -libbdd_la_SOURCES = cppext.cxx -libbdd_la_LIBADD = libbdd_c.la # See the `Updating version info' node of the Libtool manual before # changing this. libbdd_la_LDFLAGS = -no-undefined -version-info 0:0:0 - -# The C part of the library. -noinst_LTLIBRARIES = libbdd_c.la -libbdd_c_la_CPPFLAGS = $(BUDDY_FLAGS) -libbdd_c_la_SOURCES = \ +libbdd_la_CPPFLAGS = $(BUDDY_FLAGS) +libbdd_la_SOURCES = \ bddio.c \ bddop.c \ bddtree.h \ bvec.c \ cache.c \ cache.h \ + cppext.cxx \ fdd.c \ imatrix.c \ imatrix.h \