- 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

@ -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 ]
)