1 # configure.in for GPGME
2 # Copyright (C) 2000 Werner Koch (dd9jn)
3 # Copyright (C) 2001, 2002, 2003, 2004 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.)
24 min_automake_version="1.7.6"
26 # Version number: Remember to change it immediately *after* a release.
27 AC_INIT(gpgme, 0.9.1-cvs, [bug-gpgme@gnupg.org])
28 # LT Version numbers, remember to change them just *before* a release.
29 # (Code changed: REVISION++)
30 # (Interfaces added/removed/changed: CURRENT++, REVISION=0)
31 # (Interfaces added: AGE++)
32 # (Interfaces removed/changed: AGE=0)
34 LIBGPGME_LT_CURRENT=13
35 # Subtract 2 from this value if you want to make the LFS transition an
36 # ABI break. [Note to self: Remove this comment with the next regular break.]
38 LIBGPGME_LT_REVISION=2
40 # If the API is changed in an incompatible way: increment the next counter.
41 GPGME_CONFIG_API_VERSION=1
43 NEED_GPG_VERSION=1.2.2
44 NEED_GPGSM_VERSION=1.9.6
45 ##############################################
47 AC_REVISION($Revision$)
50 VERSION=$PACKAGE_VERSION
52 AC_CONFIG_SRCDIR(gpgme/gpgme.h)
53 AM_CONFIG_HEADER(config.h)
54 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
58 AH_VERBATIM([_GNU_SOURCE],
59 [/* Enable GNU extensions on systems that have them. */
64 AH_VERBATIM([_REENTRANT],
65 [/* To allow the use of GPGME in multithreaded programs we have to use
66 special features from the library.
67 IMPORTANT: gpgme is not yet fully reentrant and you should use it
68 only from one thread. */
77 AC_SUBST(LIBGPGME_LT_CURRENT)
78 AC_SUBST(LIBGPGME_LT_AGE)
79 AC_SUBST(LIBGPGME_LT_REVISION)
80 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
81 [Min. needed GnuPG version.])
82 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
83 [Min. needed GPGSM version.])
87 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
88 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
90 # Don't default to build static libs.
94 # For now we hardcode the use of version scripts. It would be better
95 # to write a test for this or even implement this within libtool.
96 have_ld_version_script=no
99 have_ld_version_script=yes
102 have_ld_version_script=yes
105 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
109 component_system=None
111 *-*-mingw32* | i?86-emx-os2 | i?86-*-os2*emx | i?86-*-msdosdjgpp* )
112 # special stuff for Windoze NT
113 # OS/2 with the EMX environment
114 # DOS with the DJGPP environment
115 AC_DEFINE(HAVE_DRIVE_LETTERS, ,
116 [Defined if we run on some of the PCDOS like systems (DOS,
117 Windoze, OS/2) with special properties like no file modes.])
118 AC_DEFINE(HAVE_DOSISH_SYSTEM, ,
119 [Defined if the filesystem uses driver letters.])
120 have_dosish_system=yes
121 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
122 # XXX Assuan is not supported in this configuration.
123 #GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
124 #component_system='COM+'
127 AC_CHECK_PTH(1.2.0,,,no,have_pth=yes)
128 if test "$have_pth" = yes; then
129 AC_DEFINE(HAVE_PTH, ,[Define if we have Pth.])
130 CFLAGS="$CFLAGS $PTH_CFLAGS"
132 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
133 if test "$have_pthread" = yes; then
134 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
137 # XXX: Probably use exec-prefix here?
138 # GPG_DEFAULT='/usr/bin/gpg'
139 # GPGSM_DEFAULT='/usr/bin/gpgsm'
142 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = "yes")
143 AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes")
144 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
147 # Checks for header files.
148 AC_CHECK_HEADERS(sys/select.h)
152 AC_CHECK_SIZEOF(unsigned int)
156 # Checks for compiler features.
157 if test "$GCC" = yes; then
158 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
162 # Checks for library functions.
165 AC_REPLACE_FUNCS(stpcpy)
167 AC_REPLACE_FUNCS(vasprintf)
168 if test "$ac_cv_func_vasprintf" != yes; then
172 # Try to find a thread-safe version of getenv().
173 have_thread_safe_getenv=no
175 if test $GLIBC21 = yes; then
176 have_thread_safe_getenv=yes
178 if test $have_thread_safe_getenv = yes; then
179 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
182 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
183 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
186 *** getenv() is not thread-safe and getenv_r() does not exist
190 # For converting time strings to seconds since Epoch, we need the timegm
192 AC_CHECK_FUNCS(timegm)
193 if test "$ac_cv_func_timegm" != yes; then
196 *** timegm() not available - a non-thread-safe kludge will be used
197 *** and the TZ variable might be changed at runtime.
201 # Checking for libgpg-error.
202 AM_PATH_GPG_ERROR(0.5,, AC_MSG_ERROR([libgpg-error was not found]))
203 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
204 [The default error source for GPGME.])
208 # Checks for system services
211 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
212 GPG=$withval, NO_OVERRIDE=yes)
213 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
216 if test "$cross_compiling" != "yes"; then
217 AC_PATH_PROG(GPG, gpg)
219 if test -z "$GPG"; then
223 if test "$GPG" = no; then
224 if test "$NO_OVERRIDE" = "yes"; then
225 if test "$cross_compiling" != "yes"; then
228 *** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
233 *** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
238 AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
241 AM_CONDITIONAL(RUN_GPG_TESTS,
242 [test "$cross_compiling" != "yes" && test -n "$GPG" && test -r "$GPG"])
247 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
248 GPGSM=$withval, NO_OVERRIDE=yes)
249 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
252 if test "$cross_compiling" != "yes"; then
253 AC_PATH_PROG(GPGSM, gpgsm)
255 if test -z "$GPGSM"; then
256 GPGSM="$GPGSM_DEFAULT"
259 if test "$GPGSM" = no; then
260 if test "$NO_OVERRIDE" = "yes"; then
261 if test "$cross_compiling" != "yes"; then
264 *** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
269 *** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
274 AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
277 AM_CONDITIONAL(HAVE_GPGSM, [test -n "$GPGSM" && test -r "$GPGSM"])
278 AM_CONDITIONAL(RUN_GPGSM_TESTS,
279 [test "$cross_compiling" != "yes" && test -n "$GPGSM" && test -r "$GPGSM"])
281 # FIXME: Only build if supported.
282 AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
285 # The assuan code uses funopen but it will also build without it. So
286 # test for it. Frankly, this is not required in gpgme, but thats the
287 # way we handle it in libassuan.
288 AC_CHECK_FUNCS(funopen)
289 if test $ac_cv_func_funopen != yes; then
290 # No funopen but we can implement that in terms of fopencookie.
291 AC_CHECK_FUNCS(fopencookie)
292 if test $ac_cv_func_fopencookie = yes; then
297 *** No implementation of fopencookie or funopen available
302 AC_REPLACE_FUNCS(isascii)
303 AC_REPLACE_FUNCS(putc_unlocked)
304 AC_REPLACE_FUNCS(memrchr)
307 AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
309 # Make the version number in gpgme/gpgme.h the same as the one here.
310 # (this is easier than to have a *.in file just for one substitution)
311 GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
313 # Substitution used for gpgme-config
314 GPGME_CONFIG_LIBS="-lgpgme"
315 GPGME_CONFIG_CFLAGS=""
316 AC_SUBST(GPGME_CONFIG_API_VERSION)
317 AC_SUBST(GPGME_CONFIG_LIBS)
318 AC_SUBST(GPGME_CONFIG_CFLAGS)
321 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
322 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
326 # Create config files
328 AC_CONFIG_FILES(Makefile assuan/Makefile gpgme/Makefile
329 tests/Makefile tests/gpg/Makefile tests/gpgsm/Makefile
330 doc/Makefile complus/Makefile)
331 AC_CONFIG_FILES(gpgme/gpgme-config, chmod +x gpgme/gpgme-config)
335 GPGME v${VERSION} has been configured as follows:
337 GnuPG version: min. $NEED_GPG_VERSION
340 GpgSM version: min. $NEED_GPGSM_VERSION