root / configure.ac @ a1de4e94
History | View | Annotate | Download (4.1 kB)
| 1 | # -*- Autoconf -*- |
|---|---|
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | |
| 4 | AC_PREREQ(2.61) |
| 5 | AC_INIT(src/sylfilter.c) |
| 6 | |
| 7 | dnl set $target |
| 8 | AC_CANONICAL_SYSTEM |
| 9 | |
| 10 | AM_INIT_AUTOMAKE(sylfilter, 0.6) |
| 11 | AC_CONFIG_SRCDIR([src/sylfilter.c]) |
| 12 | AC_CONFIG_HEADER([config.h]) |
| 13 | |
| 14 | # Checks for programs. |
| 15 | AC_PROG_CC |
| 16 | AC_PROG_INSTALL |
| 17 | AM_PROG_LIBTOOL |
| 18 | |
| 19 | MATH_LIB=-lm |
| 20 | |
| 21 | native_win32=no |
| 22 | |
| 23 | case "$target" in |
| 24 | *-*-mingw*) |
| 25 | native_win32=yes |
| 26 | MATH_LIB= |
| 27 | CFLAGS="$CFLAGS -mms-bitfields" |
| 28 | AC_DEFINE(HAVE_WIN32, 1, Define if you have native Win32 environment.) |
| 29 | ;; |
| 30 | esac |
| 31 | |
| 32 | AM_CONDITIONAL(NATIVE_WIN32, test "$native_win32" = "yes") |
| 33 | |
| 34 | AC_SUBST(MATH_LIB) |
| 35 | |
| 36 | # Checks for libraries. |
| 37 | AM_PATH_GLIB_2_0(2.0.0,, AC_MSG_ERROR(Test for GLib failed. See the 'INSTALL' for help.)) |
| 38 | |
| 39 | AC_SUBST(GLIB_CFLAGS) |
| 40 | AC_SUBST(GLIB_LIBS) |
| 41 | |
| 42 | have_kvs=no |
| 43 | |
| 44 | AC_ARG_ENABLE(sqlite, |
| 45 | [ --enable-sqlite Enable SQLite3 support [[default=yes]]], |
| 46 | [ac_cv_enable_sqlite=$enableval], [ac_cv_enable_sqlite=yes]) |
| 47 | AC_ARG_ENABLE(qdbm, |
| 48 | [ --enable-qdbm Enable QDBM support [[default=no]]], |
| 49 | [ac_cv_enable_qdbm=$enableval], [ac_cv_enable_qdbm=no]) |
| 50 | AC_ARG_ENABLE(gdbm, |
| 51 | [ --enable-gdbm Enable GDBM support [[default=no]]], |
| 52 | [ac_cv_enable_gdbm=$enableval], [ac_cv_enable_gdbm=no]) |
| 53 | |
| 54 | AC_MSG_CHECKING([whether to enable SQLite3]) |
| 55 | AC_MSG_RESULT($ac_cv_enable_sqlite) |
| 56 | if test $ac_cv_enable_sqlite = yes; then |
| 57 | PKG_CHECK_MODULES(SQLITE, sqlite3, |
| 58 | [ AC_DEFINE(USE_SQLITE, 1, Define if you have SQLite3.) |
| 59 | have_kvs=yes ], ac_cv_enable_sqlite=no ) |
| 60 | fi |
| 61 | |
| 62 | AC_MSG_CHECKING([whether to enable QDBM]) |
| 63 | AC_MSG_RESULT($ac_cv_enable_qdbm) |
| 64 | if test $ac_cv_enable_qdbm = yes; then |
| 65 | PKG_CHECK_MODULES(QDBM, qdbm, |
| 66 | [ AC_DEFINE(USE_QDBM, 1, Define if you have QDBM.) |
| 67 | have_kvs=yes ], ac_cv_enable_qdbm=no ) |
| 68 | fi |
| 69 | |
| 70 | AC_MSG_CHECKING([whether to enable GDBM]) |
| 71 | AC_MSG_RESULT($ac_cv_enable_gdbm) |
| 72 | if test $ac_cv_enable_gdbm = yes; then |
| 73 | AC_CHECK_LIB(gdbm, gdbm_open, |
| 74 | [ AC_DEFINE(USE_GDBM, 1, Define if you have GDBM.) |
| 75 | GDBM_LIBS="-lgdbm" |
| 76 | AC_SUBST(GDBM_LIBS) |
| 77 | have_kvs=yes ], ac_cv_enable_gdbm=no ) |
| 78 | fi |
| 79 | |
| 80 | if test $have_kvs != yes; then |
| 81 | AC_MSG_ERROR(Key-value store not found.) |
| 82 | fi |
| 83 | if test $ac_cv_enable_qdbm = yes -a $ac_cv_enable_gdbm = yes; then |
| 84 | AC_MSG_ERROR(QDBM and GDBM cannot be specified at the same time.) |
| 85 | fi |
| 86 | |
| 87 | # Toggle Win32 Console/GUI app |
| 88 | AC_ARG_ENABLE(windows, |
| 89 | [ --enable-windows Enable Windows GUI executable ], |
| 90 | [enable_windows=$enableval], [enable_windows=no]) |
| 91 | |
| 92 | if test "$native_win32" = yes; then |
| 93 | if test "$enable_windows" = yes; then |
| 94 | CFLAGS="$CFLAGS -mwindows" |
| 95 | fi |
| 96 | fi |
| 97 | |
| 98 | # LibSylph type |
| 99 | libsylph_type=builtin |
| 100 | |
| 101 | AC_ARG_WITH(libsylph, |
| 102 | [ --with-libsylph=[[builtin/standalone/sylpheed]] select LibSylph to use], |
| 103 | libsylph_type=$with_libsylph) |
| 104 | |
| 105 | AC_ARG_WITH(libsylph-dir, |
| 106 | [AC_HELP_STRING([--with-libsylph-dir=DIR], [search for LibSylph in DIR/include and DIR/lib])], |
| 107 | [if test "x$with_libsylph_dir" != x; then |
| 108 | LDFLAGS="$LDFLAGS -L$with_libsylph_dir/lib" |
| 109 | fi]) |
| 110 | |
| 111 | AC_SUBST(libsylph_type) |
| 112 | |
| 113 | case $libsylph_type in |
| 114 | builtin) |
| 115 | AC_DEFINE(BUILTIN_LIBSYLPH, 1, Define if you use built-in LibSylph.) |
| 116 | ;; |
| 117 | standalone) |
| 118 | AC_CHECK_LIB(sylph, syl_init, LIBSYLPH_LIBS="-lsylph", AC_MSG_ERROR(Test for LibSylph (standalone) failed.)) |
| 119 | if test "x$with_libsylph_dir" != x; then |
| 120 | CPPFLAGS="$CPPFLAGS -I$with_libsylph_dir/include" |
| 121 | fi |
| 122 | ;; |
| 123 | sylpheed) |
| 124 | AC_CHECK_LIB(sylph-0, syl_init, LIBSYLPH_LIBS="-lsylph-0", AC_MSG_ERROR(Test for LibSylph (Sylpheed-included) failed.)) |
| 125 | if test "x$with_libsylph_dir" != x; then |
| 126 | CPPFLAGS="$CPPFLAGS -I$with_libsylph_dir/include/sylpheed" |
| 127 | fi |
| 128 | ;; |
| 129 | *) AC_MSG_ERROR([Invalid type for LibSylph: use builtin, standalone, or sylpheed.]) ;; |
| 130 | esac |
| 131 | |
| 132 | AC_SUBST(LIBSYLPH_LIBS) |
| 133 | |
| 134 | AM_CONDITIONAL(BUILTIN_LIBSYLPH, test "$libsylph_type" = "builtin") |
| 135 | |
| 136 | # Checks for iconv |
| 137 | AM_ICONV |
| 138 | |
| 139 | # Checks for header files. |
| 140 | AC_HEADER_STDC |
| 141 | AC_HEADER_DIRENT |
| 142 | AC_HEADER_SYS_WAIT |
| 143 | |
| 144 | # Checks for typedefs, structures, and compiler characteristics. |
| 145 | |
| 146 | # Checks for library functions. |
| 147 | AC_CHECK_FUNCS(ftruncate fsync) |
| 148 | |
| 149 | AC_CONFIG_FILES([Makefile |
| 150 | libsylph/Makefile |
| 151 | lib/Makefile |
| 152 | lib/filters/Makefile |
| 153 | src/Makefile |
| 154 | test/Makefile]) |
| 155 | AC_OUTPUT |