symbol visibility=hidden only in release mode

for shared library and codemodels
This commit is contained in:
Holger Vogt 2018-10-27 11:06:16 +02:00
parent 75d1e45737
commit 4738edeab5
3 changed files with 24 additions and 10 deletions

View File

@ -319,19 +319,24 @@ if test "x$with_ngshared" != x && test "x$with_ngshared" != xno ; then
has_shcyg=true
AC_CHECK_LIB([pthread], [pthread_create])
;;
*)
AC_CHECK_LIB([pthread], [pthread_create])
;;
esac
if test "x$enable_debug" = xno; then
case $host_os in
*solaris* )
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -fvisibility=hidden"
else
CFLAGS="$CFLAGS -xldscope=hidden"
fi
AC_CHECK_LIB([pthread], [pthread_create])
;;
*)
CFLAGS="$CFLAGS -fvisibility=hidden"
AC_CHECK_LIB([pthread], [pthread_create])
;;
esac
esac
fi
with_x=no
with_windows=no
@ -931,6 +936,7 @@ AC_PROG_LEX
# Add new code models to the build by pointing to them here.
if test "x$enable_xspice" = xyes; then
VIS_CFLAGS=""
AC_MSG_RESULT([X-Spice features included])
AC_DEFINE([XSPICE], [1], [The xspice enhancements])
case $host_os in
@ -953,23 +959,30 @@ if test "x$enable_xspice" = xyes; then
*solaris* )
AC_DEFINE([IPC_UNIX_SOCKETS], [1], [Client-Server via socket.])
XSPICEDLLIBS=""
if test -z "$has_shared_module"; then
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -fvisibility=hidden"
if test "x$with_ngshared" != xyes ; then
if test "x$enable_debug" = xno; then
if test "x$GCC" = xyes; then
VIS_CFLAGS="-fvisibility=hidden"
else
VIS_CFLAGS="-xldscope=hidden"
fi
fi
fi
;;
* )
AC_DEFINE([IPC_UNIX_SOCKETS], [1], [Client-Server via socket.])
XSPICEDLLIBS="-ldl"
if test -z "$has_shared_module"; then
CFLAGS="$CFLAGS -fvisibility=hidden"
if test "x$with_ngshared" != xyes ; then
if test "x$enable_debug" = xno; then
VIS_CFLAGS="-fvisibility=hidden"
fi
fi
;;
esac
XSPICEINIT=""
AC_CHECK_FUNCS([modf])
AC_CHECK_HEADERS([libintl.h malloc.h])
AC_SUBST([VIS_CFLAGS])
else
XSPICEINIT="*"
fi

View File

@ -92,7 +92,7 @@ cm-distclean :
#-----
$(cm)/$(cm).cm : $(cm-objs)
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(VIS_CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
# "order-only" prerequisites
# (info "(make) Prerequisite Types")
@ -134,7 +134,7 @@ define do-deps
rm $$x.pp
endef
COMPILE = $(CC) $(INCLUDES) -I$(cm) -I$(srcdir)/$(cm) $(CFLAGS) $(EXTRA_CFLAGS)
COMPILE = $(CC) $(INCLUDES) -I$(cm) -I$(srcdir)/$(cm) $(CFLAGS) $(EXTRA_CFLAGS) $(VIS_CFLAGS)
$(cm)/dlmain.o : $(srcdir)/dlmain.c $(cm-descr)
$(COMPILE) $(gen_pp) -o $@ -c $<

View File

@ -15,6 +15,7 @@ uname = $(shell uname)
# C compiler to use
CC = @CC@
CFLAGS = @CFLAGS@
VIS_CFLAGS = @VIS_CFLAGS@
EXEEXT = @EXEEXT@
BUILD_EXEEXT = @BUILD_EXEEXT@