Tizen 2.1 base
[external/libgpg-error.git] / configure.ac
1 # configure.ac for libgpg-error
2 # Copyright (C) 2003, 2004, 2006 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 Lesser General Public
17 # License along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
20 # (Process this file with autoconf to produce a configure script.)
21 # The following lines are used by ./autogen.sh.
22 AC_PREREQ(2.59)
23 min_automake_version="1.9.6"
24
25 # Remember to change the version number immediately *after* a release.
26 # Set my_issvn to "yes" for non-released code.  Remember to run an
27 # "svn up" and "autogen.sh" right before creating a distribution.
28 m4_define([my_version], [1.7])
29 m4_define([my_issvn], [no])
30
31 m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \
32           | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)]))
33 AC_INIT([libgpg-error], 
34         [my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision])],
35         [bug-gnupg@gnupg.org])
36 # LT Version numbers, remember to change them just *before* a release.
37 #   (Code changed:                      REVISION++)
38 #   (Interfaces added/removed/changed:  CURRENT++, REVISION=0)
39 #   (Interfaces added:                  AGE++)
40 #   (Interfaces removed:                AGE=0)
41 # Note that added error codes don't constitute an interface change.
42 LIBGPG_ERROR_LT_CURRENT=5
43 LIBGPG_ERROR_LT_AGE=5
44 LIBGPG_ERROR_LT_REVISION=0
45 AC_SUBST(LIBGPG_ERROR_LT_CURRENT)
46 AC_SUBST(LIBGPG_ERROR_LT_AGE)
47 AC_SUBST(LIBGPG_ERROR_LT_REVISION)
48
49 AM_INIT_AUTOMAKE
50 AM_MAINTAINER_MODE
51 AC_CONFIG_SRCDIR([src/err-sources.h.in])
52 AC_CONFIG_HEADER([config.h])
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_LIBTOOL_WIN32_DLL
66 AC_LIBTOOL_RC
67 AC_GNU_SOURCE
68
69 AC_PROG_LIBTOOL
70
71 # We need to compile and run a program on the build machine.
72 dnl The AC_PROG_CC_FOR_BUILD macro in the AC archive is broken for
73 dnl autoconf 2.57.
74 dnl AC_PROG_CC_FOR_BUILD
75 AC_MSG_CHECKING(for cc for build)
76 if test "$cross_compiling" = "yes"; then
77   CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
78 else
79   CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
80 fi
81 AC_MSG_RESULT($CC_FOR_BUILD)
82 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
83
84
85 # Set some internal variables depending on the platform for later use.
86 have_w32_system=no
87 case "${host}" in
88     *-mingw32*)
89         have_w32_system=yes
90         ;;
91     *)
92        ;;
93 esac
94
95
96 AH_BOTTOM([
97 /* Force using of NLS for W32 even if no libintl has been found.  This is 
98    okay because we have our own gettext implementation for W32.  */
99 #if defined(HAVE_W32_SYSTEM) && !defined(ENABLE_NLS)
100 #define ENABLE_NLS 1
101 #endif
102 ])
103
104
105 # Note, that autogen.sh greps for the next line.
106 AM_GNU_GETTEXT_VERSION([0.15])
107 AM_GNU_GETTEXT([external])
108
109 # Checks for header files.
110 AC_HEADER_STDC
111 AC_CHECK_HEADERS([stdlib.h locale.h])
112 AC_FUNC_STRERROR_R
113 case "${host_os}" in
114      solaris*)
115      # All versions of Solaris from 2.4 have a thread-safe strerror().
116      # Since Solaris 10, in addition strerror_r() exists.
117      ;;
118      *)
119      AC_CHECK_FUNC([strerror_r], [],
120 AC_MSG_WARN([[Without strerror_r, gpg_strerror_r might not be thread-safe]]))
121      ;;
122 esac
123
124 # Checks for typedefs, structures, and compiler characteristics.
125 AC_C_CONST
126
127 # Substitution used for gpg-error-config
128 GPG_ERROR_CONFIG_LIBS="-lgpg-error"
129 GPG_ERROR_CONFIG_CFLAGS=""
130 AC_SUBST(GPG_ERROR_CONFIG_LIBS)
131 AC_SUBST(GPG_ERROR_CONFIG_CFLAGS)
132 AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config])
133
134
135 # Special defines for certain platforms
136 if test "$have_w32_system" = yes; then
137     AC_DEFINE(HAVE_W32_SYSTEM,1,[Defined if we run on a W32 API based system])
138     BUILD_TIMESTAMP=`date --iso-8601=minutes`
139     AC_SUBST(BUILD_TIMESTAMP)
140     changequote(,)dnl 
141     BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
142     changequote([,])dnl
143     case "$VERSION" in
144       *-svn*) BUILD_FILEVERSION="${BUILD_FILEVERSION}0,0" ;;
145       *-cvs)  BUILD_FILEVERSION="${BUILD_FILEVERSION}0,0" ;;
146       *-rc*)  BUILD_FILEVERSION="${BUILD_FILEVERSION}0,1" ;;
147       *)      BUILD_FILEVERSION="${BUILD_FILEVERSION}0,2" ;;
148     esac
149 fi
150 AC_SUBST(BUILD_TIMESTAMP)
151 AC_SUBST(BUILD_FILEVERSION)
152 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
153
154
155 AC_ARG_ENABLE(languages,
156 [  --disable-languages     do not build support for other languages than C])
157 AM_CONDITIONAL([LANGUAGES_SOME], [test "x$enable_languages" != xno])
158
159
160
161 # Substitution
162 AC_CONFIG_FILES([Makefile])
163 AC_CONFIG_FILES([po/Makefile.in m4/Makefile])
164 AC_CONFIG_FILES([src/Makefile tests/Makefile])
165 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd])
166 AC_CONFIG_FILES([src/versioninfo.rc])
167
168 AC_OUTPUT
169
170 echo "
171         Libgpg-error v${VERSION} has been configured as follows:
172         
173         Platform:  $host
174
175 "