Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 582 lines (530 sloc) 16.527 kb
220c45f *** empty log message ***
roel authored
1
2 dnl DBMAIL_MSG_CONFIGURE_START()
3 dnl
6ebab42 autotools update
paul authored
4 AC_DEFUN([DBMAIL_MSG_CONFIGURE_START], [dnl
220c45f *** empty log message ***
roel authored
5 AC_MSG_RESULT([
6 This is dbmail's GNU configure script.
7 It's going to run a bunch of strange tests to hopefully
8 make your compile work without much twiddling.
9 ])
10 ])
11
12 dnl DBMAIL_BOTH_SQL_CHECK
13 dnl
6ebab42 autotools update
paul authored
14 AC_DEFUN([DBMAIL_BOTH_SQL_CHECK], [dnl
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
15 AC_ARG_WITH(mysql,
16 [ --with-mysql use MySQL as database. Uses mysql_config
17 for finding includes and libraries],
220c45f *** empty log message ***
roel authored
18 mysqlheadername="$withval")
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
19 AC_ARG_WITH(pgsql,
20 [ --with-pgsql use PostgreSQL as database.
21 Uses pg_config for finding includes and libraries],
220c45f *** empty log message ***
roel authored
22 pgsqlheadername="$withval")
43262a9 changed package names for debian
paul authored
23 AC_ARG_WITH(sqlite,
24 [ --with-sqlite use SQLite as database.
25 Uses pkg-config for finding includes and libraries],
26 sqliteheadername="$withval")
220c45f *** empty log message ***
roel authored
27
28 WARN=0
43262a9 changed package names for debian
paul authored
29 # Make sure we only select one of mysql, pgsql or sqlite
220c45f *** empty log message ***
roel authored
30 if test "${mysqlheadername-x}" = "x"
31 then
32 if test "${pgsqlheadername-x}" = "x"
33 then
43262a9 changed package names for debian
paul authored
34 if test "${sqliteheadername-x}" = "x"
35 then
36 NEITHER=1
37 mysqlheadername=""
38 fi
220c45f *** empty log message ***
roel authored
39 fi
40 fi
41 if test "$NEITHER" = 1
42 then
43 AC_MSG_ERROR([
44
43262a9 changed package names for debian
paul authored
45 You have to specify --with-mysql, --with-pgsql or --with-sqlite to build.
220c45f *** empty log message ***
roel authored
46 ])
47 fi
48
43262a9 changed package names for debian
paul authored
49 # TODO: fix this to check for other sql libs like sqllite:
220c45f *** empty log message ***
roel authored
50 if test ! "${mysqlheadername-x}" = "x"
51 then
52 if test ! "${pgsqlheadername-x}" = "x"
53 then
54 WARN=1
55 mysqlheadername=""
56 fi
57 fi
58 if test "$WARN" = 1
59 then
60 AC_MSG_ERROR([
61
62 You cannot specify both --with-mysql and --with-pgsql on the same
63 build...
64 ])
65 fi
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
66 ])
220c45f *** empty log message ***
roel authored
67
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
68 dnl DBMAIL_CHECK_SQL_LIBS
69 dnl
6ebab42 autotools update
paul authored
70 AC_DEFUN([DBMAIL_CHECK_SQL_LIBS], [dnl
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
71 #Look for include files and libs needed to link
72 #use the configuration utilities (mysql_config and pg_config for this)
73 # MySQL first
220c45f *** empty log message ***
roel authored
74 if test ! "${mysqlheadername-x}" = "x"
75 then
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
76 AC_PATH_PROG(mysqlconfig,mysql_config)
77 if test [ -z "$mysqlconfig" ]
78 then
79 AC_MSG_ERROR([mysql_config executable not found. Make sure mysql_config is in your path])
80 else
81 AC_MSG_CHECKING([MySQL headers])
82 MYSQLINC=`${mysqlconfig} --cflags`
83 AC_MSG_RESULT([$MYSQLINC])
84 AC_MSG_CHECKING([MySQL libraries])
85 SQLLIB=`${mysqlconfig} --libs`
d770899 rework the shared libs setup
paul authored
86 SQLALIB="mysql/.libs/libsqldbmail.a"
87 SQLLTLIB="mysql/libsqldbmail.la"
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
88 AC_MSG_RESULT([$SQLLIB])
43262a9 changed package names for debian
paul authored
89 fi
90 fi
91
92 if test ! "${pgsqlheadername-x}" = "x"
220c45f *** empty log message ***
roel authored
93 then
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
94 AC_PATH_PROG(pgsqlconfig,pg_config)
95 if test [ -z "$pgsqlconfig" ]
220c45f *** empty log message ***
roel authored
96 then
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
97 AC_MSG_ERROR([pg_config executable not found. Make sure pg_config is in your path])
98 else
99 AC_MSG_CHECKING([PostgreSQL headers])
100 PGINCDIR=`${pgsqlconfig} --includedir`
101 PGSQLINC="-I$PGINCDIR"
102 AC_MSG_RESULT([$PGSQLINC])
103 AC_MSG_CHECKING([PostgreSQL libraries])
104 PGLIBDIR=`${pgsqlconfig} --libdir`
105 SQLLIB="-L$PGLIBDIR -lpq"
d770899 rework the shared libs setup
paul authored
106 SQLALIB="pgsql/.libs/libsqldbmail.a"
107 SQLLTLIB="pgsql/libsqldbmail.la"
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
108 AC_MSG_RESULT([$SQLLIB])
220c45f *** empty log message ***
roel authored
109 fi
43262a9 changed package names for debian
paul authored
110 fi
111
112 if test ! "${sqliteheadername-x}" = "x"
113 then
114 AC_PATH_PROG(sqliteconfig,pkg-config)
115 if test [ -z "$sqliteconfig" ]
116 then
117 AC_MSG_ERROR([pkg-config executable not found. Make sure pkg-config is in your path])
118 else
119 AC_MSG_CHECKING([SQLite headers])
120 SQLITEINC=`${sqliteconfig} --cflags sqlite`
121 AC_MSG_RESULT([$SQLITEINC])
122 AC_MSG_CHECKING([SQLite libraries])
123 SQLLIB=`${sqliteconfig} --libs sqlite`
d770899 rework the shared libs setup
paul authored
124 SQLALIB="sqlite/.libs/libsqldbmail.a"
125 SQLLTLIB="sqlite/libsqldbmail.la"
43262a9 changed package names for debian
paul authored
126 AC_MSG_RESULT([$SQLLIB])
127 fi
220c45f *** empty log message ***
roel authored
128 fi
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
129 ])
309ac35 Added LMTP + Sieve patch by Aaron Stone.
ilja authored
130 dnl DBMAIL_SIEVE_CONF
131 dnl check for ldap or sql authentication
6ebab42 autotools update
paul authored
132 AC_DEFUN([DBMAIL_SIEVE_CONF], [dnl
309ac35 Added LMTP + Sieve patch by Aaron Stone.
ilja authored
133 AC_MSG_RESULT([checking for sorting configuration])
05ebb5f merging changes from dbmail_2_0_branch into the trunk
paul authored
134 AC_ARG_WITH(sieve,[ --with-sieve=PATH full path to libSieve header directory (don't use, not stable)],
309ac35 Added LMTP + Sieve patch by Aaron Stone.
ilja authored
135 sieveheadername="$withval$")
136 dnl This always needs to be defined
fadd63d Dan Weber's libtool patches committed. This means that we're no using
ilja authored
137 SORTALIB="sort/.libs/libsortdbmail.a"
138 SORTLTLIB="sort/libsortdbmail.la"
309ac35 Added LMTP + Sieve patch by Aaron Stone.
ilja authored
139
140 WARN=0
141 if test ! "${sieveheadername-x}" = "x"
142 then
143 # --with-sieve was specified
144 AC_MSG_RESULT([using Sieve sorting])
145 if test "$withval" != "yes"
146 then
147 AC_MSG_CHECKING([for sieve2_interface.h (user supplied)])
148 if test -r "$sieveheadername/sieve2_interface.h"
149 then
150 # found
151 AC_MSG_RESULT([$sieveheadername/sieve2_interface.h])
152 SIEVEINC=$sieveheadername
153 else
154 # Not found
155 AC_MSG_RESULT([not found])
156 SIEVEINC=""
157 sieveheadername=""
158 AC_MSG_ERROR([
159 Unable to find sieve2_inteface.h where you specified, try just --with-sieve to
160 have configure guess])
161 fi
162 else
163 # Lets look in our standard paths
164 AC_MSG_CHECKING([for sieve2_interface.h])
165 for sievepaths in $sieveheaderpaths
166 do
167 if test -r "$sievepaths/sieve2_interface.h"
168 then
169 SIEVEINC="$sievepaths"
170 AC_MSG_RESULT([$sievepaths/sieve2_interface.h])
171 break
172 fi
173 done
174 if test -z "$SIEVEINC"
175 then
176 AC_MSG_RESULT([no])
177 AC_MSG_ERROR([
178 Unable to locate sieve2_inteface.h, try specifying with --with-sieve])
179 fi
180 fi
181 else
182 AC_MSG_RESULT([not using any sorting])
183 fi
184 ])
185
186 dnl DBMAIL_CHECK_SIEVE_LIBS
187 dnl
6ebab42 autotools update
paul authored
188 AC_DEFUN([DBMAIL_CHECK_SIEVE_LIBS], [dnl
309ac35 Added LMTP + Sieve patch by Aaron Stone.
ilja authored
189 # Look for libs needed to link to SIEVE first
190 if test ! "${sieveheadername-x}" = "x"
191 then
0c7a307 minor sieve cleanups, and prototype for headercaching during insertion
paul authored
192 AC_CHECK_LIB(sieve,sieve2_extensions_listsupport,[ SORTLIB="-lsieve"], [SORTLIB=""])
193 if test -z "$SORTLIB"
309ac35 Added LMTP + Sieve patch by Aaron Stone.
ilja authored
194 then
195 AC_MSG_ERROR([
196 Unable to link against libSieve. It appears you are missing the
197 development libraries or they aren't in your linker's path
198 ])
199 fi
200 else
201 #no Sieve needed
0c7a307 minor sieve cleanups, and prototype for headercaching during insertion
paul authored
202 SORTLIB=""
309ac35 Added LMTP + Sieve patch by Aaron Stone.
ilja authored
203 fi
204 ])
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
205
206 dnl DBMAIL_AUTH_CONF
207 dnl check for ldap or sql authentication
6ebab42 autotools update
paul authored
208 AC_DEFUN([DBMAIL_AUTH_CONF], [dnl
309ac35 Added LMTP + Sieve patch by Aaron Stone.
ilja authored
209 AC_MSG_RESULT([checking for authentication configuration])
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
210 AC_ARG_WITH(auth-ldap,[ --with-auth-ldap=PATH full path to ldap header directory],
5814caf reindent ldap macro
paul authored
211 authldapheadername="$withval")
309ac35 Added LMTP + Sieve patch by Aaron Stone.
ilja authored
212 dnl This always needs to be defined
fadd63d Dan Weber's libtool patches committed. This means that we're no using
ilja authored
213 AUTHALIB="auth/.libs/libauthdbmail.a"
214 AUTHLTLIB="auth/libauthdbmail.la"
220c45f *** empty log message ***
roel authored
215
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
216 WARN=0
217 if test ! "${authldapheadername-x}" = "x"
220c45f *** empty log message ***
roel authored
218 then
5814caf reindent ldap macro
paul authored
219 # --with-auth-ldap was specified
220 AC_MSG_RESULT([using LDAP authentication])
221 CFLAGS="$CFLAGS -DAUTHLDAP"
222 if test "$withval" != "yes"
223 then
224 AC_MSG_CHECKING([for ldap.h (user supplied)])
225 if test -r "$authldapheadername/ldap.h"
226 then
227 # found
228 AC_MSG_RESULT([$authldapheadername/ldap.h])
229 LDAPINC=$authldapheadername
230 else
231 # Not found
232 AC_MSG_RESULT([not found])
233 LDAPINC=""
234 authldapheadername=""
235 AC_MSG_ERROR([Unable to find ldap.h where you specified, try just --with-auth-ldap to have configure guess])
236 fi
237 else
238 # Lets look in our standard paths
239 AC_MSG_CHECKING([for ldap.h])
240 for ldappath in $ldapheaderpaths
241 do
242 if test -r "$ldappath/ldap.h"
243 then
244 LDAPINC="$ldappath"
245 AC_MSG_RESULT([$ldappath/ldap.h])
246 break
247 fi
248 done
249 if test -z "$LDAPINC"
250 then
251 AC_MSG_RESULT([no])
252 AC_MSG_ERROR([Unable to locate ldap.h, try specifying with --with-auth-ldap])
253 fi
254 fi
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
255 else
5814caf reindent ldap macro
paul authored
256 AC_MSG_RESULT([using SQL authentication])
220c45f *** empty log message ***
roel authored
257 fi
258 ])
259
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
260 dnl DBMAIL_CHECK_LDAP_LIBS
220c45f *** empty log message ***
roel authored
261 dnl
6ebab42 autotools update
paul authored
262 AC_DEFUN([DBMAIL_CHECK_LDAP_LIBS], [dnl
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
263 # Look for libs needed to link to LDAP first
264 if test ! "${authldapheadername-x}" = "x"
220c45f *** empty log message ***
roel authored
265 then
5814caf reindent ldap macro
paul authored
266 AC_CHECK_LIB(ldap,ldap_bind,[ LDAPLIB="-lldap"], [LDAPLIB=""])
267 if test -z "$LDAPLIB"
268 then
269 AC_MSG_ERROR([ Unable to link against ldap. It appears you are missing the development libraries or they aren't in your linker's path ])
270 fi
220c45f *** empty log message ***
roel authored
271 else
5814caf reindent ldap macro
paul authored
272 #no ldap needed
273 LDAPLIB=""
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
274 fi
220c45f *** empty log message ***
roel authored
275 ])
5814caf reindent ldap macro
paul authored
276
277
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
278 dnl AC_COMPILE_WARNINGS
279 dnl set to compile with '-W -Wall'
280 AC_DEFUN([AC_COMPILE_WARNINGS],
281 [AC_MSG_CHECKING(maximum warning verbosity option)
282 if test -n "$CXX"
283 then
284 if test "$GXX" = "yes"
285 then
286 ac_compile_warnings_opt='-Wall'
287 fi
288 CXXFLAGS="$CXXFLAGS $ac_compile_warnings_opt"
289 ac_compile_warnings_msg="$ac_compile_warnings_opt for C++"
290 fi
291 if test -n "$CC"
292 then
293 if test "$GCC" = "yes"
294 then
860be35 lots of changes
ilja authored
295 ac_compile_warnings_opt='-W -Wall -Wpointer-arith -Wstrict-prototypes'
220c45f *** empty log message ***
roel authored
296 fi
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
297 CFLAGS="$CFLAGS $ac_compile_warnings_opt"
298 ac_compile_warnings_msg="$ac_compile_warnings_msg $ac_compile_warnings_opt for C"
220c45f *** empty log message ***
roel authored
299 fi
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
300 AC_MSG_RESULT($ac_compile_warnings_msg)
301 unset ac_compile_warnings_msg
302 unset ac_compile_warnings_opt
220c45f *** empty log message ***
roel authored
303 ])
21888de merged all 2.0 branch sources with the trunk. 2.0 is now HEAD and 1.2 is
ilja authored
304
9afec01 adding glib-2.0 support. This is now a build requirement
paul authored
305 dnl DBMAIL_CHECK_GLIB
306 dnl
6ebab42 autotools update
paul authored
307 AC_DEFUN([DBMAIL_CHECK_GLIB], [dnl
9afec01 adding glib-2.0 support. This is now a build requirement
paul authored
308 #Look for include files and libs needed to link
309 #use the configuration utilities (pkg-config for this)
310 AC_PATH_PROG(glibconfig,pkg-config)
311 if test [ -z "$glibconfig" ]
312 then
313 AC_MSG_ERROR([pkg-config executable not found. Make sure pkg-config is in your path])
314 else
315 AC_MSG_CHECKING([GLib headers])
316 ac_glib_cflags=`${glibconfig} --cflags glib-2.0`
98c7440 document and enforce the glib/gmime build dependency
paul authored
317 if test -z "$ac_glib_cflags"
318 then
319 AC_MSG_RESULT([no])
320 AC_MSG_ERROR([Unable to locate glib development files])
321 fi
322
9afec01 adding glib-2.0 support. This is now a build requirement
paul authored
323 CFLAGS="$CFLAGS $ac_glib_cflags"
324 AC_MSG_RESULT([$ac_glib_cflags])
325 AC_MSG_CHECKING([Glib libraries])
326 ac_glib_libs=`${glibconfig} --libs glib-2.0`
98c7440 document and enforce the glib/gmime build dependency
paul authored
327 if test -z "$ac_glib_libs"
328 then
329 AC_MSG_RESULT([no])
330 AC_MSG_ERROR([Unable to locate glib libaries])
331 fi
332
333
9afec01 adding glib-2.0 support. This is now a build requirement
paul authored
334 LDFLAGS="$LDFLAGS $ac_glib_libs"
335 AC_MSG_RESULT([$ac_glib_libs])
336 fi
337 ])
338
00a414e committing the first gmime code
paul authored
339 dnl DBMAIL_CHECK_GMIME
340 dnl
6ebab42 autotools update
paul authored
341 AC_DEFUN([DBMAIL_CHECK_GMIME], [dnl
00a414e committing the first gmime code
paul authored
342 #Look for include files and libs needed to link
343 #use the configuration utilities (pkg-config for this)
344 AC_PATH_PROG(gmimeconfig,pkg-config)
345 if test [ -z "$gmimeconfig" ]
346 then
347 AC_MSG_ERROR([pkg-config executable not found. Make sure pkg-config is in your path])
348 else
349 AC_MSG_CHECKING([GMime headers])
350 ac_gmime_cflags=`${gmimeconfig} --cflags gmime-2.0`
98c7440 document and enforce the glib/gmime build dependency
paul authored
351 if test -z "$ac_gmime_cflags"
352 then
353 AC_MSG_RESULT([no])
354 AC_MSG_ERROR([Unable to locate gmime development files])
355 fi
356
00a414e committing the first gmime code
paul authored
357 CFLAGS="$CFLAGS $ac_gmime_cflags"
358 AC_MSG_RESULT([$ac_gmime_cflags])
359 AC_MSG_CHECKING([GMime libraries])
360 ac_gmime_libs=`${gmimeconfig} --libs gmime-2.0`
361 LDFLAGS="$LDFLAGS $ac_gmime_libs"
362 AC_MSG_RESULT([$ac_gmime_libs])
98c7440 document and enforce the glib/gmime build dependency
paul authored
363 if test -z "$ac_gmime_libs"
364 then
365 AC_MSG_RESULT([no])
366 AC_MSG_ERROR([Unable to locate gmime libaries])
367 fi
00a414e committing the first gmime code
paul authored
368 fi
369 ])
370
1c0b9c7 2004-12-03 Ilja Booij <ilja@ic-s.nl>
ilja authored
371 dnl also compile iniparser
372 AC_DEFUN([DBMAIL_SET_INIPARSER], [dnl
373 # set iniparser library. Thi is a library that we have added
374 # locally
375 INIPARSERALIB="lib/iniparser-2.14/src/.libs/libiniparser.a"
376 INIPARSERLTLIB="lib/iniparser-2.14/src/libiniparser.la"
377 ])
378
e8e21f1 applied the garbage-collection and my_strdup patches
paul authored
379 # ----------------------------------------------------------------
380 # DBMAIL_CHECK_GC
381 # I cheated I copied from w3m's acinclude.m4 :)
382 # Modified for DBMAIL by Dan Weber
383 # ----------------------------------------------------------------
384 AC_DEFUN([DBMAIL_CHECK_GC],
385 [AC_MSG_CHECKING(for --with-gc)
386 AC_ARG_WITH(gc,
387 [ --with-gc[=PREFIX] libgc PREFIX],
388 [test x"$with_gc" = xno && with_gc="no"],
389 [with_gc="no"])
390 AC_MSG_RESULT($with_gc)
391 # Don't check for gc if not appended to command line
392 if test x"$with_gc" = xyes
393 then
394 test x"$with_gc" = xyes && with_gc="/usr /usr/local ${HOME}"
395 unset ac_cv_header_gc_h
396 AC_CHECK_HEADER(gc/gc.h)
397 if test x"$ac_cv_header_gc_h" = xno; then
398 AC_MSG_CHECKING(GC header location)
399 AC_MSG_RESULT($with_gc)
400 gcincludedir=no
401 for dir in $with_gc; do
402 for inc in include include/gc; do
403 cflags="$CFLAGS"
404 CFLAGS="$CFLAGS -I$dir/$inc -DUSE_GC=1"
405 AC_MSG_CHECKING($dir/$inc)
406 unset ac_cv_header_gc_h
407 AC_CHECK_HEADER(gc/gc.h, [gcincludedir="$dir/$inc"; CFLAGS="$CFLAGS -I$dir/$inc -DUSE_GC=1"; break])
408 CFLAGS="$cflags"
409 done
410 if test x"$gcincludedir" != xno; then
411 break;
412 fi
413 done
414 if test x"$gcincludedir" = xno; then
415 AC_MSG_ERROR([gc/gc.h not found])
416 fi
417 else
418 cflags="$CFLAGS -DUSE_GC=1"
419 CFLAGS="$cflags"
420 fi
421 unset ac_cv_lib_gc_GC_init
422 AC_CHECK_LIB(gc, GC_init, [LIBS="$LIBS -lgc"])
423 if test x"$ac_cv_lib_gc_GC_init" = xno; then
424 AC_MSG_CHECKING(GC library location)
425 AC_MSG_RESULT($with_gc)
426 gclibdir=no
427 for dir in $with_gc; do
428 ldflags="$LDFLAGS"
429 LDFLAGS="$LDFLAGS -L$dir/lib"
430 AC_MSG_CHECKING($dir)
431 unset ac_cv_lib_gc_GC_init
432 AC_CHECK_LIB(gc, GC_init, [gclibdir="$dir/lib"; LIBS="$LIBS -L$dir/lib -lgc"; break])
433 LDFLAGS="$ldflags"
434 done
435 if test x"$gclibdir" = xno; then
436 AC_MSG_ERROR([libgc not found])
437 fi
438 fi
439 fi])
440
369df9e added unit-testing support
paul authored
441
442
443 # ripped from check.m4
444
445 dnl DBMAIL_PATH_CHECK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
446 dnl Test for check, and define CHECK_CFLAGS and CHECK_LIBS
447 dnl
448
5814caf reindent ldap macro
paul authored
449 AC_DEFUN([DBMAIL_PATH_CHECK],
369df9e added unit-testing support
paul authored
450 [
451 AC_ARG_WITH(check,
452 [ --with-check=PATH prefix where check is installed [default=auto]],
453 [test x"$with_check" = xno && with_check="no"],
454 [with_check="no"])
455
456 if test "x$with_check" != xno; then
457 min_check_version=ifelse([$1], ,0.8.2,$1)
458
459 AC_MSG_CHECKING(for check - version >= $min_check_version)
460
461 if test x$with_check = xno; then
462 AC_MSG_RESULT(disabled)
463 ifelse([$3], , AC_MSG_ERROR([disabling check is not supported]), [$3])
464 else
465 if test "x$with_check" = xyes; then
466 CHECK_CFLAGS=""
467 CHECK_LIBS="-lcheck"
468 else
469 CHECK_CFLAGS="-I$with_check/include"
470 CHECK_LIBS="-L$with_check/lib -lcheck"
471 fi
472
473 ac_save_CFLAGS="$CFLAGS"
474 ac_save_LIBS="$LIBS"
475
476 CFLAGS="$CFLAGS $CHECK_CFLAGS"
477 LIBS="$CHECK_LIBS $LIBS"
478
479 rm -f conf.check-test
480 AC_TRY_RUN([
481 #include <stdio.h>
482 #include <stdlib.h>
483
484 #include <check.h>
485
486 int main ()
487 {
488 int major, minor, micro;
489 char *tmp_version;
490
491 system ("touch conf.check-test");
492
493 /* HP/UX 9 (%@#!) writes to sscanf strings */
494 tmp_version = strdup("$min_check_version");
495 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
496 printf("%s, bad version string\n", "$min_check_version");
497 return 1;
498 }
499
500 if ((CHECK_MAJOR_VERSION != check_major_version) ||
501 (CHECK_MINOR_VERSION != check_minor_version) ||
502 (CHECK_MICRO_VERSION != check_micro_version))
503 {
504 printf("\n*** The check header file (version %d.%d.%d) does not match\n",
505 CHECK_MAJOR_VERSION, CHECK_MINOR_VERSION, CHECK_MICRO_VERSION);
506 printf("*** the check library (version %d.%d.%d).\n",
507 check_major_version, check_minor_version, check_micro_version);
508 return 1;
509 }
510
511 if ((check_major_version > major) ||
512 ((check_major_version == major) && (check_minor_version > minor)) ||
513 ((check_major_version == major) && (check_minor_version == minor) && (check_micro_version >= micro)))
514 {
515 return 0;
516 }
517 else
518 {
519 printf("\n*** An old version of check (%d.%d.%d) was found.\n",
520 check_major_version, check_minor_version, check_micro_version);
521 printf("*** You need a version of check being at least %d.%d.%d.\n", major, minor, micro);
522 printf("***\n");
523 printf("*** If you have already installed a sufficiently new version, this error\n");
524 printf("*** probably means that the wrong copy of the check library and header\n");
525 printf("*** file is being found. Rerun configure with the --with-check=PATH option\n");
526 printf("*** to specify the prefix where the correct version was installed.\n");
527 }
528
529 return 1;
530 }
531 ],, no_check=yes, [echo $ac_n "cross compiling; assumed OK... $ac_c"])
532
533 CFLAGS="$ac_save_CFLAGS"
534 LIBS="$ac_save_LIBS"
535
536 if test "x$no_check" = x ; then
537 AC_MSG_RESULT(yes)
538 ifelse([$2], , :, [$2])
539 else
540 AC_MSG_RESULT(no)
541 if test -f conf.check-test ; then
542 :
543 else
544 echo "*** Could not run check test program, checking why..."
545 CFLAGS="$CFLAGS $CHECK_CFLAGS"
546 LIBS="$CHECK_LIBS $LIBS"
547 AC_TRY_LINK([
548 #include <stdio.h>
549 #include <stdlib.h>
550
551 #include <check.h>
552 ], , [ echo "*** The test program compiled, but did not run. This usually means"
553 echo "*** that the run-time linker is not finding check. You'll need to set your"
554 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
555 echo "*** to the installed location Also, make sure you have run ldconfig if that"
556 echo "*** is required on your system"
557 echo "***"
558 echo "*** If you have an old version installed, it is best to remove it, although"
559 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
560 [ echo "*** The test program failed to compile or link. See the file config.log for"
561 echo "*** the exact error that occured." ])
562
563 CFLAGS="$ac_save_CFLAGS"
564 LIBS="$ac_save_LIBS"
565 fi
566
567 CHECK_CFLAGS=""
568 CHECK_LIBS=""
569
570 rm -f conf.check-test
571 ifelse([$3], , AC_MSG_ERROR([check not found]), [$3])
572 fi
573 fi
574
575 AC_SUBST(CHECK_CFLAGS)
576 AC_SUBST(CHECK_LIBS)
577
578 rm -f conf.check-test
579
580 fi
581 ])
Something went wrong with that request. Please try again.