release 0.2.9
[gnupg.git] / configure.in
1 dnl
2 dnl Configure template for GNUPG
3 dnl
4 dnl (Process this file with autoconf to produce a configure script.)
5
6 AC_INIT(g10/g10.c)
7 AC_CONFIG_AUX_DIR(scripts)
8 AM_CONFIG_HEADER(config.h)
9
10
11 if test "x$exec_prefix" = xNONE ; then
12     if test "x$prefix" = xNONE ; then
13         g10_prefix="$ac_default_prefix"
14     else
15         g10_prefix="$prefix"
16     fi
17 else
18     g10_prefix="$exec_prefix"
19 fi
20
21
22 VERSION=`cat $srcdir/VERSION`
23 PACKAGE=gnupg
24 ALL_LINGUAS="de"
25 AC_SUBST(VERSION)
26 AC_SUBST(PACKAGE)
27 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
28 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
29
30 AC_ARG_ENABLE(m-debug,
31 [  --enable-m-debug       Enable debugging of memory allocation])
32 if test "$enableval" = y || test "$enableval" = yes; then
33     AC_DEFINE(M_DEBUG)
34 fi
35
36 AC_ARG_WITH(zlib,
37 [  --with-zlib            link against static zlib],
38 [g10_force_zlib=yes], [g10_force_zlib=no] )
39
40 CFLAGS="-g -Wall"
41
42
43
44 AC_CANONICAL_SYSTEM
45 WK_CHECK_CACHE
46
47 dnl Checks for programs.
48
49 AC_PROG_MAKE_SET
50 AC_ARG_PROGRAM
51
52 missing_dir=`cd $ac_aux_dir && pwd`
53 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
54 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
55 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
56 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
57 dnl AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
58 AC_ISC_POSIX
59
60 case "${target}" in
61     i386--mingw32)
62         # special stuff for Windoze NT
63         cross_compiling=yes
64         CC="i386--mingw32-gcc"
65         CPP="i386--mingw32-gcc -E"
66         RANLIB="i386--mingw32-ranlib"
67         ac_cv_have_dev_random=no
68         PRINTABLE_OS_NAME="MingW32"
69         ;;
70     *)
71 AC_PROG_RANLIB
72 AC_PROG_INSTALL
73 AC_PROG_CC
74 AC_PROG_CPP
75         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
76        ;;
77 esac
78 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME")
79
80 dnl Checks for libraries.
81
82 dnl Checks for header files.
83 AC_HEADER_STDC
84 AC_CHECK_HEADERS(unistd.h)
85
86 G10_LOCALEDIR="$g10_prefix/$DATADIRNAME/locale"
87 AC_SUBST(G10_LOCALEDIR)
88 AC_DEFINE_UNQUOTED(G10_LOCALEDIR, "$G10_LOCALEDIR")
89
90
91 dnl Checks for typedefs, structures, and compiler characteristics.
92 AC_C_CONST
93 AC_C_INLINE
94 AC_TYPE_SIZE_T
95
96 WK_CHECK_ENDIAN
97
98
99 WK_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
100 WK_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
101 WK_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
102 WK_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
103 WK_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
104
105 AC_CHECK_SIZEOF(unsigned short, 2)
106 AC_CHECK_SIZEOF(unsigned int, 4)
107 AC_CHECK_SIZEOF(unsigned long, 4)
108
109 if test "$ac_cv_sizeof_unsigned_short" = "0" \
110    || test "$ac_cv_sizeof_unsigned_int" = "0" \
111    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
112     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
113 fi
114
115
116
117 dnl Checks for library functions.
118 AC_FUNC_VPRINTF
119 AC_CHECK_FUNCS(strerror stpcpy strlwr tcgetattr rand strtoul mlock mmap)
120
121
122
123
124 dnl check wether we have a random device
125 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
126 [if test -c /dev/random && test -c /dev/urandom ; then
127   ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
128 if test "$ac_cv_have_dev_random" = yes; then
129     AC_DEFINE(HAVE_DEV_RANDOM)
130 fi
131
132
133 dnl setup assembler stuff
134 AC_MSG_CHECKING(for mpi assembler functions)
135 if test -f $srcdir/mpi/config.links ; then
136     . $srcdir/mpi/config.links
137     WK_LINK_FILES($mpi_ln_src, $mpi_ln_dst)
138     ac_cv_mpi_extra_asm_modules="$mpi_extra_modules"
139     ac_cv_mpi_config_done="yes"
140     AC_MSG_RESULT(done)
141 else
142     AC_MSG_RESULT(failed)
143     AC_MSG_ERROR([mpi/config.links missing!])
144 fi
145 MPI_EXTRA_ASM_OBJS=""
146 if test "$ac_cv_mpi_extra_asm_modules" != ""; then
147 WK_MSG_PRINT([mpi extra asm functions:])
148 for i in $ac_cv_mpi_extra_asm_modules; do
149     WK_MSG_PRINT([$i])
150     MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.o"
151 done
152 AC_MSG_RESULT()
153 fi
154 AC_SUBST(MPI_EXTRA_ASM_OBJS)
155
156 dnl Do we have zlib? Must do it here because Solaris failed
157 dnl when compiling a conftest (due to the "-lz" from LIBS).
158 if test "$g10_force_zlib" = "yes"; then
159     ZLIBS="../zlib/libzlib.a"
160     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
161     WK_LINK_FILES(zlib/zlib.h, zlib.h )
162     WK_LINK_FILES(zlib/zconf.h, zconf.h )
163 else
164 AC_CHECK_HEADERS(zlib.h)
165 if test "$ac_cv_header_zlib_h" = yes ; then
166     LIBS="$LIBS -lz"
167     ZLIBS=
168     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
169 else
170     ZLIBS="../zlib/libzlib.a"
171     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
172     WK_LINK_FILES(zlib/zlib.h, zlib.h )
173     WK_LINK_FILES(zlib/zconf.h, zconf.h )
174 fi
175 fi
176 AC_SUBST(ZLIBS)
177
178
179 dnl checking whether we have other cipher source files
180 CIPHER_EXTRA_OBJS=""
181 CIPHER_EXTRA_DIST=""
182 AC_CACHE_CHECK(for extra cipher modules, ac_cv_have_rsa_cipher,
183 [if test -f $srcdir/cipher/rsa.c && test -f $srcdir/cipher/rsa.h; then
184   ac_cv_have_rsa_cipher=yes; else ac_cv_have_rsa_cipher=no; fi])
185 if test $ac_cv_have_rsa_cipher = yes; then
186     AC_DEFINE(HAVE_RSA_CIPHER)
187     CIPHER_EXTRA_OBJS="rsa.o"
188     CIPHER_EXTRA_DIST="rsa.c rsa.h"
189 fi
190 AC_SUBST(CIPHER_EXTRA_OBJS)
191 AC_SUBST(CIPHER_EXTRA_DIST)
192
193 AM_GNU_GETTEXT
194 WK_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl )
195
196 WK_DO_LINK_FILES
197
198 AC_OUTPUT([
199 Makefile
200 intl/Makefile
201 po/Makefile.in
202 util/Makefile
203 mpi/Makefile
204 cipher/Makefile
205 g10/Makefile
206 doc/Makefile
207 tools/Makefile
208 zlib/Makefile
209 checks/Makefile
210 ],[echo timestamp >stamp-h; sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
211