File: configure.in

package info (click to toggle)
integrit 2.03.02-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,328 kB
  • ctags: 555
  • sloc: ansic: 4,190; sh: 295; makefile: 257; perl: 224
file content (285 lines) | stat: -rw-r--r-- 9,189 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
dnl integrit - file integrity verification system    -*- m4 -*-
dnl Copyright (C) 2000, 2001 Ed L. Cashin
dnl 
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl as published by the Free Software Foundation; either version 2
dnl of the License, or (at your option) any later version.
dnl 
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl 
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
dnl 

dnl Process this file with autoconf to produce a configure script.

AC_INIT(elcwft.c)
AC_CONFIG_HEADER(config.h)

EXTRA_DEFS=${EXTRA_DEFS:-""}
CC=${CC:-"gcc"}
CFLAGS=${CFLAGS:-"-g -Wall -O2"}

# OBJ="main.o options.o xml.o show.o eachfile.o rules.o checkset.o missing.o utilities.o xstrdup.o xstradd.o elcerror.o cdb_put.o cdb_seq.o cdb_get.o elcwft.o cdb.o cdb_make.o cdb_hash.o packint.o gnupg/sha1.o gnupg/md5.o"
dnl
dnl These object files are the ones that don't go into "libintegrit.a".
dnl
dnl The library, libintegrit.a, is the way that integrit and the auxiliary
dnl tools share object code (as a convenience during the build).
dnl
OBJ="main.o options.o xml.o eachfile.o rules.o checkset.o missing.o xstrdup.o cdb_put.o cdb_get.o elcwft.o cdb.o cdb_make.o cdb_hash.o gnupg/md5.o"
ILIBOBJ="elcerror.o cdb_seq.o utilities.o xstradd.o show.o gnupg/sha1.o"

dnl ---------------- README IS THE DEFINITIVE PLACE TO SET THE VERSION NUMBER
INTEGRIT_VERSION=`sed -n 1p README | awk '{ print $3 }'`
dnl ---------------- 

dnl ---------- the C preprocessor value for INTEGRIT_VERSION must
dnl            be double-quoted
DQUOTE_INTEGRIT_VERSION='"'$INTEGRIT_VERSION'"'
AC_DEFINE_UNQUOTED(INTEGRIT_VERSION, $DQUOTE_INTEGRIT_VERSION)

dnl Checks for programs.
dnl AC_PROG_CXX
AC_PROG_CC
dnl AC_PROG_LEX
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_CACHE_SAVE

dnl ---------- let users override the install that configure finds
AC_ARG_WITH(install,
[  --with-install=INSTALL  manually specify a BSD-compatable install program])
if test "$with_install" != ""; then
	if test "`echo $with_install | sed 's/\(.\).*/\1/'`" != "/"; then
		echo configure Error: install program '"'$with_install'"' is not a full path 1>&2
		exit 1
	fi
	echo setting install program with $with_install
	INSTALL=$with_install
else
	AC_PROG_INSTALL
fi

dnl ---------- let ambitious users do ./configure --with-leakfind
dnl 
AC_ARG_WITH(leakfind,
[  --with-leakfind=DIR     use Boehm gc memory-leak detection (for developers)])

dnl Checks for libraries.

if test "$with_leakfind" != ""; then
	if test "`echo $with_leakfind | sed 's/\(.\).*/\1/'`" != "/"; then
		echo configure Error: gc source directory '"'$with_leakfind'"' is not a full path 1>&2
		exit 1
	fi
	LDFLAGS="$LDFLAGS -L $with_leakfind"
	AC_CHECK_LIB(gc, GC_gcollect, , [cat <<ELCEOF

       libgc - 
         Boehm garbage collection / leak detection library, not found

       Please install libgc.a or tell configure where to find it (see
         INSTALL).  Make sure libgc.a is installed for static linking.

       Otherwise compile without the "--with-leakfind=DIR" configure 
	 option.

       exiting.	

ELCEOF
exit 1
])
fi

AC_ARG_WITH(mmap_max,
[  --with-mmap-max=BYTES   biggest database that will be mmap-ed [BYTES=10485760]])
with_mmap_max=${with_mmap_max:-10485760}
echo using max size for mmap-ing known database: $with_mmap_max bytes
AC_DEFINE_UNQUOTED(CDB_MMAP_MAX, $with_mmap_max)

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
dnl AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h syslog.h unistd.h stdint.h inttypes.h)
AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h syslog.h unistd.h)
AC_CHECK_HEADER(stdint.h, have_stdint_h=yes, have_stdint_h=no)
AC_CHECK_HEADER(inttypes.h, have_inttypes_h=yes, have_inttypes_h=no)
if test "$have_stdint_h" = "no" && test "$have_inttypes_h" = "no"; then
  echo no system stdint.h or inttypes.h.  using stdint.h.in instead.
  cp stdint.h.in stdint.h
  AC_DEFINE(HAVE_STDINT_H)
fi

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_CACHE_SAVE

dnl ---------------- these low-level checks are needed by gnupg crypto
dnl                  and our own CDB stuff needs to know byte order
dnl
dnl                  the code up to "end gnupg configure.in" is from there
dnl

dnl ---- we need this to make CDB-format databases with little-endian numbers
dnl      the macro below is from gnupg
dnl
dnl GNUPG_CHECK_ENDIAN
dnl define either LITTLE_ENDIAN_HOST or BIG_ENDIAN_HOST
dnl
define(GNUPG_CHECK_ENDIAN,
  [ if test "$cross_compiling" = yes; then
        AC_MSG_WARN(cross compiling; assuming little endianess)
    fi
    AC_MSG_CHECKING(endianess)
    AC_CACHE_VAL(gnupg_cv_c_endian,
      [ gnupg_cv_c_endian=unknown
        # See if sys/param.h defines the BYTE_ORDER macro.
        AC_TRY_COMPILE([#include <sys/types.h>
        #include <sys/param.h>], [
        #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
         bogus endian macros
        #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
        AC_TRY_COMPILE([#include <sys/types.h>
        #include <sys/param.h>], [
        #if BYTE_ORDER != BIG_ENDIAN
         not big endian
        #endif], gnupg_cv_c_endian=big, gnupg_cv_c_endian=little)])
        if test "$gnupg_cv_c_endian" = unknown; then
            AC_TRY_RUN([main () {
              /* Are we little or big endian?  From Harbison&Steele.  */
              union
              {
                long l;
                char c[sizeof (long)];
              } u;
              u.l = 1;
              exit (u.c[sizeof (long) - 1] == 1);
              }],
              gnupg_cv_c_endian=little,
              gnupg_cv_c_endian=big,
              gnupg_cv_c_endian=little
            )
        fi
      ])
    AC_MSG_RESULT([$gnupg_cv_c_endian])
    if test "$gnupg_cv_c_endian" = little; then
      AC_DEFINE(LITTLE_ENDIAN_HOST)
    else
      AC_DEFINE(BIG_ENDIAN_HOST)
    fi
  ])
GNUPG_CHECK_ENDIAN

dnl GNUPG_CHECK_TYPEDEF(TYPE, HAVE_NAME)
dnl Check whether a typedef exists and create a #define $2 if it exists
dnl
AC_DEFUN(GNUPG_CHECK_TYPEDEF,
  [ AC_MSG_CHECKING(for $1 typedef)
    AC_CACHE_VAL(gnupg_cv_typedef_$1,
    [AC_TRY_COMPILE([#define _GNU_SOURCE 1
    #include <stdlib.h>
    #include <sys/types.h>], [
    #undef $1
    int a = sizeof($1);
    ], gnupg_cv_typedef_$1=yes, gnupg_cv_typedef_$1=no )])
    AC_MSG_RESULT($gnupg_cv_typedef_$1)
    if test "$gnupg_cv_typedef_$1" = yes; then
        AC_DEFINE($2)
    fi
  ])

GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)

AC_CHECK_SIZEOF(unsigned short, 2)
AC_CHECK_SIZEOF(unsigned int, 4)
AC_CHECK_SIZEOF(unsigned long, 4)
AC_CHECK_SIZEOF(unsigned long long, 0)
AC_CACHE_SAVE

if test "$ac_cv_sizeof_unsigned_short" = "0" \
   || test "$ac_cv_sizeof_unsigned_int" = "0" \
   || test "$ac_cv_sizeof_unsigned_long" = "0"; then
    AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
fi
dnl --------------------------------------- "end gnupg configure.in"


dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(mkdir)
AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR), [cat <<ELCEOF

        Your system doesn't have strerror. exiting.

ELCEOF
exit 1
])
AC_CHECK_FUNC(strstr, AC_DEFINE(HAVE_STRSTR), [cat <<ELCEOF

        Your system doesn't have strstr. exiting.

ELCEOF
exit 1
])

dnl AC_ARG_ENABLE(mmap,
dnl 	    [  --enable-mmap[=ARG]     use mmap for reading databases [ARG=yes]], 
dnl 	    AC_DEFINE(CDB_MMAP_ENABLE))

dnl ----------let the user do ./configure --enable-debug
dnl 
AC_ARG_ENABLE(debug,
	[  --enable-debug[=ARG]    compile with runtime diagnostics enabled [ARG=yes]], 
	AC_DEFINE(DEBUG))

dnl -----------for --with-leakfind (see above)
dnl -----------... and add to the appropriate variables
if test "$with_leakfind" != ""; then
	# LIBS="$LIBS -lgc" # this happens automatically
	CPPFLAGS="$CPPFLAGS -I $with_leakfind"
	LDFLAGS="$LDFLAGS -L $with_leakfind"
	AC_DEFINE(ELC_FIND_LEAKS)
fi

dnl Configure subdirectories
dnl AC_CONFIG_SUBDIRS(aux hashtbl)
AC_CONFIG_SUBDIRS(hashtbl)

dnl if they want debugging, then don't strip the binaries on install
dnl
if test "$enable_debug" != ""; then
	STRIP=
else
	STRIP=-s
fi

dnl Perform substitutions in the output
AC_SUBST(OBJ)
AC_SUBST(ILIBOBJ)
AC_SUBST(CFLAGS)
AC_SUBST(EXTRA_DEFS)
AC_SUBST(DEFS)
AC_SUBST(LIBS)
AC_SUBST(CPPFLAGS)
AC_SUBST(STRIP)
AC_SUBST(inc_dir)
AC_SUBST(lib_dir)
AC_SUBST(INTEGRIT_VERSION)
AC_OUTPUT(Makefile integrit.mak aux/Makefile aux/aux.mak doc/Makefile doc/integrit.1 doc/i-viewdb.1 doc/i-ls.1 doc/integrit.texi)