1 # configure.in for GPGME
2 # Copyright (C) 2000 Werner Koch (dd9jn)
3 # Copyright (C) 2001, 2002, 2003 g10 Code GmbH
5 # This file is part of GPGME.
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.
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.
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
21 # (Process this file with autoconf to produce a configure script.)
23 # Version number: Remember to change it immediately *after* a release.
24 AC_INIT(gpgme, 0.4.3, [bug-gpgme@gnupg.org])
25 # LT Version numbers, remember to change them just *before* a release.
26 # (Code changed: REVISION++)
27 # (Interfaces added/removed/changed: CURRENT++, REVISION=0)
28 # (Interfaces added: AGE++)
29 # (Interfaces removed: AGE=0)
31 LIBGPGME_LT_CURRENT=11
33 LIBGPGME_LT_REVISION=1
34 NEED_GPG_VERSION=1.2.2
35 NEED_GPGSM_VERSION=0.9.0
36 ##############################################
38 AC_REVISION($Revision$)
41 VERSION=$PACKAGE_VERSION
43 AC_CONFIG_SRCDIR(gpgme/gpgme.h)
44 AM_CONFIG_HEADER(config.h)
45 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
49 AH_VERBATIM([_GNU_SOURCE],
50 [/* Enable GNU extensions on systems that have them. */
55 AH_VERBATIM([_REENTRANT],
56 [/* To allow the use of GPGME in multithreaded programs we have to use
57 special features from the library.
58 IMPORTANT: gpgme is not yet fully reentrant and you should use it
59 only from one thread. */
68 AC_SUBST(LIBGPGME_LT_CURRENT)
69 AC_SUBST(LIBGPGME_LT_AGE)
70 AC_SUBST(LIBGPGME_LT_REVISION)
71 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
72 [Min. needed GnuPG version.])
73 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
74 [Min. needed GPGSM version.])
78 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
79 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
81 # Don't default to build static libs.
85 # For now we hardcode the use of version scripts. It would be better
86 # to write a test for this or even implement this within libtool.
87 have_ld_version_script=no
90 have_ld_version_script=yes
93 have_ld_version_script=yes
96 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
100 component_system=None
102 *-*-mingw32* | i?86-emx-os2 | i?86-*-os2*emx | i?86-*-msdosdjgpp* )
103 # special stuff for Windoze NT
104 # OS/2 with the EMX environment
105 # DOS with the DJGPP environment
106 AC_DEFINE(HAVE_DRIVE_LETTERS, ,
107 [Defined if we run on some of the PCDOS like systems (DOS,
108 Windoze, OS/2) with special properties like no file modes.])
109 AC_DEFINE(HAVE_DOSISH_SYSTEM, ,
110 [Defined if the filesystem uses driver letters.])
111 have_dosish_system=yes
112 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
113 # XXX Assuan is not supported in this configuration.
114 #GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
115 #component_system='COM+'
118 AC_CHECK_PTH(1.2.0,,,no,have_pth=yes)
119 if test "$have_pth" = yes; then
120 AC_DEFINE(HAVE_PTH, ,[Define if we have Pth.])
121 CFLAGS="$CFLAGS $PTH_CFLAGS"
123 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
124 if test "$have_pthread" = yes; then
125 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
128 # XXX: Probably use exec-prefix here?
129 # GPG_DEFAULT='/usr/bin/gpg'
130 # GPGSM_DEFAULT='/usr/bin/gpgsm'
133 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = "yes")
134 AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes")
135 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
138 # Checks for header files.
139 AC_CHECK_HEADERS(sys/select.h)
143 AC_CHECK_SIZEOF(unsigned int)
146 # Checks for compiler features.
147 if test "$GCC" = yes; then
148 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
152 # Checks for library functions.
153 AC_REPLACE_FUNCS(stpcpy)
155 AC_REPLACE_FUNCS(vasprintf)
156 if test "$ac_cv_func_vasprintf" != yes; then
160 # Try to find a thread-safe version of getenv().
161 have_thread_safe_getenv=no
163 if test $GLIBC21 = yes; then
164 have_thread_safe_getenv=yes
166 if test $have_thread_safe_getenv = yes; then
167 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
170 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
171 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
172 AC_MSG_WARN([getenv() is not thread-safe and getenv_r() does not exist])
175 # Checking for libgpg-error.
176 AM_PATH_GPG_ERROR(0.5,, AC_MSG_ERROR([libgpg-error was not found]))
177 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
178 [The default error source for GPGME.])
182 # Checks for system services
185 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
186 GPG=$withval, NO_OVERRIDE=yes)
187 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
190 if test "$cross_compiling" != "yes"; then
191 AC_PATH_PROG(GPG, gpg)
193 if test -z "$GPG"; then
197 if test "$GPG" = no; then
198 if test "$NO_OVERRIDE" = "yes"; then
199 if test "$cross_compiling" != "yes"; then
200 AC_MSG_WARN([Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it])
202 AC_MSG_ERROR([Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH])
206 AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
209 AM_CONDITIONAL(RUN_GPG_TESTS,
210 [test "$cross_compiling" != "yes" && test -n "$GPG" && test -r "$GPG"])
215 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
216 GPGSM=$withval, NO_OVERRIDE=yes)
217 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
220 if test "$cross_compiling" != "yes"; then
221 AC_PATH_PROG(GPGSM, gpgsm)
223 if test -z "$GPGSM"; then
224 GPGSM="$GPGSM_DEFAULT"
227 if test "$GPGSM" = no; then
228 if test "$NO_OVERRIDE" = "yes"; then
229 if test "$cross_compiling" != "yes"; then
230 AC_MSG_WARN([Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it])
232 AC_MSG_ERROR([Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH])
236 AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
239 AM_CONDITIONAL(HAVE_GPGSM, [test -n "$GPGSM" && test -r "$GPGSM"])
240 AM_CONDITIONAL(RUN_GPGSM_TESTS,
241 [test "$cross_compiling" != "yes" && test -n "$GPGSM" && test -r "$GPGSM"])
243 # FIXME: Only build if supported.
244 AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
246 if test "$GPGSM" != "no"; then
247 AC_CHECK_FUNCS(funopen)
248 if test $ac_cv_func_funopen != yes; then
249 # No funopen but we can implement that in terms of fopencookie.
250 AC_CHECK_FUNCS(fopencookie, AC_LIBOBJ(funopen),
252 No implementation of fopencookie or funopen available.
256 AC_REPLACE_FUNCS(isascii)
257 AC_REPLACE_FUNCS(putc_unlocked)
258 AC_REPLACE_FUNCS(memrchr)
262 AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
264 # Make the version number in gpgme/gpgme.h the same as the one here.
265 # (this is easier than to have a *.in file just for one substitution)
266 GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
268 # Substitution used for gpgme-config
269 GPGME_CONFIG_LIBS="-lgpgme"
270 GPGME_CONFIG_CFLAGS=""
271 AC_SUBST(GPGME_CONFIG_LIBS)
272 AC_SUBST(GPGME_CONFIG_CFLAGS)
275 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
276 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
280 # Create config files
282 AC_CONFIG_FILES(Makefile assuan/Makefile gpgme/Makefile
283 tests/Makefile tests/gpg/Makefile tests/gpgsm/Makefile
284 doc/Makefile complus/Makefile)
285 AC_CONFIG_FILES(gpgme/gpgme-config, chmod +x gpgme/gpgme-config)
289 GPGME v${VERSION} has been configured as follows:
291 GnuPG version: min. $NEED_GPG_VERSION
294 GpgSM version: min. $NEED_GPGSM_VERSION