Index: man5/Makefile.in
--- man5/Makefile.in.orig	2011-11-21 22:58:10.000000000 +0100
+++ man5/Makefile.in	2011-11-22 07:46:57.000000000 +0100
@@ -2,6 +2,7 @@
 groups.ldap.5 groups.ldap.cat5\
 ldapuseradd.conf.5 ldapuseradd.conf.cat5\
 users.ldap.5 users.ldap.cat5
+MAN_DIR=@MAN_DIR@
 
 all: $(FILES)
 
@@ -9,10 +10,10 @@
 	-rm *.cat5
 
 install:
-	-mkdir -p @MAN_DIR@/man5
-	-mkdir -p @MAN_DIR@/cat5
-	cp *.5 @MAN_DIR@/man5
-	cp *.cat5 @MAN_DIR@/cat5
+	-mkdir -p $(MAN_DIR)/man5
+	-mkdir -p $(MAN_DIR)/cat5
+	cp *.5 $(MAN_DIR)/man5
+	cp *.cat5 $(MAN_DIR)/cat5
 
 #%.5: %.5.xml
 #	xmltoman $^ > $@
Index: man8/Makefile.in
--- man8/Makefile.in.orig	2011-11-21 22:58:10.000000000 +0100
+++ man8/Makefile.in	2011-11-22 07:46:57.000000000 +0100
@@ -5,6 +5,7 @@
 ldapuseradd.8 ldapuseradd.cat8 \
 ldapuserdel.8 ldapuserdel.cat8 \
 ldapusermod.8 ldapusermod.cat8
+MAN_DIR=@MAN_DIR@
 
 all: $(FILES)
 
@@ -12,10 +13,10 @@
 	-rm *.cat8
 
 install:
-	-mkdir -p @MAN_DIR@/man8
-	-mkdir -p @MAN_DIR@/cat8
-	cp *.8 @MAN_DIR@/man8
-	cp *.cat8 @MAN_DIR@/cat8
+	-mkdir -p $(MAN_DIR)/man8
+	-mkdir -p $(MAN_DIR)/cat8
+	cp *.8 $(MAN_DIR)/man8
+	cp *.cat8 $(MAN_DIR)/cat8
 
 #%.8: %.8.xml
 #	xmltoman $^ > $@
Index: src/Makefile.in
--- src/Makefile.in.orig	2011-11-21 22:58:10.000000000 +0100
+++ src/Makefile.in	2011-11-22 07:46:57.000000000 +0100
@@ -12,7 +12,7 @@
 LDAP_OBJS=$(patsubst %.c,%.o,$(wildcard ldap/*.c))
 API_OBJS=$(patsubst %.c,%.o,$(wildcard api/*.c))
 CC=@CC@
-CFLAGS=-Wall -I.. -I. -Iapi -Ildap @CFLAGS@
+CFLAGS=-Wall -I.. -I. -Iapi -Ildap @CFLAGS@ @CPPFLAGS@
 #TODO: --export-dynamic on non-GNU ld.
 LDFLAGS=-Wl,-s -Wl,--export-dynamic
 BIN_DIR=@BIN_DIR@
@@ -29,13 +29,13 @@
 install:
 	-install -d $(BIN_DIR)
 	install ldapuseradd $(BIN_DIR)
-	-ln -s ldapuseradd $(BIN_DIR)/ldapusermod
-	-ln -s ldapuseradd $(BIN_DIR)/ldapuserdel
-	-ln -s ldapuseradd $(BIN_DIR)/ldapgroupadd
-	-ln -s ldapuseradd $(BIN_DIR)/ldapgroupmod
-	-ln -s ldapuseradd $(BIN_DIR)/ldapgroupdel
+	-ln $(BIN_DIR)/ldapuseradd $(BIN_DIR)/ldapusermod
+	-ln $(BIN_DIR)/ldapuseradd $(BIN_DIR)/ldapuserdel
+	-ln $(BIN_DIR)/ldapuseradd $(BIN_DIR)/ldapgroupadd
+	-ln $(BIN_DIR)/ldapuseradd $(BIN_DIR)/ldapgroupmod
+	-ln $(BIN_DIR)/ldapuseradd $(BIN_DIR)/ldapgroupdel
 	cd hooks; make install
 
 ldapuseradd: $(OBJS) $(LDAP_OBJS) $(API_OBJS)
-	$(CC) -o ldapuseradd $(OBJS) $(LDAP_OBJS) $(API_OBJS) $(LDFLAGS) -lldap
+	$(CC) -o ldapuseradd $(OBJS) $(LDAP_OBJS) $(API_OBJS) $(LDFLAGS) -lldap -llber -lssl -lcrypto
 
Index: src/getopt.c
--- src/getopt.c.orig	2011-11-21 22:58:10.000000000 +0100
+++ src/getopt.c	2011-11-22 07:46:57.000000000 +0100
@@ -39,6 +39,7 @@
 #endif
 
 #include <stdio.h>
+#include <string.h>
 
 /* Comment out all this code if we are using the GNU C Library, and are not
    actually compiling the library itself.  This code is part of the GNU C
@@ -75,17 +76,7 @@
 # endif
 #endif
 
-#ifdef _LIBC
-# include <libintl.h>
-#else
-/* This is for other GNU distributions with internationalized messages.  */
-# include "gettext.h"
-#endif
-#define _(msgid) gettext (msgid)
-
-#if defined _LIBC && defined USE_IN_LIBIO
-# include <wchar.h>
-#endif
+#define _(msgid) msgid
 
 #ifndef attribute_hidden
 # define attribute_hidden
Index: src/hooks/Makefile.in
--- src/hooks/Makefile.in.orig	2011-11-21 22:59:11.000000000 +0100
+++ src/hooks/Makefile.in	2011-11-22 07:47:47.000000000 +0100
@@ -1,5 +1,5 @@
 SOBJS=hook_home.so hook_mail.so hook_sql.so hook_web.so hook_script.so
-CFLAGS=-Wunused -I.. -I../.. -I../api -I../ldap -fPIC
+CFLAGS=-Wunused -I.. -I../.. -I../api -I../ldap -fPIC @CFLAGS@ @CPPFLAGS@
 CC=@CC@
 LIB_DIR=@LIB_DIR@
 
Index: src/ldapuseradd.c
--- src/ldapuseradd.c.orig	2011-11-21 22:58:10.000000000 +0100
+++ src/ldapuseradd.c	2011-11-22 07:46:57.000000000 +0100
@@ -36,7 +36,9 @@
  */
 
 #include "ldapuseradd.h"
+#ifdef __linux__
 #include <sys/prctl.h>
+#endif
 
 /**
  * catch_int: Here is the signal handler (to catch ctrl-c)
@@ -55,7 +57,9 @@
     struct lua_struct uab;
     struct lua_struct *ua1 = &uab;
 
+#ifdef __linux__
     prctl(PR_SET_DUMPABLE, 1);
+#endif
 
     ua1->current_account = (struct user_account*)malloc(sizeof(struct user_account));
     ua1->newmod_account = (struct user_account*)malloc(sizeof(struct user_account));
