Bumbed version number to *-cvs
[gpgme.git] / configure.ac
1 # configure.in  for GPGME
2 # Copyright (C) 2000 Werner Koch (dd9jn)
3 # Copyright (C) 2001, 2002 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 # Version numbers (Remember to change them just before a release.)
24 #   (Code changed:                      REVISION++)
25 #   (Interfaces added/removed/changed:  CURRENT++, REVISION=0)
26 #   (Interfaces added:                  AGE++)
27 #   (Interfaces removed:                AGE=0)
28 #
29 AC_INIT(gpgme, 0.3.7-cvs, [gnupg-devel@gnupg.org])
30 LIBGPGME_LT_CURRENT=8
31 LIBGPGME_LT_AGE=2
32 LIBGPGME_LT_REVISION=0
33 NEED_GPG_VERSION=1.0.7
34 NEED_GPGSM_VERSION=0.3.6
35 ##############################################
36 AC_PREREQ(2.52)
37 AC_REVISION($Revision$)
38
39 PACKAGE=$PACKAGE_NAME
40 VERSION=$PACKAGE_VERSION
41
42 AC_CONFIG_SRCDIR(gpgme/gpgme.h)
43 AM_CONFIG_HEADER(config.h)
44 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
45 AM_MAINTAINER_MODE
46
47 AH_VERBATIM([_GNU_SOURCE],
48 [/* Enable GNU extensions on systems that have them.  */
49 #ifndef _GNU_SOURCE
50 # define _GNU_SOURCE
51 #endif])
52
53 AH_VERBATIM([_REENTRANT],
54 [/* To allow the use of GPGME in multithreaded programs we have to use
55   special features from the library.
56   IMPORTANT: gpgme is not yet fully reentrant and you should use it
57   only from one thread.  */
58 #ifndef _REENTRANT
59 # define _REENTRANT 1
60 #endif])
61
62
63 AC_PROG_CC
64
65
66 AC_SUBST(LIBGPGME_LT_CURRENT)
67 AC_SUBST(LIBGPGME_LT_AGE)
68 AC_SUBST(LIBGPGME_LT_REVISION)
69 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
70                                      [Min. needed GnuPG version.])
71 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
72                                        [Min. needed GPGSM version.])
73
74 AC_SUBST(PACKAGE)
75 AC_SUBST(VERSION)
76 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
77 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
78
79 dnl Don't default to build static libs.
80 dnl AC_DISABLE_STATIC
81 AC_PROG_LIBTOOL
82
83 GPG_DEFAULT=no
84 GPGSM_DEFAULT=no
85 component_system=None
86 case "${target}" in
87     *-*-mingw32* | i?86-emx-os2 | i?86-*-os2*emx | i?86-*-msdosdjgpp* )
88         # special stuff for Windoze NT
89         # OS/2 with the EMX environment
90         # DOS with the DJGPP environment
91         AC_DEFINE(HAVE_DRIVE_LETTERS, ,
92                   [Defined if we run on some of the PCDOS like systems (DOS,
93                    Windoze, OS/2) with special properties like no file modes.])
94         AC_DEFINE(HAVE_DOSISH_SYSTEM, ,
95                   [Defined if the filesystem uses driver letters.])
96         have_dosish_system=yes
97         GPG_DEFAULT='c:\\gnupg\\gpg.exe'
98         GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
99         #component_system='COM+'
100         ;;
101     *)
102 dnl     # XXX: Probably use exec-prefix here?
103 dnl     GPG_DEFAULT='/usr/bin/gpg'
104 dnl     GPGSM_DEFAULT='/usr/bin/gpgsm'
105         ;;
106 esac
107 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = "yes")
108
109 dnl
110 dnl Checks for libraries.
111 dnl
112
113 dnl FIXME: check whether Bonobo is installed
114
115 dnl
116 dnl Checks for header files.
117 dnl
118
119 dnl
120 dnl Checks for typedefs and structures.
121 dnl
122 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
123 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
124 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
125 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
126 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
127
128 dnl We should not use them in this software;
129 dnl However jnlib/types.h needs them - so we take the easy way.
130 AC_CHECK_SIZEOF(unsigned short)
131 AC_CHECK_SIZEOF(unsigned int)
132 AC_CHECK_SIZEOF(unsigned long)
133
134 dnl
135 dnl Checks for compiler features.
136 dnl
137
138 if test "$GCC" = yes; then
139     CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
140 fi
141
142 dnl
143 dnl Checks for library functions.
144 dnl
145 dnl These are needed by libjnlib
146 AC_CHECK_FUNCS(memicmp stpcpy strlwr strtoul memmove stricmp)
147
148 # asprintf() is at least used in assuan
149 AC_REPLACE_FUNCS(vasprintf)
150 # Note: fopencokie is only a dummy stub and not used.  
151 #       However some code in assuan/ links against it.
152 AC_REPLACE_FUNCS(fopencookie)
153
154
155 dnl We use jnlib, so tell other modules about it
156 AC_DEFINE(HAVE_JNLIB_LOGGING, 1,
157         [Defined if jnlib style logging fucntions are available.])
158
159 dnl
160 dnl Checks for system services
161 dnl
162
163 NO_OVERRIDE=no
164 AC_ARG_WITH(gpg,
165             AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
166             GPG=$withval, NO_OVERRIDE=yes)
167 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
168   GPG=
169   NO_OVERRIDE=yes
170   if test "$cross_compiling" != "yes"; then
171     AC_PATH_PROG(GPG, gpg)
172   fi
173   if test -z "$GPG"; then
174     GPG="$GPG_DEFAULT"
175   fi
176 fi
177 if test "$GPG" = no; then
178   if test "$NO_OVERRIDE" = "yes"; then
179     if test "$cross_compiling" != "yes"; then
180       AC_MSG_WARN([Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it])
181     else
182       AC_MSG_ERROR([Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH])
183     fi
184   fi
185 else
186   AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
187   AC_SUBST(GPG)
188 fi
189 AM_CONDITIONAL(RUN_GPG_TESTS,
190   [test "$cross_compiling" != "yes" && test -n "$GPG" && test -r "$GPG"])
191 AC_SUBST(GPG_PATH)
192
193 NO_OVERRIDE=no
194 AC_ARG_WITH(gpgsm,
195             AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
196             GPGSM=$withval, NO_OVERRIDE=yes)
197 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
198   GPGSM=
199   NO_OVERRIDE=yes
200   if test "$cross_compiling" != "yes"; then
201     AC_PATH_PROG(GPGSM, gpgsm)
202   fi
203   if test -z "$GPGSM"; then
204     GPGSM="$GPGSM_DEFAULT"
205   fi
206 fi
207 if test "$GPGSM" = no; then
208   if test "$NO_OVERRIDE" = "yes"; then
209     if test "$cross_compiling" != "yes"; then
210       AC_MSG_WARN([Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it])
211     else
212       AC_MSG_ERROR([Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH])
213     fi
214   fi
215 else
216   AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
217   AC_SUBST(GPGSM)
218 fi
219 AM_CONDITIONAL(RUN_GPGSM_TESTS,
220   [test "$cross_compiling" != "yes" && test -n "$GPGSM" && test -r "$GPGSM"])
221
222 dnl FIXME: Only build if supported.
223 AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
224
225 AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
226 AM_CONDITIONAL(BUILD_BONOBO,  test "$component_system" = "Bonobo")
227
228 GPGMEPLUG=no
229 AC_ARG_ENABLE(gpgmeplug,
230             AC_HELP_STRING([--enable-gpgmeplug], [build GPGME Crypt Plug-In]),
231             GPGMEPLUG=$enableval)
232 AM_CONDITIONAL(BUILD_GPGMEPLUG, test "$GPGMEPLUG" = "yes")
233
234 dnl Make the version number in gpgme/gpgme.h the same as the one here.
235 dnl (this is easier than to have a *.in file just for one substitution)
236 GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
237
238 dnl Substitution used for gpgme-config 
239 GPGME_LIBS="-L${libdir} -lgpgme"
240 GPGME_CFLAGS=""
241 AC_SUBST(GPGME_LIBS)
242 AC_SUBST(GPGME_CFLAGS)
243
244 dnl
245 dnl Create config files 
246 dnl
247
248 AC_CONFIG_FILES(Makefile assuan/Makefile jnlib/Makefile gpgme/Makefile
249                 tests/Makefile tests/gpg/Makefile tests/gpgsm/Makefile
250                 doc/Makefile
251                 bonobo/Makefile complus/Makefile gpgmeplug/Makefile)
252 AC_CONFIG_FILES(gpgme/gpgme-config, chmod +x gpgme/gpgme-config)
253 AC_OUTPUT
254
255 echo "
256         GPGME v${VERSION} has been configured as follows:
257
258         GnuPG version: min. $NEED_GPG_VERSION
259         GnuPG path:    $GPG
260
261         GpgSM version: min. $NEED_GPGSM_VERSION
262         GpgSM path:    $GPGSM
263
264         GPGME CryptPlug: $GPGMEPLUG
265 "