Avoild some linker errors and warnings

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23963 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-10-25 14:46:36 +00:00
parent 2d387c3dee
commit 397d23e000
5 changed files with 100 additions and 1 deletions

View file

@ -1,3 +1,14 @@
2006-10-25 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: Define HAVE_VISIBILITY_ATTRIBUTE if gcc's visibility
attribute is both present in the version being used and working on
the current platform.
* configure: Regenerate
* Headers/Additions/GNUstepBase/config.h.in: Regenerate
* Source/GSPrivate.h: Only use the visibility attribute if it is
available. Avoids warnings (and link errors in at least one case)
on systems where it is not fully supported by gcc yet.
2006-10-23 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSCalendarDate: when adding offset to a date, work in

View file

@ -378,6 +378,9 @@
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
/* Says whether the visibility attribute works */
#undef HAVE_VISIBILITY_ATTRIBUTE
/* Define to 1 if you have the `vsprintf' function. */
#undef HAVE_VSPRINTF

View file

@ -28,7 +28,7 @@
@class NSNotification;
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
#if ( (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) ) && defined(HAVE_VISIBILITY_ATTRIBUTE) )
#define GS_ATTRIB_PRIVATE __attribute__ ((visibility("internal")))
#else
#define GS_ATTRIB_PRIVATE

67
configure vendored
View file

@ -4352,6 +4352,73 @@ else
echo "${ECHO_T}not found" >&6; }
fi
{ echo "$as_me:$LINENO: checking for gcc visibility attribute support" >&5
echo $ECHO_N "checking for gcc visibility attribute support... $ECHO_C" >&6; }
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
cat >conftest.$ac_ext <<_ACEOF
#include <stdio.h>
int foo() __attribute__ ((visibility("internal")));
int foo(){ return 1; }
int main(){ return foo(); }
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
{ echo "$as_me:$LINENO: result: found" >&5
echo "${ECHO_T}found" >&6; }
gs_visibility=1
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ echo "$as_me:$LINENO: result: not present" >&5
echo "${ECHO_T}not present" >&6; }
gs_visibility=0
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
cat >>confdefs.h <<_ACEOF
#define HAVE_VISIBILITY_ATTRIBUTE $gs_visibility
_ACEOF
CFLAGS="$saved_CFLAGS"
#--------------------------------------------------------------------
# Check if system has buggy SO_REUSEADDR
#--------------------------------------------------------------------

View file

@ -391,6 +391,24 @@ else
AC_MSG_RESULT([not found])
fi
AC_MSG_CHECKING(for gcc visibility attribute support)
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([
#include <stdio.h>
int foo() __attribute__ ((visibility("internal")));
int foo(){ return 1; }
int main(){ return foo(); }],
AC_MSG_RESULT([found])
gs_visibility=1,
AC_MSG_RESULT([not present])
gs_visibility=0
)
AC_DEFINE_UNQUOTED(HAVE_VISIBILITY_ATTRIBUTE,$gs_visibility,
[Says whether the visibility attribute works])
CFLAGS="$saved_CFLAGS"
#--------------------------------------------------------------------
# Check if system has buggy SO_REUSEADDR
#--------------------------------------------------------------------