From 251424ef23522b716269059083b3377cbbd42d72 Mon Sep 17 00:00:00 2001 From: William Brown Date: Nov 29 2016 23:52:12 +0000 Subject: Ticket 48797 - Add freebsd support to ns-slapd: Configure and makefile. Description: Fix the configure file and make file to support FreeBSD specifics https://fedorahosted.org/389/ticket/48797 Author: wibrown Reviewed by: lslebodn (Thanks!) --- diff --git a/Makefile.am b/Makefile.am index 546f89e..1d76aeb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,7 +61,7 @@ AM_LDFLAGS = -lpthread else #AM_LDFLAGS = -Wl,-z,defs AM_LDFLAGS = $(ASAN_DEFINES) -endif +endif #end hpux #------------------------ # Linker Flags @@ -89,7 +89,7 @@ PCRE_LINK = @pcre_lib@ -lpcre NETSNMP_LINK = @netsnmp_lib@ @netsnmp_link@ PAM_LINK = -lpam KERBEROS_LINK = $(kerberos_lib) -DLOPEN_LINK = -ldl + SYSTEMD_LINK = @systemd_lib@ @@ -1751,7 +1751,7 @@ ns_slapd_SOURCES = ldap/servers/slapd/abandon.c \ ns_slapd_CPPFLAGS = $(AM_CPPFLAGS) @sasl_inc@ @openldap_inc@ @ldapsdk_inc@ @nss_inc@ \ @nspr_inc@ @svrcore_inc@ @systemd_inc@ -ns_slapd_LDADD = libslapd.la libldaputil.a $(LDAPSDK_LINK) $(NSS_LINK) $(DLOPEN_LINK) \ +ns_slapd_LDADD = libslapd.la libldaputil.a $(LDAPSDK_LINK) $(NSS_LINK) $(LIBADD_DL) \ $(NSPR_LINK) $(SASL_LINK) $(SVRCORE_LINK) $(LIBNSL) $(LIBSOCKET) $(THREADLIB) $(SYSTEMD_LINK) # We need to link ns-slapd with the C++ compiler on HP-UX since we load # some C++ shared libraries (such as icu). @@ -1946,7 +1946,7 @@ endif if SYSTEMD $(fixupcmd) $^ | sed -e 's/@preamble@/# This file is in systemd EnvironmentFile format - see man systemd.exec/' > $@ else - $(fixupcmd) $^ | sed -n -e 's/@preamble@//' -e '/^#/{p;d}' -e '/^$$/{p;d}' -e 's/^\([^=]*\)\(=.*\)$$/\1\2 ; export \1/ ; p' > $@ + $(fixupcmd) $^ | sed -n -e 's/@preamble@//' -e '/^#/{p;d;}' -e '/^$$/{p;d;}' -e 's/^\([^=]*\)\(=.*\)$$/\1\2 ; export \1/ ; p' > $@ $(fixupcmd) $(srcdir)/ldap/admin/src/initconfig.in >> $@ endif @@ -1955,7 +1955,7 @@ endif if SYSTEMD $(fixupcmd) $^ | sed -e 's/@preamble@/# This file is in systemd EnvironmentFile format - see man systemd.exec/' > $@ else - $(fixupcmd) $^ | sed -n -e 's/@preamble@//' -e '/^#/{p;d}' -e '/^$$/{p;d}' -e 's/^\([^=]*\)\(=.*\)$$/\1\2 ; export \1/ ; p' > $@ + $(fixupcmd) $^ | sed -n -e 's/@preamble@//' -e '/^#/{p;d;}' -e '/^$$/{p;d;}' -e 's/^\([^=]*\)\(=.*\)$$/\1\2 ; export \1/ ; p' > $@ endif %/$(PACKAGE_NAME).pc: %/dirsrv.pc.in diff --git a/configure.ac b/configure.ac index 327452f..57b5b29 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,7 @@ AC_PROG_LIBTOOL AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/file.h sys/socket.h sys/time.h unistd.h inttypes.h mntent.h]) +AC_CHECK_HEADERS([arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/file.h sys/socket.h sys/time.h unistd.h inttypes.h mntent.h sys/sysinfo.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STAT @@ -68,6 +68,9 @@ AC_FUNC_STRFTIME AC_FUNC_VPRINTF AC_CHECK_FUNCS([clock_gettime endpwent ftruncate getcwd gethostbyname inet_ntoa localtime_r memmove memset mkdir munmap putenv rmdir setrlimit socket strcasecmp strchr strcspn strdup strerror strncasecmp strpbrk strrchr strstr strtol tzset]) +# This will detect if we need to add the LIBADD_DL value for us. +LT_LIB_DLLOAD + AC_MSG_CHECKING(for --enable-debug) AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (default: no)]), [ @@ -550,6 +553,15 @@ case $host in AC_SUBST([LIBCRYPT], [$LIBCRYPT]) AC_DEFINE([USE_POSIX_RWLOCKS], [1], [POSIX rwlocks]) ;; + *-*-freebsd*) + AC_DEFINE([FREEBSD], [1], [FreeBSD]) + platform="freebsd" + initdir='$(sysconfdir)/rc.d' + THREADLIB=-lthr + AC_SUBST([THREADLIB], [$THREADLIB]) + AC_DEFINE([USE_POSIX_RWLOCKS], [1], [POSIX rwlocks]) + LIBDL= + ;; ia64-hp-hpux*) AC_DEFINE([hpux], [1], [HP-UX]) AC_DEFINE([HPUX], [1], [HP-UX]) @@ -654,6 +666,7 @@ AC_SUBST(initconfigdir) AM_CONDITIONAL([HPUX],[test "$platform" = "hpux"]) AM_CONDITIONAL([SOLARIS],[test "$platform" = "solaris"]) +AM_CONDITIONAL([FREEBSD],[test "$platform" = "freebsd"]) # Check for library dependencies m4_include(m4/nspr.m4)