--- bin/ad/ad.h
+++ bin/ad/ad.h
@@ -16,8 +16,10 @@
 #define AD_H
 
 #if !defined(__FreeBSD__)
+#ifndef _XOPEN_SOURCE
 # define _XOPEN_SOURCE 600
 #endif
+#endif
 
 #include <sys/types.h>
 #include <sys/stat.h>
--- etc/uams/uams_dhx2_passwd.c
+++ etc/uams/uams_dhx2_passwd.c
@@ -19,11 +19,15 @@
 #include <pwd.h>
 
 #ifdef NETBSD
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE 500 /* for crypt() */
 #endif
+#endif
 #ifdef FREEBSD
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE /* for crypt() */
 #endif
+#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
--- etc/uams/uams_dhx_passwd.c
+++ etc/uams/uams_dhx_passwd.c
@@ -11,11 +11,15 @@
 #endif /* HAVE_CONFIG_H */
 
 #ifdef NETBSD
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE 500 /* for crypt() */
 #endif
+#endif
 #ifdef FREEBSD
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE /* for crypt() */
 #endif
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
--- etc/uams/uams_passwd.c
+++ etc/uams/uams_passwd.c
@@ -13,11 +13,15 @@
 #include <sys/types.h>
 /* crypt needs _XOPEN_SOURCE (500) at least on BSD, but that breaks Solaris compile */
 #ifdef NETBSD
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE 500 /* for crypt() */
 #endif
+#endif
 #ifdef FREEBSD
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE /* for crypt() */
 #endif
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
--- etc/uams/uams_pgp.c
+++ etc/uams/uams_pgp.c
@@ -13,7 +13,9 @@
 #ifdef UAM_PGP
 
 /* for crypt() */
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
--- libatalk/tdb/tdb.c
+++ libatalk/tdb/tdb.c
@@ -47,7 +47,9 @@
 #include <config.h>
 #endif
 
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE 600
+#endif
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
