2001-12-14 Marcus Brinkmann <marcus@g10code.de>
[gpgme.git] / configure.ac
1 # configure.in  for GPGME
2 # Copyright (C) 2000 Werner Koch (dd9jn)
3 # Copyright (C) 2001 g10 Code GmbH
4
5 # This file is part of GPGME.
6
7 # GPGME is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11
12 # GPGME is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20  
21 # (Process this file with autoconf to produce a configure script.)
22
23 AC_INIT(gpgme, 0.2.3a, [gnupg-devel@gnupg.org])
24 AC_PREREQ(2.52)
25 AC_REVISION($Revision$)
26
27 AC_CONFIG_SRCDIR(gpgme/gpgme.h)
28 AM_CONFIG_HEADER(config.h)
29 AM_INIT_AUTOMAKE(gpgme, 0.2.3a)
30 AM_MAINTAINER_MODE
31
32 AC_PROG_CC
33
34 # Version numbers (Remember to change them just before a release.)
35 #   (Interfaces removed:    CURRENT++, AGE=0, REVISION=0)
36 #   (Interfaces added:      CURRENT++, AGE++, REVISION=0)
37 #   (No interfaces changed:                   REVISION++)
38 # XXXX new functions
39 LIBGPGME_LT_CURRENT=4
40 LIBGPGME_LT_AGE=4
41 LIBGPGME_LT_REVISION=0
42 NEED_GPG_VERSION=1.0.6
43 NEED_GPGSM_VERSION=0.0.0
44 ##############################################
45
46 AC_SUBST(LIBGPGME_LT_CURRENT)
47 AC_SUBST(LIBGPGME_LT_AGE)
48 AC_SUBST(LIBGPGME_LT_REVISION)
49 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION")
50 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION")
51
52 dnl Don't default to build static libs.
53 dnl AC_DISABLE_STATIC
54 AC_PROG_LIBTOOL
55
56 GPG_DEFAULT=no
57 GPGSM_DEFAULT=no
58 component_system=None
59 case "${target}" in
60     *-*-mingw32* | i?86-emx-os2 | i?86-*-os2*emx | i?86-*-msdosdjgpp* )
61         # special stuff for Windoze NT
62         # OS/2 with the EMX environment
63         # DOS with the DJGPP environment
64         AC_DEFINE(HAVE_DRIVE_LETTERS)
65         AC_DEFINE(HAVE_DOSISH_SYSTEM)
66         GPG_DEFAULT='c:\\gnupg\\gpg.exe'
67         GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
68         #component_system='COM+'
69         ;;
70     *)
71 dnl     # XXX: Probably use exec-prefix here?
72 dnl     GPG_DEFAULT='/usr/bin/gpg'
73 dnl     GPGSM_DEFAULT='/usr/bin/gpgsm'
74         ;;
75 esac
76
77 dnl
78 dnl Checks for libraries.
79 dnl
80
81 dnl FIXME: check whether Bonobo is installed
82
83 dnl
84 dnl Checks for header files.
85 dnl
86
87 dnl
88 dnl Checks for typedefs and structures.
89 dnl
90 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
91 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
92 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
93 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
94 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
95
96 # We should not use them in this software;
97 # However jnlib/types.h needs them - so we take the easy way.
98 AC_CHECK_SIZEOF(unsigned short)
99 AC_CHECK_SIZEOF(unsigned int)
100 AC_CHECK_SIZEOF(unsigned long)
101
102 dnl
103 dnl Checks for compiler features.
104 dnl
105
106 if test "$GCC" = yes; then
107     CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
108 fi
109
110 dnl
111 dnl Checks for library functions.
112 dnl
113 dnl These are needed by libjnlib
114 AC_CHECK_FUNCS(memicmp stpcpy strlwr strtoul memmove stricmp)
115
116 dnl
117 dnl Checks for system services
118 dnl
119
120 NO_OVERRIDE=no
121 AC_ARG_WITH(gpg,
122             AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
123             GPG=$withval, NO_OVERRIDE=yes)
124 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
125   GPG=
126   NO_OVERRIDE=yes
127   if test "$cross_compiling" != "yes"; then
128     AC_PATH_PROG(GPG, gpg)
129   fi
130   if test -z "$GPG"; then
131     GPG="$GPG_DEFAULT"
132   fi
133 fi
134 if test "$GPG" = no; then
135   if test "$NO_OVERRIDE" = "yes"; then
136     if test "$cross_compiling" != "yes"; then
137       AC_MSG_WARN([Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it])
138     else
139       AC_MSG_ERROR([Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH])
140     fi
141   fi
142 else
143   AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG")
144   AC_SUBST(GPG)
145 fi
146 AM_CONDITIONAL(RUN_GPG_TESTS,
147   [test "$cross_compiling" != "yes" && test -n "$GPG" && test -r "$GPG"])
148 AC_SUBST(GPG_PATH)
149
150 NO_OVERRIDE=no
151 AC_ARG_WITH(gpgsm,
152             AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
153             GPGSM=$withval, NO_OVERRIDE=yes)
154 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
155   GPGSM=
156   NO_OVERRIDE=yes
157   if test "$cross_compiling" != "yes"; then
158     AC_PATH_PROG(GPGSM, gpgsm)
159   fi
160   if test -z "$GPGSM"; then
161     GPGSM="$GPGSM_DEFAULT"
162   fi
163 fi
164 if test "$GPGSM" = no; then
165   if test "$NO_OVERRIDE" = "yes"; then
166     if test "$cross_compiling" != "yes"; then
167       AC_MSG_WARN([Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it])
168     else
169       AC_MSG_ERROR([Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH])
170     fi
171   fi
172 else
173   AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM")
174   AC_SUBST(GPGSM)
175 fi
176 AM_CONDITIONAL(RUN_GPGSM_TESTS,
177   [test "$cross_compiling" != "yes" && test -n "$GPGSM" && test -r "$GPGSM"])
178
179 dnl
180 dnl Create config files 
181 dnl
182
183 /* FIXME: Only build if supported.  */
184 AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
185
186 AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
187 AM_CONDITIONAL(BUILD_BONOBO,  test "$component_system" = "Bonobo")
188
189 GPGMEPLUG=no
190 AC_ARG_ENABLE(gpgmeplug,
191             AC_HELP_STRING([--enable-gpgmeplug], [build GPGME Crypt Plug-In]),
192             GPGMEPLUG=$enableval)
193 AM_CONDITIONAL(BUILD_GPGMEPLUG, test "$GPGMEPLUG" = "yes")
194
195 dnl Make the version number in gpgme/gpgme.h the same as the one here.
196 dnl (this is easier than to have a *.in file just for one substitution)
197 GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
198
199 dnl Substitution used for gpgme-config 
200 GPGME_LIBS="-L${libdir} -lgpgme"
201 GPGME_CFLAGS=""
202 AC_SUBST(GPGME_LIBS)
203 AC_SUBST(GPGME_CFLAGS)
204
205 AC_CONFIG_FILES(Makefile assuan/Makefile jnlib/Makefile gpgme/Makefile
206                 tests/Makefile tests/gpg/Makefile tests/gpgsm/Makefile
207                 doc/Makefile
208                 bonobo/Makefile complus/Makefile gpgmeplug/Makefile)
209 AC_CONFIG_FILES(gpgme/gpgme-config, chmod +x gpgme/gpgme-config)
210 AC_OUTPUT
211
212 echo "
213         GPGME v${VERSION} has been configured as follows:
214
215         GnuPG version: min. $NEED_GPG_VERSION
216         GnuPG path:    $GPG
217
218         GpgSM version: min. $NEED_GPGSM_VERSION
219         GpgSM path:    $GPGSM
220
221         GPGME CryptPlug: $GPGMEPLUG
222 "