* acinclude.m4 (GNUPG_FIX_HDR_VERSION): Fixed for new automake.
[gpgme.git] / acinclude.m4
1 dnl Macros to configure gpgme
2
3
4 dnl GNUPG_FIX_HDR_VERSION(FILE, NAME)
5 dnl Make the version number in gcrypt/gcrypt.h the same as the one here.
6 dnl (this is easier than to have a .in file just for one substitution)
7 dnl We must use a temp file in the current directory because make distcheck 
8 dnl install all sourcefiles RO.
9 dnl (wk 2001-12-18)
10 AC_DEFUN(GNUPG_FIX_HDR_VERSION,
11   [ sed "s/^#define $2 \".*/#define $2 \"$VERSION\"/" $srcdir/$1 > fixhdr.tmp
12     if cmp -s $srcdir/$1 fixhdr.tmp 2>/dev/null; then
13         rm -f fixhdr.tmp
14     else
15         rm -f $srcdir/$1
16         if mv fixhdr.tmp $srcdir/$1 ; then
17             :
18         else
19             AC_MSG_ERROR([[
20 ***
21 *** Failed to fix the version string macro $2 in $1.
22 *** The old file has been saved as fixhdr.tmp
23 ***]])
24         fi
25         AC_MSG_WARN([fixed the $2 macro in $1])
26     fi
27   ])
28
29
30
31
32 dnl GNUPG_CHECK_TYPEDEF(TYPE, HAVE_NAME)
33 dnl Check whether a typedef exists and create a #define $2 if it exists
34 dnl
35 AC_DEFUN(GNUPG_CHECK_TYPEDEF,
36   [ AC_MSG_CHECKING(for $1 typedef)
37     AC_CACHE_VAL(gnupg_cv_typedef_$1,
38     [AC_TRY_COMPILE([#include <stdlib.h>
39     #include <sys/types.h>], [
40     #undef $1
41     int a = sizeof($1);
42     ], gnupg_cv_typedef_$1=yes, gnupg_cv_typedef_$1=no )])
43     AC_MSG_RESULT($gnupg_cv_typedef_$1)
44     if test "$gnupg_cv_typedef_$1" = yes; then
45         AC_DEFINE($2)
46     fi
47   ])
48
49
50
51
52
53
54
55
56
57