Blame configure.ac

Packit fc043f
# configure.ac for libgpg-error
Packit fc043f
# Copyright (C) 2003, 2004, 2006, 2010, 2013-2017 g10 Code GmbH
Packit fc043f
#
Packit fc043f
# This file is part of libgpg-error.
Packit fc043f
#
Packit fc043f
# libgpg-error is free software; you can redistribute it and/or modify
Packit fc043f
# it under the terms of the GNU Lesser General Public License as
Packit fc043f
# published by the Free Software Foundation; either version 2.1 of the
Packit fc043f
# License, or (at your option) any later version.
Packit fc043f
#
Packit fc043f
# libgpg-error is distributed in the hope that it will be useful,
Packit fc043f
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit fc043f
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit fc043f
# GNU Lesser General Public License for more details.
Packit fc043f
#
Packit fc043f
# You should have received a copy of the GNU General Public License
Packit fc043f
# along with this program; if not, see <https://www.gnu.org/licenses/>.
Packit fc043f
# SPDX-License-Identifier: LGPL-2.1+
Packit fc043f
Packit fc043f
# (Process this file with autoconf to produce a configure script.)
Packit fc043f
# The following lines are used by ./autogen.sh.
Packit fc043f
AC_PREREQ(2.59)
Packit fc043f
min_automake_version="1.14"
Packit fc043f
Packit fc043f
# To build a release you need to create a tag with the version number
Packit fc043f
# (git tag -s libgpg-error-n.m) and run "./autogen.sh --force".
Packit fc043f
# Please bump the version number immediately after the release, do
Packit fc043f
# another commit, and a push so that the git magic is able to work.
Packit fc043f
# See below for the LT versions.
Packit fc043f
m4_define([mym4_package],[libgpg-error])
Packit fc043f
m4_define([mym4_major], [1])
Packit fc043f
m4_define([mym4_minor], [31])
Packit fc043f
Packit fc043f
# Below is m4 magic to extract and compute the revision number, the
Packit fc043f
# decimalized short revision number, a beta version string, and a flag
Packit fc043f
# indicating a development version (mym4_isgit). Note that the m4
Packit fc043f
# processing is done by autoconf and not during the configure run.
Packit fc043f
m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \
Packit fc043f
                           mym4_package mym4_major mym4_minor),[:]))
Packit fc043f
m4_define([mym4_isbeta],       m4_argn(2, mym4_verslist))
Packit fc043f
m4_define([mym4_version],      m4_argn(4, mym4_verslist))
Packit fc043f
m4_define([mym4_revision],     m4_argn(7, mym4_verslist))
Packit fc043f
m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
Packit fc043f
m4_esyscmd([echo ]mym4_version[>VERSION])
Packit fc043f
AC_INIT([mym4_package],[mym4_version], [https://bugs.gnupg.org])
Packit fc043f
# LT Version numbers, remember to change them just *before* a release.
Packit fc043f
#   (Code changed:			REVISION++)
Packit fc043f
#   (Interfaces added/removed/changed:	CURRENT++, REVISION=0)
Packit fc043f
#   (Interfaces added:			AGE++)
Packit fc043f
#   (Interfaces removed:		AGE=0)
Packit fc043f
# Note that added error codes don't constitute an interface change.
Packit fc043f
LIBGPG_ERROR_LT_CURRENT=24
Packit fc043f
LIBGPG_ERROR_LT_AGE=24
Packit fc043f
LIBGPG_ERROR_LT_REVISION=2
Packit fc043f
################################################
Packit fc043f
Packit fc043f
AC_SUBST(LIBGPG_ERROR_LT_CURRENT)
Packit fc043f
AC_SUBST(LIBGPG_ERROR_LT_AGE)
Packit fc043f
AC_SUBST(LIBGPG_ERROR_LT_REVISION)
Packit fc043f
Packit fc043f
VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x00" mym4_major mym4_minor)
Packit fc043f
AC_SUBST(VERSION_NUMBER)
Packit fc043f
Packit fc043f
AC_CONFIG_AUX_DIR([build-aux])
Packit fc043f
AM_INIT_AUTOMAKE([serial-tests dist-bzip2])
Packit fc043f
AM_MAINTAINER_MODE
Packit fc043f
AC_CONFIG_SRCDIR([src/err-sources.h.in])
Packit fc043f
AC_CONFIG_HEADER([config.h])
Packit fc043f
AC_CONFIG_MACRO_DIR([m4])
Packit fc043f
AM_SILENT_RULES
Packit fc043f
Packit fc043f
# We need to know about the host architecture to avoid spurious
Packit fc043f
# warnings.
Packit fc043f
AC_CANONICAL_HOST
Packit fc043f
AB_INIT
Packit fc043f
Packit fc043f
# Checks for programs.
Packit fc043f
AC_PROG_CC
Packit fc043f
AM_PROG_CC_C_O
Packit fc043f
AC_PROG_CPP
Packit fc043f
AC_PROG_AWK
Packit fc043f
AC_CHECK_TOOL(AR, ar, :)
Packit fc043f
AC_GNU_SOURCE
Packit fc043f
Packit fc043f
# Set some variables depending on the platform for later use.
Packit fc043f
have_w32_system=no
Packit fc043f
have_w64_system=no
Packit fc043f
have_w32ce_system=no
Packit fc043f
case "${host}" in
Packit fc043f
    x86_64-*mingw32*)
Packit fc043f
        have_w32_system=yes
Packit fc043f
        have_w64_system=yes
Packit fc043f
        ;;
Packit fc043f
    *-mingw32ce*)
Packit fc043f
        have_w32_system=yes
Packit fc043f
        have_w32ce_system=yes
Packit fc043f
        ;;
Packit fc043f
    *-mingw32*)
Packit fc043f
        have_w32_system=yes
Packit fc043f
        ;;
Packit fc043f
    *-apple-darwin*)
Packit fc043f
        # This is the equivalent of the _GNU_SOURCE feature-test-macro
Packit fc043f
        # on GNU libc systems.
Packit fc043f
        AC_DEFINE(_DARWIN_C_SOURCE, 900000L,
Packit fc043f
                  Expose all libc features (__DARWIN_C_FULL).)
Packit fc043f
        ;;
Packit fc043f
    *)
Packit fc043f
       ;;
Packit fc043f
esac
Packit fc043f
Packit fc043f
Packit fc043f
if test "$have_w32_system" != yes; then
Packit fc043f
  gl_THREADLIB_EARLY
Packit fc043f
fi
Packit fc043f
Packit fc043f
# We build libgpg-error with large file support so that we have a 64
Packit fc043f
# bit off_t.  Our external interface uses the gpgrt_off_t which is
Packit fc043f
# anyway specified as 64 bit.  Thus the same libgpg-error can be used
Packit fc043f
# by software which is not build with large file support.
Packit fc043f
AC_SYS_LARGEFILE
Packit fc043f
Packit fc043f
Packit fc043f
LT_PREREQ([2.2.6])
Packit fc043f
LT_INIT([win32-dll disable-static])
Packit fc043f
LT_LANG([Windows Resource])
Packit fc043f
Packit fc043f
Packit fc043f
# We need to compile and run a program on the build machine.
Packit fc043f
dnl The AC_PROG_CC_FOR_BUILD macro in the AC archive is broken for
Packit fc043f
dnl autoconf 2.57.
Packit fc043f
dnl AC_PROG_CC_FOR_BUILD
Packit fc043f
AC_MSG_CHECKING(for cc for build)
Packit fc043f
if test "$cross_compiling" = "yes"; then
Packit fc043f
  CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
Packit fc043f
else
Packit fc043f
  CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
Packit fc043f
fi
Packit fc043f
AC_MSG_RESULT($CC_FOR_BUILD)
Packit fc043f
AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
Packit fc043f
Packit fc043f
AC_PATH_PROG(YAT2M, yat2m)
Packit fc043f
AC_ARG_VAR(YAT2M, [tool to convert texi to man pages])
Packit fc043f
AM_CONDITIONAL(HAVE_YAT2M, test -n "$ac_cv_path_YAT2M")
Packit fc043f
Packit fc043f
AH_BOTTOM([
Packit fc043f
/* Force using of NLS for W32 even if no libintl has been found.  This is
Packit fc043f
   okay because we have our own gettext implementation for W32.  */
Packit fc043f
#if defined(HAVE_W32_SYSTEM) && !defined(ENABLE_NLS)
Packit fc043f
#define ENABLE_NLS 1
Packit fc043f
#endif
Packit fc043f
Packit fc043f
/* Connect the generic estream-printf.c to our framework.  */
Packit fc043f
#define _ESTREAM_PRINTF_REALLOC _gpgrt_realloc
Packit fc043f
#define _ESTREAM_PRINTF_EXTRA_INCLUDE "gpgrt-int.h"
Packit fc043f
Packit fc043f
/* For building we need to define these macro.  */
Packit fc043f
#define GPG_ERR_ENABLE_GETTEXT_MACROS 1
Packit fc043f
#define GPG_ERR_ENABLE_ERRNO_MACROS 1
Packit fc043f
#define GPGRT_ENABLE_ES_MACROS 1
Packit fc043f
#define GPGRT_ENABLE_LOG_MACROS 1
Packit fc043f
#define GPGRT_ENABLE_ARGPARSE_MACROS 1
Packit fc043f
])
Packit fc043f
Packit fc043f
Packit fc043f
# Note, that autogen.sh greps for the next line.
Packit fc043f
AM_GNU_GETTEXT_VERSION([0.19.3])
Packit fc043f
AM_GNU_GETTEXT([external])
Packit fc043f
Packit fc043f
# Checks for header files.
Packit fc043f
AC_HEADER_STDC
Packit fc043f
AC_CHECK_HEADERS([stdlib.h locale.h stdint.h sys/select.h sys/time.h \
Packit fc043f
                  signal.h])
Packit fc043f
Packit fc043f
AC_FUNC_STRERROR_R
Packit fc043f
case "${host_os}" in
Packit fc043f
     solaris*)
Packit fc043f
     # All versions of Solaris from 2.4 have a thread-safe strerror().
Packit fc043f
     # Since Solaris 10, in addition strerror_r() exists.
Packit fc043f
     ;;
Packit fc043f
     *)
Packit fc043f
     AC_CHECK_FUNC([strerror_r], [],
Packit fc043f
AC_MSG_WARN([[Without strerror_r, gpg_strerror_r might not be thread-safe]]))
Packit fc043f
     ;;
Packit fc043f
esac
Packit fc043f
Packit fc043f
AC_FUNC_FORK
Packit fc043f
AC_CHECK_FUNCS([flockfile vasprintf mmap rand strlwr stpcpy setenv stat \
Packit fc043f
                getrlimit ])
Packit fc043f
Packit fc043f
Packit fc043f
#
Packit fc043f
# Checks for typedefs, structures, and compiler characteristics.
Packit fc043f
#
Packit fc043f
AC_C_CONST
Packit fc043f
Packit fc043f
AC_CHECK_SIZEOF(int)
Packit fc043f
AC_CHECK_SIZEOF(long)
Packit fc043f
AC_CHECK_SIZEOF(long long)
Packit fc043f
AC_HEADER_TIME
Packit fc043f
AC_CHECK_SIZEOF(time_t,,[[
Packit fc043f
#include <stdio.h>
Packit fc043f
#if TIME_WITH_SYS_TIME
Packit fc043f
# include <sys/time.h>
Packit fc043f
# include <time.h>
Packit fc043f
#else
Packit fc043f
# if HAVE_SYS_TIME_H
Packit fc043f
#  include <sys/time.h>
Packit fc043f
# else
Packit fc043f
#  include <time.h>
Packit fc043f
# endif
Packit fc043f
#endif
Packit fc043f
]])
Packit fc043f
Packit fc043f
GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
Packit fc043f
Packit fc043f
Packit fc043f
# Find a 64 bit integer type to be used instead of off_t.  We prefer
Packit Service f2e949
# int64_t and finally try long long.
Packit Service f2e949
if test "$ac_cv_header_stdint_h" = yes; then
Packit Service f2e949
   replacement_for_off_t="int64_t"
Packit Service f2e949
elif test "$ac_cv_sizeof_int" = "8"; then
Packit fc043f
   replacement_for_off_t="int"
Packit fc043f
elif test "$ac_cv_sizeof_long" = "8"; then
Packit fc043f
   replacement_for_off_t="long"
Packit fc043f
elif test "$ac_cv_sizeof_long_long" = "8"; then
Packit fc043f
   replacement_for_off_t="long long"
Packit fc043f
else
Packit fc043f
   AC_MSG_ERROR([[
Packit fc043f
***
Packit fc043f
*** No 64 bit signed integer type found.  Can't build this library.
Packit fc043f
***]])
Packit fc043f
fi
Packit fc043f
AC_DEFINE_UNQUOTED(REPLACEMENT_FOR_OFF_T, "$replacement_for_off_t",
Packit fc043f
                   [Used by mkheader to insert the replacement type.])
Packit fc043f
Packit fc043f
Packit fc043f
#
Packit fc043f
# Setup gcc specific options
Packit fc043f
#
Packit fc043f
AC_MSG_NOTICE([checking for cc features])
Packit fc043f
if test "$GCC" = yes; then
Packit fc043f
    # Check whether gcc does not emit a diagnostic for unknown -Wno-*
Packit fc043f
    # options.  This is the case for gcc >= 4.6
Packit fc043f
    AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
Packit fc043f
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Packit fc043f
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
Packit fc043f
#kickerror
Packit fc043f
#endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
Packit fc043f
    AC_MSG_RESULT($_gcc_silent_wno)
Packit fc043f
Packit fc043f
    # Note that it is okay to use CFLAGS here because these are just
Packit fc043f
    # warning options and the user should have a chance of overriding
Packit fc043f
    # them.
Packit fc043f
    if test "$USE_MAINTAINER_MODE" = "yes"; then
Packit fc043f
        M_CFLAGS="-O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
Packit fc043f
        M_CFLAGS="$M_CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
Packit fc043f
        if test x"$_gcc_silent_wno" = xyes ; then
Packit fc043f
          _gcc_wopt=yes
Packit fc043f
        else
Packit fc043f
          AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
Packit fc043f
          _gcc_cflags_save=$CFLAGS
Packit fc043f
          CFLAGS="-Wno-missing-field-initializers"
Packit fc043f
          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
Packit fc043f
                            [_gcc_wopt=yes],[_gcc_wopt=no])
Packit fc043f
          AC_MSG_RESULT($_gcc_wopt)
Packit fc043f
          CFLAGS=$_gcc_cflags_save;
Packit fc043f
        fi
Packit fc043f
        if test x"$_gcc_wopt" = xyes ; then
Packit fc043f
          M_CFLAGS="$M_CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
Packit fc043f
        fi
Packit fc043f
Packit fc043f
        AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
Packit fc043f
        _gcc_cflags_save=$CFLAGS
Packit fc043f
        CFLAGS="-Wdeclaration-after-statement"
Packit fc043f
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
Packit fc043f
        AC_MSG_RESULT($_gcc_wopt)
Packit fc043f
        CFLAGS=$_gcc_cflags_save;
Packit fc043f
        if test x"$_gcc_wopt" = xyes ; then
Packit fc043f
          M_CFLAGS="$M_CFLAGS -Wdeclaration-after-statement"
Packit fc043f
        fi
Packit fc043f
Packit fc043f
	# Prepend the maintainer-cflags so that the user can override
Packit fc043f
	# them, e.g. to override the optimization flags for debugging.
Packit fc043f
	CFLAGS="$M_CFLAGS $CFLAGS"
Packit fc043f
    else
Packit fc043f
        CFLAGS="$CFLAGS -Wall"
Packit fc043f
    fi
Packit fc043f
Packit fc043f
    AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
Packit fc043f
    _gcc_cflags_save=$CFLAGS
Packit fc043f
    CFLAGS="-Wpointer-arith"
Packit fc043f
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
Packit fc043f
    AC_MSG_RESULT($_gcc_psign)
Packit fc043f
    CFLAGS=$_gcc_cflags_save;
Packit fc043f
    if test x"$_gcc_psign" = xyes ; then
Packit fc043f
       CFLAGS="$CFLAGS -Wpointer-arith"
Packit fc043f
    fi
Packit fc043f
Packit fc043f
    # The undocumented option -Wno-psabi suppresses the annoying
Packit fc043f
    #   "the ABI of passing union with long double has changed in GCC 4.4"
Packit fc043f
    # which is emitted in estream-printf.c but entirely irrelvant
Packit fc043f
    # because that union is local to the file.
Packit fc043f
    if test x"$_gcc_silent_wno" = xyes ; then
Packit fc043f
       CFLAGS="$CFLAGS -Wno-psabi"
Packit fc043f
    fi
Packit fc043f
fi
Packit fc043f
Packit fc043f
#
Packit fc043f
# Check whether the compiler supports the GCC style aligned attribute
Packit fc043f
#
Packit fc043f
AC_CACHE_CHECK([whether the GCC style aligned attribute is supported],
Packit fc043f
       [gcry_cv_gcc_attribute_aligned],
Packit fc043f
       [gcry_cv_gcc_attribute_aligned=no
Packit fc043f
        AC_COMPILE_IFELSE([AC_LANG_SOURCE(
Packit fc043f
          [[struct { int a; } foo __attribute__ ((aligned (16)));]])],
Packit fc043f
          [gcry_cv_gcc_attribute_aligned=yes])])
Packit fc043f
if test "$gcry_cv_gcc_attribute_aligned" = "yes" ; then
Packit fc043f
   AC_DEFINE(HAVE_GCC_ATTRIBUTE_ALIGNED,1,
Packit fc043f
     [Defined if a GCC style "__attribute__ ((aligned (n))" is supported])
Packit fc043f
fi
Packit fc043f
Packit fc043f
#
Packit fc043f
# Check for ELF visibility support.
Packit fc043f
#
Packit fc043f
AC_CACHE_CHECK(whether the visibility attribute is supported,
Packit fc043f
       gcry_cv_visibility_attribute,
Packit fc043f
       [gcry_cv_visibility_attribute=no
Packit fc043f
        AC_LANG_CONFTEST([AC_LANG_SOURCE(
Packit fc043f
          [[int foo __attribute__ ((visibility ("hidden"))) = 1;
Packit fc043f
            int bar __attribute__ ((visibility ("protected"))) = 1;
Packit fc043f
          ]])])
Packit fc043f
Packit fc043f
        if ${CC-cc} -Werror -S conftest.c -o conftest.s \
Packit fc043f
                  1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
Packit fc043f
            if grep '\.hidden.*foo' conftest.s >/dev/null 2>&1 ; then
Packit fc043f
                if grep '\.protected.*bar' conftest.s >/dev/null 2>&1; then
Packit fc043f
                    gcry_cv_visibility_attribute=yes
Packit fc043f
                fi
Packit fc043f
            fi
Packit fc043f
        fi
Packit fc043f
       ])
Packit fc043f
if test "$gcry_cv_visibility_attribute" = "yes"; then
Packit fc043f
    AC_CACHE_CHECK(for broken visibility attribute,
Packit fc043f
       gcry_cv_broken_visibility_attribute,
Packit fc043f
       [gcry_cv_broken_visibility_attribute=yes
Packit fc043f
        AC_LANG_CONFTEST([AC_LANG_SOURCE(
Packit fc043f
          [[int foo (int x);
Packit fc043f
            int bar (int x) __asm__ ("foo")
Packit fc043f
                            __attribute__ ((visibility ("hidden")));
Packit fc043f
            int bar (int x) { return x; }
Packit fc043f
          ]])])
Packit fc043f
Packit fc043f
        if ${CC-cc} -Werror -S conftest.c -o conftest.s \
Packit fc043f
                  1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
Packit fc043f
           if grep '\.hidden@<:@ 	_@:>@foo' conftest.s >/dev/null 2>&1;
Packit fc043f
            then
Packit fc043f
               gcry_cv_broken_visibility_attribute=no
Packit fc043f
           fi
Packit fc043f
        fi
Packit fc043f
       ])
Packit fc043f
fi
Packit fc043f
if test "$gcry_cv_visibility_attribute" = "yes"; then
Packit fc043f
    AC_CACHE_CHECK(for broken alias attribute,
Packit fc043f
       gcry_cv_broken_alias_attribute,
Packit fc043f
       [gcry_cv_broken_alias_attribute=yes
Packit fc043f
        AC_LANG_CONFTEST([AC_LANG_SOURCE(
Packit fc043f
          [[extern int foo (int x) __asm ("xyzzy");
Packit fc043f
            int bar (int x) { return x; }
Packit fc043f
            extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
Packit fc043f
            extern int dfoo;
Packit fc043f
            extern __typeof (dfoo) dfoo __asm ("abccb");
Packit fc043f
            int dfoo = 1;
Packit fc043f
          ]])])
Packit fc043f
Packit fc043f
        if ${CC-cc} -Werror -S conftest.c -o conftest.s \
Packit fc043f
                  1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
Packit fc043f
           if grep 'xyzzy' conftest.s >/dev/null 2>&1 && \
Packit fc043f
              grep 'abccb' conftest.s >/dev/null 2>&1; then
Packit fc043f
              gcry_cv_broken_alias_attribute=no
Packit fc043f
           fi
Packit fc043f
        fi
Packit fc043f
        ])
Packit fc043f
fi
Packit fc043f
if test "$gcry_cv_visibility_attribute" = "yes"; then
Packit fc043f
    AC_CACHE_CHECK(if gcc supports -fvisibility=hidden,
Packit fc043f
       gcry_cv_gcc_has_f_visibility,
Packit fc043f
       [gcry_cv_gcc_has_f_visibility=no
Packit fc043f
        _gcc_cflags_save=$CFLAGS
Packit fc043f
        CFLAGS="-fvisibility=hidden"
Packit fc043f
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
Packit fc043f
                          gcry_cv_gcc_has_f_visibility=yes)
Packit fc043f
        CFLAGS=$_gcc_cflags_save;
Packit fc043f
       ])
Packit fc043f
fi
Packit fc043f
if test "$gcry_cv_visibility_attribute" = "yes" \
Packit fc043f
   && test "$gcry_cv_broken_visibility_attribute" != "yes" \
Packit fc043f
   && test "$gcry_cv_broken_alias_attribute" != "yes" \
Packit fc043f
   && test "$gcry_cv_gcc_has_f_visibility" = "yes"
Packit fc043f
 then
Packit fc043f
   AC_DEFINE(GPGRT_USE_VISIBILITY, 1,
Packit fc043f
             [Define to use the GNU C visibility attribute.])
Packit fc043f
   CFLAGS="$CFLAGS -fvisibility=hidden"
Packit fc043f
fi
Packit fc043f
Packit fc043f
#
Packit fc043f
# Check whether ld supports a version script.
Packit fc043f
# (Actually not a check but a list of systems which are known to support it.)
Packit fc043f
#
Packit fc043f
have_ld_version_script=no
Packit fc043f
case "${host}" in
Packit fc043f
    *-*-linux*)
Packit fc043f
	have_ld_version_script=yes
Packit fc043f
        ;;
Packit fc043f
    *-*-gnu*)
Packit fc043f
	have_ld_version_script=yes
Packit fc043f
        ;;
Packit fc043f
esac
Packit fc043f
AC_ARG_ENABLE([ld-version-script],
Packit fc043f
              AC_HELP_STRING([--enable-ld-version-script],
Packit fc043f
                             [enable/disable use of linker version script.
Packit fc043f
                              (default is system dependent)]),
Packit fc043f
              [have_ld_version_script=$enableval],
Packit fc043f
              [ : ] )
Packit fc043f
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
Packit fc043f
Packit fc043f
Packit fc043f
#
Packit fc043f
# Check for thread library.
Packit fc043f
#
Packit fc043f
# Windows has always thread support; thus we don't bother to test for
Packit fc043f
# it as it may lead to false results when cross building.
Packit fc043f
if test "$have_w32_system" = yes; then
Packit fc043f
  AC_DEFINE([USE_WINDOWS_THREADS], [1])
Packit fc043f
  LIBTHREAD=
Packit fc043f
  LTLIBTHREAD=
Packit fc043f
  LIBMULTITHREAD=
Packit fc043f
  LTLIBMULTITHREAD=
Packit fc043f
  THREADLIB_CPPFLAGS=""
Packit fc043f
  AC_SUBST([LIBTHREAD])
Packit fc043f
  AC_SUBST([LTLIBTHREAD])
Packit fc043f
  AC_SUBST([LIBMULTITHREAD])
Packit fc043f
  AC_SUBST([LTLIBMULTITHREAD])
Packit fc043f
else
Packit fc043f
  gl_LOCK
Packit fc043f
  if test "$gl_threads_api" = posix; then
Packit fc043f
    AC_CHECK_SIZEOF(pthread_mutex_t,,[AC_INCLUDES_DEFAULT
Packit fc043f
                                      #include <pthread.h>])
Packit fc043f
  fi
Packit fc043f
fi
Packit fc043f
Packit fc043f
# Default value for GPG_ERROR_CONFIG_LIBS
Packit fc043f
config_libs="-lgpg-error"
Packit fc043f
Packit fc043f
#
Packit fc043f
# Check for other libraries
Packit fc043f
#
Packit fc043f
LIB_SCHED_YIELD=
Packit fc043f
AC_SUBST([LIB_SCHED_YIELD])
Packit fc043f
AC_SEARCH_LIBS([sched_yield], [rt posix4],
Packit fc043f
               [if test "$ac_cv_search_sched_yield" != "none required"; then
Packit fc043f
                  LIB_SCHED_YIELD=$ac_cv_search_sched_yield
Packit fc043f
                  config_libs="$config_libs $LIB_SCHED_YIELD"
Packit fc043f
                fi])
Packit fc043f
Packit fc043f
LIB_NETWORK=
Packit fc043f
AC_SUBST([LIB_NETWORK])
Packit fc043f
AC_SEARCH_LIBS([inet_addr], [nsl],
Packit fc043f
               [if test "$ac_cv_search_inet_addr" != "none required"; then
Packit fc043f
                  LIB_NETWORK=$ac_cv_search_inet_addr
Packit fc043f
                fi])
Packit fc043f
AC_SEARCH_LIBS([socket], [socket],
Packit fc043f
               [if test "$ac_cv_search_socket" != "none required"; then
Packit fc043f
                  LIB_NETWORK="$ac_cv_search_socket $LIB_NETWORK"
Packit fc043f
                fi], [], [$LIB_NETWORK])
Packit fc043f
if test "x$LIB_NETWORK" != x; then
Packit fc043f
  config_libs="$config_libs $LIB_NETWORK"
Packit fc043f
fi
Packit fc043f
Packit fc043f
# Check for optional readline support
Packit fc043f
GNUPG_CHECK_READLINE
Packit fc043f
Packit fc043f
Packit fc043f
#
Packit fc043f
# Prepare building of estream
Packit fc043f
#
Packit fc043f
estream_INIT
Packit fc043f
Packit fc043f
#
Packit fc043f
# Substitution used for gpg-error-config
Packit fc043f
#
Packit fc043f
GPG_ERROR_CONFIG_LIBS="$config_libs"
Packit fc043f
if test "x$LIBTHREAD" != x; then
Packit fc043f
  GPG_ERROR_CONFIG_LIBS="${GPG_ERROR_CONFIG_LIBS} ${LIBTHREAD}"
Packit fc043f
fi
Packit fc043f
if test "x$LIBMULTITHREAD" != x; then
Packit fc043f
  GPG_ERROR_CONFIG_MT_LIBS="${LIBMULTITHREAD}"
Packit fc043f
else
Packit fc043f
  GPG_ERROR_CONFIG_MT_LIBS=""
Packit fc043f
fi
Packit fc043f
GPG_ERROR_CONFIG_CFLAGS=""
Packit fc043f
if test "x$THREADLIB_CPPFLAGS" != x; then
Packit fc043f
  GPG_ERROR_CONFIG_MT_CFLAGS="${THREADLIB_CPPFLAGS}"
Packit fc043f
else
Packit fc043f
  GPG_ERROR_CONFIG_MT_CFLAGS=""
Packit fc043f
fi
Packit fc043f
GPG_ERROR_CONFIG_ISUBDIRAFTER=""
Packit fc043f
GPG_ERROR_CONFIG_HOST="$host"
Packit fc043f
AC_SUBST(GPG_ERROR_CONFIG_LIBS)
Packit fc043f
AC_SUBST(GPG_ERROR_CONFIG_CFLAGS)
Packit fc043f
AC_SUBST(GPG_ERROR_CONFIG_MT_LIBS)
Packit fc043f
AC_SUBST(GPG_ERROR_CONFIG_MT_CFLAGS)
Packit fc043f
AC_SUBST(GPG_ERROR_CONFIG_ISUBDIRAFTER)
Packit fc043f
AC_SUBST(GPG_ERROR_CONFIG_HOST)
Packit fc043f
Packit fc043f
Packit fc043f
#
Packit fc043f
# Special defines for certain platforms
Packit fc043f
#
Packit fc043f
force_use_syscfg=no
Packit fc043f
if test "$have_w32_system" = yes; then
Packit fc043f
    AC_DEFINE(HAVE_W32_SYSTEM,1,[Defined if we run on a W32 API based system])
Packit fc043f
    if test "$have_w64_system" = yes; then
Packit fc043f
      AC_DEFINE(HAVE_W64_SYSTEM,1,[Defined if we run on 64 bit W32 API system])
Packit fc043f
    fi
Packit fc043f
    if test "$have_w32ce_system" = yes; then
Packit fc043f
      AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
Packit fc043f
      GPG_ERROR_CONFIG_ISUBDIRAFTER="gpg-extra"
Packit fc043f
    fi
Packit fc043f
    force_use_syscfg=yes
Packit fc043f
fi
Packit fc043f
if test x$cross_compiling = xyes; then
Packit fc043f
    force_use_syscfg=yes
Packit fc043f
fi
Packit fc043f
Packit fc043f
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
Packit fc043f
AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
Packit fc043f
AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
Packit fc043f
AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
Packit fc043f
AM_CONDITIONAL(FORCE_USE_SYSCFG, test x$force_use_syscfg = xyes)
Packit fc043f
Packit fc043f
AC_DEFINE_UNQUOTED(HOST_TRIPLET_STRING, "$host", [The host triplet])
Packit fc043f
Packit fc043f
Packit fc043f
#
Packit fc043f
# gpgrt_log_clock may require linking with extra libaries.  As long as
Packit fc043f
# we don't have a good test for this we require the use of this
Packit fc043f
# configure option to enabling printing of a timestamp.
Packit fc043f
#
Packit fc043f
AC_MSG_CHECKING([whether to enable log_clock])
Packit fc043f
AC_ARG_ENABLE(log_clock,
Packit fc043f
              AC_HELP_STRING([--enable-log-clock],
Packit fc043f
                             [enable log_clock timestamps]),
Packit fc043f
              enable_log_clock=$enableval, enable_log_clock=no)
Packit fc043f
AC_MSG_RESULT($enable_log_clock)
Packit fc043f
if test "$enable_log_clock" = yes ; then
Packit fc043f
  AC_DEFINE(ENABLE_LOG_CLOCK,1,[Defined to use log_clock timestamps])
Packit fc043f
fi
Packit fc043f
Packit fc043f
#
Packit fc043f
# For now we do not build gpgscm by default.
Packit fc043f
# Eventually we will reverse the meaning of that option.
Packit fc043f
#
Packit fc043f
build_gpgscm=no
Packit fc043f
#AC_MSG_CHECKING([whether to build gpgscm])
Packit fc043f
#AC_ARG_ENABLE(gpgscm,
Packit fc043f
#              AC_HELP_STRING([--enable-gpgscm],
Packit fc043f
#                             [build the gpgscm tool]),
Packit fc043f
#              build_gpgscm=$enableval, build_gpgscm=no)
Packit fc043f
#AC_MSG_RESULT($build_gpgscm)
Packit fc043f
AM_CONDITIONAL([BUILD_GPGSCM], [test "x$build_gpgscm" != xno])
Packit fc043f
Packit fc043f
Packit fc043f
#
Packit fc043f
# Add -Werror to CFLAGS.  This hack can be used to avoid problems with
Packit fc043f
# misbehaving autoconf tests in case the user supplied -Werror.
Packit fc043f
#
Packit fc043f
AC_ARG_ENABLE(werror,
Packit fc043f
   AC_HELP_STRING([--enable-werror],
Packit fc043f
                  [append -Werror to CFLAGS]),
Packit fc043f
                  [if test $enableval = yes ; then
Packit fc043f
                      CFLAGS="$CFLAGS -Werror"
Packit fc043f
                   fi])
Packit fc043f
Packit fc043f
Packit fc043f
#
Packit fc043f
# Provide information about the build.
Packit fc043f
#
Packit fc043f
BUILD_REVISION="mym4_revision"
Packit fc043f
AC_SUBST(BUILD_REVISION)
Packit fc043f
AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
Packit fc043f
                   [GIT commit id revision used to build this package])
Packit fc043f
Packit fc043f
changequote(,)dnl
Packit fc043f
BUILD_VERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./'`
Packit fc043f
changequote([,])dnl
Packit fc043f
BUILD_VERSION="${BUILD_VERSION}0.mym4_revision_dec"
Packit fc043f
BUILD_FILEVERSION=`echo "${BUILD_VERSION}" | tr . ,`
Packit fc043f
AC_SUBST(BUILD_VERSION)
Packit fc043f
AC_SUBST(BUILD_FILEVERSION)
Packit fc043f
Packit fc043f
AC_ARG_ENABLE([build-timestamp],
Packit fc043f
  AC_HELP_STRING([--enable-build-timestamp],
Packit fc043f
                 [set an explicit build timestamp for reproducibility.
Packit fc043f
                  (default is the current time in ISO-8601 format)]),
Packit fc043f
     [if test "$enableval" = "yes"; then
Packit fc043f
        BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
Packit fc043f
      else
Packit fc043f
        BUILD_TIMESTAMP="$enableval"
Packit fc043f
      fi],
Packit fc043f
     [BUILD_TIMESTAMP="<none>"])
Packit fc043f
AC_SUBST(BUILD_TIMESTAMP)
Packit fc043f
AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
Packit fc043f
                   [The time this package was configured for a build])
Packit fc043f
Packit fc043f
Packit fc043f
Packit fc043f
AC_ARG_ENABLE(languages, AC_HELP_STRING([--disable-languages],
Packit fc043f
                        [do not build support for other languages than C]))
Packit fc043f
AM_CONDITIONAL([LANGUAGES_SOME], [test "x$enable_languages" != xno])
Packit fc043f
Packit fc043f
build_doc=yes
Packit fc043f
AC_ARG_ENABLE([doc], AC_HELP_STRING([--disable-doc],
Packit fc043f
                                    [do not build the documentation]),
Packit fc043f
                     build_doc=$enableval, build_doc=yes)
Packit fc043f
AM_CONDITIONAL([BUILD_DOC], [test "x$build_doc" != xno])
Packit fc043f
Packit fc043f
build_tests=yes
Packit fc043f
AC_ARG_ENABLE([tests], AC_HELP_STRING([--disable-tests],
Packit fc043f
                                    [do not build the tests]),
Packit fc043f
                     build_tests=$enableval, build_tests=yes)
Packit fc043f
AM_CONDITIONAL([BUILD_TESTS], [test "x$build_tests" != xno])
Packit fc043f
Packit fc043f
#
Packit fc043f
# Substitution
Packit fc043f
#
Packit fc043f
AC_CONFIG_FILES([Makefile])
Packit fc043f
AC_CONFIG_FILES([doc/Makefile po/Makefile.in m4/Makefile])
Packit fc043f
AC_CONFIG_FILES([src/Makefile tests/Makefile])
Packit fc043f
AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd])
Packit fc043f
AC_CONFIG_FILES([src/versioninfo.rc src/gpg-error.w32-manifest])
Packit fc043f
AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config])
Packit fc043f
Packit fc043f
AC_OUTPUT
Packit fc043f
Packit fc043f
tmp=
Packit fc043f
if test "$have_w32_system" != yes; then
Packit fc043f
   if test x"$gl_use_threads" = xno; then
Packit fc043f
     tmp=" NO-THREADS"
Packit fc043f
   fi
Packit fc043f
fi
Packit fc043f
echo "
Packit fc043f
        $PACKAGE_NAME v$PACKAGE_VERSION has been configured as follows:
Packit fc043f
Packit fc043f
        Revision: mym4_revision  (mym4_revision_dec)
Packit fc043f
        Platform: $host$tmp
Packit fc043f
"
Packit fc043f
if test "$gcry_cv_gcc_attribute_aligned" != "yes" ; then
Packit fc043f
cat <
Packit fc043f
***
Packit fc043f
***  Please note that your compiler does not support the GCC style
Packit fc043f
***  aligned attribute.  Using this software may evoke bus errors.
Packit fc043f
***
Packit fc043f
G10EOF
Packit fc043f
fi