From 7033702b2b1302d443b55f2ad973714a5f5fb684 Mon Sep 17 00:00:00 2001 From: bdc Date: Sat, 28 Sep 1996 00:02:24 +0000 Subject: [PATCH] on HP-UX use dld dynamic loader for symbol lookup (faster) --- Error-log | 3 ++ configure | 121 +++++++++++++++++++++++++++++++++++---------------- configure.in | 2 + unix.c | 14 ++++++ 4 files changed, 102 insertions(+), 38 deletions(-) diff --git a/Error-log b/Error-log index 205b63e..7e3e435 100644 --- a/Error-log +++ b/Error-log @@ -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. diff --git a/configure b/configure index 7a0c456..50f073f 100755 --- a/configure +++ b/configure @@ -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 <&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 <&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 <&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 <&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 <&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 <&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 <&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 <&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 <&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 < #include @@ -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 < 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 < 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 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 <&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 <&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 <&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 < 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 < 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 < 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 < 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 < #include @@ -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 diff --git a/configure.in b/configure.in index 602d5bf..4ba38bc 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/unix.c b/unix.c index 0e23435..3cd3770 100644 --- a/unix.c +++ b/unix.c @@ -568,6 +568,19 @@ lookup_external_name(char *name, long *location) #else /* i.e. #if !defined(_AIX) */ +#if defined(__hpux) +#include +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 */