1 # configure.ac for GPGME
2 # Copyright (C) 2000 Werner Koch (dd9jn)
3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 # 2009, 2010, 2011 g10 Code GmbH
6 # This file is part of GPGME.
8 # GPGME is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU Lesser General Public License as
10 # published by the Free Software Foundation; either version 2.1 of the
11 # License, or (at your option) any later version.
13 # GPGME is distributed in the hope that it will be useful, but WITHOUT
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
16 # Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 # (Process this file with autoconf to produce a configure script.)
24 min_automake_version="1.11"
26 # Version number: Remember to change it immediately *after* a release.
27 # Make sure to run "svn up" and "./autogen.sh --force"
28 # before a "make dist". See below for the LT versions.
29 # Never do a binary build with the same version number
30 # in another year; this would mess up the build number.
32 # The SVN version is usually the next intended release version with
33 # the string "-svnNNN" appended. The reason for this is that tests for a
34 # specific feature can already be done under the assumption that the
35 # SVN version is the most recent one in a branch. To disable the SVN
36 # version for the real release, set the my_issvn macro to no.
37 m4_define(my_version, [1.3.1])
38 m4_define(my_issvn, [yes])
40 m4_define([svn_revision], m4_esyscmd([printf "%d" $( (svn info 2>/dev/null \
41 || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
42 m4_define([git_revision], m4_esyscmd([git branch -v 2>/dev/null \
43 | awk '/^\* / {printf "%s",$3}']))
44 m4_define([my_full_version], [my_version[]m4_if(my_issvn,[yes],
45 [m4_if(git_revision,[],[-svn[]svn_revision],[-git[]git_revision])])])
47 AC_INIT([gpgme],[my_full_version],[http://bugs.gnupg.org])
49 # LT Version numbers, remember to change them just *before* a release.
50 # (Code changed: REVISION++)
51 # (Interfaces added/removed/changed: CURRENT++, REVISION=0)
52 # (Interfaces added: AGE++)
53 # (Interfaces removed/changed: AGE=0)
55 LIBGPGME_LT_CURRENT=19
56 # Subtract 2 from this value if you want to make the LFS transition an
57 # ABI break. [Note to self: Remove this comment with the next regular break.]
59 LIBGPGME_LT_REVISION=0
61 # If the API is changed in an incompatible way: increment the next counter.
62 GPGME_CONFIG_API_VERSION=1
63 ##############################################
66 NEED_LIBASSUAN_VERSION=2.0.2
69 m4_define([git_brevis],m4_esyscmd(printf "%u" 0x[]m4_substr(git_revision,0,4)))
70 BUILD_REVISION=m4_if(git_revision,[],[svn_revision],[git_brevis])
72 VERSION=$PACKAGE_VERSION
74 AC_CONFIG_SRCDIR(src/gpgme.h.in)
75 AM_CONFIG_HEADER(config.h)
76 AC_CONFIG_MACRO_DIR([m4])
77 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
81 # Enable GNU extensions on systems that have them.
84 AH_VERBATIM([_REENTRANT],
85 [/* To allow the use of GPGME in multithreaded programs we have to use
86 special features from the library.
87 IMPORTANT: gpgme is not yet fully reentrant and you should use it
88 only from one thread. */
96 AC_SUBST(LIBGPGME_LT_CURRENT)
97 AC_SUBST(LIBGPGME_LT_AGE)
98 AC_SUBST(LIBGPGME_LT_REVISION)
102 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
103 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
105 # Don't default to build static libs.
107 LT_INIT([win32-dll disable-static])
108 LT_LANG([Windows Resource])
110 # For now we hardcode the use of version scripts. It would be better
111 # to write a test for this or even implement this within libtool.
112 have_ld_version_script=no
115 have_ld_version_script=yes
118 have_ld_version_script=yes
121 AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
125 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
131 component_system=None
132 have_dosish_system=no
142 have_w32ce_system=yes
146 *-mingw32ce*|*-mingw32*)
147 have_dosish_system=yes
149 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
150 GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
151 GPGCONF_DEFAULT='c:\\gnupg\\gpgconf.exe'
152 G13_DEFAULT='c:\\gnupg\\g13.exe'
153 #component_system='COM+'
156 AC_ARG_ENABLE(w32-glib,
157 AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
158 build_w32_glib=$enableval)
160 # Check disabled, because the qt-dev packages in gpg4win do
161 # not provide any support for cross compilation.
162 # PKG_CHECK_MODULES(QT4_CORE, QtCore)
165 # ./configure --enable-w32-qt QT4_CORE_CFLAGS="..." QT4_CORE_LIBS="..."
166 AC_SUBST(QT4_CORE_CFLAGS)
167 AC_SUBST(QT4_CORE_LIBS)
168 AC_ARG_ENABLE(w32-qt,
169 AC_HELP_STRING([--enable-w32-qt], [build GPGME Qt for W32]),
170 build_w32_qt=$enableval)
173 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
174 if test "$have_pthread" = yes; then
175 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
178 # XXX: Probably use exec-prefix here?
179 # GPG_DEFAULT='/usr/bin/gpg'
180 # GPGSM_DEFAULT='/usr/bin/gpgsm'
181 # GPGCONF_DEFAULT='/usr/bin/gpgconf'
182 # G13_DEFAULT='/usr/bin/g13'
186 if test "$have_dosish_system" = yes; then
187 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
188 [Defined if we run on some of the PCDOS like systems
189 (DOS, Windoze. OS/2) with special properties like
192 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
194 if test "$have_w32_system" = yes; then
195 AC_DEFINE(HAVE_W32_SYSTEM,1,
196 [Defined if we run on any kind of W32 API based system])
198 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
200 if test "$have_w64_system" = yes; then
201 AC_DEFINE(HAVE_W64_SYSTEM,1,
202 [Defined if we run on a 64 bit W32 API based system])
204 AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
206 if test "$have_w32ce_system" = yes; then
207 AC_DEFINE(HAVE_W32CE_SYSTEM,1,
208 [Defined if we run on a W32 CE API based system])
210 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
212 AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
213 AM_CONDITIONAL(BUILD_W32_QT, test "$build_w32_qt" = yes)
215 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
219 # Checks for header files.
220 AC_CHECK_HEADERS_ONCE([locale.h sys/select.h sys/uio.h argp.h
221 unistd.h sys/time.h sys/types.h sys/stat.h])
226 AC_CHECK_SIZEOF(unsigned int)
231 # A simple compile time check in gpgme.h for GNU/Linux systems that
232 # prevents a file offset bits mismatch between gpgme and the application.
233 NEED__FILE_OFFSET_BITS=0
234 case "$ac_cv_sys_file_offset_bits" in
235 "" | no | unknown) ;;
237 NEED__FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
240 AC_SUBST(NEED__FILE_OFFSET_BITS)
242 # Figure out platform dependent typedefs for gpgme.h
243 if test "$have_w32_system" = yes; then
244 if test "$have_w64_system" = yes; then
245 INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 64 bit W32 API. */
248 typedef __int64 ssize_t;"
250 INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 32 bit W32 API. */
252 typedef long ssize_t;"
255 INSERT__TYPEDEFS_FOR_GPGME_H="#include <sys/types.h>"
257 AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H)
258 AM_SUBST_NOTMAKE(INSERT__TYPEDEFS_FOR_GPGME_H)
260 # Checks for compiler features.
261 if test "$GCC" = yes; then
262 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
263 if test "$have_w32_system" = yes; then
264 CFLAGS="$CFLAGS -mms-bitfields"
268 # Only used for debugging, so no serious test needed (for actual
269 # functionality you have to test libc as well, this only tests the
271 AC_CACHE_CHECK([for __thread],[gpgme_cv_tls_works],
272 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([__thread int foo;])],
273 gpgme_cv_tls_works=yes,gpgme_cv_tls_works=no))
274 if test "$gpgme_cv_tls_works" = yes; then
275 AC_DEFINE(HAVE_TLS, [1], [Define if __thread is supported])
279 # Checks for library functions.
282 AC_REPLACE_FUNCS(vasprintf)
283 if test "$ac_cv_func_vasprintf" != yes; then
287 # Try to find a thread-safe version of ttyname().
288 gnupg_REPLACE_TTYNAME_R
289 if test "$ac_cv_func_ttyname_r" != yes; then
292 *** ttyname() is not thread-safe and ttyname_r() does not exist
296 # Try to find a thread-safe version of getenv().
297 have_thread_safe_getenv=no
299 if test $GLIBC21 = yes; then
300 have_thread_safe_getenv=yes
302 if test $have_thread_safe_getenv = yes; then
303 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
306 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
307 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
310 *** getenv() is not thread-safe and getenv_r() does not exist
314 # For converting time strings to seconds since Epoch, we need the timegm
316 AC_CHECK_FUNCS(timegm)
317 if test "$ac_cv_func_timegm" != yes; then
320 *** timegm() not available - a non-thread-safe kludge will be used
321 *** and the TZ variable might be changed at runtime.
325 AC_CHECK_FUNCS(setlocale)
327 # Checking for libgpg-error.
328 AM_PATH_GPG_ERROR(1.8,, AC_MSG_ERROR([libgpg-error was not found]))
329 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
330 [The default error source for GPGME.])
334 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
335 have_libassuan=yes, have_libassuan=no)
336 if test "$have_libassuan" = "yes"; then
337 AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
338 [version of the libassuan library])
340 AM_CONDITIONAL(HAVE_ASSUAN, test "$have_libassuan" = "yes")
341 if test "$have_libassuan" = "yes"; then
342 AC_DEFINE(ENABLE_ASSUAN,1,[Whether Assuan support is enabled])
345 # Checks for system services
346 NEED_GPG_VERSION_DEFAULT=1.4.0
347 NEED_GPGSM_VERSION_DEFAULT=1.9.6
348 NEED_GPGCONF_VERSION_DEFAULT=2.0.4
349 NEED_G13_VERSION_DEFAULT=2.1.0
350 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
351 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
352 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
353 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
354 AC_ARG_WITH(gpg-version,
355 AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
356 NEED_GPG_VERSION=$withval)
357 if test "$NEED_GPG_VERSION" = "yes"; then
358 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
360 if test "$NEED_GPG_VERSION" = "no"; then
361 NEED_GPG_VERSION=0.0.0
363 AC_ARG_WITH(gpgsm-version,
364 AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
365 NEED_GPGSM_VERSION=$withval)
366 if test "$NEED_GPGSM_VERSION" = "yes"; then
367 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
369 if test "$NEED_GPGSM_VERSION" = "no"; then
370 NEED_GPGSM_VERSION=0.0.0
372 AC_ARG_WITH(gpgconf-version,
373 AC_HELP_STRING([--with-gpgconf-version=VER], [require GPGCONF version VER]),
374 NEED_GPGCONF_VERSION=$withval)
375 if test "$NEED_GPGCONF_VERSION" = "yes"; then
376 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
378 if test "$NEED_GPGCONF_VERSION" = "no"; then
379 NEED_GPGCONF_VERSION=0.0.0
381 AC_ARG_WITH(g13-version,
382 AC_HELP_STRING([--with-g13-version=VER], [require G13 version VER]),
383 NEED_G13_VERSION=$withval)
384 if test "$NEED_G13_VERSION" = "yes"; then
385 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
387 if test "$NEED_G13_VERSION" = "no"; then
388 NEED_G13_VERSION=0.0.0
391 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
392 [Min. needed GnuPG version.])
393 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
394 [Min. needed GPGSM version.])
395 AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
396 [Min. needed GPGCONF version.])
397 AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
398 [Min. needed G13 version.])
403 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
404 GPG=$withval, NO_OVERRIDE=yes)
405 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
408 if test "$cross_compiling" != "yes"; then
409 AC_PATH_PROG(GPG, gpg)
411 if test -z "$GPG"; then
415 if test "$GPG" = no; then
416 if test "$NO_OVERRIDE" = "yes"; then
417 if test "$cross_compiling" != "yes"; then
420 *** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
425 *** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
430 AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
433 dnl Check for GnuPG version requirement.
436 if test -z "$GPG" -o "x$GPG" = "xno"; then
439 if test "$cross_compiling" = "yes"; then
440 AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
443 if test ! -x "$GPG"; then
444 AC_MSG_WARN([GnuPG not executable, version check disabled])
449 if test "$ok" = "maybe"; then
450 AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
451 req_major=`echo $NEED_GPG_VERSION | \
452 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
453 req_minor=`echo $NEED_GPG_VERSION | \
454 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
455 req_micro=`echo $NEED_GPG_VERSION | \
456 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
457 GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
458 major=`echo $GPG_VERSION | \
459 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
460 minor=`echo $GPG_VERSION | \
461 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
462 micro=`echo $GPG_VERSION | \
463 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
465 if test "$major" -gt "$req_major"; then
468 if test "$major" -eq "$req_major"; then
469 if test "$minor" -gt "$req_minor"; then
472 if test "$minor" -eq "$req_minor"; then
473 if test "$micro" -ge "$req_micro"; then
480 if test "$ok" = "yes"; then
484 AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
488 AC_ARG_ENABLE(gpg-test,
489 AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
490 run_gpg_test=$enableval)
491 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
496 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
497 GPGSM=$withval, NO_OVERRIDE=yes)
498 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
501 if test "$cross_compiling" != "yes"; then
502 AC_PATH_PROG(GPGSM, gpgsm)
504 if test -z "$GPGSM"; then
505 GPGSM="$GPGSM_DEFAULT"
508 if test "$GPGSM" = no; then
509 if test "$NO_OVERRIDE" = "yes"; then
510 if test "$cross_compiling" != "yes"; then
513 *** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
518 *** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
523 AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
524 AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
526 AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
529 dnl Check for GPGSM version requirement.
530 GPGSM_VERSION=unknown
532 if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
535 if test "$cross_compiling" = "yes"; then
536 AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
539 if test ! -x "$GPGSM"; then
540 AC_MSG_WARN([GPGSM not executable, version check disabled])
545 if test "$ok" = "maybe"; then
546 AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
547 req_major=`echo $NEED_GPGSM_VERSION | \
548 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
549 req_minor=`echo $NEED_GPGSM_VERSION | \
550 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
551 req_micro=`echo $NEED_GPGSM_VERSION | \
552 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
553 GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
554 major=`echo $GPGSM_VERSION | \
555 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
556 minor=`echo $GPGSM_VERSION | \
557 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
558 micro=`echo $GPGSM_VERSION | \
559 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
561 if test "$major" -gt "$req_major"; then
564 if test "$major" -eq "$req_major"; then
565 if test "$minor" -gt "$req_minor"; then
568 if test "$minor" -eq "$req_minor"; then
569 if test "$micro" -ge "$req_micro"; then
576 if test "$ok" = "yes"; then
580 AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
584 AC_ARG_ENABLE(gpgsm-test,
585 AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
586 run_gpgsm_test=$enableval)
587 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
592 AC_HELP_STRING([--with-gpgconf=PATH],
593 [use gpgconf binary at PATH]),
594 GPGCONF=$withval, NO_OVERRIDE=yes)
595 if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
598 if test "$cross_compiling" != "yes"; then
599 AC_PATH_PROG(GPGCONF, gpgconf)
601 if test -z "$GPGCONF"; then
602 GPGCONF="$GPGCONF_DEFAULT"
605 if test "$GPGCONF" = no; then
606 if test "$NO_OVERRIDE" = "yes"; then
607 if test "$cross_compiling" != "yes"; then
610 *** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
615 *** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
620 AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
621 AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
623 AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
625 dnl Check for GPGCONF version requirement.
626 GPGCONF_VERSION=unknown
628 if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
631 if test "$cross_compiling" = "yes"; then
632 AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
635 if test ! -x "$GPGCONF"; then
636 AC_MSG_WARN([GPGCONF not executable, version check disabled])
641 if test "$ok" = "maybe"; then
642 AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
643 req_major=`echo $NEED_GPGCONF_VERSION | \
644 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
645 req_minor=`echo $NEED_GPGCONF_VERSION | \
646 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
647 req_micro=`echo $NEED_GPGCONF_VERSION | \
648 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
649 GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
650 major=`echo $GPGCONF_VERSION | \
651 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
652 minor=`echo $GPGCONF_VERSION | \
653 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
654 micro=`echo $GPGCONF_VERSION | \
655 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
657 if test "$major" -gt "$req_major"; then
660 if test "$major" -eq "$req_major"; then
661 if test "$minor" -gt "$req_minor"; then
664 if test "$minor" -eq "$req_minor"; then
665 if test "$micro" -ge "$req_micro"; then
672 if test "$ok" = "yes"; then
676 AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
679 run_gpgconf_test="$ok"
680 AC_ARG_ENABLE(gpgconf-test,
681 AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
682 run_gpgconf_test=$enableval)
683 AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
688 AC_HELP_STRING([--with-g13=PATH],
689 [use g13 binary at PATH]),
690 G13=$withval, NO_OVERRIDE=yes)
691 if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
694 if test "$cross_compiling" != "yes"; then
695 AC_PATH_PROG(G13, g13)
697 if test -z "$G13"; then
701 if test "$G13" = no; then
702 if test "$NO_OVERRIDE" = "yes"; then
703 if test "$cross_compiling" != "yes"; then
706 *** Could not find g13, install g13 or use --with-g13=PATH to enable it
711 *** Can not determine path to g13 when cross-compiling, use --with-g13=PATH
716 AC_DEFINE_UNQUOTED(G13_PATH, "$G13", [Path to the G13 binary.])
717 AC_DEFINE(ENABLE_G13,1,[Whether G13 support is enabled])
719 AM_CONDITIONAL(HAVE_G13, test "$G13" != "no")
721 dnl Check for G13 version requirement.
724 if test -z "$G13" -o "x$G13" = "xno"; then
727 if test "$cross_compiling" = "yes"; then
728 AC_MSG_WARN([G13 version can not be checked when cross compiling])
731 if test ! -x "$G13"; then
732 AC_MSG_WARN([G13 not executable, version check disabled])
737 if test "$ok" = "maybe"; then
738 AC_MSG_CHECKING(for G13 >= $NEED_G13_VERSION)
739 req_major=`echo $NEED_G13_VERSION | \
740 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
741 req_minor=`echo $NEED_G13_VERSION | \
742 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
743 req_micro=`echo $NEED_G13_VERSION | \
744 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
745 G13_VERSION=`$G13 --version | sed -n '1 s/.*\ \([[0-9]].*\)/\1/p'`
746 major=`echo $G13_VERSION | \
747 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
748 minor=`echo $G13_VERSION | \
749 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
750 micro=`echo $G13_VERSION | \
751 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
753 if test "$major" -gt "$req_major"; then
756 if test "$major" -eq "$req_major"; then
757 if test "$minor" -gt "$req_minor"; then
760 if test "$minor" -eq "$req_minor"; then
761 if test "$micro" -ge "$req_micro"; then
768 if test "$ok" = "yes"; then
772 AC_MSG_WARN([G13 must be at least version $NEED_G13_VERSION])
776 AC_ARG_ENABLE(g13-test,
777 AC_HELP_STRING([--disable-g13-test], [disable G13 run test]),
778 run_g13_test=$enableval)
779 AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
783 AC_CHECK_FUNCS(funopen)
784 if test $ac_cv_func_funopen != yes; then
785 # No funopen but we can implement that in terms of fopencookie.
786 AC_CHECK_FUNCS(fopencookie)
787 if test $ac_cv_func_fopencookie = yes; then
788 AC_REPLACE_FUNCS(funopen)
792 *** No implementation of fopencookie or funopen available
797 # Check for getgid etc
798 AC_CHECK_FUNCS(getgid getegid)
801 # Replacement functions.
802 AC_REPLACE_FUNCS(stpcpy)
803 AC_REPLACE_FUNCS(setenv)
805 # Assuan check for descriptor passing.
806 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
807 [supports_descriptor_passing=yes],
808 [supports_descriptor_passing=no
811 *** Data structure for sending ancillary data missing.
812 *** Descriptor passing won't work.
817 #include <sys/types.h>
818 #include <sys/socket.h>
826 use_descriptor_passing=no
827 AC_ARG_ENABLE(fd-passing,
828 AC_HELP_STRING([--enable-fd-passing], [use FD passing if supported]),
829 use_descriptor_passing=$enableval)
831 if test "$supports_descriptor_passing" != "yes"; then
832 use_descriptor_passing=no
835 if test "$use_descriptor_passing" = "yes"; then
836 AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
837 [Defined if descriptor passing is enabled and supported])
840 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
844 if test "$use_descriptor_passing" = "yes" && test "$have_libassuan" = "yes"; then
847 if test "$uiserver" != "no"; then
848 AC_DEFINE(ENABLE_UISERVER, 1,
849 [Defined if we are building with uiserver support.])
851 AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
854 # Generate values for the DLL version info
856 dnl Windows uses an internal build number. We use the last day of the
857 dnl year concatenated with the hour for it. WARNING: You should not
858 dnl do a build with the same version number in another year.
859 if test "$have_w32_system" = yes; then
860 BUILD_TIMESTAMP=`date --iso-8601=minutes`
861 BUILD_NUMBER="$(date -u '+%j%H' | sed 's/^0*\(.*\)/\1/')"
863 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
865 BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_NUMBER}"
867 AC_SUBST(BUILD_NUMBER)
868 AC_SUBST(BUILD_TIMESTAMP)
869 AC_SUBST(BUILD_FILEVERSION)
871 # Add a few constants to help porting to W32
872 AH_VERBATIM([SEPCONSTANTS],
874 /* Separators as used in $PATH. */
875 #ifdef HAVE_DOSISH_SYSTEM
876 #define PATHSEP_C ';'
878 #define PATHSEP_C ':'
883 /* Definition of GCC specific attributes. */
885 # define GPGME_GCC_A_PURE __attribute__ ((__pure__))
887 # define GPGME_GCC_A_PURE
890 /* Under WindowsCE we need gpg-error's strerror macro. */
891 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
895 # Substitution used for gpgme-config
896 GPGME_CONFIG_LIBS="-lgpgme"
897 GPGME_CONFIG_CFLAGS=""
898 GPGME_CONFIG_HOST="$host"
899 AC_SUBST(GPGME_CONFIG_API_VERSION)
900 AC_SUBST(GPGME_CONFIG_LIBS)
901 AC_SUBST(GPGME_CONFIG_CFLAGS)
902 AC_SUBST(GPGME_CONFIG_HOST)
905 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
906 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
909 # Some checks for gpgme-tool
910 # Done at top: AC_CHECK_HEADER([argp.h])
911 AC_CHECK_TYPES([error_t], [],
912 [AC_DEFINE([error_t], [int],
913 [Define to a type to use for `error_t' if it is not otherwise available.])],
914 [#include <errno.h>])
917 # A substitution to set generated files in a Emacs buffer to read-only.
918 AC_SUBST(emacs_local_vars_begin, ['Local Variables:'])
919 AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
920 AC_SUBST(emacs_local_vars_end, ['End:'])
925 if test "$have_libassuan" = "no"; then
929 *** You need libassuan to build this program with GPGSM support.
930 *** This library is for example available at
931 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
932 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
936 if test "$die" = "yes"; then
939 *** Required libraries not found. Please consult the above messages
940 *** and install them before running configure again.
946 # Create config files
948 AC_CONFIG_FILES(Makefile src/Makefile
952 tests/opassuan/Makefile
956 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
957 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
961 GPGME v${VERSION} has been configured as follows:
964 GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
967 GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
969 GpgConf path: $GPGCONF
970 GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
973 G13 version: $G13_VERSION, min. $NEED_G13_VERSION
975 Assuan version: $libassuan_version, min. $NEED_LIBASSUAN_VERSION
978 FD Passing: $use_descriptor_passing
980 GPGME Pthread: $have_pthread