Blame acinclude.m4

Packit d7e8d0
dnl Macros to configure GPGME
Packit d7e8d0
dnl Copyright (C) 2004 g10 Code GmbH
Packit d7e8d0
dnl
Packit d7e8d0
dnl This file is part of GPGME.
Packit d7e8d0
dnl
Packit d7e8d0
dnl GPGME is free software; you can redistribute it and/or modify it
Packit d7e8d0
dnl under the terms of the GNU Lesser General Public License as
Packit d7e8d0
dnl published by the Free Software Foundation; either version 2.1 of the
Packit d7e8d0
dnl License, or (at your option) any later version.
Packit d7e8d0
dnl 
Packit d7e8d0
dnl GPGME is distributed in the hope that it will be useful, but WITHOUT
Packit d7e8d0
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit d7e8d0
dnl or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
Packit d7e8d0
dnl Public License for more details.
Packit d7e8d0
dnl 
Packit d7e8d0
dnl You should have received a copy of the GNU Lesser General Public
Packit d7e8d0
dnl License along with this program; if not, write to the Free Software
Packit d7e8d0
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Packit d7e8d0
Packit d7e8d0
dnl GNUPG_CHECK_VA_COPY()
Packit d7e8d0
dnl   Do some check on how to implement va_copy.
Packit d7e8d0
dnl   May define MUST_COPY_VA_BY_VAL.
Packit d7e8d0
dnl   Actual test code taken from glib-1.1.
Packit d7e8d0
AC_DEFUN([GNUPG_CHECK_VA_COPY],
Packit d7e8d0
[ AC_MSG_CHECKING(whether va_lists must be copied by value)
Packit d7e8d0
  AC_CACHE_VAL(gnupg_cv_must_copy_va_byval,[
Packit d7e8d0
    if test "$cross_compiling" = yes; then
Packit d7e8d0
      gnupg_cv_must_copy_va_byval=no
Packit d7e8d0
    else
Packit d7e8d0
      gnupg_cv_must_copy_va_byval=no
Packit d7e8d0
      AC_TRY_RUN([
Packit d7e8d0
       #include <stdarg.h>
Packit d7e8d0
       void f (int i, ...)
Packit d7e8d0
       {
Packit d7e8d0
          va_list args1, args2;
Packit d7e8d0
          va_start (args1, i);
Packit d7e8d0
          args2 = args1;
Packit d7e8d0
          if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
Packit d7e8d0
            exit (1);
Packit d7e8d0
          va_end (args1);
Packit d7e8d0
          va_end (args2);
Packit d7e8d0
       }
Packit d7e8d0
      
Packit d7e8d0
       int main()
Packit d7e8d0
       {
Packit d7e8d0
          f (0, 42);
Packit d7e8d0
            return 0;
Packit d7e8d0
       }
Packit d7e8d0
      ],gnupg_cv_must_copy_va_byval=yes)
Packit d7e8d0
    fi
Packit d7e8d0
  ])
Packit d7e8d0
  if test "$gnupg_cv_must_copy_va_byval" = yes; then
Packit d7e8d0
     AC_DEFINE(MUST_COPY_VA_BYVAL,1,[used to implement the va_copy macro])
Packit d7e8d0
  fi
Packit d7e8d0
  if test "$cross_compiling" = yes; then
Packit d7e8d0
    AC_MSG_RESULT(assuming $gnupg_cv_must_copy_va_byval)
Packit d7e8d0
  else
Packit d7e8d0
    AC_MSG_RESULT($gnupg_cv_must_copy_va_byval)
Packit d7e8d0
  fi
Packit d7e8d0
])
Packit d7e8d0
Packit d7e8d0
dnl LIST_MEMBER()
Packit d7e8d0
dnl Check whether an element ist contained in a list.  Set `found' to
Packit d7e8d0
dnl `1' if the element is found in the list, to `0' otherwise.
Packit d7e8d0
AC_DEFUN([LIST_MEMBER],
Packit d7e8d0
[
Packit d7e8d0
name=$1
Packit d7e8d0
list=$2
Packit d7e8d0
found=0
Packit d7e8d0
Packit d7e8d0
for n in $list; do
Packit d7e8d0
  if test "x$name" = "x$n"; then
Packit d7e8d0
    found=1
Packit d7e8d0
  fi
Packit d7e8d0
done
Packit d7e8d0
])