- Fix Python/C++ module compilation when compiler supports

the -fvisibility=hidden option
- Update Makefile consequentially


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@361 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-02-20 21:26:08 +00:00
parent b3ba006800
commit b788ebab4b
5 changed files with 49 additions and 28 deletions

View File

@ -120,6 +120,8 @@ src_backend_pyloader_libpyloader_la_CPPFLAGS = \
-DLOCALEDIR="\"$(localedir)\"" \
$(PYTHON_CPPFLAGS) \
$(GLIBMM_CFLAGS)
src_backend_pyloader_libpyloader_la_CXXFLAGS = \
$(VISIB_HIDDEN)
src_backend_pyloader_libpyloader_la_LIBADD = \
$(PYTHON_LDFLAGS) \
$(PYTHON_EXTRA_LIBS) \
@ -157,6 +159,8 @@ src_backend_libbackend_la_CPPFLAGS = \
-DLOCALEDIR="\"$(localedir)\"" \
$(PYTHON_CPPFLAGS) \
$(GLIBMM_CFLAGS)
src_backend_libbackend_la_CXXFLAGS = \
$(VISIB_HIDDEN)
src_backend_libbackend_la_LIBADD = \
src/backend/pyloader/libpyloader.la
src_backend_libbackend_la_LDFLAGS = \
@ -210,6 +214,7 @@ sgpemv2_CPPFLAGS = \
$(GTKMM_CFLAGS) \
$(PYTHON_CPPFLAGS) \
$(GTHREAD_CFLAGS)
sgpemv2_CXXFLAGS = $(VISIB_HIDDEN)
sgpemv2_LDFLAGS = $(LT_LDFLAGS)
sgpemv2_LDADD = \
src/backend/libbackend.la \

View File

@ -60,11 +60,11 @@ CAIRO_VERSION=1.0.0
dnl c++ compiler and flags
AC_PROG_CXX
AC_CHECK_CXXFLAG([Wall])
AC_CHECK_CXXFLAG([pedantic])
AC_CHECK_CXXFLAG([Wextra])
AC_CHECK_CXXFLAG([Wno-long-long])
AC_CHECK_LDFLAG([--as-needed])
AC_CHECK_CXXFLAG([CXXFLAGS], [Wall])
AC_CHECK_CXXFLAG([CXXFLAGS], [pedantic])
AC_CHECK_CXXFLAG([CXXFLAGS], [Wextra])
AC_CHECK_CXXFLAG([CXXFLAGS], [Wno-long-long])
AC_CHECK_LDFLAG([LDFLAGS],[--as-needed])
AC_PROG_INSTALL
@ -119,8 +119,9 @@ AC_COMPILE_IFELSE(
AC_DEFINE([SG_DLLLOCAL],[__attribute__ ((visibility("hidden")))])
AC_DEFINE([SG_DLLPUBLIC],[__attribute__ ((visibility("default")))])
AC_CHECK_CXXFLAG([fvisibility=hidden])
AC_CHECK_CXXFLAG([fvisibility-inlines-hidden])
AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden])
AC_SUBST([VISIB_HIDDEN])
AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden])
],[
AC_MSG_RESULT([no])
AC_DEFINE([SG_DLLIMPORT],[/* unsupported */])

View File

@ -2,22 +2,27 @@ dnl **************************************************
dnl Copyright (C) 2004 Matteo Settenvini
dnl **************************************************
dnl ---------- AX_CHECK_CXXFLAG ---------------------
dnl ---------- AC_CHECK_CXXFLAG ---------------------
dnl This macro checks if a particular flag for the
dnl C++ compiler works. If it is so, it adds the flag
dnl to the CXXFLAGS variable.
dnl Example of usage : AC_CHECK_CXXFLAG([Wall])
dnl C++ compiler works. If it is so, it puts the flag
dnl into the first macro parameter.
dnl Example of usage : AC_CHECK_CXXFLAG([CXXFLAGS],[Wall])
dnl -------------------------------------------------
AC_DEFUN([AC_CHECK_CXXFLAG],
[ AC_REQUIRE([AC_PROG_CXX])dnl
AC_MSG_CHECKING([whether $CXX supports the -$1 flag])
[ if test -z "$1" -o -z "$2"; then
AC_MSG_FAILURE([Wrong parameters passed to the m4 macro.
Please contact the package mantainer.])
fi
AC_REQUIRE([AC_PROG_CXX])dnl
AC_MSG_CHECKING([whether $CXX supports the -$2 flag])
ac_check_cxxflags=$CXXFLAGS
CXXFLAGS="-$1"
CXXFLAGS="-$2"
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [return 0;]),
[AC_MSG_RESULT([yes])
CXXFLAGS="-$1 $ac_check_cxxflags" ],
CXXFLAGS="$ac_check_cxxflags"
$1="-$2 $[$1]" ],
[AC_MSG_RESULT([no])
CXXFLAGS=$ac_check_cxxflags ]
)
@ -29,19 +34,24 @@ AC_DEFUN([AC_CHECK_CXXFLAG],
dnl ---------- AC_CHECK_CFLAG ---------------------
dnl This macro checks if a particular flag for the
dnl C compiler works. If it is so, it adds the flag
dnl to the CFLAGS variable.
dnl Example of usage : AC_CHECK_CFLAG([Wall])
dnl into the first macro parameter.
dnl Example of usage : AC_CHECK_CFLAG([CFLAGS],[Wall])
dnl -------------------------------------------------
AC_DEFUN([AC_CHECK_CFLAG],
[ AC_REQUIRE([AC_PROG_CC])dnl
AC_MSG_CHECKING([whether $CC supports the -$1 flag])
[ if test -z "$1" -o -z "$2"; then
AC_MSG_FAILURE([Wrong parameters passed to the m4 macro.
Please contact the package mantainer.])
fi
AC_REQUIRE([AC_PROG_CC])dnl
AC_MSG_CHECKING([whether $CC supports the -$2 flag])
ac_check_cflags=$CFLAGS
CFLAGS="-$1"
CFLAGS="-$2"
AC_LANG_PUSH([C])
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [return 0;]),
[AC_MSG_RESULT([yes])
CFLAGS="-$1 $ac_check_cflags" ],
CFLAGS="$ac_check_cflags"
$1="-$2 $[$1]" ],
[AC_MSG_RESULT([no])
CFLAGS=$ac_check_cflags ]
)

View File

@ -5,19 +5,24 @@ dnl **************************************************
dnl ---------- AX_CHECK_LDFLAG ---------------------
dnl This macro checks if a particular flag for the
dnl C++ compiler works. If it is so, it adds the flag
dnl to the CXXFLAGS variable.
dnl Example of usage : AC_CHECK_LDFLAG([--as-needed])
dnl to the end of the first parameter.
dnl Example of usage : AC_CHECK_LDFLAG([LDFLAGS],[--as-needed])
dnl -------------------------------------------------
AC_DEFUN([AC_CHECK_LDFLAG],
[ AC_REQUIRE([AC_PROG_CC])dnl
AC_MSG_CHECKING([whether the linker supports the $1 flag])
[ if test -z "$1" -o -z "$2"; then
AC_MSG_FAILURE([Wrong parameters passed to the m4 macro.
Please contact the package mantainer.])
fi
AC_REQUIRE([AC_PROG_CC])dnl
AC_MSG_CHECKING([whether the linker supports the $2 flag])
ac_check_ldflags=$LDFLAGS
LDFLAGS="-Wl,$1"
LDFLAGS="-Wl,$2"
AC_LANG_PUSH([C])
AC_LINK_IFELSE(
AC_LANG_PROGRAM([], [return 0;]),
[AC_MSG_RESULT([yes])
LDFLAGS="-Wl,$1 $ac_check_ldflags" ],
LDFLAGS=$ac_check_ldflags
$1="-Wl,$2 $[$1]" ],
[AC_MSG_RESULT([no])
LDFLAGS=$ac_check_ldflags ]
)

View File

@ -1,4 +1,4 @@
// src/templates/parameter.tcc - Copyright 2005, 2006, University
// Src/templates/parameter.tcc - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//