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