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