1# configure.ac for libgpg-error 2# Copyright (C) 2003, 2004, 2006, 2010 g10 Code GmbH 3# 4# This file is part of libgpg-error. 5# 6# libgpg-error is free software; you can redistribute it and/or modify 7# it under the terms of the GNU Lesser General Public License as 8# published by the Free Software Foundation; either version 2.1 of the 9# License, or (at your option) any later version. 10# 11# libgpg-error is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU Lesser General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program; if not, see <http://www.gnu.org/licenses/>. 18 19# (Process this file with autoconf to produce a configure script.) 20# The following lines are used by ./autogen.sh. 21AC_PREREQ(2.59) 22min_automake_version="1.9.6" 23 24# Remember to change the version number immediately *after* a release. 25# Set my_issvn to "yes" for non-released code. Remember to run an 26# "svn up" and "autogen.sh" right before creating a distribution. 27m4_define([my_version], [1.10]) 28m4_define([my_issvn], [no]) 29 30m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \ 31 | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)])) 32AC_INIT([libgpg-error], 33 [my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision])], 34 [bug-gnupg@gnupg.org]) 35# LT Version numbers, remember to change them just *before* a release. 36# (Code changed: REVISION++) 37# (Interfaces added/removed/changed: CURRENT++, REVISION=0) 38# (Interfaces added: AGE++) 39# (Interfaces removed: AGE=0) 40# Note that added error codes don't constitute an interface change. 41LIBGPG_ERROR_LT_CURRENT=8 42LIBGPG_ERROR_LT_AGE=8 43LIBGPG_ERROR_LT_REVISION=0 44AC_SUBST(LIBGPG_ERROR_LT_CURRENT) 45AC_SUBST(LIBGPG_ERROR_LT_AGE) 46AC_SUBST(LIBGPG_ERROR_LT_REVISION) 47 48AM_INIT_AUTOMAKE 49AM_MAINTAINER_MODE 50AC_CONFIG_SRCDIR([src/err-sources.h.in]) 51AC_CONFIG_HEADER([config.h]) 52AC_CONFIG_MACRO_DIR([m4]) 53 54# We need to know about the host architecture to avoid spurious 55# warnings. 56AC_CANONICAL_HOST 57AB_INIT 58 59# Checks for programs. 60AC_PROG_CC 61AM_PROG_CC_C_O 62AC_PROG_CPP 63AC_PROG_AWK 64AC_CHECK_TOOL(AR, ar, :) 65AC_GNU_SOURCE 66 67LT_PREREQ([2.2.6]) 68LT_INIT([win32-dll disable-static]) 69LT_LANG([Windows Resource]) 70 71 72# We need to compile and run a program on the build machine. 73dnl The AC_PROG_CC_FOR_BUILD macro in the AC archive is broken for 74dnl autoconf 2.57. 75dnl AC_PROG_CC_FOR_BUILD 76AC_MSG_CHECKING(for cc for build) 77if test "$cross_compiling" = "yes"; then 78 CC_FOR_BUILD="${CC_FOR_BUILD-cc}" 79else 80 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}" 81fi 82AC_MSG_RESULT($CC_FOR_BUILD) 83AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler]) 84 85 86# Set some internal variables depending on the platform for later use. 87have_w32_system=no 88have_w32ce_system=no 89case "${host}" in 90 *-mingw32ce*) 91 have_w32_system=yes 92 have_w32ce_system=yes 93 ;; 94 *-mingw32*) 95 have_w32_system=yes 96 ;; 97 *) 98 ;; 99esac 100 101 102AH_BOTTOM([ 103/* Force using of NLS for W32 even if no libintl has been found. This is 104 okay because we have our own gettext implementation for W32. */ 105#if defined(HAVE_W32_SYSTEM) && !defined(ENABLE_NLS) 106#define ENABLE_NLS 1 107#endif 108/* For building we need to define these macro. */ 109#define GPG_ERR_ENABLE_GETTEXT_MACROS 1 110#define GPG_ERR_ENABLE_ERRNO_MACROS 1 111]) 112 113 114# Note, that autogen.sh greps for the next line. 115AM_GNU_GETTEXT_VERSION([0.17]) 116AM_GNU_GETTEXT([external]) 117 118# Checks for header files. 119AC_HEADER_STDC 120AC_CHECK_HEADERS([stdlib.h locale.h]) 121AC_FUNC_STRERROR_R 122case "${host_os}" in 123 solaris*) 124 # All versions of Solaris from 2.4 have a thread-safe strerror(). 125 # Since Solaris 10, in addition strerror_r() exists. 126 ;; 127 *) 128 AC_CHECK_FUNC([strerror_r], [], 129AC_MSG_WARN([[Without strerror_r, gpg_strerror_r might not be thread-safe]])) 130 ;; 131esac 132 133# Checks for typedefs, structures, and compiler characteristics. 134AC_C_CONST 135 136# Substitution used for gpg-error-config 137GPG_ERROR_CONFIG_LIBS="-lgpg-error" 138GPG_ERROR_CONFIG_CFLAGS="" 139GPG_ERROR_CONFIG_ISUBDIRAFTER="" 140AC_SUBST(GPG_ERROR_CONFIG_LIBS) 141AC_SUBST(GPG_ERROR_CONFIG_CFLAGS) 142AC_SUBST(GPG_ERROR_CONFIG_ISUBDIRAFTER) 143AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config]) 144 145 146# Special defines for certain platforms 147if test "$have_w32_system" = yes; then 148 AC_DEFINE(HAVE_W32_SYSTEM,1,[Defined if we run on a W32 API based system]) 149 if test "$have_w32ce_system" = yes; then 150 AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE]) 151 GPG_ERROR_CONFIG_ISUBDIRAFTER="gpg-extra" 152 fi 153 BUILD_TIMESTAMP=`date --iso-8601=minutes` 154 changequote(,)dnl 155 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'` 156 changequote([,])dnl 157 case "$VERSION" in 158 *-svn*) BUILD_FILEVERSION="${BUILD_FILEVERSION}0,0" ;; 159 *-cvs) BUILD_FILEVERSION="${BUILD_FILEVERSION}0,0" ;; 160 *-rc*) BUILD_FILEVERSION="${BUILD_FILEVERSION}0,1" ;; 161 *) BUILD_FILEVERSION="${BUILD_FILEVERSION}0,2" ;; 162 esac 163fi 164AC_SUBST(BUILD_TIMESTAMP) 165AC_SUBST(BUILD_FILEVERSION) 166AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes) 167AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes) 168 169 170AC_ARG_ENABLE(languages, 171[ --disable-languages do not build support for other languages than C]) 172AM_CONDITIONAL([LANGUAGES_SOME], [test "x$enable_languages" != xno]) 173 174 175# Substitution 176AC_CONFIG_FILES([Makefile]) 177AC_CONFIG_FILES([po/Makefile.in m4/Makefile]) 178AC_CONFIG_FILES([src/Makefile tests/Makefile]) 179AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd]) 180AC_CONFIG_FILES([src/versioninfo.rc]) 181 182AC_OUTPUT 183 184echo " 185 Libgpg-error v${VERSION} has been configured as follows: 186 187 Platform: $host 188 189" 190