Compatibility improvements for QNX.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35451 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Niels Grewe 2012-08-26 08:55:49 +00:00
parent 868d8a6922
commit ee4052bf6d
13 changed files with 3066 additions and 2272 deletions

View file

@ -1,3 +1,24 @@
2012-08-26 Niels Grewe <niels.grewe@halbordnung.de>
* configure.ac: Check for sys/filio.h and whether we need to
link libsocket (as on QNX).
* configure
* SSL/configure
* Headers/GNUstepBase/config.h.in:
Regenerate.
* Source/common.h
* Source/GSFileHandle.m
* Source/NSMessagePort.m
* Source/NSSocketPort.m
* Source/NSThread.m
* SSL/GSSSLHandle.m:
QNX compatibility tweaks.
* Tools/gdnc.m
* Tools/gdomap.c:
Use slog facility for logging on QNX.
Compatibility improvements for building for QNX.
2012-08-26 Niels Grewe <niels.grewe@halbordnung.de>
* configure.ac: Check for QNX slog facilities.

View file

@ -247,6 +247,9 @@
/* Define to 1 if you have the `gethostbyaddr_r' function. */
#undef HAVE_GETHOSTBYADDR_R
/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME
/* Define to 1 if you have the `getlogin' function. */
#undef HAVE_GETLOGIN
@ -337,6 +340,9 @@
/* Define to 1 if you have the `rt' library (-lrt). */
#undef HAVE_LIBRT
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if libxml available */
#undef HAVE_LIBXML
@ -539,6 +545,9 @@
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/filio.h> header file. */
#undef HAVE_SYS_FILIO_H
/* Define to 1 if you have the <sys/inttypes.h> header file. */
#undef HAVE_SYS_INTTYPES_H

View file

@ -95,8 +95,10 @@
#include <sys/ioctl.h>
#ifdef __svr4__
#ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
#endif
#include <netdb.h>
#include <string.h>

4727
SSL/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -66,8 +66,10 @@
#include <sys/ioctl.h>
#ifdef __svr4__
# ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
# endif
#endif
#include <netdb.h>
#include <string.h>
@ -75,7 +77,7 @@
/*
* Stuff for setting the sockets into non-blocking mode.
*/
#ifdef __POSIX_SOURCE
#if defined(__POSIX_SOURCE) || defined(__EXT_POSIX1_198808)
#define NBLK_OPT O_NONBLOCK
#else
#define NBLK_OPT FNDELAY

View file

@ -77,7 +77,7 @@
/*
* Stuff for setting the sockets into non-blocking mode.
*/
#ifdef __POSIX_SOURCE
#if defined(__POSIX_SOURCE) || defined(__EXT_POSIX1_198808)
#define NBLK_OPT O_NONBLOCK
#else
#define NBLK_OPT FNDELAY
@ -93,8 +93,10 @@
#endif
#if defined(__svr4__)
# if defined(HAVE_SYS_STROPTS)
# include <sys/stropts.h>
# endif
#endif
@interface NSProcessInfo (private)
+ (BOOL) _exists: (int)pid;

View file

@ -84,7 +84,7 @@
/*
* Stuff for setting the sockets into non-blocking mode.
*/
#ifdef __POSIX_SOURCE
#if defined(__POSIX_SOURCE) || defined(__EXT_POSIX1_198808)
#define NBLK_OPT O_NONBLOCK
#else
#define NBLK_OPT FNDELAY
@ -100,8 +100,10 @@
#endif
#if defined(__svr4__)
# if defined(HAVE_SYS_STROPTS_H)
# include <sys/stropts.h>
# endif
#endif
#define SOCKET int
#define SOCKET_ERROR -1

View file

@ -56,7 +56,7 @@
# include <fcntl.h>
#endif
#ifdef __POSIX_SOURCE
#if defined(__POSIX_SOURCE) || defined(__EXT_POSIX1_198808)
#define NBLK_OPT O_NONBLOCK
#else
#define NBLK_OPT FNDELAY

View file

@ -17,7 +17,7 @@
*/
/* This hack work around for glibc breaks FreeBSD and probably other platforms.
*/
#if defined(__linux__) &&!defined(__GNU__)
#if (defined(__linux__) &&!defined(__GNU__)) || defined(__QNXNTO__)
# if defined(_XOPEN_SOURCE)
# if _XOPEN_SOURCE < 600
# undef _XOPEN_SOURCE

View file

@ -69,8 +69,17 @@ static BOOL debugging = NO;
static BOOL is_daemon = NO; /* Currently running as daemon. */
static BOOL auto_stop = NO; /* Should we shut down when unused? */
#ifdef HAVE_SYSLOG
#if defined(HAVE_SYSLOG) || defined(HAVE_SLOGF)
# if defined(HAVE_SLOGF)
# include <sys/slogcodes.h>
# include <sys/slog.h>
# define LOG_CRIT _SLOG_CRITICAL
# define LOG_DEBUG _SLOG_DEBUG1
# define LOG_ERR _SLOG_ERROR
# define LOG_INFO _SLOG_INFO
# define LOG_WARNING _SLOG_WARNING
# define syslog(prio, msg,...) slogf(_SLOG_SETCODE(_SLOG_SYSLOG, 0), prio, msg, __VA_ARGS__)
# endif
static int log_priority = LOG_DEBUG;
static void
@ -78,7 +87,12 @@ gdnc_log (int prio, const char *ebuf)
{
if (is_daemon)
{
# if defined(HAVE_SLOGF)
// Let's not have 0 as the value for prio. It means "shutdown" on QNX
syslog (prio ? prio : log_priority, "%s", ebuf);
# else
syslog (log_priority | prio, "%s", ebuf);
# endif
}
else if (prio == LOG_INFO)
{
@ -95,7 +109,7 @@ gdnc_log (int prio, const char *ebuf)
{
if (is_daemon)
{
syslog (LOG_CRIT, "exiting.");
syslog (LOG_CRIT, "%s", "exiting.");
}
else
{
@ -105,6 +119,7 @@ gdnc_log (int prio, const char *ebuf)
exit(EXIT_FAILURE);
}
}
#else
#define LOG_CRIT 2

View file

@ -79,7 +79,7 @@
/*
* Stuff for setting the sockets into non-blocking mode.
*/
#if defined(__POSIX_SOURCE)
#if defined(__POSIX_SOURCE) || defined(__EXT_POSIX1_198808)
#define NBLK_OPT O_NONBLOCK
#else
#define NBLK_OPT FNDELAY
@ -95,13 +95,20 @@
#endif
#if defined(__svr4__)
#if defined(HAVE_SYS_STROPTS_H)
#include <sys/stropts.h>
#endif
#endif
#endif /* !__MINGW__ */
#if defined(HAVE_SYSLOG_H)
#include <syslog.h>
#elif defined(HAVE_SYS_SLOG_H)
# include <sys/slog.h>
# if defined(HAVE_SYS_SLOGCODES_H)
# include <sys/slogcodes.h>
# endif
#endif
#if HAVE_STRERROR
@ -277,7 +284,15 @@ getopt(int argc, char **argv, char *options)
static char ebuf[2048];
#if defined(HAVE_SYSLOG)
#if defined(HAVE_SYSLOG) || defined(HAVE_SLOGF)
# if defined(HAVE_SLOGF)
# define LOG_CRIT _SLOG_CRITICAL
# define LOG_DEBUG _SLOG_DEBUG1
# define LOG_ERR _SLOG_ERROR
# define LOG_INFO _SLOG_INFO
# define LOG_WARNING _SLOG_WARNING
# define syslog(prio, msg,...) slogf(_SLOG_SETCODE(_SLOG_SYSLOG, 0), prio, msg, __VA_ARGS__)
# endif
static int log_priority;
@ -295,7 +310,12 @@ gdomap_log (int prio)
}
if (is_daemon)
{
#if defined(HAVE_SLOGF)
// QNX doesn't like 0 as the prio. It means "shutdown" to them.
syslog (prio ? log_priority : prio, "%s", ebuf);
# else
syslog (log_priority | prio, "%s", ebuf);
#endif
}
else if (prio == LOG_INFO)
{
@ -312,7 +332,7 @@ gdomap_log (int prio)
{
if (is_daemon)
{
syslog (LOG_CRIT, "exiting.");
syslog (LOG_CRIT, "%s", "exiting.");
}
else
{
@ -1254,7 +1274,8 @@ init_iface()
perror("socket for init_iface");
exit(EXIT_FAILURE);
}
#if defined(__svr4__)
// QNX seems to disagree about what it means to be SysV r4.
#if defined(__svr4__) && !defined(__QNXNTO__)
{
struct strioctl ioc;
@ -4428,7 +4449,7 @@ main(int argc, char** argv)
#if defined(SYSLOG_4_2)
openlog ("gdomap", LOG_NDELAY);
log_priority = LOG_DAEMON;
#else
#elif !defined(HAVE_SLOGF)
openlog ("gdomap", LOG_NDELAY, LOG_DAEMON);
#endif
#endif

204
configure vendored
View file

@ -11968,6 +11968,207 @@ fi
done
for ac_func in gethostbyname
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval echo '${'$as_ac_var'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
if test "$ac_cv_func_gethostbyname" = "no"; then
# QNX has gethostbyname and friends in libsocket
{ echo "$as_me:$LINENO: checking for gethostbyname in -lsocket" >&5
echo $ECHO_N "checking for gethostbyname in -lsocket... $ECHO_C" >&6; }
if test "${ac_cv_lib_socket_gethostbyname+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char gethostbyname ();
int
main ()
{
return gethostbyname ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_socket_gethostbyname=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_socket_gethostbyname=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_gethostbyname" >&5
echo "${ECHO_T}$ac_cv_lib_socket_gethostbyname" >&6; }
if test $ac_cv_lib_socket_gethostbyname = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSOCKET 1
_ACEOF
LIBS="-lsocket $LIBS"
fi
fi
#--------------------------------------------------------------------
# Check for pthread.h
#--------------------------------------------------------------------
@ -21506,7 +21707,8 @@ _ACEOF
for ac_header in fcntl.h inttypes.h libc.h limits.h malloc.h memory.h signal.h stdint.h string.h sys/fcntl.h sys/file.h sys/inttypes.h sys/ioctl.h sys/signal.h sys/stropts.h sys/wait.h unistd.h utime.h stdlib.h
for ac_header in fcntl.h inttypes.h libc.h limits.h malloc.h memory.h signal.h stdint.h string.h sys/fcntl.h sys/file.h sys/filio.h sys/inttypes.h sys/ioctl.h sys/signal.h sys/stropts.h sys/wait.h unistd.h utime.h stdlib.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then

View file

@ -1625,6 +1625,12 @@ OBJC_SYS_DYNAMIC_LINKER()
# NOTE: libdl should be in LIBS now if it's available.
AC_CHECK_FUNCS(dladdr)
AC_CHECK_FUNCS(gethostbyname)
if test "$ac_cv_func_gethostbyname" = "no"; then
# QNX has gethostbyname and friends in libsocket
AC_CHECK_LIB(socket, gethostbyname)
fi
#--------------------------------------------------------------------
# Check for pthread.h
#--------------------------------------------------------------------
@ -2239,6 +2245,7 @@ AC_CHECK_HEADERS(dnl
string.h dnl
sys/fcntl.h dnl
sys/file.h dnl
sys/filio.h dnl
sys/inttypes.h dnl
sys/ioctl.h dnl
sys/signal.h dnl