Blame acinclude.m4

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