Bugzilla Bug 261649: added GNU/k*BSD and preliminary GNU/Hurd support. The

patch is contributed by Robert Millan <rmh@aybabtu.com>. r=wtc.
Modified files: configure configure.in _linux.cfg _pth.h _unixos.h
prosdep.h pr/src/linking/Makefile.in prlink.c prosdep.c unix.c uxproces.c
uxrng.c prnetdb.c ptio.c pr/tests/Makefile.in
This commit is contained in:
wtchang%redhat.com 2005-12-24 08:25:31 +00:00
Родитель de97871fab
Коммит 7d5638e978
15 изменённых файлов: 81 добавлений и 56 удалений

56
nsprpub/configure поставляемый
Просмотреть файл

@ -3800,7 +3800,7 @@ EOF
esac
;;
*-linux*)
*-linux*|*-gnu*|*-k*bsd*-gnu)
if test -z "$USE_NSPR_THREADS"; then
USE_PTHREADS=1
IMPL_STRATEGY=_PTH
@ -3829,10 +3829,14 @@ EOF
#define HAVE_FCNTL_FILE_LOCKING 1
EOF
cat >> confdefs.h <<\EOF
case "${target_os}" in
linux*)
cat >> confdefs.h <<\EOF
#define LINUX 1
EOF
;;
esac
CFLAGS="$CFLAGS -ansi -Wall"
CXXFLAGS="$CXXFLAGS -ansi -Wall"
MDCPUCFG_H=_linux.cfg
@ -4412,17 +4416,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:4416: checking for machine/builtins.h" >&5
echo "configure:4420: 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 4421 "configure"
#line 4425 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4426: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4430: \"$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*
@ -4984,7 +4988,7 @@ case $target in
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
echo "configure:4988: checking for dlopen in -ldl" >&5
echo "configure:4992: 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
@ -4992,7 +4996,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4996 "configure"
#line 5000 "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
@ -5003,7 +5007,7 @@ int main() {
dlopen()
; return 0; }
EOF
if { (eval echo configure:5007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:5011: \"$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
@ -5020,17 +5024,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:5024: checking for dlfcn.h" >&5
echo "configure:5028: 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 5029 "configure"
#line 5033 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:5034: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:5038: \"$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*
@ -5063,13 +5067,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:5067: checking whether ${CC-cc} needs -traditional" >&5
echo "configure:5071: 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 5073 "configure"
#line 5077 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@ -5087,7 +5091,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
#line 5091 "configure"
#line 5095 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@ -5111,12 +5115,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5115: checking for $ac_func" >&5
echo "configure:5119: 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 5120 "configure"
#line 5124 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -5139,7 +5143,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:5143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:5147: \"$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
@ -5180,7 +5184,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
echo "configure:5184: checking for +Olit support" >&5
echo "configure:5188: 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
@ -5219,7 +5223,7 @@ darwin*)
*)
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
echo "configure:5223: checking for pthread_create in -lpthreads" >&5
echo "configure:5227: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5241,7 +5245,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
echo "configure:5245: checking for pthread_create in -lpthread" >&5
echo "configure:5249: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5263,7 +5267,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
echo "configure:5267: checking for pthread_create in -lc_r" >&5
echo "configure:5271: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5285,7 +5289,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
echo "configure:5289: checking for pthread_create in -lc" >&5
echo "configure:5293: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5439,7 +5443,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:5443: checking whether ${CC-cc} accepts -pthread" >&5
echo "configure:5447: 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
@ -5462,7 +5466,7 @@ echo "configure:5443: 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:5466: checking whether ${CC-cc} accepts -pthreads" >&5
echo "configure:5470: 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
@ -5516,7 +5520,7 @@ EOF
_PTHREAD_LDFLAGS=-pthread
fi
;;
*-linux*)
*-linux*|*-gnu*|*-k*bsd*-gnu)
cat >> confdefs.h <<\EOF
#define _REENTRANT 1
EOF
@ -5653,7 +5657,7 @@ EOF
fi
fi
;;
*-linux*)
*-linux*|*-gnu*|*-k*bsd*-gnu)
if test -n "$USE_NSPR_THREADS"; then
cat >> confdefs.h <<\EOF
#define _PR_LOCAL_THREADS_ONLY 1

Просмотреть файл

@ -1336,7 +1336,7 @@ tools are selected during the Xcode/Developer Tools installation.])
esac
;;
*-linux*)
*-linux*|*-gnu*|*-k*bsd*-gnu)
if test -z "$USE_NSPR_THREADS"; then
USE_PTHREADS=1
IMPL_STRATEGY=_PTH
@ -1347,7 +1347,11 @@ tools are selected during the Xcode/Developer Tools installation.])
AC_DEFINE(_SVID_SOURCE)
AC_DEFINE(_LARGEFILE64_SOURCE)
AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
AC_DEFINE(LINUX)
case "${target_os}" in
linux*)
AC_DEFINE(LINUX)
;;
esac
CFLAGS="$CFLAGS -ansi -Wall"
CXXFLAGS="$CXXFLAGS -ansi -Wall"
MDCPUCFG_H=_linux.cfg
@ -2442,7 +2446,7 @@ if test -n "$USE_PTHREADS"; then
_PTHREAD_LDFLAGS=-pthread
fi
;;
*-linux*)
*-linux*|*-gnu*|*-k*bsd*-gnu)
AC_DEFINE(_REENTRANT)
;;
esac
@ -2526,7 +2530,7 @@ case "$target" in
fi
fi
;;
*-linux*)
*-linux*|*-gnu*|*-k*bsd*-gnu)
if test -n "$USE_NSPR_THREADS"; then
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
fi

Просмотреть файл

@ -35,6 +35,11 @@
*
* ***** END LICENSE BLOCK ***** */
/*
* This file is used by not only Linux but also other glibc systems
* such as GNU/Hurd and GNU/k*BSD.
*/
#ifndef nspr_cpucfg___
#define nspr_cpucfg___
@ -42,7 +47,7 @@
#define XP_UNIX
#endif
#ifndef LINUX
#if !defined(LINUX) && defined(__linux__)
#define LINUX
#endif

Просмотреть файл

@ -143,10 +143,15 @@
(!memcmp(&(t), &pt_zero_tid, sizeof(pthread_t)))
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
#elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
|| defined(HPUX) || defined(LINUX) || defined(FREEBSD) \
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|| defined(HPUX) || defined(FREEBSD) \
|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
|| defined(VMS) || defined(NTO) || defined(DARWIN) \
|| defined(UNIXWARE) || defined(RISCOS)
#ifdef __GNU__
/* Hurd pthreads don't have an invalid value for pthread_t. -- rmh */
#error Using Hurd pthreads
#endif
#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) (t) = 0
#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) (t) == 0
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
@ -235,7 +240,8 @@
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
#endif /* defined(_PR_DCETHREADS) */
#elif defined(LINUX) || defined(FREEBSD)
#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|| defined(FREEBSD)
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
#elif defined(NTO)
@ -291,7 +297,8 @@ extern int (*_PT_aix_yield_fcn)();
onemillisec.tv_nsec = 1000000L; \
nanosleep(&onemillisec,NULL); \
PR_END_MACRO
#elif defined(HPUX) || defined(LINUX) || defined(SOLARIS) \
#elif defined(HPUX) || defined(SOLARIS) \
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
|| defined(UNIXWARE) || defined(RISCOS)

Просмотреть файл

@ -46,7 +46,8 @@
* Linux: FD_SETSIZE is defined in /usr/include/sys/select.h and should
* not be redefined.
*/
#if !defined(LINUX) && !defined(DARWIN) && !defined(NEXTSTEP)
#if !defined(LINUX) && !defined(__GNU__) && !defined(__GLIBC__) \
&& !defined(DARWIN) && !defined(NEXTSTEP)
#ifndef FD_SETSIZE
#define FD_SETSIZE 4096
#endif

Просмотреть файл

@ -90,7 +90,7 @@ PR_BEGIN_EXTERN_C
#elif defined(IRIX)
#include "md/_irix.h"
#elif defined(LINUX)
#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
#include "md/_linux.h"
#elif defined(OSF1)

Просмотреть файл

@ -63,7 +63,7 @@ TARGETS = $(OBJS)
INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
# For Dl_info and dladdr.
ifeq ($(OS_TARGET),Linux)
ifeq (,$(filter-out Linux GNU GNU_kFreeBSD GNU_kNetBSD,$(OS_TARGET)))
DEFINES += -D_GNU_SOURCE
endif

Просмотреть файл

@ -1388,7 +1388,8 @@ PR_LoadStaticLibrary(const char *name, const PRStaticLinkTable *slt)
PR_IMPLEMENT(char *)
PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr)
{
#if defined(SOLARIS) || defined(LINUX) || defined(FREEBSD)
#if defined(SOLARIS) || defined(FREEBSD) \
|| defined(LINUX) || defined(__GLIBC__)
Dl_info dli;
char *result;

Просмотреть файл

@ -63,7 +63,8 @@ static void GetPageSize(void)
/* Get page size */
#ifdef XP_UNIX
#if defined SUNOS4 || defined LINUX || defined BSDI || defined AIX \
#if defined SUNOS4 || defined BSDI || defined AIX \
|| defined LINUX || defined __GNU__ || defined __GLIBC__ \
|| defined FREEBSD || defined NETBSD || defined OPENBSD \
|| defined DARWIN || defined NEXTSTEP
_pr_pageSize = getpagesize();

Просмотреть файл

@ -65,7 +65,7 @@
* PRInt32* pointer to a _PRSockLen_t* pointer.
*/
#if defined(HAVE_SOCKLEN_T) \
|| (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
|| (defined(__GLIBC__) && __GLIBC__ >= 2)
#define _PRSockLen_t socklen_t
#elif defined(IRIX) || defined(HPUX) || defined(OSF1) || defined(SOLARIS) \
|| defined(AIX4_1) || defined(LINUX) || defined(SONY) \

Просмотреть файл

@ -92,7 +92,8 @@ typedef struct pr_PidRecord {
* that can share the virtual address space and file descriptors.
*/
#if (defined(IRIX) && !defined(_PR_PTHREADS)) \
|| (defined(LINUX) && defined(_PR_PTHREADS))
|| ((defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)) \
&& defined(_PR_PTHREADS))
#define _PR_SHARE_CLONES
#endif
@ -106,7 +107,8 @@ typedef struct pr_PidRecord {
*/
#if defined(_PR_GLOBAL_THREADS_ONLY) \
|| (defined(_PR_PTHREADS) && !defined(LINUX))
|| (defined(_PR_PTHREADS) \
&& !defined(LINUX) && !defined(__GNU__) && !defined(__GLIBC__))
#define _PR_NATIVE_THREADS
#endif

Просмотреть файл

@ -138,7 +138,8 @@ GetHighResClock(void *buf, size_t maxbytes)
return 0;
}
#elif (defined(LINUX) || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD))
#elif (defined(LINUX) || defined(FREEBSD) || defined(__FreeBSD_kernel__) \
|| defined(NETBSD) || defined(__NetBSD_kernel__) || defined(OPENBSD))
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

Просмотреть файл

@ -108,7 +108,7 @@ PRLock *_pr_dnsLock = NULL;
#define _PR_HAVE_GETPROTO_R_INT
#endif
#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
#if (defined(__GLIBC__) && __GLIBC__ >= 2)
#define _PR_HAVE_GETPROTO_R
#define _PR_HAVE_5_ARG_GETPROTO_R
#endif

Просмотреть файл

@ -205,7 +205,8 @@ static PRBool _pr_ipv6_v6only_on_by_default;
#define _PRSelectFdSetArg_t void *
#elif defined(IRIX) || (defined(AIX) && !defined(AIX4_1)) \
|| defined(OSF1) || defined(SOLARIS) \
|| defined(HPUX10_30) || defined(HPUX11) || defined(LINUX) \
|| defined(HPUX10_30) || defined(HPUX11) \
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|| defined(BSDI) || defined(VMS) || defined(NTO) || defined(DARWIN) \
|| defined(UNIXWARE) || defined(RISCOS)
@ -289,7 +290,7 @@ static PRBool IsValidNetAddrLen(const PRNetAddr *addr, PRInt32 addr_len)
* most current systems.
*/
#if defined(HAVE_SOCKLEN_T) \
|| (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
|| (defined(__GLIBC__) && __GLIBC__ >= 2)
typedef socklen_t pt_SockLen;
#elif (defined(AIX) && !defined(AIX4_1)) \
|| defined(VMS)
@ -3230,7 +3231,8 @@ static PRIOMethods _pr_socketpollfd_methods = {
};
#if defined(HPUX) || defined(OSF1) || defined(SOLARIS) || defined (IRIX) \
|| defined(AIX) || defined(LINUX) || defined(FREEBSD) || defined(NETBSD) \
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|| defined(AIX) || defined(FREEBSD) || defined(NETBSD) \
|| defined(OPENBSD) || defined(BSDI) || defined(VMS) || defined(NTO) \
|| defined(DARWIN) || defined(UNIXWARE) || defined(RISCOS)
#define _PR_FCNTL_FLAGS O_NONBLOCK
@ -4727,7 +4729,8 @@ PR_IMPLEMENT(PRInt32) PR_FD_NISSET(PRInt32 fd, PR_fd_set *set)
#include <sys/types.h>
#include <sys/time.h>
#if !defined(SUNOS4) && !defined(HPUX) && !defined(LINUX)
#if !defined(SUNOS4) && !defined(HPUX) \
&& !defined(LINUX) && !defined(__GNU__) && !defined(__GLIBC__)
#include <sys/select.h>
#endif

Просмотреть файл

@ -376,14 +376,10 @@ ifeq ($(OS_ARCH), NEWS-OS)
EXTRA_LIBS = -lsocket -lnsl -lgen -lresolv
endif
ifeq ($(OS_ARCH), Linux)
ifeq ($(OS_RELEASE), 1.2)
EXTRA_LIBS = -ldl
else
LDOPTS += -Xlinker -rpath $(ABSOLUTE_LIB_DIR)
ifeq ($(USE_PTHREADS),1)
EXTRA_LIBS = -lpthread
endif
ifeq (,$(filter-out Linux GNU GNU_kFreeBSD GNU_kNetBSD,$(OS_ARCH)))
LDOPTS += -Xlinker -rpath $(ABSOLUTE_LIB_DIR)
ifeq ($(USE_PTHREADS),1)
EXTRA_LIBS = -lpthread
endif
endif