1# XCAM_MD5SUM([file], [md5sum], [if-true], [if-false]) 2AC_DEFUN([XCAM_MD5SUM], 3[ 4 AS_IF([test -f $1], 5 [ 6 md5=`md5sum $1 | cut --delimiter=' ' --fields=1` 7 AS_IF([test "x$md5" = "x$2"], [$3], [$4]) 8 ], 9 [$4]) 10]) 11 12# XCAM_WGET([url], [output-file], [md5sum]) 13AC_DEFUN([XCAM_WGET], 14[ 15 MD5_CORRECT=yes 16 XCAM_MD5SUM([$2], [$3], [MD5_CORRECT=yes], [MD5_CORRECT=no]) 17 AS_IF([test "x$MD5_CORRECT" = "xyes"], 18 [AC_MSG_NOTICE([checking $2 md5sum ... ok])], 19 [ 20 AC_MSG_NOTICE([downloading $2...]) 21 dir=`dirname $2` 22 AS_IF([test ! -d $dir], [mkdir -p $dir]) 23 24 wget --tries=2 --timeout=5 -q --no-use-server-timestamps $1 -O $2 25 AS_IF([test "$?" != 0], [AC_MSG_ERROR([download/wget $2 failed])]) 26 27 XCAM_MD5SUM([$2], [$3], [AC_MSG_NOTICE([checking $2 md5sum ... ok])], [AC_MSG_ERROR([checking $2 md5sum ... failed])]) 28 ]) 29]) 30 31