on HP-UX use dld dynamic loader for symbol lookup (faster)

This commit is contained in:
bdc 1996-09-28 00:02:24 +00:00
parent 4e05a0aaf1
commit 7033702b2b
4 changed files with 102 additions and 38 deletions

View File

@ -48,3 +48,6 @@ Reported by Sean Doran 29 Jul 96. Fixed by bdc 26 Sept 96.
Solaris users with BIND installed lose MAXHOSTNAMELEN
reported by Lutz Euler 23 Aug 96. Fixed by bdc 26 Sept 96.
on HP-UX use dld dynamic loader for symbol lookup (faster)
reported by Bill Sommerfeld 31 Oct 95. Fixed by bdc 27 Sept 96.

121
configure vendored
View File

@ -1044,6 +1044,7 @@ EOF
## HP 9000 series 700 and 800, running HP/UX
hppa*-hp-hpux* )
dir=hpux
LDFLAGS="-Wl,-E"
if test ${CC} = cc; then
CFLAGS="-Ae -O +Obb1800"
cat >> confdefs.h <<\EOF
@ -1178,7 +1179,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1182 "configure"
#line 1183 "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
@ -1190,7 +1191,7 @@ int t() {
sqrt()
; return 0; }
EOF
if { (eval echo configure:1194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1222,7 +1223,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lgen $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1226 "configure"
#line 1227 "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
@ -1234,7 +1235,7 @@ int t() {
pathfind()
; return 0; }
EOF
if { (eval echo configure:1238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1266,7 +1267,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1270 "configure"
#line 1271 "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
@ -1278,7 +1279,7 @@ int t() {
gethostbyaddr()
; return 0; }
EOF
if { (eval echo configure:1282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1310,7 +1311,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1314 "configure"
#line 1315 "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
@ -1322,7 +1323,7 @@ int t() {
socket()
; return 0; }
EOF
if { (eval echo configure:1326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1354,7 +1355,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lelf $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1358 "configure"
#line 1359 "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
@ -1366,7 +1367,7 @@ int t() {
nlist()
; return 0; }
EOF
if { (eval echo configure:1370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1398,7 +1399,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lld $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1402 "configure"
#line 1403 "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
@ -1410,7 +1411,7 @@ int t() {
ldopen()
; return 0; }
EOF
if { (eval echo configure:1414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1442,7 +1443,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1446 "configure"
#line 1447 "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
@ -1454,7 +1455,7 @@ int t() {
dlopen()
; return 0; }
EOF
if { (eval echo configure:1458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1478,13 +1479,57 @@ else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking for -ldld""... $ac_c" 1>&6
ac_lib_var=`echo dld'_'shl_findsym | tr './+\055' '__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="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1491 "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 shl_findsym();
int main() { return 0; }
int t() {
shl_findsym()
; return 0; }
EOF
if { (eval echo configure:1503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
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_tr_lib=HAVE_LIB`echo dld | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
LIBS="-ldld $LIBS"
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1488 "configure"
#line 1533 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@ -1502,7 +1547,7 @@ int t() {
int i;
; return 0; }
EOF
if { (eval echo configure:1506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1551: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@ -1534,13 +1579,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 1538 "configure"
#line 1583 "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:1544: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@ -1549,13 +1594,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1553 "configure"
#line 1598 "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:1559: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@ -1583,12 +1628,12 @@ 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 1587 "configure"
#line 1632 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1592: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1637: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1619,7 +1664,7 @@ 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 1623 "configure"
#line 1668 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1643,7 +1688,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1672,7 +1717,7 @@ 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 1676 "configure"
#line 1721 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1696,7 +1741,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1725,7 +1770,7 @@ 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 1729 "configure"
#line 1774 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1749,7 +1794,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1849,7 +1894,7 @@ EOF
else
cat > conftest.$ac_ext <<EOF
#line 1853 "configure"
#line 1898 "configure"
#include "confdefs.h"
#include <nlist.h>
int main() { return 0; }
@ -1858,7 +1903,7 @@ struct nlist name_list;
name_list.n_name = "foo";
; return 0; }
EOF
if { (eval echo configure:1862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
s48_cv_nlist=yes
else
@ -1884,7 +1929,7 @@ EOF
else
cat > conftest.$ac_ext <<EOF
#line 1888 "configure"
#line 1933 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() { return 0; }
@ -1892,7 +1937,7 @@ int t() {
return stdin->_cnt;
; return 0; }
EOF
if { (eval echo configure:1896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
s48_cv__cnt=yes
else
@ -1919,7 +1964,7 @@ EOF
else
cat > conftest.$ac_ext <<EOF
#line 1923 "configure"
#line 1968 "configure"
#include "confdefs.h"
#include <time.h>
int main() { return 0; }
@ -1927,7 +1972,7 @@ int t() {
return (int) tzname;
; return 0; }
EOF
if { (eval echo configure:1931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1976: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
scsh_cv_tzname=yes
else
@ -1953,7 +1998,7 @@ EOF
else
cat > conftest.$ac_ext <<EOF
#line 1957 "configure"
#line 2002 "configure"
#include "confdefs.h"
#include <time.h>
int main() { return 0; }
@ -1962,7 +2007,7 @@ struct tm time;
return time.tm_gmtoff;
; return 0; }
EOF
if { (eval echo configure:1966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
scsh_cv_gmtoff=yes
else
@ -1988,7 +2033,7 @@ EOF
else
cat > conftest.$ac_ext <<EOF
#line 1992 "configure"
#line 2037 "configure"
#include "confdefs.h"
#include <errno.h>
#include <unistd.h>
@ -1997,7 +2042,7 @@ int t() {
const extern char *sys_errlist[];
; return 0; }
EOF
if { (eval echo configure:2001: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2046: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
scsh_cv_const_sys_errlist=yes
else

View File

@ -244,6 +244,7 @@ case "$host" in
## HP 9000 series 700 and 800, running HP/UX
hppa*-hp-hpux* )
dir=hpux
LDFLAGS="-Wl,-E"
if test ${CC} = cc; then
CFLAGS="-Ae -O +Obb1800"
AC_DEFINE(_HPUX_SOURCE)
@ -323,6 +324,7 @@ dnl Solaris 2.3 seems to need -lelf for nlist(). (tnx Bryan O'Sullivan)
AC_CHECK_LIB(elf, nlist)
AC_CHECK_LIB(ld, ldopen)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(dld, shl_findsym)
dnl AC_CHECK_LIB(mld, main)
AC_RETSIGTYPE

14
unix.c
View File

@ -568,6 +568,19 @@ lookup_external_name(char *name, long *location)
#else /* i.e. #if !defined(_AIX) */
#if defined(__hpux)
#include <dl.h>
lookup_external_name (char *name, long *location )
{
int ret;
shl_t shlh = PROG_HANDLE;
*location = 0xdeadbeef;
ret = shl_findsym (&shlh, name, TYPE_UNDEFINED, location);
return (!ret);
}
#else /* i.e. #if !defined(__hpux) && !defined(_AIX) */
#if !defined(NLIST_HAS_N_NAME)
#define n_name n_un.n_name
#endif
@ -634,6 +647,7 @@ lookup_external_name(char *name, long *location)
#endif /*! HAVE_DLOPEN */
}
#endif /* !defined(__hpux) */
#endif /* !defined(AIX) */
extern char *object_file; /* specified via a command line argument */