Bug 461270: Upgraded NSPR to NSPR_HEAD_20090210: linking NSPR
shared libraries should use LDFLAGS.
--- a/nsprpub/config/rules.mk
+++ b/nsprpub/config/rules.mk
@@ -344,17 +344,17 @@ else # WINNT && !GCC
ifeq ($(OS_TARGET), OpenVMS)
@if test ! -f $(VMS_SYMVEC_FILE); then \
if test -f $(VMS_SYMVEC_FILE_MODULE); then \
echo Creating component options file $(VMS_SYMVEC_FILE); \
cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
fi; \
fi
endif # OpenVMS
- $(MKSHLIB) $(OBJS) $(RES) $(EXTRA_LIBS)
+ $(MKSHLIB) $(OBJS) $(RES) $(LDFLAGS) $(EXTRA_LIBS)
endif # WINNT && !GCC
endif # AIX 4.1
ifdef ENABLE_STRIP
$(STRIP) $@
endif
ifeq ($(OS_ARCH),WINNT)
$(RES): $(RESNAME)
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -3427,35 +3427,32 @@ tools are selected during the Xcode/Deve
HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
if test "$HOST_DARWIN_MAJOR" -lt 9 ; then
MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}"
else
MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}"
fi
- LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
- DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS"
+ LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
export NEXT_ROOT=$MACOS_SDK_DIR
if test -n "$CROSS_COMPILE" ; then
HOST_CC="NEXT_ROOT= $HOST_CC"
HOST_CXX="NEXT_ROOT= $HOST_CXX"
fi
else
CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
- if test "$GCC_VERSION_FULL" != "4.0.0" ; then
+ if test "$GCC_VERSION_FULL" != "4.0.0" ; then
LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
- DSO_LDOPTS="$DSO_LDOPTS -isysroot ${MACOS_SDK_DIR}"
else
LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
- DSO_LDOPTS="$DSO_LDOPTS -Wl,-syslibroot,${MACOS_SDK_DIR}"
fi
fi
fi
fi
;;
*-dgux*)
cat >> confdefs.h <<\EOF
@@ -4498,17 +4495,17 @@ EOF
cat >> confdefs.h <<\EOF
#define PR_GETIPNODE_NOT_THREADSAFE 1
EOF
RESOLVE_LINK_SYMBOLS=1
AR_FLAGS='c $@'
MDCPUCFG_H=_openvms.cfg
PR_MD_CSRCS=openvms.c
- DSO_LDOPTS='-shared -auto_symvec $(LDFLAGS)'
+ DSO_LDOPTS='-shared -auto_symvec'
if test -n "$MOZ_DEBUG"; then
DSO_LDOPTS="$DSO_LDOPTS $_DEBUG_FLAGS"
else
DSO_LDOPTS="$DSO_LDOPTS $_OPTIMIZE_FLAGS"
fi
;;
*-osf*)
@@ -4541,27 +4538,27 @@ EOF
if test -z "$GNU_CC"; then
CC="$CC -std1 -ieee_with_inexact"
if test "$OS_RELEASE" != "V2.0"; then
CC="$CC -readonly_strings"
fi
_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:4550: checking for machine/builtins.h" >&5
+echo "configure:4547: 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 4555 "configure"
+#line 4552 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4560: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4557: \"$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*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
@@ -5040,28 +5037,27 @@ EOF
EOF
AR=emxomfar
AR_FLAGS='r $@'
CFLAGS="$CFLAGS -Wall -Zomf"
CXXFLAGS="$CFLAGS -Wall -Zomf"
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
DSO_CFLAGS=
- DSO_LDOPTS='-Zomf -Zdll -Zmap'
+ DSO_LDOPTS='-Zomf -Zdll'
LDFLAGS='-Zmap'
_OPTIMIZE_FLAGS="-O2 -s"
_DEBUG_FLAGS="-g -fno-inline"
if test -n "$MOZ_OPTIMIZE"; then
DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
fi
OS_LIBS="-lsocket"
IMPLIB='emximp -o'
FILTER='emxexp -o'
if test -n "$MOZ_OS2_HIGH_MEMORY"; then
- DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
LDFLAGS="$LDFLAGS -Zhigh-mem"
cat >> confdefs.h <<\EOF
#define MOZ_OS2_HIGH_MEMORY 1
EOF
fi
# GCC for OS/2 currently predefines these, but we don't want them
@@ -5081,63 +5077,63 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then
case $target in
*-darwin*|*-beos*)
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5090: checking for dlopen in -ldl" >&5
+echo "configure:5086: 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
else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5098 "configure"
+#line 5094 "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
builtin and then its argument prototype would still apply. */
char dlopen();
int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:5109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5105: \"$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
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
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:5126: checking for dlfcn.h" >&5
+echo "configure:5122: 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 5131 "configure"
+#line 5127 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5136: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5132: \"$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*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
@@ -5160,23 +5156,23 @@ fi
;;
esac
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:5169: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:5165: 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 5175 "configure"
+#line 5171 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "$ac_pattern" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_prog_gcc_traditional=yes
@@ -5184,17 +5180,17 @@ else
rm -rf conftest*
ac_cv_prog_gcc_traditional=no
fi
rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 5193 "configure"
+#line 5189 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "$ac_pattern" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_prog_gcc_traditional=yes
@@ -5208,22 +5204,22 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional
if test $ac_cv_prog_gcc_traditional = yes; then
CC="$CC -traditional"
fi
fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5217: checking for $ac_func" >&5
+echo "configure:5213: 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 5222 "configure"
+#line 5218 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
@@ -5236,17 +5232,17 @@ int main() {
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
-if { (eval echo configure:5245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5241: \"$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
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
@@ -5277,17 +5273,17 @@ if test "${enable_strip+set}" = set; the
fi
case "${target_os}" in
hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:5286: checking for +Olit support" >&5
+echo "configure:5282: 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
ac_cv_hpux_usable_olit_option=no
rm -f conftest*
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} ${CFLAGS} +Olit=all -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@@ -5316,17 +5312,17 @@ esac
case "$target_os" in
darwin*)
_HAVE_PTHREADS=1
;;
*)
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5325: checking for pthread_create in -lpthreads" >&5
+echo "configure:5321: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
int main() {
pthread_t t;
if (!pthread_create(&t, 0, &foo, 0)) {
pthread_join(t, 0);
}
@@ -5338,17 +5334,17 @@ echo "
rm -f dummy.c dummy${ac_exeext} ;
if test "$_res" = "0"; then
echo "$ac_t""yes" 1>&6
_HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5347: checking for pthread_create in -lpthread" >&5
+echo "configure:5343: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
int main() {
pthread_t t;
if (!pthread_create(&t, 0, &foo, 0)) {
pthread_join(t, 0);
}
@@ -5360,17 +5356,17 @@ echo "
rm -f dummy.c dummy${ac_exeext} ;
if test "$_res" = "0"; then
echo "$ac_t""yes" 1>&6
_HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5369: checking for pthread_create in -lc_r" >&5
+echo "configure:5365: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
int main() {
pthread_t t;
if (!pthread_create(&t, 0, &foo, 0)) {
pthread_join(t, 0);
}
@@ -5382,17 +5378,17 @@ echo "
rm -f dummy.c dummy${ac_exeext} ;
if test "$_res" = "0"; then
echo "$ac_t""yes" 1>&6
_HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5391: checking for pthread_create in -lc" >&5
+echo "configure:5387: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
int main() {
pthread_t t;
if (!pthread_create(&t, 0, &foo, 0)) {
pthread_join(t, 0);
}
@@ -5514,17 +5510,17 @@ EOF
fi
fi
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:5523: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5519: 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
if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
ac_cv_have_dash_pthread=yes
case "$target_os" in
freebsd*)
# Freebsd doesn't use -pthread for compiles, it uses them for linking
@@ -5537,17 +5533,17 @@ echo "configure:5523: checking whether $
fi
fi
rm -f conftest*
echo "$ac_t""$ac_cv_have_dash_pthread" 1>&6
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:5546: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5542: 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
if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
ac_cv_have_dash_pthreads=yes
CFLAGS="$CFLAGS -pthreads"
CXXFLAGS="$CXXFLAGS -pthreads"
fi
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -1096,21 +1096,17 @@ tools are selected during the Xcode/Deve
dnl were present in earlier OS releases (and the associated
dnl SDK) but not in Leopard. -syslibroot does not have
dnl this problem, but it results in harmless warnings when
dnl NEXT_ROOT is set. NEXT_ROOT needs to remain set even
dnl on Leopard because the compiler uses it too.
MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}"
fi
- dnl LDFLAGS is for the utilities built in config (now and
- dnl nsinstall). DSO_LDOPTS is used when linking shared
- dnl libraries.
LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
- DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS"
export NEXT_ROOT=$MACOS_SDK_DIR
if test -n "$CROSS_COMPILE" ; then
dnl NEXT_ROOT will be in the environment, but it
dnl shouldn't be set for the build host. HOST_CXX is
dnl presently unused.
HOST_CC="NEXT_ROOT= $HOST_CC"
HOST_CXX="NEXT_ROOT= $HOST_CXX"
@@ -1122,29 +1118,24 @@ tools are selected during the Xcode/Deve
dnl CPP needs to be set for AC_CHECK_HEADER.
CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which
dnl has an ld that supports -syslibroot. Don't set
dnl NEXT_ROOT because it will be ignored and cause
dnl warnings when -syslibroot is specified.
- dnl
- dnl Both LDFLAGS and DSO_LDOPTS are set here, see the
- dnl gcc < 4.0 case for the explanation.
if test "$GCC_VERSION_FULL" != "4.0.0" ; then
dnl gcc > 4.0.0 will pass -syslibroot to ld automatically
dnl based on the -isysroot it receives.
LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
- DSO_LDOPTS="$DSO_LDOPTS -isysroot ${MACOS_SDK_DIR}"
else
dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs
dnl to be explicit.
LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
- DSO_LDOPTS="$DSO_LDOPTS -Wl,-syslibroot,${MACOS_SDK_DIR}"
fi
fi
fi
fi
;;
*-dgux*)
AC_DEFINE(XP_UNIX)
@@ -1855,17 +1846,17 @@ mips-sony-newsos*)
*-openvms*)
AC_DEFINE(XP_UNIX)
AC_DEFINE(VMS)
AC_DEFINE(PR_GETIPNODE_NOT_THREADSAFE)
RESOLVE_LINK_SYMBOLS=1
AR_FLAGS='c $@'
MDCPUCFG_H=_openvms.cfg
PR_MD_CSRCS=openvms.c
- DSO_LDOPTS='-shared -auto_symvec $(LDFLAGS)'
+ DSO_LDOPTS='-shared -auto_symvec'
if test -n "$MOZ_DEBUG"; then
DSO_LDOPTS="$DSO_LDOPTS $_DEBUG_FLAGS"
else
DSO_LDOPTS="$DSO_LDOPTS $_OPTIMIZE_FLAGS"
fi
;;
*-osf*)
@@ -2191,28 +2182,27 @@ mips-sony-newsos*)
AC_DEFINE(OS2)
AR=emxomfar
AR_FLAGS='r $@'
CFLAGS="$CFLAGS -Wall -Zomf"
CXXFLAGS="$CFLAGS -Wall -Zomf"
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
DSO_CFLAGS=
- DSO_LDOPTS='-Zomf -Zdll -Zmap'
+ DSO_LDOPTS='-Zomf -Zdll'
LDFLAGS='-Zmap'
_OPTIMIZE_FLAGS="-O2 -s"
_DEBUG_FLAGS="-g -fno-inline"
if test -n "$MOZ_OPTIMIZE"; then
DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
fi
OS_LIBS="-lsocket"
IMPLIB='emximp -o'
FILTER='emxexp -o'
if test -n "$MOZ_OS2_HIGH_MEMORY"; then
- DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
LDFLAGS="$LDFLAGS -Zhigh-mem"
AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
fi
# GCC for OS/2 currently predefines these, but we don't want them
DEFINES="$DEFINES -Uunix -U__unix -U__unix__"
;;