1dnl macros to configure gnupg 2dnl Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. 3dnl 4dnl This file is part of GnuPG. 5dnl 6dnl GnuPG is free software; you can redistribute it and/or modify 7dnl it under the terms of the GNU General Public License as published by 8dnl the Free Software Foundation; either version 2 of the License, or 9dnl (at your option) any later version. 10dnl 11dnl GnuPG is distributed in the hope that it will be useful, 12dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 13dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14dnl GNU General Public License for more details. 15dnl 16dnl You should have received a copy of the GNU General Public License 17dnl along with this program; if not, write to the Free Software 18dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 20dnl GNUPG_CHECK_TYPEDEF(TYPE, HAVE_NAME) 21dnl Check whether a typedef exists and create a #define $2 if it exists 22dnl 23AC_DEFUN([GNUPG_CHECK_TYPEDEF], 24 [ AC_MSG_CHECKING(for $1 typedef) 25 AC_CACHE_VAL(gnupg_cv_typedef_$1, 26 [AC_TRY_COMPILE([#define _GNU_SOURCE 1 27 #include <stdlib.h> 28 #include <sys/types.h>], [ 29 #undef $1 30 int a = sizeof($1); 31 ], gnupg_cv_typedef_$1=yes, gnupg_cv_typedef_$1=no )]) 32 AC_MSG_RESULT($gnupg_cv_typedef_$1) 33 if test "$gnupg_cv_typedef_$1" = yes; then 34 AC_DEFINE($2,1,[Defined if a `]$1[' is typedef'd]) 35 fi 36 ]) 37 38dnl Stolen from gcc 39dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead 40dnl of the usual 2. 41AC_DEFUN([GNUPG_FUNC_MKDIR_TAKES_ONE_ARG], 42[AC_CHECK_HEADERS(sys/stat.h unistd.h direct.h) 43AC_CACHE_CHECK([if mkdir takes one argument], gnupg_cv_mkdir_takes_one_arg, 44[AC_TRY_COMPILE([ 45#include <sys/types.h> 46#ifdef HAVE_SYS_STAT_H 47# include <sys/stat.h> 48#endif 49#ifdef HAVE_UNISTD_H 50# include <unistd.h> 51#endif 52#ifdef HAVE_DIRECT_H 53# include <direct.h> 54#endif], [mkdir ("foo", 0);], 55 gnupg_cv_mkdir_takes_one_arg=no, gnupg_cv_mkdir_takes_one_arg=yes)]) 56if test $gnupg_cv_mkdir_takes_one_arg = yes ; then 57 AC_DEFINE(MKDIR_TAKES_ONE_ARG,1, 58 [Defined if mkdir() does not take permission flags]) 59fi 60]) 61 62 63dnl GNUPG_CHECK_VA_COPY() 64dnl Do some check on how to implement va_copy. 65dnl May define MUST_COPY_VA_BY_VAL. 66dnl Actual test code taken from glib-1.1. 67AC_DEFUN([GNUPG_CHECK_VA_COPY], 68[ AC_MSG_CHECKING(whether va_lists must be copied by value) 69 AC_CACHE_VAL(gnupg_cv_must_copy_va_byval,[ 70 if test "$cross_compiling" = yes; then 71 gnupg_cv_must_copy_va_byval=no 72 else 73 gnupg_cv_must_copy_va_byval=no 74 AC_TRY_RUN([ 75 #include <stdarg.h> 76 void f (int i, ...) 77 { 78 va_list args1, args2; 79 va_start (args1, i); 80 args2 = args1; 81 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) 82 exit (1); 83 va_end (args1); 84 va_end (args2); 85 } 86 87 int main() 88 { 89 f (0, 42); 90 return 0; 91 } 92 ],gnupg_cv_must_copy_va_byval=yes) 93 fi 94 ]) 95 if test "$gnupg_cv_must_copy_va_byval" = yes; then 96 AC_DEFINE(MUST_COPY_VA_BYVAL,1,[used to implement the va_copy macro]) 97 fi 98 if test "$cross_compiling" = yes; then 99 AC_MSG_RESULT(assuming $gnupg_cv_must_copy_va_byval) 100 else 101 AC_MSG_RESULT($gnupg_cv_must_copy_va_byval) 102 fi 103]) 104