6c380a1408b1630a5acb084e8e8f5c55921c7d02
[gpgol.git] / configure.ac
1 # configure.ac - for GPGol
2 # Copyright (C) 2005 g10 Code GmbH
3 #
4 # This file is free software; as a special exception the author gives
5 # unlimited permission to copy and/or distribute it, with or without
6 # modifications, as long as this notice is preserved.
7 #
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
12 # Process this file with autoconf to produce a configure script.
13 AC_PREREQ(2.59)
14 min_automake_version="1.9.4"
15
16 # Version number: Remember to change it immediately *after* a release.
17 #                 Make sure to run  "svn up" before a "make dist".
18 #                 Add a "-cvs" prefix for non-released code.
19 AC_INIT(gpgol, 0.9.4-cvs, bug-gpgol@g10code.com)
20
21 NEED_GPGME_API=1
22 NEED_GPGME_VERSION=1.1.0
23
24
25 PACKAGE=$PACKAGE_NAME
26 PACKAGE_GT=${PACKAGE_NAME}
27 VERSION=$PACKAGE_VERSION
28
29 AC_CONFIG_SRCDIR(src/gpgol.def)
30 AM_CONFIG_HEADER(config.h)
31 AC_CANONICAL_TARGET()
32 AM_INIT_AUTOMAKE
33
34 AC_GNU_SOURCE
35
36 AC_SUBST(PACKAGE)
37 AC_SUBST(PACKAGE_GT)
38 AC_SUBST(VERSION)
39 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
40 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
41                                 [Name of this package for gettext])
42 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
43 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
44                                         [Bug report address])
45 AC_DEFINE_UNQUOTED(NEED_GPGME_VERSION, "$NEED_GPGME_VERSION",
46                                        [Required version of GPGME])
47
48
49 BUILD_TIMESTAMP=`date --iso-8601=minutes`
50 AC_SUBST(BUILD_TIMESTAMP)
51 changequote(,)dnl
52 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
53 tmp="`echo '$Revision$' | sed 's/[^0-9]//g'`"
54 changequote([,])dnl
55 test -z "$tmp" && tmp="0"
56 BUILD_FILEVERSION="${BUILD_FILEVERSION}$tmp"
57 AC_SUBST(BUILD_FILEVERSION)
58
59
60 AH_BOTTOM([
61 /* Some global constants. */
62
63
64 ])
65
66 AM_MAINTAINER_MODE
67
68 # Checks for programs.
69 AC_PROG_MAKE_SET
70 AM_SANITY_CHECK
71 missing_dir=`cd $ac_aux_dir && pwd`
72 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
73 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
74 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
75 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
76 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
77 AC_PROG_AWK
78 AC_PROG_CC
79 AC_PROG_CPP
80 AC_PROG_CXX
81 AC_PROG_INSTALL
82 AC_PROG_LN_S
83 AC_PROG_MAKE_SET
84 AC_PROG_RANLIB
85 AC_CHECK_TOOL(AR, ar, :)
86 AC_CHECK_TOOL(DLLTOOL, dlltool, :)
87 AC_CHECK_TOOL(WINDRES, windres, :)
88
89
90 try_gettext=yes
91 have_dosish_system=no
92 have_w32_system=no
93 case "${host}" in
94     *-mingw32*)
95         # special stuff for Windoze NT
96         ac_cv_have_dev_random=no
97         AC_DEFINE(USE_ONLY_8DOT3,1,
98                   [set this to limit filenames to the 8.3 format])
99         AC_DEFINE(HAVE_DRIVE_LETTERS,1,
100                   [defined if we must run on a stupid file system])
101         AC_DEFINE(USE_SIMPLE_GETTEXT,1,
102                   [because the Unix gettext has too much overhead on
103                    MingW32 systems and these systems lack Posix functions,
104                    we use a simplified version of gettext])
105         have_dosish_system=yes
106         have_w32_system=yes
107         try_gettext="no"
108         ;;
109     *)
110     AC_MSG_ERROR([[
111 ***
112 *** This software my only be build for W32 systems.  Use
113 ***     ./autogen.sh --build-w32
114 *** to prepare it for such a build.
115 ***]])
116        ;;
117 esac
118
119 if test "$have_dosish_system" = yes; then
120    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
121              [Defined if we run on some of the PCDOS like systems
122               (DOS, Windoze. OS/2) with special properties like
123               no file modes])
124 fi
125 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
126
127 if test "$have_w32_system" = yes; then
128    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
129 fi
130 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
131
132
133
134 #
135 # Checks for libraries.
136 #
137
138
139 AM_PATH_GPGME("$NEED_GPGME_API:$NEED_GPGME_VERSION",
140                have_gpgme=yes,have_gpgme=no)
141 AM_PATH_GPG_ERROR(0.5,, AC_MSG_ERROR([libgpg-error was not found]))
142
143
144 # Checks for header files.
145 AC_HEADER_STDC
146 AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h)
147
148 AC_CHECK_FUNCS(stpcpy)
149
150 # Checks for typedefs, structures, and compiler characteristics.
151 AC_C_CONST
152 AC_C_INLINE
153 AC_TYPE_SIZE_T
154 AC_TYPE_SIGNAL
155
156 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
157
158 # Add some extra libs here so that previous tests don't fail for
159 # mysterious reasons - the final link step should bail out.
160 if test "$have_w32_system" = yes; then
161    W32LIBS="-lwsock32"
162 fi
163
164 if test "$GCC" = yes; then
165     CFLAGS="$CFLAGS -Wall -mms-bitfields"
166     CXXFLAGS="$CXXFLAGS -Wall -mms-bitfields"
167     if test "$USE_MAINTAINER_MODE" = "yes"; then
168         CFLAGS="$CFLAGS -Wcast-align -Wshadow -Wstrict-prototypes"
169         CFLAGS="$CFLAGS -Wno-format-y2k -Wformat-security"
170         CXXFLAGS="$CXXFLAGS -Wcast-align -Wshadow"
171         CXXFLAGS="$CXXFLAGS -Wno-format-y2k -Wformat-security"
172     fi
173 fi
174
175 AC_SUBST(W32LIBS)
176
177
178
179 #
180 # Print errors here so that they are visible all
181 # together and the user can acquire them all together.
182 #
183 die=no
184 if test "$have_gpgme" = "no"; then
185    die=yes
186    AC_MSG_NOTICE([[
187 ***  
188 *** You need gpgme to build this program.
189 **  This library is for example available at
190 ***   ftp://ftp.gnupg.org/gcrypt/gpgme/
191 *** (at least version $NEED_GPGME_VERSION is required.)
192 ***]])
193 fi
194 if test "$die" = "yes"; then
195     AC_MSG_ERROR([[
196 ***
197 *** Required libraries not found. Please consult the above messages
198 *** and install them before running configure again.
199 ***]])
200 fi
201
202
203 AC_CONFIG_FILES([ Makefile
204 src/Makefile
205 src/versioninfo.rc        
206 ])
207 AC_OUTPUT