added revcation stuff and fixed a couple of bugs
[libgcrypt.git] / configure.in
1 dnl
2 dnl Configure template for G10
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=g10
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
59 case "${target}" in
60     i386--mingw32)
61         # special stuff for Windoze NT
62         cross_compiling=yes
63         CC="i386--mingw32-gcc"
64         CPP="i386--mingw32-gcc -E"
65         RANLIB="i386--mingw32-ranlib"
66         ac_cv_have_dev_random=no
67         PRINTABLE_OS_NAME="MingW32"
68         ;;
69     *)
70 AC_PROG_RANLIB
71 AC_PROG_INSTALL
72 AC_PROG_CC
73 AC_PROG_CPP
74         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
75        ;;
76 esac
77 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME")
78
79 dnl Checks for libraries.
80
81 dnl Checks for header files.
82 AC_HEADER_STDC
83 AC_CHECK_HEADERS(unistd.h)
84
85 AM_GNU_GETTEXT
86 G10_LOCALEDIR="$g10_prefix/$DATADIRNAME/locale"
87 AC_SUBST(G10_LOCALEDIR)
88 AC_DEFINE_UNQUOTED(G10_LOCALEDIR, "$G10_LOCALEDIR")
89
90 WK_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl )
91
92 dnl Checks for typedefs, structures, and compiler characteristics.
93 AC_C_CONST
94 AC_C_INLINE
95 AC_TYPE_SIZE_T
96
97 WK_CHECK_ENDIAN
98
99
100 WK_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
101 WK_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
102 WK_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
103 WK_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
104 WK_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
105
106 AC_CHECK_SIZEOF(unsigned short, 2)
107 AC_CHECK_SIZEOF(unsigned int, 4)
108 AC_CHECK_SIZEOF(unsigned long, 4)
109
110 if test "$ac_cv_sizeof_unsigned_short" = "0" \
111    || test "$ac_cv_sizeof_unsigned_int" = "0" \
112    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
113     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
114 fi
115
116
117
118 dnl Checks for library functions.
119 AC_FUNC_VPRINTF
120 AC_CHECK_FUNCS(strerror stpcpy strlwr tcgetattr rand strtoul mlock mmap)
121
122
123
124
125 dnl check wether we have a random device
126 AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
127 [if test -c /dev/random && test -c /dev/urandom ; then
128   ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
129 if test "$ac_cv_have_dev_random" = yes; then
130     AC_DEFINE(HAVE_DEV_RANDOM)
131 fi
132
133
134 dnl setup assembler stuff
135 AC_MSG_CHECKING(for mpi assembler functions)
136 if test -f $srcdir/mpi/config.links ; then
137     . $srcdir/mpi/config.links
138     WK_LINK_FILES($mpi_ln_src, $mpi_ln_dst)
139     ac_cv_mpi_extra_asm_modules="$mpi_extra_modules"
140     ac_cv_mpi_config_done="yes"
141     AC_MSG_RESULT(done)
142 else
143     AC_MSG_RESULT(failed)
144     AC_MSG_ERROR([mpi/config.links missing!])
145 fi
146 MPI_EXTRA_ASM_OBJS=""
147 if test "$ac_cv_mpi_extra_asm_modules" != ""; then
148 WK_MSG_PRINT([mpi extra asm functions:])
149 for i in $ac_cv_mpi_extra_asm_modules; do
150     WK_MSG_PRINT([$i])
151     MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.o"
152 done
153 AC_MSG_RESULT()
154 fi
155 AC_SUBST(MPI_EXTRA_ASM_OBJS)
156
157 dnl Do we have zlib? Must do it here because Solaris failed
158 dnl when compiling a conftest (due to the "-lz" from LIBS).
159 if test "$g10_force_zlib" = "yes"; then
160     ZLIBS="../zlib/libzlib.a"
161     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
162     WK_LINK_FILES(zlib/zlib.h, zlib.h )
163     WK_LINK_FILES(zlib/zconf.h, zconf.h )
164 else
165 AC_CHECK_HEADERS(zlib.h)
166 if test "$ac_cv_header_zlib_h" = yes ; then
167     LIBS="$LIBS -lz"
168     ZLIBS=
169     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
170 else
171     ZLIBS="../zlib/libzlib.a"
172     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
173     WK_LINK_FILES(zlib/zlib.h, zlib.h )
174     WK_LINK_FILES(zlib/zconf.h, zconf.h )
175 fi
176 fi
177 AC_SUBST(ZLIBS)
178
179
180 dnl checking whether we have other cipher source files
181 CIPHER_EXTRA_OBJS=""
182 CIPHER_EXTRA_DIST=""
183 AC_CACHE_CHECK(for extra cipher modules, ac_cv_have_rsa_cipher,
184 [if test -f $srcdir/cipher/rsa.c && test -f $srcdir/cipher/rsa.h; then
185   ac_cv_have_rsa_cipher=yes; else ac_cv_have_rsa_cipher=no; fi])
186 if test $ac_cv_have_rsa_cipher = yes; then
187     AC_DEFINE(HAVE_RSA_CIPHER)
188     CIPHER_EXTRA_OBJS="rsa.o"
189     CIPHER_EXTRA_DIST="rsa.c rsa.h"
190 fi
191 AC_SUBST(CIPHER_EXTRA_OBJS)
192 AC_SUBST(CIPHER_EXTRA_DIST)
193
194 dnl
195 dnl If no gettext is found, default to gnu gettext
196 dnl
197 if test x$ac_cv_func_gettext = xno; then
198     LIBS="$LIBS -lintl -L\$(topbuilddir)/intl"
199 fi
200
201
202 WK_DO_LINK_FILES
203
204 AC_OUTPUT([
205 Makefile
206 intl/Makefile
207 po/Makefile.in
208 util/Makefile
209 mpi/Makefile
210 cipher/Makefile
211 g10/Makefile
212 tools/Makefile
213 zlib/Makefile
214 ],[echo timestamp >stamp-h; sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
215