Debian Codegraph @

acinclude.m4

raw
1 dnl macros to configure gnupg
2 dnl Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
3 dnl
4 dnl This file is part of GnuPG.
5 dnl
6 dnl GnuPG is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 2 of the License, or
9 dnl (at your option) any later version.
10 dnl
11 dnl GnuPG is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU General Public License
17 dnl 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
21 dnl GNUPG_CHECK_TYPEDEF(TYPE, HAVE_NAME)
22 dnl Check whether a typedef exists and create a #define $2 if it exists
23 dnl
24 AC_DEFUN([GNUPG_CHECK_TYPEDEF],
25 [ AC_MSG_CHECKING(for $1 typedef)
26 AC_CACHE_VAL(gnupg_cv_typedef_$1,
27 [AC_TRY_COMPILE([#define _GNU_SOURCE 1
28 #include <stdlib.h>
29 #include <sys/types.h>], [
30 #undef $1
31 int a = sizeof($1);
32 ], gnupg_cv_typedef_$1=yes, gnupg_cv_typedef_$1=no )])
33 AC_MSG_RESULT($gnupg_cv_typedef_$1)
34 if test "$gnupg_cv_typedef_$1" = yes; then
35 AC_DEFINE($2,1,[Defined if a `]$1[' is typedef'd])
36 fi
37 ])
38
39 dnl GNUPG_CHECK_ENDIAN
40 dnl define either LITTLE_ENDIAN_HOST or BIG_ENDIAN_HOST
41 dnl
42 define(GNUPG_CHECK_ENDIAN,
43 [
44 tmp_assumed_endian=big
45 if test "$cross_compiling" = yes; then
46 case "$host_cpu" in
47 i@<:@345678@:>@* )
48 tmp_assumed_endian=little
49 ;;
50 *)
51 ;;
52 esac
53 AC_MSG_WARN(cross compiling; assuming $tmp_assumed_endian endianess)
54 fi
55 AC_MSG_CHECKING(endianess)
56 AC_CACHE_VAL(gnupg_cv_c_endian,
57 [ gnupg_cv_c_endian=unknown
58 # See if sys/param.h defines the BYTE_ORDER macro.
59 AC_TRY_COMPILE([#include <sys/types.h>
60 #include <sys/param.h>], [
61 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
62 bogus endian macros
63 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
64 AC_TRY_COMPILE([#include <sys/types.h>
65 #include <sys/param.h>], [
66 #if BYTE_ORDER != BIG_ENDIAN
67 not big endian
68 #endif], gnupg_cv_c_endian=big, gnupg_cv_c_endian=little)])
69 if test "$gnupg_cv_c_endian" = unknown; then
70 AC_TRY_RUN([main () {
71 /* Are we little or big endian? From Harbison&Steele. */
72 union
73 {
74 long l;
75 char c[sizeof (long)];
76 } u;
77 u.l = 1;
78 exit (u.c[sizeof (long) - 1] == 1);
79 }],
80 gnupg_cv_c_endian=little,
81 gnupg_cv_c_endian=big,
82 gnupg_cv_c_endian=$tmp_assumed_endian
83 )
84 fi
85 ])
86 AC_MSG_RESULT([$gnupg_cv_c_endian])
87 if test "$gnupg_cv_c_endian" = little; then
88 AC_DEFINE(LITTLE_ENDIAN_HOST,1,
89 [Defined if the host has little endian byte ordering])
90 else
91 AC_DEFINE(BIG_ENDIAN_HOST,1,
92 [Defined if the host has big endian byte ordering])
93 fi
94 ])
95
96 # GNUPG_BUILD_PROGRAM(NAME,DEFAULT)
97 # Add a --enable-NAME option to configure an set the
98 # shell variable build_NAME either to "yes" or "no". DEFAULT must
99 # either be "yes" or "no" and decided on the default value for
100 # build_NAME and whether --enable-NAME or --disable-NAME is shown with
101 # ./configure --help
102 AC_DEFUN([POLDI_ENABLE_FEATURE],
103 [$1=$2
104 m4_if([$2],[yes],[
105 AC_ARG_ENABLE([$3], AS_HELP_STRING([--disable-$3],
106 [disable $4]),
107 $1=$enableval, $1=$2)
108 ],[
109 AC_ARG_ENABLE([$3], AS_HELP_STRING([--enable-$3],
110 [enable $4]),
111 $1=$enableval, $1=$2)
112 ])
113 case "$$1" in
114 no|yes)
115 ;;
116 *)
117 echo "$1"
118 AC_MSG_ERROR([argument for --enable-$3 must be either yes or no])
119 ;;
120 esac
121 ])