]> code.citadel.org Git - citadel.git/blob - citadel/acinclude.m4
* Applied a patch sent in by Clint Adams <schizo@debian.org> to handle
[citadel.git] / citadel / acinclude.m4
1 # CIT_STRUCT_TM
2 # ------------------
3 # Figure out how to get the current GMT offset.  If `struct tm' has a
4 # `tm_gmtoff' member, define `HAVE_STRUCT_TM_TM_GMTOFF'.  Otherwise, if the
5 # external variable `timezone' is found, define `HAVE_TIMEZONE'.
6 AC_DEFUN([CIT_STRUCT_TM],
7 [AC_REQUIRE([AC_STRUCT_TM])dnl
8 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <sys/types.h>
9 #include <$ac_cv_struct_tm>
10 ])
11 if test "$ac_cv_member_struct_tm_tm_gmtoff" != yes; then
12   AC_CACHE_CHECK(for timezone, ac_cv_var_timezone,
13 [AC_TRY_LINK(
14 [#include <time.h>],
15 [printf("%ld", (long)timezone);], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)])
16   if test $ac_cv_var_timezone = yes; then
17     AC_DEFINE(HAVE_TIMEZONE, 1,
18               [Define if you don't have `tm_gmtoff' but do have the external
19                variable `timezone'.])
20   fi
21 fi
22 ])# CIT_STRUCT_TM
23
24 AC_DEFUN([AC_CHECK_DB],[
25 for lib in $1
26 do
27    AS_VAR_PUSHDEF([ac_tr_db], [ac_cv_db_lib_${lib}])dnl
28    bogo_saved_LIBS="$LIBS"
29    LIBS="$LIBS -l$lib"
30    AC_CACHE_CHECK([for db_create in -l${lib}], ac_tr_db,
31       [AC_TRY_LINK([#include <db.h>], [int foo=db_create((void *)0, (void *) 0, 
32 0 )],
33                    [AS_VAR_SET(ac_tr_db, yes)],
34                    [AS_VAR_SET(ac_tr_db, no)])
35       ])
36    AS_IF([test AS_VAR_GET(ac_tr_db) = yes],
37          [$2
38           db=yes],
39          [LIBS="$bogo_saved_LIBS"
40           db=no])
41    AS_VAR_POPDEF([ac_tr_db])dnl
42 test "$db" = "yes" && break
43 done
44 if test "$db" = "no"; then
45 $3
46 fi
47 ])# AC_CHECK_DB
48