Bugzilla bug 322427: do not compile NSPR with -ansi and with _POSIX_SOURCE,

_BSD_SOURCE, _SVID_SOURCE, _LARGEFILE64_SOURCE, and _XOPEN_SOURCE defined.
Instead, just define _GNU_SOURCE.  r=kengert.
Modified files: configure configure.in pr/src/linking/Makefile.in
                pr/src/pthreads/Makefile.in
This commit is contained in:
wtchang%redhat.com 2006-01-07 00:51:39 +00:00
parent d6350f1b77
commit 513d31b9fc
4 changed files with 28 additions and 53 deletions

62
nsprpub/configure vendored
View File

@ -3810,19 +3810,7 @@ EOF
EOF
cat >> confdefs.h <<\EOF
#define _POSIX_SOURCE 1
EOF
cat >> confdefs.h <<\EOF
#define _BSD_SOURCE 1
EOF
cat >> confdefs.h <<\EOF
#define _SVID_SOURCE 1
EOF
cat >> confdefs.h <<\EOF
#define _LARGEFILE64_SOURCE 1
#define _GNU_SOURCE 1
EOF
cat >> confdefs.h <<\EOF
@ -3837,8 +3825,8 @@ EOF
;;
esac
CFLAGS="$CFLAGS -ansi -Wall"
CXXFLAGS="$CXXFLAGS -ansi -Wall"
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CXXFLAGS -Wall"
MDCPUCFG_H=_linux.cfg
PR_MD_CSRCS=linux.c
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
@ -4416,17 +4404,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:4420: checking for machine/builtins.h" >&5
echo "configure:4408: 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 4425 "configure"
#line 4413 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4418: \"$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*
@ -4988,7 +4976,7 @@ case $target in
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
echo "configure:4992: checking for dlopen in -ldl" >&5
echo "configure:4980: 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
@ -4996,7 +4984,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 5000 "configure"
#line 4988 "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
@ -5007,7 +4995,7 @@ int main() {
dlopen()
; return 0; }
EOF
if { (eval echo configure:5011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4999: \"$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
@ -5024,17 +5012,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:5028: checking for dlfcn.h" >&5
echo "configure:5016: 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 5033 "configure"
#line 5021 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:5038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:5026: \"$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*
@ -5067,13 +5055,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:5071: checking whether ${CC-cc} needs -traditional" >&5
echo "configure:5059: 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 5077 "configure"
#line 5065 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@ -5091,7 +5079,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
#line 5095 "configure"
#line 5083 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@ -5115,12 +5103,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5119: checking for $ac_func" >&5
echo "configure:5107: 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 5124 "configure"
#line 5112 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -5143,7 +5131,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:5147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:5135: \"$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
@ -5184,7 +5172,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
echo "configure:5188: checking for +Olit support" >&5
echo "configure:5176: 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
@ -5223,7 +5211,7 @@ darwin*)
*)
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
echo "configure:5227: checking for pthread_create in -lpthreads" >&5
echo "configure:5215: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5245,7 +5233,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
echo "configure:5249: checking for pthread_create in -lpthread" >&5
echo "configure:5237: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5267,7 +5255,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
echo "configure:5271: checking for pthread_create in -lc_r" >&5
echo "configure:5259: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5289,7 +5277,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
echo "configure:5293: checking for pthread_create in -lc" >&5
echo "configure:5281: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5443,7 +5431,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:5447: checking whether ${CC-cc} accepts -pthread" >&5
echo "configure:5435: 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
@ -5466,7 +5454,7 @@ echo "configure:5447: 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:5470: checking whether ${CC-cc} accepts -pthreads" >&5
echo "configure:5458: 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

View File

@ -1342,18 +1342,15 @@ tools are selected during the Xcode/Developer Tools installation.])
IMPL_STRATEGY=_PTH
fi
AC_DEFINE(XP_UNIX)
AC_DEFINE(_POSIX_SOURCE)
AC_DEFINE(_BSD_SOURCE)
AC_DEFINE(_SVID_SOURCE)
AC_DEFINE(_LARGEFILE64_SOURCE)
AC_DEFINE(_GNU_SOURCE)
AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
case "${target_os}" in
linux*)
AC_DEFINE(LINUX)
;;
esac
CFLAGS="$CFLAGS -ansi -Wall"
CXXFLAGS="$CXXFLAGS -ansi -Wall"
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CXXFLAGS -Wall"
MDCPUCFG_H=_linux.cfg
PR_MD_CSRCS=linux.c
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'

View File

@ -62,11 +62,6 @@ TARGETS = $(OBJS)
INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
# For Dl_info and dladdr.
ifeq (,$(filter-out Linux GNU GNU_%,$(OS_TARGET)))
DEFINES += -D_GNU_SOURCE
endif
# On Mac OS X use flat #includes.
ifeq ($(OS_TARGET),MacOSX)
INCLUDES += -I$(MACOS_SDK_DIR)/Developer/Headers/FlatCarbon

View File

@ -67,11 +67,6 @@ INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/incl
DEFINES += -D_NSPR_BUILD_
ifeq ($(OS_ARCH),Linux)
# for pthread_mutexattr_settype
DEFINES += -D_XOPEN_SOURCE=500
endif
include $(topsrcdir)/config/rules.mk
export:: $(TARGETS)