| 1 | dnl Process this file with autoconf to produce a configure script. |
| 2 | dnl $Id: configure.in,v 1.21 2009/11/08 18:14:47 mrsam Exp $ |
| 3 | dnl |
| 4 | dnl Copyright 1998 - 2009 Double Precision, Inc. See COPYING for |
| 5 | dnl distribution information. |
| 6 | |
| 7 | AC_INIT(rfc822lib, 0.13, [courier-users@lists.sourceforge.net]) |
| 8 | |
| 9 | >confdefs.h # Kill PACKAGE_ macros |
| 10 | |
| 11 | AC_CONFIG_SRCDIR(rfc822.c) |
| 12 | AM_INIT_AUTOMAKE([foreign no-define]) |
| 13 | AM_CONFIG_HEADER(config.h) |
| 14 | |
| 15 | dnl Checks for programs. |
| 16 | AC_USE_SYSTEM_EXTENSIONS |
| 17 | AC_PROG_CC |
| 18 | AC_PROG_LIBTOOL |
| 19 | |
| 20 | if test "$GCC" = yes ; then |
| 21 | CXXFLAGS="$CXXFLAGS -Wall" |
| 22 | CFLAGS="$CFLAGS -Wall" |
| 23 | fi |
| 24 | |
| 25 | dnl Checks for libraries. |
| 26 | |
| 27 | dnl Checks for header files. |
| 28 | AC_HEADER_STDC |
| 29 | AC_CHECK_HEADERS(locale.h) |
| 30 | |
| 31 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 32 | AC_C_CONST |
| 33 | AC_TYPE_SIZE_T |
| 34 | AC_STRUCT_TM |
| 35 | |
| 36 | dnl Checks for library functions. |
| 37 | |
| 38 | AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]], |
| 39 | [Support IDN (needs GNU Libidn)]), |
| 40 | libidn=$withval, libidn=yes) |
| 41 | |
| 42 | if test "$libidn" != "no" |
| 43 | then |
| 44 | PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no]) |
| 45 | if test "$libidn" != "yes" |
| 46 | then |
| 47 | libidn=no |
| 48 | AC_MSG_WARN([Libidn not found]) |
| 49 | else |
| 50 | libidn=yes |
| 51 | AC_DEFINE(LIBIDN, 1, [Define to 1 if you want Libidn.]) |
| 52 | fi |
| 53 | fi |
| 54 | AC_MSG_CHECKING([if Libidn should be used]) |
| 55 | AC_MSG_RESULT($libidn) |
| 56 | |
| 57 | AC_CHECK_FUNCS(strcasecmp strncasecmp setlocale) |
| 58 | |
| 59 | AC_CACHE_CHECK([how to calculate alternate timezone],librfc822_cv_SYS_TIMEZONE, |
| 60 | |
| 61 | AC_TRY_COMPILE([ |
| 62 | #include <time.h> |
| 63 | ],[ |
| 64 | int main() |
| 65 | { |
| 66 | time_t t=altzone; |
| 67 | |
| 68 | return (0); |
| 69 | } |
| 70 | ], librfc822_cv_SYS_TIMEZONE=altzone, |
| 71 | |
| 72 | AC_TRY_COMPILE([ |
| 73 | #include <time.h> |
| 74 | ],[ |
| 75 | int main() |
| 76 | { |
| 77 | int n=daylight; |
| 78 | |
| 79 | return (0); |
| 80 | } |
| 81 | ], librfc822_cv_SYS_TIMEZONE=daylight, |
| 82 | |
| 83 | AC_TRY_COMPILE([ |
| 84 | #include <time.h> |
| 85 | |
| 86 | extern struct tm dummy; |
| 87 | ],[ |
| 88 | int main() |
| 89 | { |
| 90 | long n=dummy.tm_gmtoff; |
| 91 | |
| 92 | return (0); |
| 93 | } |
| 94 | ] ,librfc822_cv_SYS_TIMEZONE=tm_gmtoff, |
| 95 | librfc822_cv_SYS_TIMEZONE=unknown |
| 96 | ) |
| 97 | ) |
| 98 | ) |
| 99 | ) |
| 100 | |
| 101 | case $librfc822_cv_SYS_TIMEZONE in |
| 102 | tm_gmtoff) |
| 103 | AC_DEFINE_UNQUOTED(USE_TIME_GMTOFF,1, |
| 104 | [ The time offset is specified in the tm_gmtoff member ]) |
| 105 | ;; |
| 106 | altzone) |
| 107 | AC_DEFINE_UNQUOTED(USE_TIME_ALTZONE,1, |
| 108 | [ The daylight savings time offset is in the altzone member ]) |
| 109 | ;; |
| 110 | daylight) |
| 111 | AC_DEFINE_UNQUOTED(USE_TIME_DAYLIGHT,1, |
| 112 | [ The daylight savings time offset is in the tm_isdst member ]) |
| 113 | ;; |
| 114 | *) |
| 115 | AC_MSG_WARN([Cannot figure out how to calculate the alternate timezone, will use GMT]) |
| 116 | ;; |
| 117 | esac |
| 118 | |
| 119 | AM_CONDITIONAL(HAVE_SGML, test -d ${srcdir}/../docbook) |
| 120 | |
| 121 | AC_OUTPUT(Makefile) |