gpgme-tool: Use membuf functions to build up strings.
[gpgme.git] / acinclude.m4
1 dnl Macros to configure GPGME
2 dnl Copyright (C) 2004 g10 Code GmbH
3 dnl
4 dnl This file is part of GPGME.
5 dnl
6 dnl GPGME is free software; you can redistribute it and/or modify it
7 dnl under the terms of the GNU Lesser General Public License as
8 dnl published by the Free Software Foundation; either version 2.1 of the
9 dnl License, or (at your option) any later version.
10 dnl 
11 dnl GPGME is distributed in the hope that it will be useful, but WITHOUT
12 dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 dnl or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
14 dnl Public License for more details.
15 dnl 
16 dnl You should have received a copy of the GNU Lesser General Public
17 dnl License along with this program; if not, write to the Free Software
18 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
20 dnl GNUPG_CHECK_VA_COPY()
21 dnl   Do some check on how to implement va_copy.
22 dnl   May define MUST_COPY_VA_BY_VAL.
23 dnl   Actual test code taken from glib-1.1.
24 AC_DEFUN([GNUPG_CHECK_VA_COPY],
25 [ AC_MSG_CHECKING(whether va_lists must be copied by value)
26   AC_CACHE_VAL(gnupg_cv_must_copy_va_byval,[
27     if test "$cross_compiling" = yes; then
28       gnupg_cv_must_copy_va_byval=no
29     else
30       gnupg_cv_must_copy_va_byval=no
31       AC_TRY_RUN([
32        #include <stdarg.h>
33        void f (int i, ...)
34        {
35           va_list args1, args2;
36           va_start (args1, i);
37           args2 = args1;
38           if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
39             exit (1);
40           va_end (args1);
41           va_end (args2);
42        }
43       
44        int main()
45        {
46           f (0, 42);
47             return 0;
48        }
49       ],gnupg_cv_must_copy_va_byval=yes)
50     fi
51   ])
52   if test "$gnupg_cv_must_copy_va_byval" = yes; then
53      AC_DEFINE(MUST_COPY_VA_BYVAL,1,[used to implement the va_copy macro])
54   fi
55   if test "$cross_compiling" = yes; then
56     AC_MSG_RESULT(assuming $gnupg_cv_must_copy_va_byval)
57   else
58     AC_MSG_RESULT($gnupg_cv_must_copy_va_byval)
59   fi
60 ])