Skip to content

Commit 3f32df1

Browse files
committed
Check for HP-UX features on HP-UX only.
Do the existing dl_hp_ppa_info_t.dl_module_id_1 and putmsg() checks on HP-UX only. While at it, add the missing CMake leg for the former.
1 parent 06d7b45 commit 3f32df1

File tree

3 files changed

+47
-36
lines changed

3 files changed

+47
-36
lines changed

CMakeLists.txt

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,19 +1003,26 @@ else(WIN32)
10031003
endif(LIBXNET_HAS_RECVMSG)
10041004
endif(NOT STDLIBS_HAVE_GETADDRINFO)
10051005

1006-
#
1007-
# DLPI needs putmsg under HP-UX, so test for -lstr while we're at it.
1008-
#
1009-
check_function_exists(putmsg STDLIBS_HAVE_PUTMSG)
1010-
if(NOT STDLIBS_HAVE_PUTMSG)
1011-
check_library_exists(str putmsg "" LIBSTR_HAS_PUTMSG)
1012-
if(LIBSTR_HAS_PUTMSG)
1013-
set(PCAP_LINK_LIBRARIES str ${PCAP_LINK_LIBRARIES})
1014-
set(LIBS "-lstr ${LIBS}")
1015-
set(LIBS_STATIC "-lstr ${LIBS_STATIC}")
1016-
set(LIBS_PRIVATE "-lstr ${LIBS_PRIVATE}")
1017-
endif(LIBSTR_HAS_PUTMSG)
1018-
endif(NOT STDLIBS_HAVE_PUTMSG)
1006+
if(CMAKE_SYSTEM_NAME STREQUAL "HP-UX")
1007+
#
1008+
# Same as the respective AC_CHECK_MEMBERS() in Autoconf.
1009+
#
1010+
check_struct_has_member("struct dl_hp_ppa_info_t" dl_module_id_1 "sys/types.h;sys/dlpi.h;sys/dlpi_ext.h" HAVE_DL_HP_PPA_INFO_T_DL_MODULE_ID_1)
1011+
1012+
#
1013+
# Same as the respective AC_SEARCH_LIBS() in Autoconf.
1014+
#
1015+
check_function_exists(putmsg STDLIBS_HAVE_PUTMSG)
1016+
if(NOT STDLIBS_HAVE_PUTMSG)
1017+
check_library_exists(str putmsg "" LIBSTR_HAS_PUTMSG)
1018+
if(LIBSTR_HAS_PUTMSG)
1019+
set(PCAP_LINK_LIBRARIES str ${PCAP_LINK_LIBRARIES})
1020+
set(LIBS "-lstr ${LIBS}")
1021+
set(LIBS_STATIC "-lstr ${LIBS_STATIC}")
1022+
set(LIBS_PRIVATE "-lstr ${LIBS_PRIVATE}")
1023+
endif(LIBSTR_HAS_PUTMSG)
1024+
endif(NOT STDLIBS_HAVE_PUTMSG)
1025+
endif()
10191026

10201027
#
10211028
# Haiku has getpass() in libbsd.

aclocal.m4

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -775,11 +775,6 @@ AC_DEFUN(AC_LBL_LIBRARY_NET, [
775775
LIBS="-lxnet $LIBS"
776776
], , -lsocket -lnsl)
777777
])
778-
779-
#
780-
# DLPI needs putmsg under HP-UX, so test for -lstr while we're at it.
781-
#
782-
AC_SEARCH_LIBS(putmsg, str)
783778
])
784779

785780
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])

configure.ac

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,33 @@ haiku*)
151151
#
152152
LIBS="-lbsd $LIBS"
153153
;;
154+
hpux*)
155+
#
156+
# Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
157+
# dl_module_id_1 member.
158+
# (This is the case on HP-UX B.11.31.)
159+
#
160+
# NOTE: any failure means we conclude that it doesn't have that member,
161+
# so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
162+
# have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
163+
# it doesn't have that member (which is OK, as either we won't be
164+
# using code that would use that member, or we wouldn't compile in
165+
# any case).
166+
#
167+
AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
168+
[
169+
#include <sys/types.h>
170+
#include <sys/dlpi.h>
171+
#include <sys/dlpi_ext.h>
172+
])
173+
174+
#
175+
# On HP-UX DLPI needs putmsg(), which previously was in libstr, but in
176+
# HP-UX B.11.31 this is no longer the case.
177+
# AC_SEARCH_LIBS() accounts for that.
178+
#
179+
AC_SEARCH_LIBS([putmsg], [str])
180+
;;
154181
esac
155182

156183
AC_CHECK_FUNC(strerror_r,
@@ -2319,24 +2346,6 @@ AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,
23192346
#include <sys/socket.h>
23202347
])
23212348

2322-
#
2323-
# Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
2324-
# dl_module_id_1 member.
2325-
#
2326-
# NOTE: any failure means we conclude that it doesn't have that member,
2327-
# so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
2328-
# have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
2329-
# it doesn't have that member (which is OK, as either we won't be
2330-
# using code that would use that member, or we wouldn't compile in
2331-
# any case).
2332-
#
2333-
AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
2334-
[
2335-
#include <sys/types.h>
2336-
#include <sys/dlpi.h>
2337-
#include <sys/dlpi_ext.h>
2338-
])
2339-
23402349
#
23412350
# Various Linux-specific mechanisms.
23422351
#

0 commit comments

Comments
 (0)