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