diff options
author | bryner%brianryner.com <devnull@localhost> | 2004-12-15 05:52:40 +0000 |
---|---|---|
committer | bryner%brianryner.com <devnull@localhost> | 2004-12-15 05:52:40 +0000 |
commit | 9b024f4475a38b2fe60024bf4cff1e18b2d16322 (patch) | |
tree | 4086e16a5c12968b4219bb98157ee894cac904d8 | |
parent | 6871cd90652130c7045a7f8cd1a6cacd323f6159 (diff) | |
download | nspr-hg-9b024f4475a38b2fe60024bf4cff1e18b2d16322.tar.gz |
Add support for using gcc's visibility pragma to treat all function and method declarations as "hidden" unless declared otherwise. Create wrappers for system headers that cause them to be treated as default-visibility declarations. This gives a substantial code size and performance win on compilers that support it, and should show up on the gruff tinderbox. Bug 273336, r=darin sr=dbaron.
-rw-r--r-- | config/Makefile.in | 6 | ||||
-rw-r--r-- | config/autoconf.mk.in | 3 | ||||
-rw-r--r-- | config/config.mk | 8 | ||||
-rw-r--r-- | config/gcc_hidden.h | 2 | ||||
-rw-r--r-- | config/make-system-wrappers.pl | 59 | ||||
-rw-r--r-- | config/system-headers | 168 | ||||
-rwxr-xr-x | configure | 338 | ||||
-rw-r--r-- | configure.in | 47 | ||||
-rw-r--r-- | pr/include/prtypes.h | 22 | ||||
-rw-r--r-- | pr/src/md/unix/uxproces.c | 2 |
10 files changed, 564 insertions, 91 deletions
diff --git a/config/Makefile.in b/config/Makefile.in index 1b83ffa5..012c903b 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -133,6 +133,12 @@ define MAKE_OBJDIR if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); else true; fi endef +ifdef WRAP_SYSTEM_INCLUDES +export:: + mkdir -p $(dist_includedir)/system_wrappers + $(PERL) $(srcdir)/make-system-wrappers.pl $(dist_includedir)/system_wrappers < $(srcdir)/system-headers +endif + export:: $(TARGETS) rm -f $(dist_bindir)/nspr-config diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 92800154..066832be 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -111,3 +111,6 @@ OBJECT_MODE = @OBJECT_MODE@ ifdef OBJECT_MODE export OBJECT_MODE endif + +VISIBILITY_FLAGS = @VISIBILITY_FLAGS@ +WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@ diff --git a/config/config.mk b/config/config.mk index 697a6015..10ebfdab 100644 --- a/config/config.mk +++ b/config/config.mk @@ -62,10 +62,10 @@ endif NFSPWD = $(MOD_DEPTH)/config/nfspwd -CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\ - $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) -CCCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\ - $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) +CFLAGS = $(VISIBILITY_FLAGS) $(CC_ONLY_FLAGS) $(OPTIMIZER)\ + $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) +CCCFLAGS = $(VISIBILITY_FLAGS) $(CCC_ONLY_FLAGS) $(OPTIMIZER)\ + $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) # For purify NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) diff --git a/config/gcc_hidden.h b/config/gcc_hidden.h new file mode 100644 index 00000000..58140c15 --- /dev/null +++ b/config/gcc_hidden.h @@ -0,0 +1,2 @@ +/* Begin all files as hidden visibility */ +#pragma GCC visibility push(hidden) diff --git a/config/make-system-wrappers.pl b/config/make-system-wrappers.pl new file mode 100644 index 00000000..31c9af4a --- /dev/null +++ b/config/make-system-wrappers.pl @@ -0,0 +1,59 @@ +#!/usr/bin/perl +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# IBM Corporation. +# Portions created by the Initial Developer are Copyright (C) 2004 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Brian Ryner <bryner@brianryner.com> +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +$output_dir = shift; + +while (<STDIN>) { + chomp; + if (-e "$output_dir/$_") { + next; + } + + if (/(.*)\/[^\/*]/) { + mkdir "$output_dir/$1"; + } + + open OUT, ">$output_dir/$_"; + print OUT "#pragma GCC system_header\n"; # suppress include_next warning + print OUT "#pragma GCC visibility push(default)\n"; + print OUT "#include_next \<$_\>\n"; + print OUT "#pragma GCC visibility pop\n"; + close OUT; +} + diff --git a/config/system-headers b/config/system-headers new file mode 100644 index 00000000..7a2869e7 --- /dev/null +++ b/config/system-headers @@ -0,0 +1,168 @@ +Aliases.h +arpa/inet.h +assert.h +bsd/libc.h +bsd/syscall.h +bstring.h +builtin.h +c_asm.h +CFBundle.h +CFData.h +CFDictionary.h +CFString.h +CFURL.h +CodeFragments.h +commdlg.h +crt_externs.h +crypt.h +ctype.h +descrip.h +Devices.h +direct.h +dirent.h +dlfcn.h +dl.h +DriverServices.h +dvidef.h +errno.h +Errors.h +Events.h +fcntl.h +fibdef.h +files.h +Files.h +float.h +Folders.h +Gestalt.h +getopt.h +grp.h +ia64/sys/inline.h +ifaddrs.h +image.h +ints.h +iodef.h +io.h +iostream.h +kernel/OS.h +lib$routines.h +limits.h +loader.h +locale.h +LowMem.h +MacErrors.h +machine/builtins.h +machine/clock.h +machine/endian.h +machine/inline.h +mach-o/dyld.h +MacTypes.h +Math64.h +math.h +mbstring.h +memory.h +MixedMode.h +model.h +mswsock.h +Multiprocessing.h +mutex.h +netdb.h +net/if.h +netinet/in.h +netinet/in_systm.h +netinet/tcp.h +OpenTptInternet.h +OpenTransport.h +os2.h +OS.h +osreldate.h +OSUtils.h +poll.h +PPCToolbox.h +Processes.h +process.h +pthread.h +pwd.h +QDOffscreen.h +Resources.h +rld_interface.h +rpc/types.h +semaphore.h +setjmp.h +share.h +signal.h +ssdef.h +starlet.h +stat.h +stdarg.h +stddef.h +stdio.h +stdlib.h +string.h +stropts.h +stsdef.h +support/SupportDefs.h +support/TLS.h +synch.h +sys/atomic_op.h +syscall.h +sys/file.h +sys/filio.h +sys/immu.h +sys/ioctl.h +sys/ipc.h +sys/ldr.h +sys/locking.h +sys/lwp.h +sys/mman.h +sys/mpctl.h +sys/param.h +sys/pda.h +sys/poll.h +sys/prctl.h +sys/priv.h +sys/procfs.h +sys/pstat.h +sys/regset.h +sys/resource.h +sys/sched.h +sys/select.h +sys/sem.h +sys/sendfile.h +sys/shm.h +sys/socket.h +sys/stack.h +sys/stat.h +sys/statvfs.h +sys/syscall.h +sys/sysctl.h +sys/sysmp.h +sys/syssgi.h +sys/systeminfo.h +sys/timeb.h +sys/time.h +sys/times.h +sys/types.h +sys/ucontext.h +sys/uio.h +sys/utsname.h +sys/wait.h +task.h +TextUtils.h +thread.h +time.h +Timer.h +types.h +Types.h +ucontext.h +ucx$inetdef.h +ulocks.h +unistd.h +unix.h +unixlib.h +utime.h +wchar.h +winbase.h +win/compobj.h +windef.h +windows.h +winsock.h @@ -1605,12 +1605,63 @@ else fi fi +for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat > conftest.$ac_ext <<EOF +#line 1619 "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +int main() { +exit (42); +; return 0; } +EOF +if { (eval echo configure:1627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + continue +fi +rm -f conftest* + cat > conftest.$ac_ext <<EOF +#line 1637 "configure" +#include "confdefs.h" +$ac_declaration +int main() { +exit (42); +; return 0; } +EOF +if { (eval echo configure:1644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + + for ac_prog in $RANLIB "${target_alias}-ranlib" "${target}-ranlib" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1614: checking for $ac_word" >&5 +echo "configure:1665: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1645,7 +1696,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1649: checking for $ac_word" >&5 +echo "configure:1700: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1680,7 +1731,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1684: checking for $ac_word" >&5 +echo "configure:1735: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1715,7 +1766,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1719: checking for $ac_word" >&5 +echo "configure:1770: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1750,7 +1801,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1754: checking for $ac_word" >&5 +echo "configure:1805: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1785,7 +1836,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1789: checking for $ac_word" >&5 +echo "configure:1840: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1822,7 +1873,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1826: checking for $ac_word" >&5 +echo "configure:1877: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1854,7 +1905,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1858: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1909: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1865,12 +1916,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1869 "configure" +#line 1920 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1896,12 +1947,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1900: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1951: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1905: checking whether we are using GNU C++" >&5 +echo "configure:1956: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1910,7 +1961,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1914: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1929,7 +1980,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1933: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1984: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1960,13 +2011,64 @@ else fi fi +for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat > conftest.$ac_ext <<EOF +#line 2025 "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +int main() { +exit (42); +; return 0; } +EOF +if { (eval echo configure:2033: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + continue +fi +rm -f conftest* + cat > conftest.$ac_ext <<EOF +#line 2043 "configure" +#include "confdefs.h" +$ac_declaration +int main() { +exit (42); +; return 0; } +EOF +if { (eval echo configure:2050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + + if test "$CXX" = "cl" -a -z "$CC"; then CC=$CXX else # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1970: checking for $ac_word" >&5 +echo "configure:2072: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1996,7 +2098,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2000: checking for $ac_word" >&5 +echo "configure:2102: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2047,7 +2149,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2051: checking for $ac_word" >&5 +echo "configure:2153: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2079,7 +2181,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2083: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2185: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2090,12 +2192,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2094 "configure" +#line 2196 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2121,12 +2223,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2125: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2227: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2130: checking whether we are using GNU C" >&5 +echo "configure:2232: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2135,7 +2237,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2139: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2241: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2154,7 +2256,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2158: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2260: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2187,7 +2289,7 @@ fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2191: checking how to run the C preprocessor" >&5 +echo "configure:2293: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2202,13 +2304,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 2206 "configure" +#line 2308 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2314: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2219,13 +2321,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 2223 "configure" +#line 2325 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2331: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2236,13 +2338,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 2240 "configure" +#line 2342 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2246: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2269,7 +2371,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2273: checking for $ac_word" >&5 +echo "configure:2375: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2301,7 +2403,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2305: checking for $ac_word" >&5 +echo "configure:2407: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2342,7 +2444,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2346: checking for $ac_word" >&5 +echo "configure:2448: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2383,7 +2485,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2387: checking for $ac_word" >&5 +echo "configure:2489: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2424,7 +2526,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2428: checking for $ac_word" >&5 +echo "configure:2530: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2465,7 +2567,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2469: checking for $ac_word" >&5 +echo "configure:2571: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2527,7 +2629,7 @@ else fi echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6 -echo "configure:2531: checking for gcc -pipe support" >&5 +echo "configure:2633: checking for gcc -pipe support" >&5 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then echo '#include <stdio.h>' > dummy-hello.c echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c @@ -2542,14 +2644,14 @@ if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then _SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -pipe" cat > conftest.$ac_ext <<EOF -#line 2546 "configure" +#line 2648 "configure" #include "confdefs.h" #include <stdio.h> int main() { printf("Hello World\n"); ; return 0; } EOF -if { (eval echo configure:2553: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* _res_gcc_pipe="yes" else @@ -2574,6 +2676,63 @@ else echo "$ac_t""no" 1>&6 fi +if test "$GNU_CC"; then + echo $ac_n "checking for visibility(hidden) attribute""... $ac_c" 1>&6 +echo "configure:2682: checking for visibility(hidden) attribute" >&5 +if eval "test \"`echo '$''{'ac_cv_visibility_hidden'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF + int foo __attribute__ ((visibility ("hidden"))) = 1; +EOF + ac_cv_visibility_attribute=no + if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then + if grep '\.hidden.*foo' conftest.s >/dev/null; then + ac_cv_visibility_hidden=yes + fi + fi + rm -f conftest.cs + +fi + +echo "$ac_t""$ac_cv_visibility_hidden" 1>&6 + if test $ac_cv_visibility_hidden = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_VISIBILITY_HIDDEN_ATTRIBUTE 1 +EOF + + echo $ac_n "checking for visibility pragma support""... $ac_c" 1>&6 +echo "configure:2706: checking for visibility pragma support" >&5 +if eval "test \"`echo '$''{'ac_cv_visibility_pragma'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#pragma GCC visibility push(hidden) + int foo_hidden = 1; +#pragma GCC visibility push(default) + int foo_default = 1; +EOF + ac_cv_visibility_pragma=no + if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then + if grep '\.hidden.*foo_hidden' conftest.s >/dev/null && ! grep '\.hidden.*foo_default' conftest.s > /dev/null ; then + ac_cv_visibility_pragma=yes + fi + fi + rm -f conftest.cs + +fi + +echo "$ac_t""$ac_cv_visibility_pragma" 1>&6 + if test $ac_cv_visibility_pragma = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_VISIBILITY_PRAGMA 1 +EOF + + VISIBILITY_FLAGS='-I$(dist_includedir)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h' + WRAP_SYSTEM_INCLUDES=1 + fi + fi +fi # GNU_CC fi # SKIP_COMPILER_CHECKS if test -z "$SKIP_PATH_CHECKS"; then @@ -2582,7 +2741,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2586: checking for $ac_word" >&5 +echo "configure:2745: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2827,17 +2986,17 @@ EOF DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib' ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6 -echo "configure:2831: checking for sys/atomic_op.h" >&5 +echo "configure:2990: checking for sys/atomic_op.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2836 "configure" +#line 2995 "configure" #include "confdefs.h" #include <sys/atomic_op.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2841: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2994,7 +3153,7 @@ EOF _DEBUG_FLAGS='-gdwarf-2 -O0' MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@' echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6 -echo "configure:2998: checking for gethostbyaddr in -lbind" >&5 +echo "configure:3157: checking for gethostbyaddr in -lbind" >&5 ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3002,7 +3161,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbind $LIBS" cat > conftest.$ac_ext <<EOF -#line 3006 "configure" +#line 3165 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3013,7 +3172,7 @@ int main() { gethostbyaddr() ; return 0; } EOF -if { (eval echo configure:3017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4216,17 +4375,17 @@ EOF _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000" ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6 -echo "configure:4220: checking for machine/builtins.h" >&5 +echo "configure:4379: checking for machine/builtins.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4225 "configure" +#line 4384 "configure" #include "confdefs.h" #include <machine/builtins.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4230: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4768,7 +4927,7 @@ case $target in ;; *) echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:4772: checking for dlopen in -ldl" >&5 +echo "configure:4931: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4776,7 +4935,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 4780 "configure" +#line 4939 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4787,7 +4946,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:4791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4804,17 +4963,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6 -echo "configure:4808: checking for dlfcn.h" >&5 +echo "configure:4967: checking for dlfcn.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4813 "configure" +#line 4972 "configure" #include "confdefs.h" #include <dlfcn.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4818: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4977: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4847,13 +5006,13 @@ esac if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:4851: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:5010: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 4857 "configure" +#line 5016 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -4871,7 +5030,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 4875 "configure" +#line 5034 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -4895,12 +5054,12 @@ fi for ac_func in lchown strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4899: checking for $ac_func" >&5 +echo "configure:5058: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4904 "configure" +#line 5063 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4923,7 +5082,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4964,7 +5123,7 @@ hpux*) if test -z "$GNU_CC"; then echo $ac_n "checking for +Olit support""... $ac_c" 1>&6 -echo "configure:4968: checking for +Olit support" >&5 +echo "configure:5127: checking for +Olit support" >&5 if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4998,7 +5157,7 @@ esac echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:5002: checking for pthread_create in -lpthreads" >&5 +echo "configure:5161: checking for pthread_create in -lpthreads" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5020,7 +5179,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:5024: checking for pthread_create in -lpthread" >&5 +echo "configure:5183: checking for pthread_create in -lpthread" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5042,7 +5201,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:5046: checking for pthread_create in -lc_r" >&5 +echo "configure:5205: checking for pthread_create in -lc_r" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5064,7 +5223,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 -echo "configure:5068: checking for pthread_create in -lc" >&5 +echo "configure:5227: checking for pthread_create in -lc" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5216,7 +5375,7 @@ if test -n "$USE_PTHREADS"; then rm -f conftest* ac_cv_have_dash_pthread=no echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6 -echo "configure:5220: checking whether ${CC-cc} accepts -pthread" >&5 +echo "configure:5379: checking whether ${CC-cc} accepts -pthread" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -5239,7 +5398,7 @@ echo "configure:5220: checking whether ${CC-cc} accepts -pthread" >&5 ac_cv_have_dash_pthreads=no if test "$ac_cv_have_dash_pthread" = "no"; then echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6 -echo "configure:5243: checking whether ${CC-cc} accepts -pthreads" >&5 +echo "configure:5402: checking whether ${CC-cc} accepts -pthreads" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -5647,6 +5806,8 @@ esac + + MAKEFILES=" Makefile config/Makefile @@ -5762,15 +5923,34 @@ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '` -rm -f conftest.defs +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed # Without the "./", some shells look in PATH for config.status. @@ -5936,6 +6116,8 @@ s%@DLLFLAGS@%$DLLFLAGS%g s%@EXEFLAGS@%$EXEFLAGS%g s%@OS_DLLFLAGS@%$OS_DLLFLAGS%g s%@CYGWIN_WRAPPER@%$CYGWIN_WRAPPER%g +s%@VISIBILITY_FLAGS@%$VISIBILITY_FLAGS%g +s%@WRAP_SYSTEM_INCLUDES@%$WRAP_SYSTEM_INCLUDES%g CEOF EOF diff --git a/configure.in b/configure.in index 8c473caa..1f2676a2 100644 --- a/configure.in +++ b/configure.in @@ -484,6 +484,51 @@ else AC_MSG_RESULT([no]) fi +dnl Check for .hidden assembler directive and visibility attribute. +dnl Borrowed from glibc configure.in +dnl =============================================================== +dnl Check for .hidden assembler directive and visibility attribute. +dnl Borrowed from glibc configure.in +dnl =============================================================== +if test "$GNU_CC"; then + AC_CACHE_CHECK(for visibility(hidden) attribute, + ac_cv_visibility_hidden, + [cat > conftest.c <<EOF + int foo __attribute__ ((visibility ("hidden"))) = 1; +EOF + ac_cv_visibility_attribute=no + if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then + if grep '\.hidden.*foo' conftest.s >/dev/null; then + ac_cv_visibility_hidden=yes + fi + fi + rm -f conftest.[cs] + ]) + if test $ac_cv_visibility_hidden = yes; then + AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE) + AC_CACHE_CHECK(for visibility pragma support, + ac_cv_visibility_pragma, + [cat > conftest.c <<EOF +#pragma GCC visibility push(hidden) + int foo_hidden = 1; +#pragma GCC visibility push(default) + int foo_default = 1; +EOF + ac_cv_visibility_pragma=no + if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then + if grep '\.hidden.*foo_hidden' conftest.s >/dev/null && ! grep '\.hidden.*foo_default' conftest.s > /dev/null ; then + ac_cv_visibility_pragma=yes + fi + fi + rm -f conftest.[cs] + ]) + if test $ac_cv_visibility_pragma = yes; then + AC_DEFINE(HAVE_VISIBILITY_PRAGMA) + VISIBILITY_FLAGS='-I$(dist_includedir)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h' + WRAP_SYSTEM_INCLUDES=1 + fi + fi +fi # GNU_CC fi # SKIP_COMPILER_CHECKS dnl ======================================================== @@ -2508,6 +2553,8 @@ AC_SUBST(DLLFLAGS) AC_SUBST(EXEFLAGS) AC_SUBST(OS_DLLFLAGS) AC_SUBST(CYGWIN_WRAPPER) +AC_SUBST(VISIBILITY_FLAGS) +AC_SUBST(WRAP_SYSTEM_INCLUDES) dnl ======================================================== dnl Generate output files. diff --git a/pr/include/prtypes.h b/pr/include/prtypes.h index 6b954881..3eb15548 100644 --- a/pr/include/prtypes.h +++ b/pr/include/prtypes.h @@ -178,15 +178,21 @@ #else /* Unix */ -#define PR_EXPORT(__type) extern __type -#define PR_EXPORT_DATA(__type) extern __type -#define PR_IMPORT(__type) extern __type -#define PR_IMPORT_DATA(__type) extern __type +#ifdef HAVE_VISIBILITY_PRAGMA +#define PR_VISIBILITY_DEFAULT __attribute__((visibility("default"))) +#else +#define PR_VISIBILITY_DEFAULT +#endif -#define PR_EXTERN(__type) extern __type -#define PR_IMPLEMENT(__type) __type -#define PR_EXTERN_DATA(__type) extern __type -#define PR_IMPLEMENT_DATA(__type) __type +#define PR_EXPORT(__type) extern PR_VISIBILITY_DEFAULT __type +#define PR_EXPORT_DATA(__type) extern PR_VISIBILITY_DEFAULT __type +#define PR_IMPORT(__type) extern PR_VISIBILITY_DEFAULT __type +#define PR_IMPORT_DATA(__type) extern PR_VISIBILITY_DEFAULT __type + +#define PR_EXTERN(__type) extern PR_VISIBILITY_DEFAULT __type +#define PR_IMPLEMENT(__type) PR_VISIBILITY_DEFAULT __type +#define PR_EXTERN_DATA(__type) extern PR_VISIBILITY_DEFAULT __type +#define PR_IMPLEMENT_DATA(__type) PR_VISIBILITY_DEFAULT __type #define PR_CALLBACK #define PR_CALLBACK_DECL #define PR_STATIC_CALLBACK(__x) static __x diff --git a/pr/src/md/unix/uxproces.c b/pr/src/md/unix/uxproces.c index 43fdd290..c5c8be94 100644 --- a/pr/src/md/unix/uxproces.c +++ b/pr/src/md/unix/uxproces.c @@ -49,7 +49,7 @@ #if defined(DARWIN) #include <crt_externs.h> #else -extern char **environ; +PR_IMPORT_DATA(char **) environ; #endif /* |