build: Update md5.h detection in waf and autoconf to use sys/md5.h and -lmd
authorAndrew Bartlett <abartlet@samba.org>
Tue, 21 May 2013 14:14:19 +0000 (00:14 +1000)
committerRichard Sharpe <sharpe@samba.org>
Wed, 22 May 2013 08:06:40 +0000 (10:06 +0200)
This brings the two build systems in sync, without using md5.h (which is a problem name)

Tested on FreeBSD

Andrew Bartlett

Reviewed-by: Richard Sharpe <rsharpe@samba.org>
Autobuild-User(master): Richard Sharpe <sharpe@samba.org>
Autobuild-Date(master): Wed May 22 10:06:40 CEST 2013 on sn-devel-104

lib/crypto/md5.h
lib/crypto/wscript_build
lib/crypto/wscript_configure
source3/configure.in

index 388cdf83f093c3dd91cedcb234ca75be388cd6a3..edae27f65bd809089b4ddffe1cbd6dd4808f73df 100644 (file)
@@ -6,12 +6,16 @@
 #define HEADER_MD5_H 
 #endif
 
-#ifdef HAVE_BSD_MD5_H
-/* Try to avoid clashes with BSD MD5 implementation */
+#if defined(HAVE_BSD_MD5_H)
+/* Try to avoid clashes with BSD MD5 implementation (on linux) */
 #include <bsd/md5.h>
-#else
+
+#elif defined(HAVE_SYS_MD5_H)
+/* Try to avoid clashes with BSD MD5 implementation (on BSD) */
+#include <sys/md5.h>
+
 /* Try to use CommonCrypto on Mac as otherwise we can get MD5Final twice */
-#ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H
+#elif defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
 #include <CommonCrypto/CommonDigest.h>
 
 #define MD5Init(c)                                     CC_MD5_Init(c)
@@ -32,8 +36,6 @@ void MD5Init(MD5_CTX *context);
 void MD5Update(MD5_CTX *context, const uint8_t *buf,
               size_t len);
 void MD5Final(uint8_t digest[MD5_DIGEST_LENGTH], MD5_CTX *context);
-#endif /* HAVE_COMMONCRYPTO_COMMONDIGEST_H */
-
-#endif /* HAVE_BSD_MD5_H */
+#endif /* HAVE_*MD5_H */
 
 #endif /* !MD5_H */
index cd7a466a1552802c33e7f8dff274402afc148401..e056f653fb9ae731317c3ac6378863bf5a36e8e6 100644 (file)
@@ -4,6 +4,10 @@ extra_source = ''
 extra_deps = ''
 if bld.CONFIG_SET('HAVE_BSD_MD5_H'):
        extra_deps += ' bsd'
+elif bld.CONFIG_SET('HAVE_SYS_MD5_H') and bld.CONFIG_SET('HAVE_LIBMD5'):
+       extra_deps += ' md5'
+elif bld.CONFIG_SET('HAVE_SYS_MD5_H') and bld.CONFIG_SET('HAVE_LIBMD'):
+       extra_deps += ' md'
 elif not bld.CONFIG_SET('HAVE_COMMONCRYPTO_COMMONDIGEST_H'):
        extra_source += ' md5.c'
 
index 5fc00fb22cb81b3966822b68fc04ed1febad8804..21ec566b6ba966544915b374c42fa2c6d40494fe 100644 (file)
@@ -1,4 +1,8 @@
-conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h',
-    checklibc=True)
+if not conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h',
+    checklibc=True):
+    conf.CHECK_FUNCS_IN('MD5Init', 'md5', headers='sys/md5.h',
+                        checklibc=True)
+    conf.CHECK_FUNCS_IN('MD5Init', 'md', headers='sys/md5.h',
+                        checklibc=True)
 conf.CHECK_FUNCS_IN('CC_MD5_Init', '', headers='CommonCrypto/CommonDigest.h',
     checklibc=True)
index 822c5f4442e91851c21126692ff228dc995d3a33..0e2f1267a701b00a7d82ef44a5b9eb007b82500d 100644 (file)
@@ -620,11 +620,11 @@ if test x"$samba_cv_md5lib" = x"none" ; then
 fi
 
 if test x"$samba_cv_md5lib" != x"none" ; then
-       AC_CHECK_HEADERS(md5.h)
+       AC_CHECK_HEADERS(sys/md5.h)
 fi
 
 CRYPTO_MD5_OBJ="../lib/crypto/md5.o"
-if test x"$ac_cv_header_md5_h" = x"yes" -a \
+if test x"$ac_cv_header_sys_md5_h" = x"yes" -a \
         x"$samba_cv_md5lib" != x"none" ; then
        if test x"$samba_cv_md5lib" != x ; then
                LIBS="${LIBS} -l${samba_cv_md5lib}"