Skip to content

Commit 06d7b45

Browse files
committed
Simplify the use of getpass() on Haiku.
getpass() is in libbsd iff the OS is Haiku, so the check for getpass() in libc is always false on Haiku and always true elsewhere, and the check for getpass() in libbsd is always true on Haiku. So, iff the OS is Haiku, add libbsd to the list of required libraries and that's it.
1 parent e130a4f commit 06d7b45

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

CMakeLists.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,14 +1017,12 @@ else(WIN32)
10171017
endif(LIBSTR_HAS_PUTMSG)
10181018
endif(NOT STDLIBS_HAVE_PUTMSG)
10191019

1020-
# Haiku has getpass in libbsd
1021-
check_function_exists(getpass STDLIBS_HAVE_GETPASS)
1022-
if(NOT STDLIBS_HAVE_GETPASS)
1023-
check_library_exists(bsd getpass "" LIBBSD_HAS_GETPASS)
1024-
if(LIBBSD_HAS_GETPASS)
1025-
set(PCAP_LINK_LIBRARIES bsd ${PCAP_LINK_LIBRARIES})
1026-
endif(LIBBSD_HAS_GETPASS)
1027-
endif(NOT STDLIBS_HAVE_GETPASS)
1020+
#
1021+
# Haiku has getpass() in libbsd.
1022+
#
1023+
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
1024+
set(PCAP_LINK_LIBRARIES bsd ${PCAP_LINK_LIBRARIES})
1025+
endif()
10281026
endif(WIN32)
10291027

10301028
#

configure.ac

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ haiku*)
145145
# use them.
146146
#
147147
CFLAGS="$CFLAGS -D_BSD_SOURCE"
148+
148149
#
149-
# Haiku has getpass in libbsd.
150+
# Haiku has getpass() in libbsd.
150151
#
151-
AC_CHECK_LIB(bsd, getpass)
152+
LIBS="-lbsd $LIBS"
152153
;;
153154
esac
154155

0 commit comments

Comments
 (0)