1 # configure.ac for GPGME
2 # Copyright (C) 2000 Werner Koch (dd9jn)
3 # Copyright (C) 2001-2018 g10 Code GmbH
5 # This file is part of GPGME.
7 # GPGME is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU Lesser General Public License as
9 # published by the Free Software Foundation; either version 2.1 of the
10 # License, or (at your option) any later version.
12 # GPGME is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
15 # Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this program; if not, see <https://gnu.org/licenses/>.
19 # SPDX-License-Identifier: LGPL-2.1-or-later
21 # (Process this file with autoconf to produce a configure script.)
23 min_automake_version="1.14"
25 # To build a release you need to create a tag with the version number
26 # (git tag -s gpgme-n.m.k) and run "./autogen.sh --force". Please
27 # bump the version number immediately after the release and do another
28 # commit and push so that the git magic is able to work. See below
29 # for the LT versions.
30 m4_define([mym4_package],[gpgme])
31 m4_define([mym4_major], [1])
32 m4_define([mym4_minor], [13])
33 m4_define([mym4_micro], [0])
35 # Below is m4 magic to extract and compute the git revision number,
36 # the decimalized short revision number, a beta version string and a
37 # flag indicating a development version (mym4_isbeta). Note that the
38 # m4 processing is done by autoconf and not during the configure run.
39 m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \
40 mym4_package mym4_major mym4_minor mym4_micro),[:]))
41 m4_define([mym4_isbeta], m4_argn(2, mym4_verslist))
42 m4_define([mym4_version], m4_argn(4, mym4_verslist))
43 m4_define([mym4_revision], m4_argn(7, mym4_verslist))
44 m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
45 m4_esyscmd([echo ]mym4_version[>VERSION])
46 AC_INIT([mym4_package],[mym4_version], [https://bugs.gnupg.org])
48 # LT Version numbers, remember to change them just *before* a release.
49 # (Code changed: REVISION++)
50 # (Interfaces added/removed/changed: CURRENT++, REVISION=0)
51 # (Interfaces added: AGE++)
52 # (Interfaces removed: AGE=0)
54 LIBGPGME_LT_CURRENT=33
56 LIBGPGME_LT_REVISION=0
58 # If there is an ABI break in gpgmepp or qgpgme also bump the
59 # version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in
61 LIBGPGMEPP_LT_CURRENT=15
63 LIBGPGMEPP_LT_REVISION=0
65 LIBQGPGME_LT_CURRENT=10
67 LIBQGPGME_LT_REVISION=3
68 ################################################
70 AC_SUBST(LIBGPGME_LT_CURRENT)
71 AC_SUBST(LIBGPGME_LT_AGE)
72 AC_SUBST(LIBGPGME_LT_REVISION)
74 AC_SUBST(LIBGPGMEPP_LT_CURRENT)
75 AC_SUBST(LIBGPGMEPP_LT_AGE)
76 AC_SUBST(LIBGPGMEPP_LT_REVISION)
78 AC_SUBST(LIBQGPGME_LT_CURRENT)
79 AC_SUBST(LIBQGPGME_LT_AGE)
80 AC_SUBST(LIBQGPGME_LT_REVISION)
82 # If the API is changed in an incompatible way: increment the next counter.
83 GPGME_CONFIG_API_VERSION=1
84 ##############################################
86 NEED_GPG_ERROR_VERSION=1.24
88 NEED_LIBASSUAN_VERSION=2.4.2
91 VERSION_MAJOR=mym4_major
92 VERSION_MINOR=mym4_minor
93 VERSION_MICRO=mym4_micro
95 AC_CONFIG_AUX_DIR([build-aux])
96 AC_CONFIG_MACRO_DIR([m4])
97 AC_CONFIG_SRCDIR(src/gpgme.h.in)
98 AC_CONFIG_HEADER(conf/config.h)
99 AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
103 AC_ARG_VAR(SYSROOT,[locate config scripts also below that directory])
105 # Enable GNU extensions on systems that have them.
108 # Taken from mpfr-4.0.1, then modified for LDADD_FOR_TESTS_KLUDGE
109 dnl Under Linux, make sure that the old dtags are used if LD_LIBRARY_PATH
110 dnl is defined. The issue is that with the new dtags, LD_LIBRARY_PATH has
111 dnl the precedence over the run path, so that if a compatible MPFR library
112 dnl is installed in some directory from $LD_LIBRARY_PATH, then the tested
113 dnl MPFR library will be this library instead of the MPFR library from the
114 dnl build tree. Other OS with the same issue might be added later.
117 dnl https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859732
118 dnl http://lists.gnu.org/archive/html/libtool/2017-05/msg00000.html
120 dnl We need to check whether --disable-new-dtags is supported as alternate
121 dnl linkers may be used (e.g., with tcc: CC=tcc LD=tcc).
125 if test -n "$LD_LIBRARY_PATH"; then
126 saved_LDFLAGS="$LDFLAGS"
127 LDADD_FOR_TESTS_KLUDGE="-Wl,--disable-new-dtags"
128 LDFLAGS="$LDFLAGS $LDADD_FOR_TESTS_KLUDGE"
129 AC_MSG_CHECKING(whether --disable-new-dtags is supported by the linker)
130 AC_LINK_IFELSE([AC_LANG_SOURCE([[
131 int main (void) { return 0; }
133 [AC_MSG_RESULT(yes (use it since LD_LIBRARY_PATH is set))],
135 LDADD_FOR_TESTS_KLUDGE=""
137 LDFLAGS="$saved_LDFLAGS"
141 AC_SUBST([LDADD_FOR_TESTS_KLUDGE])
143 AH_VERBATIM([_REENTRANT],
144 [/* To allow the use of GPGME in multithreaded programs we have to use
145 special features from the library.
146 IMPORTANT: gpgme is not yet fully reentrant and you should use it
147 only from one thread. */
149 # define _REENTRANT 1
156 # Note: A suitable gitlog-to-changelog script can be found in GnuPG master.
157 AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog, [gitlog-to-changelog])
159 AC_SUBST(VERSION_MAJOR)
160 AC_SUBST(VERSION_MINOR)
161 AC_SUBST(VERSION_MICRO)
163 VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_major \
164 mym4_minor mym4_micro)
165 AC_SUBST(VERSION_NUMBER)
167 # We need to compile and run a program on the build machine. A
168 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
169 # the AC archive is broken for autoconf 2.57. Given that there is no
170 # newer version of that macro, we assume that it is also broken for
171 # autoconf 2.61 and thus we use a simple but usually sufficient
173 AC_MSG_CHECKING(for cc for build)
174 if test "$cross_compiling" = "yes"; then
175 CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
177 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
179 AC_MSG_RESULT($CC_FOR_BUILD)
180 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
183 # Don't default to build static libs.
185 LT_INIT([win32-dll disable-static])
186 LT_LANG([Windows Resource])
188 # For now we hardcode the use of version scripts. It would be better
189 # to write a test for this or even implement this within libtool.
190 have_ld_version_script=no
193 have_ld_version_script=yes
196 have_ld_version_script=yes
199 AC_DEFINE(_DARWIN_C_SOURCE, 900000L,
200 Expose all libc features (__DARWIN_C_FULL).)
201 AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
205 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
211 component_system=None
212 have_dosish_system=no
213 have_android_system=no
219 available_languages="cl cpp python qt"
220 default_languages="cl cpp python qt"
226 have_android_system=yes
229 have_macos_system=yes
234 have_dosish_system=yes
236 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
237 GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
238 GPGCONF_DEFAULT='c:\\gnupg\\gpgconf.exe'
239 G13_DEFAULT='c:\\gnupg\\g13.exe'
240 #component_system='COM+'
243 AC_ARG_ENABLE(w32-glib,
244 AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
245 build_w32_glib=$enableval)
249 # XXX: Probably use exec-prefix here?
250 # GPG_DEFAULT='/usr/bin/gpg'
251 # GPGSM_DEFAULT='/usr/bin/gpgsm'
252 # GPGCONF_DEFAULT='/usr/bin/gpgconf'
253 # G13_DEFAULT='/usr/bin/g13'
257 if test "$have_dosish_system" = yes; then
258 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
259 [Defined if we run on some of the PCDOS like systems
260 (DOS, Windoze. OS/2) with special properties like
263 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
265 if test "$have_w32_system" = yes; then
266 AC_DEFINE(HAVE_W32_SYSTEM,1,
267 [Defined if we run on any kind of W32 API based system])
269 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
271 if test "$have_w64_system" = yes; then
272 AC_DEFINE(HAVE_W64_SYSTEM,1,
273 [Defined if we run on a 64 bit W32 API based system])
275 AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
277 if test "$have_android_system" = yes; then
278 AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
280 AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
282 if test "$have_macos_system" = yes; then
283 AC_DEFINE(HAVE_MACOS_SYSTEM,1,
284 [Defined if we build for an MacOS system])
286 AM_CONDITIONAL(HAVE_MACOS_SYSTEM, test "$have_macos_system" = yes)
288 AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
291 AC_ARG_ENABLE([fixed-path],
292 AC_HELP_STRING([--enable-fixed-path=PATH],
293 [locate binaries only via this PATH]),
294 [fixed_search_path="$enableval"],
295 [fixed_search_path=""])
296 if test x$fixed_search_path != x ; then
297 AC_DEFINE_UNQUOTED(FIXED_SEARCH_PATH, "$fixed_search_path",
298 [Locate binaries only via this PATH])
302 # Note: You need to declare all possible languages also in
303 # lang/Makefile.am's DIST_SUBDIRS.
304 AC_ARG_ENABLE([languages],
305 AC_HELP_STRING([--enable-languages=languages],
306 [enable only specific language bindings]),
307 [enabled_languages=`echo $enableval | \
308 tr ',:' ' ' | tr '[A-Z]' '[a-z]' | \
310 [enabled_languages="maybe"])
311 if test "x$enabled_languages" = "x" \
312 -o "$enabled_languages" = "no"; then
316 # If languages are explicitly set missing requirements
317 # for the languages are treated as errors otherwise
318 # there will be a warning.
320 if test "x$enabled_languages" = "xmaybe"; then
322 enabled_languages="$default_languages"
325 for language in $enabled_languages; do
326 LIST_MEMBER($language, $available_languages)
327 if test "$found" = "0"; then
328 AC_MSG_ERROR([unsupported language binding specified])
334 # Enable C++ 11 if cpp language is requested
335 LIST_MEMBER("cpp", $enabled_languages)
336 if test "$found" = "1"; then
337 AX_CXX_COMPILE_STDCXX(11, noext, optional)
338 if test "$HAVE_CXX11" != "1"; then
339 if test "$explicit_languages" = "1"; then
342 *** A compiler with c++11 support is required for the c++ binding.
345 enabled_languages=$(echo $enabled_languages | sed 's/cpp//')
346 enabled_languages=$(echo $enabled_languages | sed 's/qt//')
349 *** No c++11 support detected. C++ and Qt bindings will be disabled.
355 # Check that if qt is enabled cpp also is enabled
356 LIST_MEMBER("qt", $enabled_languages)
357 if test "$found" = "1"; then
358 # We need to ensure that in the language order qt comes after cpp
359 # so we remove qt first and explicitly add it as last list member.
360 enabled_languages=$(echo $enabled_languages | sed 's/qt//')
361 LIST_MEMBER("cpp", $enabled_languages)
362 if test "$found" = "0"; then
365 *** Qt language binding depends on cpp binding.
369 if test "$have_qt5_libs" != "yes"; then
370 if test "$explicit_languages" = "1"; then
373 *** Qt5 (Qt5Core) is required for Qt binding.
378 *** Qt5 (Qt5Core) not found Qt Binding will be disabled.
382 enabled_languages=`echo $enabled_languages qt`
384 AC_CHECK_PROGS([DOXYGEN], [doxygen])
385 if test -z "$DOXYGEN";
386 # This is not highlighted because it's not really important.
387 then AC_MSG_WARN([Doxygen not found - Qt binding doc will not be built.])
389 AC_CHECK_PROGS([GRAPHVIZ], [dot])
390 if test -z "$GRAPHVIZ";
391 then AC_MSG_WARN([Graphviz not found - Qt binding doc will not have diagrams.])
395 AM_CONDITIONAL([HAVE_DOXYGEN],
396 [test -n "$DOXYGEN"])
397 if test -n "$GRAPHVIZ"; then
405 LIST_MEMBER("python", $enabled_languages)
407 if test "$found_py" = "1"; then
409 if test -z "$SWIG"; then
410 if test "$explicit_languages" = "1"; then
413 *** You need SWIG to build the Python bindings.
416 enabled_languages=$(echo $enabled_languages | sed 's/python//')
419 # Reset the version collecting vars.
423 if test "$found_py" = "1" -o "$found_py3" = "1"; then
424 # Reset everything, so that we can look for another Python.
425 m4_foreach([mym4pythonver],
426 [[2.7],[3.4],[3.5],[3.6],[3.7],[3.8],[all]],
429 unset PYTHON_CPPFLAGS
431 unset PYTHON_SITE_PKG
432 unset PYTHON_EXTRA_LIBS
433 unset PYTHON_EXTRA_LDFLAGS
434 unset ac_cv_path_PYTHON
435 unset am_cv_pathless_PYTHON
436 unset am_cv_python_version
437 unset am_cv_python_platform
438 unset am_cv_python_pythondir
439 unset am_cv_python_pyexecdir
440 AM_PATH_PYTHON(mym4pythonver, [
442 if test "$PYTHON_VERSION"; then
443 PYTHONS="$(echo $PYTHONS $PYTHON)"
444 PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS $PYTHON_VERSION)"
446 ], :, m4_if([mym4pythonver],[all],[],[python]mym4pythonver))
450 # Recover some values lost in the second attempt to find Python.
451 PYTHON="$(echo $PYTHONS | cut -d ' ' -f 1)"
452 PYTHON_VERSION="$(echo $PYTHON_VERSIONS | cut -d ' ' -f 1)"
455 PYTHONS="$(echo $PYTHONS | tr '[[:space:]]' '\n' | sort | uniq | tr '\n' ' ' | sed -e 's/ $//')"
456 PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS | tr '[[:space:]]' '\n' | sort | uniq | tr '\n' ' ' | sed -e 's/ $//')"
458 if test "$PYTHON_VERSIONS"; then
459 enabled_languages_v=$(echo $enabled_languages | sed -Ee "s/python[[23]]?/python ($PYTHON_VERSIONS)/")
460 enabled_languages=$(echo $enabled_languages | sed -Ee "s/python[[23]]?/python/")
462 if test "$explicit_languages" = "1"; then
465 *** Please install the python development packages.
468 enabled_languages=$(echo $enabled_languages | sed 's/python//')
472 AC_SUBST(PYTHONS, $PYTHONS)
476 AC_SUBST(ENABLED_LANGUAGES, $enabled_languages)
479 # Provide information about the build.
481 BUILD_REVISION="mym4_revision"
482 AC_SUBST(BUILD_REVISION)
483 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
484 [GIT commit id revision used to build this package])
487 BUILD_VERSION=`echo "$PACKAGE_VERSION" | sed 's/\([0-9.]*\).*/\1./'`
489 BUILD_VERSION="${BUILD_VERSION}mym4_revision_dec"
490 BUILD_FILEVERSION=`echo "${BUILD_VERSION}" | tr . ,`
491 AC_SUBST(BUILD_VERSION)
492 AC_SUBST(BUILD_FILEVERSION)
494 AC_ARG_ENABLE([build-timestamp],
495 AC_HELP_STRING([--enable-build-timestamp],
496 [set an explicit build timestamp for reproducibility.
497 (default is the current time in ISO-8601 format)]),
498 [if test "$enableval" = "yes"; then
499 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
501 BUILD_TIMESTAMP="$enableval"
503 [BUILD_TIMESTAMP="<none>"])
504 AC_SUBST(BUILD_TIMESTAMP)
505 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
506 [The time this package was configured for a build])
510 # Options to disable some regression tests
512 run_gpgconf_test="yes"
513 AC_ARG_ENABLE(gpgconf-test,
514 AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF regression test]),
515 run_gpgconf_test=$enableval)
516 AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
519 AC_ARG_ENABLE(gpg-test,
520 AC_HELP_STRING([--disable-gpg-test], [disable GPG regression test]),
521 run_gpg_test=$enableval)
522 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
525 AC_ARG_ENABLE(gpgsm-test,
526 AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM regression test]),
527 run_gpgsm_test=$enableval)
528 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
531 AC_ARG_ENABLE(g13-test,
532 AC_HELP_STRING([--disable-g13-test], [disable G13 regression test]),
533 run_g13_test=$enableval)
534 AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
537 # Checks for header files.
538 AC_CHECK_HEADERS_ONCE([locale.h sys/select.h sys/uio.h argp.h stdint.h
539 unistd.h sys/time.h sys/types.h sys/stat.h])
544 AC_CHECK_SIZEOF(unsigned int)
549 # We require uint64_t
550 if test "$ac_cv_header_stdint_h" != yes; then
553 *** No stdint.h and thus no uint64_t type. Can't build this library.
558 # A simple compile time check in gpgme.h for GNU/Linux systems that
559 # prevents a file offset bits mismatch between gpgme and the application.
560 NEED__FILE_OFFSET_BITS=0
561 if test "$have_w32_system" != yes; then
562 case "$ac_cv_sys_file_offset_bits" in
563 "" | no | unknown) ;;
565 NEED__FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
569 AC_SUBST(NEED__FILE_OFFSET_BITS)
571 # Figure out platform dependent typedefs for gpgme.h
572 if test "$have_w32_system" = yes; then
573 INSERT__TYPEDEFS_FOR_GPGME_H="
576 typedef int64_t gpgme_off_t;
577 typedef int64_t gpgme_ssize_t;
579 typedef long gpgme_off_t;
580 typedef long gpgme_ssize_t;
582 API__OFF_T="gpgme_off_t"
583 API__SSIZE_T="gpgme_ssize_t"
585 INSERT__TYPEDEFS_FOR_GPGME_H="
586 #include <sys/types.h>
587 typedef off_t gpgme_off_t;
588 typedef ssize_t gpgme_ssize_t;"
590 API__SSIZE_T="ssize_t"
592 AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H)
593 AM_SUBST_NOTMAKE(INSERT__TYPEDEFS_FOR_GPGME_H)
595 AM_SUBST_NOTMAKE(API__OFF_T)
596 AC_SUBST(API__SSIZE_T)
597 AM_SUBST_NOTMAKE(API__SSIZE_T)
599 # Checks for compiler features.
600 if test "$GCC" = yes; then
601 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
602 if test "$USE_MAINTAINER_MODE" = "yes"; then
603 CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
605 # If -Wno-missing-field-initializers is supported we can enable a
606 # a bunch of really useful warnings.
607 AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
608 _gcc_cflags_save=$CFLAGS
609 CFLAGS="-Wno-missing-field-initializers"
610 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
611 AC_MSG_RESULT($_gcc_wopt)
612 CFLAGS=$_gcc_cflags_save;
613 if test x"$_gcc_wopt" = xyes ; then
614 CFLAGS="$CFLAGS -W -Wextra -Wbad-function-cast"
615 CFLAGS="$CFLAGS -Wwrite-strings"
616 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
617 CFLAGS="$CFLAGS -Wno-missing-field-initializers"
618 CFLAGS="$CFLAGS -Wno-sign-compare"
619 CFLAGS="$CFLAGS -Wno-format-zero-length"
620 CFLAGS="$CFLAGS -Wno-format-truncation"
621 CFLAGS="$CFLAGS -Wno-sizeof-pointer-div"
623 CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wno-shadow"
625 AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
626 _gcc_cflags_save=$CFLAGS
627 CFLAGS="-Wpointer-arith"
628 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
629 AC_MSG_RESULT($_gcc_wopt)
630 CFLAGS=$_gcc_cflags_save;
631 if test x"$_gcc_wopt" = xyes ; then
632 CFLAGS="$CFLAGS -Wpointer-arith"
635 if test "$have_w32_system" = yes; then
636 CFLAGS="$CFLAGS -mms-bitfields"
640 # Only used for debugging, so no serious test needed (for actual
641 # functionality you have to test libc as well, this only tests the
643 AC_CACHE_CHECK([for __thread],[gpgme_cv_tls_works],
644 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([__thread int foo;])],
645 gpgme_cv_tls_works=yes,gpgme_cv_tls_works=no))
646 if test "$gpgme_cv_tls_works" = yes; then
647 AC_DEFINE(HAVE_TLS, [1], [Define if __thread is supported])
651 # Checks for library functions.
652 AC_MSG_NOTICE([checking for libraries])
656 # Try to find a thread-safe version of ttyname().
657 gnupg_REPLACE_TTYNAME_R
658 if test "$ac_cv_func_ttyname_r" != yes; then
661 *** ttyname() is not thread-safe and ttyname_r() does not exist
665 # Try to find a thread-safe version of getenv().
666 have_thread_safe_getenv=no
668 if test $GLIBC21 = yes -o $have_w32_system = yes; then
669 have_thread_safe_getenv=yes
671 if test $have_thread_safe_getenv = yes; then
672 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
675 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
676 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
679 *** getenv() is not thread-safe and getenv_r() does not exist
683 # For converting time strings to seconds since Epoch, we need the timegm
685 AC_CHECK_FUNCS(timegm)
686 if test "$ac_cv_func_timegm" != yes; then
689 *** timegm() not available - a non-thread-safe kludge will be used
690 *** and the TZ variable might be changed at runtime.
694 AC_CHECK_FUNCS(setlocale)
696 # Checking for libgpg-error.
698 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
699 have_gpg_error=yes, have_gpg_error=no)
700 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
701 [The default error source for GPGME.])
705 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
706 have_libassuan=yes, have_libassuan=no)
707 if test "$have_libassuan" = "yes"; then
708 AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
709 [version of the libassuan library])
717 # Check for getgid etc
718 AC_CHECK_FUNCS(getgid getegid closefrom)
721 # Replacement functions.
722 AC_REPLACE_FUNCS(stpcpy)
723 AC_REPLACE_FUNCS(setenv)
725 # Assuan check for descriptor passing.
726 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
727 [supports_descriptor_passing=yes],
728 [supports_descriptor_passing=no
731 *** Data structure for sending ancillary data missing.
732 *** Descriptor passing won't work.
737 #include <sys/types.h>
738 #include <sys/socket.h>
746 use_descriptor_passing=yes
747 AC_ARG_ENABLE(fd-passing,
748 AC_HELP_STRING([--disable-fd-passing], [do not use FD passing]),
749 use_descriptor_passing=$enableval)
751 if test "$supports_descriptor_passing" != "yes"; then
752 use_descriptor_passing=no
755 if test "$use_descriptor_passing" = "yes"; then
756 AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
757 [Defined if descriptor passing is enabled and supported])
760 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
764 if test "$use_descriptor_passing" = "yes" && test "$have_libassuan" = "yes"; then
767 if test "$uiserver" != "no"; then
768 AC_DEFINE(ENABLE_UISERVER, 1,
769 [Defined if we are building with uiserver support.])
771 AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
774 # Option --disable-linux-getdents
776 # By default we use SYS_getdents on Linux to optimize fd closing
777 # before an exec. This option allows to switch this optimization off.
778 use_linux_getdents=yes
779 AC_ARG_ENABLE(linux-getdents,
780 AC_HELP_STRING([--disable-linux-getdents],
781 [do not use SYS_getdents on Linux]),
782 use_linux_getdents=$enableval)
783 if test "$use_linux_getdents" = "yes"; then
786 AC_DEFINE(USE_LINUX_GETDENTS,1,
787 [Defined if SYS_getdents can be used on Linux])
794 # Add a few constants to help porting to W32
796 AH_VERBATIM([SEPCONSTANTS],
798 /* Separators as used in $PATH and file name. */
799 #ifdef HAVE_DOSISH_SYSTEM
800 #define PATHSEP_C ';'
801 #define DIRSEP_C '\\'
802 #define DIRSEP_S "\\"
804 #define PATHSEP_C ':'
811 /* Definition of GCC specific attributes. */
813 # define GPGME_GCC_A_PURE __attribute__ ((__pure__))
815 # define GPGME_GCC_A_PURE
818 /* Under WindowsCE we need gpg-error's strerror macro. */
819 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
821 #define CRIGHTBLURB "Copyright (C) 2000 Werner Koch\n" \
822 "Copyright (C) 2001--2018 g10 Code GmbH\n"
826 # Substitution used for gpgme-config
827 GPGME_CONFIG_LIBS="-lgpgme"
828 GPGME_CONFIG_CFLAGS=""
829 GPGME_CONFIG_HOST="$host"
830 GPGME_CONFIG_AVAIL_LANG="$enabled_languages"
831 AC_SUBST(GPGME_CONFIG_API_VERSION)
832 AC_SUBST(GPGME_CONFIG_LIBS)
833 AC_SUBST(GPGME_CONFIG_CFLAGS)
834 AC_SUBST(GPGME_CONFIG_HOST)
835 AC_SUBST(GPGME_CONFIG_AVAIL_LANG)
838 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
839 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
842 # Some checks for gpgme-tool
843 # Done at top: AC_CHECK_HEADER([argp.h])
844 AC_CHECK_TYPES([error_t], [],
845 [AC_DEFINE([error_t], [int],
846 [Define to a type to use for `error_t' if it is not otherwise available.])],
847 [#include <errno.h>])
850 # A substitution to set generated files in a Emacs buffer to read-only.
851 AC_SUBST(emacs_local_vars_begin, [['Local][ ][Variables:']])
852 AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
853 AC_SUBST(emacs_local_vars_end, ['End:'])
857 if test "$have_gpg_error" = "no"; then
861 *** You need libgpg-error to build this program.
862 ** This library is for example available at
863 *** https://www.gnupg.org/ftp/gcrypt/libgpg-error/
864 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
867 if test "$have_libassuan" = "no"; then
871 *** You need libassuan to build this program.
872 *** This library is for example available at
873 *** https://www.gnupg.org/ftp/gcrypt/libassuan/
874 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
878 if test "$die" = "yes"; then
881 *** Required libraries not found. Please consult the above messages
882 *** and install them before running configure again.
888 # Create config files
890 AC_CONFIG_FILES(Makefile src/Makefile
894 tests/opassuan/Makefile
901 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
902 AC_CONFIG_FILES(lang/cpp/Makefile lang/cpp/src/Makefile)
903 AC_CONFIG_FILES(lang/cpp/tests/Makefile)
904 AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig-w32.cmake.in)
905 AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig.cmake.in)
906 AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfigVersion.cmake)
907 AC_CONFIG_FILES(lang/cpp/src/gpgmepp_version.h)
908 AC_CONFIG_FILES(lang/qt/Makefile lang/qt/src/Makefile)
909 AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig-w32.cmake.in)
910 AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig.cmake.in)
911 AC_CONFIG_FILES(lang/qt/src/QGpgmeConfigVersion.cmake)
912 AC_CONFIG_FILES(lang/qt/tests/Makefile)
913 AC_CONFIG_FILES(lang/qt/src/qgpgme_version.h)
914 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
915 AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([lang/qt/doc/Doxyfile])])
916 AC_CONFIG_FILES([lang/js/Makefile lang/js/src/Makefile
917 lang/js/BrowserTestExtension/Makefile
918 lang/js/DemoExtension/Makefile])
919 AC_CONFIG_FILES(lang/qt/doc/Makefile)
920 AC_CONFIG_FILES([lang/python/Makefile
921 lang/python/version.py
922 lang/python/tests/Makefile])
923 AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py])
927 GPGME v${VERSION} has been configured as follows:
929 Revision: mym4_revision (mym4_revision_dec)
933 FD Passing: $use_descriptor_passing
935 Language bindings: ${enabled_languages_v:-$enabled_languages}
937 if test "x${gpg_config_script_warn}" != x; then
939 Mismatches between the target platform and the to
940 be used libraries have been been detected for:
941 ${gpg_config_script_warn}
942 Please check above for warning messages.