* configure.ac (VERSION,PACKAGE): Defined and subst. Used for
[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 # 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 # XXXX new functions
29 AC_INIT(gpgme, 0.3.0a-cvs, [gnupg-devel@gnupg.org])
30 LIBGPGME_LT_CURRENT=5
31 LIBGPGME_LT_AGE=0
32 LIBGPGME_LT_REVISION=0
33 NEED_GPG_VERSION=1.0.6
34 NEED_GPGSM_VERSION=0.0.0
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 AC_PROG_CC
48
49
50 AC_SUBST(LIBGPGME_LT_CURRENT)
51 AC_SUBST(LIBGPGME_LT_AGE)
52 AC_SUBST(LIBGPGME_LT_REVISION)
53 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION")
54 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION")
55
56 AC_SUBST(PACKAGE)
57 AC_SUBST(VERSION)
58 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
59 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
60
61
62 dnl Don't default to build static libs.
63 dnl AC_DISABLE_STATIC
64 AC_PROG_LIBTOOL
65
66 GPG_DEFAULT=no
67 GPGSM_DEFAULT=no
68 component_system=None
69 case "${target}" in
70     *-*-mingw32* | i?86-emx-os2 | i?86-*-os2*emx | i?86-*-msdosdjgpp* )
71         # special stuff for Windoze NT
72         # OS/2 with the EMX environment
73         # DOS with the DJGPP environment
74         AC_DEFINE(HAVE_DRIVE_LETTERS)
75         AC_DEFINE(HAVE_DOSISH_SYSTEM)
76         GPG_DEFAULT='c:\\gnupg\\gpg.exe'
77         GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
78         #component_system='COM+'
79         ;;
80     *)
81 dnl     # XXX: Probably use exec-prefix here?
82 dnl     GPG_DEFAULT='/usr/bin/gpg'
83 dnl     GPGSM_DEFAULT='/usr/bin/gpgsm'
84         ;;
85 esac
86
87 dnl
88 dnl Checks for libraries.
89 dnl
90
91 dnl FIXME: check whether Bonobo is installed
92
93 dnl
94 dnl Checks for header files.
95 dnl
96
97 dnl
98 dnl Checks for typedefs and structures.
99 dnl
100 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
101 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
102 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
103 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
104 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
105
106 # We should not use them in this software;
107 # However jnlib/types.h needs them - so we take the easy way.
108 AC_CHECK_SIZEOF(unsigned short)
109 AC_CHECK_SIZEOF(unsigned int)
110 AC_CHECK_SIZEOF(unsigned long)
111
112 dnl
113 dnl Checks for compiler features.
114 dnl
115
116 if test "$GCC" = yes; then
117     CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
118 fi
119
120 dnl
121 dnl Checks for library functions.
122 dnl
123 dnl These are needed by libjnlib
124 AC_CHECK_FUNCS(memicmp stpcpy strlwr strtoul memmove stricmp)
125
126 dnl
127 dnl Checks for system services
128 dnl
129
130 NO_OVERRIDE=no
131 AC_ARG_WITH(gpg,
132             AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
133             GPG=$withval, NO_OVERRIDE=yes)
134 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
135   GPG=
136   NO_OVERRIDE=yes
137   if test "$cross_compiling" != "yes"; then
138     AC_PATH_PROG(GPG, gpg)
139   fi
140   if test -z "$GPG"; then
141     GPG="$GPG_DEFAULT"
142   fi
143 fi
144 if test "$GPG" = no; then
145   if test "$NO_OVERRIDE" = "yes"; then
146     if test "$cross_compiling" != "yes"; then
147       AC_MSG_WARN([Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it])
148     else
149       AC_MSG_ERROR([Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH])
150     fi
151   fi
152 else
153   AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG")
154   AC_SUBST(GPG)
155 fi
156 AM_CONDITIONAL(RUN_GPG_TESTS,
157   [test "$cross_compiling" != "yes" && test -n "$GPG" && test -r "$GPG"])
158 AC_SUBST(GPG_PATH)
159
160 NO_OVERRIDE=no
161 AC_ARG_WITH(gpgsm,
162             AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
163             GPGSM=$withval, NO_OVERRIDE=yes)
164 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
165   GPGSM=
166   NO_OVERRIDE=yes
167   if test "$cross_compiling" != "yes"; then
168     AC_PATH_PROG(GPGSM, gpgsm)
169   fi
170   if test -z "$GPGSM"; then
171     GPGSM="$GPGSM_DEFAULT"
172   fi
173 fi
174 if test "$GPGSM" = no; then
175   if test "$NO_OVERRIDE" = "yes"; then
176     if test "$cross_compiling" != "yes"; then
177       AC_MSG_WARN([Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it])
178     else
179       AC_MSG_ERROR([Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH])
180     fi
181   fi
182 else
183   AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM")
184   AC_SUBST(GPGSM)
185 fi
186 AM_CONDITIONAL(RUN_GPGSM_TESTS,
187   [test "$cross_compiling" != "yes" && test -n "$GPGSM" && test -r "$GPGSM"])
188
189 dnl
190 dnl Create config files 
191 dnl
192
193 dnl FIXME: Only build if supported.
194 AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
195
196 AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
197 AM_CONDITIONAL(BUILD_BONOBO,  test "$component_system" = "Bonobo")
198
199 GPGMEPLUG=no
200 AC_ARG_ENABLE(gpgmeplug,
201             AC_HELP_STRING([--enable-gpgmeplug], [build GPGME Crypt Plug-In]),
202             GPGMEPLUG=$enableval)
203 AM_CONDITIONAL(BUILD_GPGMEPLUG, test "$GPGMEPLUG" = "yes")
204
205 dnl Make the version number in gpgme/gpgme.h the same as the one here.
206 dnl (this is easier than to have a *.in file just for one substitution)
207 GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
208
209 dnl Substitution used for gpgme-config 
210 GPGME_LIBS="-L${libdir} -lgpgme"
211 GPGME_CFLAGS=""
212 AC_SUBST(GPGME_LIBS)
213 AC_SUBST(GPGME_CFLAGS)
214
215 AC_CONFIG_FILES(Makefile assuan/Makefile jnlib/Makefile gpgme/Makefile
216                 tests/Makefile tests/gpg/Makefile tests/gpgsm/Makefile
217                 doc/Makefile
218                 bonobo/Makefile complus/Makefile gpgmeplug/Makefile)
219 AC_CONFIG_FILES(gpgme/gpgme-config, chmod +x gpgme/gpgme-config)
220 AC_OUTPUT
221
222 echo "
223         GPGME v${VERSION} has been configured as follows:
224
225         GnuPG version: min. $NEED_GPG_VERSION
226         GnuPG path:    $GPG
227
228         GpgSM version: min. $NEED_GPGSM_VERSION
229         GpgSM path:    $GPGSM
230
231         GPGME CryptPlug: $GPGMEPLUG
232 "