Imported Upstream version 1.10
[platform/upstream/libgpg-error.git] / configure.ac
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.
21 AC_PREREQ(2.59)
22 min_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.
27 m4_define([my_version], [1.10])
28 m4_define([my_issvn], [no])
29
30 m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \
31           | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)]))
32 AC_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.
41 LIBGPG_ERROR_LT_CURRENT=8
42 LIBGPG_ERROR_LT_AGE=8
43 LIBGPG_ERROR_LT_REVISION=0
44 AC_SUBST(LIBGPG_ERROR_LT_CURRENT)
45 AC_SUBST(LIBGPG_ERROR_LT_AGE)
46 AC_SUBST(LIBGPG_ERROR_LT_REVISION)
47
48 AM_INIT_AUTOMAKE
49 AM_MAINTAINER_MODE
50 AC_CONFIG_SRCDIR([src/err-sources.h.in])
51 AC_CONFIG_HEADER([config.h])
52 AC_CONFIG_MACRO_DIR([m4])
53
54 # We need to know about the host architecture to avoid spurious
55 # warnings.
56 AC_CANONICAL_HOST
57 AB_INIT
58
59 # Checks for programs.
60 AC_PROG_CC
61 AM_PROG_CC_C_O
62 AC_PROG_CPP
63 AC_PROG_AWK
64 AC_CHECK_TOOL(AR, ar, :)
65 AC_GNU_SOURCE
66
67 LT_PREREQ([2.2.6])
68 LT_INIT([win32-dll disable-static])
69 LT_LANG([Windows Resource])
70
71
72 # We need to compile and run a program on the build machine.
73 dnl The AC_PROG_CC_FOR_BUILD macro in the AC archive is broken for
74 dnl autoconf 2.57.
75 dnl AC_PROG_CC_FOR_BUILD
76 AC_MSG_CHECKING(for cc for build)
77 if test "$cross_compiling" = "yes"; then
78   CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
79 else
80   CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
81 fi
82 AC_MSG_RESULT($CC_FOR_BUILD)
83 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
84
85
86 # Set some internal variables depending on the platform for later use.
87 have_w32_system=no
88 have_w32ce_system=no
89 case "${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        ;;
99 esac
100
101
102 AH_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.
115 AM_GNU_GETTEXT_VERSION([0.17])
116 AM_GNU_GETTEXT([external])
117
118 # Checks for header files.
119 AC_HEADER_STDC
120 AC_CHECK_HEADERS([stdlib.h locale.h])
121 AC_FUNC_STRERROR_R
122 case "${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], [],
129 AC_MSG_WARN([[Without strerror_r, gpg_strerror_r might not be thread-safe]]))
130      ;;
131 esac
132
133 # Checks for typedefs, structures, and compiler characteristics.
134 AC_C_CONST
135
136 # Substitution used for gpg-error-config
137 GPG_ERROR_CONFIG_LIBS="-lgpg-error"
138 GPG_ERROR_CONFIG_CFLAGS=""
139 GPG_ERROR_CONFIG_ISUBDIRAFTER=""
140 AC_SUBST(GPG_ERROR_CONFIG_LIBS)
141 AC_SUBST(GPG_ERROR_CONFIG_CFLAGS)
142 AC_SUBST(GPG_ERROR_CONFIG_ISUBDIRAFTER)
143 AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config])
144
145
146 # Special defines for certain platforms
147 if 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
163 fi
164 AC_SUBST(BUILD_TIMESTAMP)
165 AC_SUBST(BUILD_FILEVERSION)
166 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
167 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
168
169
170 AC_ARG_ENABLE(languages,
171 [  --disable-languages     do not build support for other languages than C])
172 AM_CONDITIONAL([LANGUAGES_SOME], [test "x$enable_languages" != xno])
173
174
175 # Substitution
176 AC_CONFIG_FILES([Makefile])
177 AC_CONFIG_FILES([po/Makefile.in m4/Makefile])
178 AC_CONFIG_FILES([src/Makefile tests/Makefile])
179 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd])
180 AC_CONFIG_FILES([src/versioninfo.rc])
181
182 AC_OUTPUT
183
184 echo "
185         Libgpg-error v${VERSION} has been configured as follows:
186         
187         Platform:  $host
188
189 "