[77864] trunk/base
afb at macports.org
afb at macports.org
Fri Apr 15 00:29:49 PDT 2011
Revision: 77864
http://trac.macports.org/changeset/77864
Author: afb at macports.org
Date: 2011-04-15 00:29:48 -0700 (Fri, 15 Apr 2011)
Log Message:
-----------
autoconf: look for CommonCrypto, libmd/FreeBSD and libcrypto/OpenSSL (with headers)
Modified Paths:
--------------
trunk/base/aclocal.m4
trunk/base/configure
trunk/base/src/config.h.in
Modified: trunk/base/aclocal.m4
===================================================================
--- trunk/base/aclocal.m4 2011-04-15 07:11:42 UTC (rev 77863)
+++ trunk/base/aclocal.m4 2011-04-15 07:29:48 UTC (rev 77864)
@@ -524,25 +524,37 @@
# Check for an md5 implementation
AC_DEFUN([MP_LIB_MD5],[
- # Check for libmd, which is prefered
- AC_CHECK_LIB([md], [MD5Update],[
- AC_CHECK_HEADERS([md5.h], ,[
- case $host_os in
- darwin*)
- AC_MSG_NOTICE([Please install the BSD SDK package from the Xcode Developer Tools CD.])
- ;;
- *)
- AC_MSG_NOTICE([Please install the libmd developer headers for your platform.])
- ;;
- esac
- AC_MSG_ERROR([libmd was found, but md5.h is missing.])
+ # Check for libmd from FreeBSD, which is preferred
+ AC_CHECK_LIB([md], [MD5File],[
+ AC_CHECK_HEADERS([md5.h sha.h], ,[
+ AC_MSG_ERROR([libmd was found, but md5.h or sha.h is missing.])
])
+ ac_save_LIBS="$LIBS"
+ LIBS="-lmd $LIBS"
+ AC_CHECK_FUNCS([SHA1_File])
+ LIBS="$ac_save_LIBS"
+ AC_CHECK_HEADERS([ripemd.h sha256.h])
AC_DEFINE([HAVE_LIBMD], ,[Define if you have the `md' library (-lmd).])
MD5_LIBS="-lmd"]
)
if test "x$MD5_LIBS" = "x"; then
- AC_MSG_ERROR([Neither CommonCrypto nor libmd were found. A working md5 implementation is required.])
+ # If libmd is not found, check for libcrypto from OpenSSL
+ AC_CHECK_LIB([crypto], [MD5_Update],[
+ AC_CHECK_HEADERS([openssl/md5.h openssl/sha.h], ,[
+ AC_MSG_ERROR([libcrypto was found, but openssl/md5.h or openssl/sha.h is missing.])
+ ])
+ AC_CHECK_HEADERS([openssl/ripemd.h])
+ ac_save_LIBS="$LIBS"
+ LIBS="-lcrypto $LIBS"
+ AC_CHECK_FUNCS([SHA256_Update])
+ LIBS="$ac_save_LIBS"
+ AC_DEFINE([HAVE_LIBCRYPTO], ,[Define if you have the `crypto' library (-lcrypto).])
+ MD5_LIBS="-lcrypto"]
+ )
fi
+ if test "x$MD5_LIBS" = "x"; then
+ AC_MSG_ERROR([Neither CommonCrypto, libmd nor libcrypto were found. A working md5 implementation is required.])
+ fi
AC_SUBST([MD5_LIBS])
])
Modified: trunk/base/configure
===================================================================
--- trunk/base/configure 2011-04-15 07:11:42 UTC (rev 77863)
+++ trunk/base/configure 2011-04-15 07:29:48 UTC (rev 77864)
@@ -5789,7 +5789,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tar supports -q" >&5
$as_echo_n "checking whether tar supports -q... " >&6; }
- if $TAR -t -q </dev/null 2>/dev/null ; then
+ if $TAR -t -q -f - </dev/null 2>/dev/null ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (bsdtar)" >&5
$as_echo "yes (bsdtar)" >&6; }
TAR_Q='q'
@@ -8442,10 +8442,10 @@
else
- # Check for libmd, which is prefered
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5Update in -lmd" >&5
-$as_echo_n "checking for MD5Update in -lmd... " >&6; }
-if ${ac_cv_lib_md_MD5Update+:} false; then :
+ # Check for libmd from FreeBSD, which is preferred
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5File in -lmd" >&5
+$as_echo_n "checking for MD5File in -lmd... " >&6; }
+if ${ac_cv_lib_md_MD5File+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -8459,55 +8459,73 @@
#ifdef __cplusplus
extern "C"
#endif
-char MD5Update ();
+char MD5File ();
int
main ()
{
-return MD5Update ();
+return MD5File ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_md_MD5Update=yes
+ ac_cv_lib_md_MD5File=yes
else
- ac_cv_lib_md_MD5Update=no
+ ac_cv_lib_md_MD5File=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_md_MD5Update" >&5
-$as_echo "$ac_cv_lib_md_MD5Update" >&6; }
-if test "x$ac_cv_lib_md_MD5Update" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_md_MD5File" >&5
+$as_echo "$ac_cv_lib_md_MD5File" >&6; }
+if test "x$ac_cv_lib_md_MD5File" = xyes; then :
- for ac_header in md5.h
+ for ac_header in md5.h sha.h
do :
- ac_fn_c_check_header_mongrel "$LINENO" "md5.h" "ac_cv_header_md5_h" "$ac_includes_default"
-if test "x$ac_cv_header_md5_h" = xyes; then :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_MD5_H 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
else
- case $host_os in
- darwin*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: Please install the BSD SDK package from the Xcode Developer Tools CD." >&5
-$as_echo "$as_me: Please install the BSD SDK package from the Xcode Developer Tools CD." >&6;}
- ;;
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: Please install the libmd developer headers for your platform." >&5
-$as_echo "$as_me: Please install the libmd developer headers for your platform." >&6;}
- ;;
- esac
- as_fn_error $? "libmd was found, but md5.h is missing." "$LINENO" 5
+ as_fn_error $? "libmd was found, but md5.h or sha.h is missing." "$LINENO" 5
fi
done
+ ac_save_LIBS="$LIBS"
+ LIBS="-lmd $LIBS"
+ for ac_func in SHA1_File
+do :
+ ac_fn_c_check_func "$LINENO" "SHA1_File" "ac_cv_func_SHA1_File"
+if test "x$ac_cv_func_SHA1_File" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SHA1_FILE 1
+_ACEOF
+fi
+done
+
+ LIBS="$ac_save_LIBS"
+ for ac_header in ripemd.h sha256.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
$as_echo "#define HAVE_LIBMD /**/" >>confdefs.h
MD5_LIBS="-lmd"
@@ -8515,8 +8533,99 @@
fi
if test "x$MD5_LIBS" = "x"; then
- as_fn_error $? "Neither CommonCrypto nor libmd were found. A working md5 implementation is required." "$LINENO" 5
+ # If libmd is not found, check for libcrypto from OpenSSL
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5_Update in -lcrypto" >&5
+$as_echo_n "checking for MD5_Update in -lcrypto... " >&6; }
+if ${ac_cv_lib_crypto_MD5_Update+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcrypto $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char MD5_Update ();
+int
+main ()
+{
+return MD5_Update ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_crypto_MD5_Update=yes
+else
+ ac_cv_lib_crypto_MD5_Update=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_MD5_Update" >&5
+$as_echo "$ac_cv_lib_crypto_MD5_Update" >&6; }
+if test "x$ac_cv_lib_crypto_MD5_Update" = xyes; then :
+
+ for ac_header in openssl/md5.h openssl/sha.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+
+ as_fn_error $? "libcrypto was found, but openssl/md5.h or openssl/sha.h is missing." "$LINENO" 5
+
+fi
+
+done
+
+ for ac_header in openssl/ripemd.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "openssl/ripemd.h" "ac_cv_header_openssl_ripemd_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_ripemd_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_OPENSSL_RIPEMD_H 1
+_ACEOF
+
+fi
+
+done
+
+ ac_save_LIBS="$LIBS"
+ LIBS="-lcrypto $LIBS"
+ for ac_func in SHA256_Update
+do :
+ ac_fn_c_check_func "$LINENO" "SHA256_Update" "ac_cv_func_SHA256_Update"
+if test "x$ac_cv_func_SHA256_Update" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SHA256_UPDATE 1
+_ACEOF
+
+fi
+done
+
+ LIBS="$ac_save_LIBS"
+
+$as_echo "#define HAVE_LIBCRYPTO /**/" >>confdefs.h
+
+ MD5_LIBS="-lcrypto"
+
+fi
+
fi
+ if test "x$MD5_LIBS" = "x"; then
+ as_fn_error $? "Neither CommonCrypto, libmd nor libcrypto were found. A working md5 implementation is required." "$LINENO" 5
+ fi
fi
Modified: trunk/base/src/config.h.in
===================================================================
--- trunk/base/src/config.h.in 2011-04-15 07:11:42 UTC (rev 77863)
+++ trunk/base/src/config.h.in 2011-04-15 07:29:48 UTC (rev 77864)
@@ -83,6 +83,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define if you have the `crypto' library (-lcrypto). */
+#undef HAVE_LIBCRYPTO
+
/* Define if you have the `md' library (-lmd). */
#undef HAVE_LIBMD
@@ -110,6 +113,15 @@
/* Define to 1 if you have the <objc/objc.h> header file. */
#undef HAVE_OBJC_OBJC_H
+/* Define to 1 if you have the <openssl/md5.h> header file. */
+#undef HAVE_OPENSSL_MD5_H
+
+/* Define to 1 if you have the <openssl/ripemd.h> header file. */
+#undef HAVE_OPENSSL_RIPEMD_H
+
+/* Define to 1 if you have the <openssl/sha.h> header file. */
+#undef HAVE_OPENSSL_SHA_H
+
/* Define to 1 if you have the <paths.h> header file. */
#undef HAVE_PATHS_H
@@ -125,9 +137,24 @@
/* Define to 1 if you have the <readline/readline.h> header file. */
#undef HAVE_READLINE_READLINE_H
+/* Define to 1 if you have the <ripemd.h> header file. */
+#undef HAVE_RIPEMD_H
+
/* Define to 1 if you have the `setmode' function. */
#undef HAVE_SETMODE
+/* Define to 1 if you have the `SHA1_File' function. */
+#undef HAVE_SHA1_FILE
+
+/* Define to 1 if you have the <sha256.h> header file. */
+#undef HAVE_SHA256_H
+
+/* Define to 1 if you have the `SHA256_Update' function. */
+#undef HAVE_SHA256_UPDATE
+
+/* Define to 1 if you have the <sha.h> header file. */
+#undef HAVE_SHA_H
+
/* Define to 1 if you have the <sqlite3ext.h> header file. */
#undef HAVE_SQLITE3EXT_H
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110415/5d9a3970/attachment-0001.html>
More information about the macports-changes
mailing list