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, 1.0.1, [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=14
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 dnl FIXME: Enable this with autoconf 2.59.
54 dnl AC_CONFIG_MACRO_DIR(m4)
55 AM_CONFIG_HEADER(config.h)
56 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
60 AH_VERBATIM([_GNU_SOURCE],
61 [/* Enable GNU extensions on systems that have them. */
66 AH_VERBATIM([_REENTRANT],
67 [/* To allow the use of GPGME in multithreaded programs we have to use
68 special features from the library.
69 IMPORTANT: gpgme is not yet fully reentrant and you should use it
70 only from one thread. */
79 AC_SUBST(LIBGPGME_LT_CURRENT)
80 AC_SUBST(LIBGPGME_LT_AGE)
81 AC_SUBST(LIBGPGME_LT_REVISION)
82 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
83 [Min. needed GnuPG version.])
84 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
85 [Min. needed GPGSM version.])
89 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
90 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
92 # Don't default to build static libs.
96 # For now we hardcode the use of version scripts. It would be better
97 # to write a test for this or even implement this within libtool.
98 have_ld_version_script=no
101 have_ld_version_script=yes
104 have_ld_version_script=yes
107 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
111 component_system=None
113 *-*-mingw32* | i?86-emx-os2 | i?86-*-os2*emx | i?86-*-msdosdjgpp* )
114 # special stuff for Windoze NT
115 # OS/2 with the EMX environment
116 # DOS with the DJGPP environment
117 AC_DEFINE(HAVE_DRIVE_LETTERS, ,
118 [Defined if we run on some of the PCDOS like systems (DOS,
119 Windoze, OS/2) with special properties like no file modes.])
120 AC_DEFINE(HAVE_DOSISH_SYSTEM, ,
121 [Defined if the filesystem uses driver letters.])
122 have_dosish_system=yes
123 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
124 # XXX Assuan is not supported in this configuration.
125 #GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
126 #component_system='COM+'
129 AC_CHECK_PTH(1.2.0,,,no,have_pth=yes)
130 if test "$have_pth" = yes; then
131 AC_DEFINE(HAVE_PTH, ,[Define if we have Pth.])
132 CFLAGS="$CFLAGS $PTH_CFLAGS"
134 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
135 if test "$have_pthread" = yes; then
136 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
139 # XXX: Probably use exec-prefix here?
140 # GPG_DEFAULT='/usr/bin/gpg'
141 # GPGSM_DEFAULT='/usr/bin/gpgsm'
144 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = "yes")
145 AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes")
146 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
149 # Checks for header files.
150 AC_CHECK_HEADERS(sys/select.h)
154 AC_CHECK_SIZEOF(unsigned int)
158 # Checks for compiler features.
159 if test "$GCC" = yes; then
160 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
164 # Checks for library functions.
167 AC_REPLACE_FUNCS(stpcpy)
169 AC_REPLACE_FUNCS(vasprintf)
170 if test "$ac_cv_func_vasprintf" != yes; then
174 # Try to find a thread-safe version of getenv().
175 have_thread_safe_getenv=no
177 if test $GLIBC21 = yes; then
178 have_thread_safe_getenv=yes
180 if test $have_thread_safe_getenv = yes; then
181 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
184 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
185 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
188 *** getenv() is not thread-safe and getenv_r() does not exist
192 # For converting time strings to seconds since Epoch, we need the timegm
194 AC_CHECK_FUNCS(timegm)
195 if test "$ac_cv_func_timegm" != yes; then
198 *** timegm() not available - a non-thread-safe kludge will be used
199 *** and the TZ variable might be changed at runtime.
203 # Checking for libgpg-error.
204 AM_PATH_GPG_ERROR(0.5,, AC_MSG_ERROR([libgpg-error was not found]))
205 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
206 [The default error source for GPGME.])
210 # Checks for system services
213 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
214 GPG=$withval, NO_OVERRIDE=yes)
215 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
218 if test "$cross_compiling" != "yes"; then
219 AC_PATH_PROG(GPG, gpg)
221 if test -z "$GPG"; then
225 if test "$GPG" = no; then
226 if test "$NO_OVERRIDE" = "yes"; then
227 if test "$cross_compiling" != "yes"; then
230 *** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
235 *** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
240 AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
243 dnl Check for GnuPG version requirement.
246 if test -z "$GPG" -o "x$GPG" = "xno"; then
249 if test "$cross_compiling" = "yes"; then
250 AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
253 if test ! -x "$GPG"; then
254 AC_MSG_WARN([GnuPG not executable, version check disabled])
259 if test "$ok" = "maybe"; then
260 AC_MSG_CHECKING(for GnuPG >= $NEED_GPG_VERSION)
261 req_major=`echo $NEED_GPG_VERSION | \
262 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
263 req_minor=`echo $NEED_GPG_VERSION | \
264 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
265 req_micro=`echo $NEED_GPG_VERSION | \
266 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
267 gpg_version=`$GPG --version | grep ^gpg`
268 major=`echo $gpg_version | \
269 sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
270 minor=`echo $gpg_version | \
271 sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
272 micro=`echo $gpg_version | \
273 sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
274 GPG_VERSION=`echo $gpg_version | sed 's/^gpg (GnuPG) //'`
276 if test "$major" -gt "$req_major"; then
279 if test "$major" -eq "$req_major"; then
280 if test "$minor" -gt "$req_minor"; then
283 if test "$minor" -eq "$req_minor"; then
284 if test "$micro" -ge "$req_micro"; then
291 if test "$ok" = "yes"; then
295 AC_MSG_WARN([GnuPG must be at least version $NEED_GPG_VERSION])
298 AM_CONDITIONAL(RUN_GPG_TESTS, [test "$ok" = "yes" ])
303 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
304 GPGSM=$withval, NO_OVERRIDE=yes)
305 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
308 if test "$cross_compiling" != "yes"; then
309 AC_PATH_PROG(GPGSM, gpgsm)
311 if test -z "$GPGSM"; then
312 GPGSM="$GPGSM_DEFAULT"
315 if test "$GPGSM" = no; then
316 if test "$NO_OVERRIDE" = "yes"; then
317 if test "$cross_compiling" != "yes"; then
320 *** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
325 *** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
330 AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
333 AM_CONDITIONAL(HAVE_GPGSM, ["$GPGSM" != "no"])
334 dnl Check for GPGSM version requirement.
335 GPGSM_VERSION=unknown
337 if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
340 if test "$cross_compiling" = "yes"; then
341 AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
344 if test ! -x "$GPGSM"; then
345 AC_MSG_WARN([GPGSM not executable, version check disabled])
350 if test "$ok" = "maybe"; then
351 AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
352 req_major=`echo $NEED_GPGSM_VERSION | \
353 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
354 req_minor=`echo $NEED_GPGSM_VERSION | \
355 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
356 req_micro=`echo $NEED_GPGSM_VERSION | \
357 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
358 gpgsm_version=`$GPGSM --version | grep ^gpgsm`
359 major=`echo $gpgsm_version | \
360 sed 's/^gpgsm (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
361 minor=`echo $gpgsm_version | \
362 sed 's/^gpgsm (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
363 micro=`echo $gpgsm_version | \
364 sed 's/^gpgsm (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
365 GPGSM_VERSION=`echo $gpgsm_version | sed 's/^gpg (GnuPG) //'`
367 if test "$major" -gt "$req_major"; then
370 if test "$major" -eq "$req_major"; then
371 if test "$minor" -gt "$req_minor"; then
374 if test "$minor" -eq "$req_minor"; then
375 if test "$micro" -ge "$req_micro"; then
382 if test "$ok" = "yes"; then
386 AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
389 AM_CONDITIONAL(RUN_GPGSM_TESTS, [test "$ok" = "yes" ])
391 # FIXME: Only build if supported.
392 AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
395 # The assuan code uses funopen but it will also build without it. So
396 # test for it. Frankly, this is not required in gpgme, but thats the
397 # way we handle it in libassuan.
398 AC_CHECK_FUNCS(funopen)
399 if test $ac_cv_func_funopen != yes; then
400 # No funopen but we can implement that in terms of fopencookie.
401 AC_CHECK_FUNCS(fopencookie)
402 if test $ac_cv_func_fopencookie = yes; then
407 *** No implementation of fopencookie or funopen available
412 # More assuan replacement functions.
413 AC_REPLACE_FUNCS(isascii)
414 AC_REPLACE_FUNCS(putc_unlocked)
415 AC_REPLACE_FUNCS(memrchr)
417 # More assuan checks.
418 AC_CHECK_HEADERS([sys/uio.h])
420 # End of assuan checks.
422 AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
424 # Make the version number in gpgme/gpgme.h the same as the one here.
425 # (this is easier than to have a *.in file just for one substitution)
426 GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
428 # Substitution used for gpgme-config
429 GPGME_CONFIG_LIBS="-lgpgme"
430 GPGME_CONFIG_CFLAGS=""
431 AC_SUBST(GPGME_CONFIG_API_VERSION)
432 AC_SUBST(GPGME_CONFIG_LIBS)
433 AC_SUBST(GPGME_CONFIG_CFLAGS)
436 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
437 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
441 # Create config files
443 AC_CONFIG_FILES(Makefile assuan/Makefile gpgme/Makefile
444 tests/Makefile tests/gpg/Makefile tests/gpgsm/Makefile
445 doc/Makefile complus/Makefile)
446 AC_CONFIG_FILES(gpgme/gpgme-config, chmod +x gpgme/gpgme-config)
450 GPGME v${VERSION} has been configured as follows:
453 GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
456 GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
458 GPGME Pthread: $have_pthread