Skip to content

Commit

Permalink
Fix macOS and Solaris builds
Browse files Browse the repository at this point in the history
Also bring us closer to having a working AIX build (but not yet, need more
Makefile changes).

Resolves: #31
  • Loading branch information
solardiz committed Jul 13, 2023
1 parent 974ee63 commit fbf3822
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ all locales pam utils install install_lib install_locales install_pam install_ut
LDLIBS_pam="$(LDLIBS_pam_LINUX)" \
$@_wrapped;; \
SunOS) $(MAKE) -e CPPFLAGS_lib="$(CPPFLAGS_lib) -DHAVE_SHADOW" \
LD_lib=ld \
LD_lib=/usr/ccs/bin/ld \
LDFLAGS_lib="$(LDFLAGS_lib_SUN)" \
LDFLAGS_pam="$(LDFLAGS_pam_SUN)" \
LDLIBS_pam="$(LDLIBS_pam_SUN)" \
Expand Down Expand Up @@ -174,9 +174,9 @@ $(SHARED_LIB): $(OBJS_LIB) $(MAP_LIB)
$(LD_lib) $(LDFLAGS_lib) $(OBJS_LIB) $(LDLIBS_lib) -o $(SHARED_LIB)

$(DEVEL_LIB): $(SHARED_LIB)
ifndef CYGWIN
$(LN_s) $(SHARED_LIB) $(DEVEL_LIB)
endif
if [ "$(CYGWIN)" != true ]; then \
$(LN_s) $(SHARED_LIB) $(DEVEL_LIB); \
fi

$(SHARED_PAM): $(OBJS_PAM) $(MAP_PAM) $(DEVEL_LIB)
$(LD_lib) $(LDFLAGS_pam) $(OBJS_PAM) $(LDLIBS_pam) -L. -lpasswdqc -o $(SHARED_PAM)
Expand All @@ -203,7 +203,7 @@ pwqfilter.o: pwqfilter.c passwdqc_filter.h passwdqc.h
$(CC) $(CPPFLAGS_lib) $(CFLAGS_lib) -c $*.c

$(PKGCONFIG): $(PKGCONFIG).in
sed -e "s|@VERSION@|$(VERSION)|g" $< > $@
sed -e "s|@VERSION@|$(VERSION)|g" $(PKGCONFIG).in > $@

concat.o: concat.h
pam_passwdqc.o: passwdqc.h pam_macros.h
Expand All @@ -225,12 +225,12 @@ install_lib_wrapped:
$(INSTALL) -m $(SHLIBMODE) $(SHARED_LIB) $(DESTDIR)$(SHARED_LIBDIR)/

$(MKDIR) $(DESTDIR)$(DEVEL_LIBDIR)
ifndef CYGWIN
$(LN_s) $(SHARED_LIBDIR_REL)/$(SHARED_LIB) \
$(DESTDIR)$(DEVEL_LIBDIR)/$(DEVEL_LIB)
else
$(INSTALL) -m $(SHLIBMODE) $(DEVEL_LIB) $(DESTDIR)$(DEVEL_LIBDIR)/
endif
if [ "$(CYGWIN)" != true ]; then \
$(LN_s) $(SHARED_LIBDIR_REL)/$(SHARED_LIB) \
$(DESTDIR)$(DEVEL_LIBDIR)/$(DEVEL_LIB); \
else \
$(INSTALL) -m $(SHLIBMODE) $(DEVEL_LIB) $(DESTDIR)$(DEVEL_LIBDIR)/; \
fi

$(MKDIR) $(DESTDIR)$(INCLUDEDIR)
$(INSTALL) -m $(INCMODE) $(HEADER) $(DESTDIR)$(INCLUDEDIR)/
Expand Down
8 changes: 1 addition & 7 deletions pam_passwdqc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@
* See LICENSE
*/

#ifdef __FreeBSD__
/* For vsnprintf(3) */
#define _XOPEN_SOURCE 600
#else
#define _XOPEN_SOURCE 500
#define _XOPEN_SOURCE_EXTENDED
#define _XOPEN_VERSION 500
#define _DEFAULT_SOURCE
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
Expand Down Expand Up @@ -45,7 +39,7 @@
#define PAM_AUTHTOK_RECOVERY_ERR PAM_AUTHTOK_RECOVER_ERR
#endif

#if (defined(__sun) || defined(__hpux)) && \
#if (defined(__sun) || defined(__hpux) || defined(_AIX)) && \
!defined(LINUX_PAM) && !defined(_OPENPAM)
/* Sun's PAM doesn't use const here, while Linux-PAM and OpenPAM do */
#define lo_const
Expand Down
9 changes: 8 additions & 1 deletion passwdqc_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ extern int passwdqc_filter_close(passwdqc_filter_t *flt);
/* Lower-level inlines for shared use by pwqfilter.c and passwdqc_filter.c */

#include <string.h> /* for strcspn() */
#if !defined(_MSC_VER) && !defined(__APPLE__)

/* We assume little-endian if this leaves __BYTE_ORDER undefined */
#if !defined(_MSC_VER) && !defined(__APPLE__) && !defined(__sun) && !defined(_AIX)
#include <endian.h>
#elif (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || \
defined(__sparc) || defined(_POWER)
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#define __BYTE_ORDER __BIG_ENDIAN
#endif

#include "md4.h"
Expand Down

0 comments on commit fbf3822

Please sign in to comment.