1 AC_INIT([libundertow], [0.0.2],
2 [http://www.syntaxjockey.com/projects/libundertow],
4 AM_INIT_AUTOMAKE(no-define)
6 AM_CONFIG_HEADER(config.h)
8 # set library version. for more information see:
9 # http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91
17 # Checks for programs.
26 # parse configure switches
27 AC_ARG_ENABLE(bittorrent,
28 AS_HELP_STRING([--enable-bittorrent],
29 [Enable support for bittorrent downloads (autodetect)]),
30 enable_bittorrent=$enableval)
31 AC_ARG_ENABLE(internal-sqlite,
32 AS_HELP_STRING([--enable-internal-sqlite],
33 [Use internal copy of sqlite3 (autodetect)]),
34 enable_sqlite=$enableval)
36 # Checks for header files.
38 AC_CHECK_HEADERS([stdlib.h string.h sys/time.h unistd.h])
40 # Checks for typedefs, structures, and compiler characteristics.
45 # Checks for library functions.
48 AC_CHECK_FUNCS([gettimeofday pthread_create])
50 # Checks for libraries.
51 PKG_CHECK_MODULES(libcurl,[libcurl],,
52 [AC_MSG_FAILURE([$libcurl_PKG_ERRORS])])
53 PKG_CHECK_MODULES(libxml2,[libxml-2.0],,
54 [AC_MSG_FAILURE([$libxml2_PKG_ERRORS])])
56 # Determine whether to build support for bittorrent downloads
57 if test x$enable_bittorrent = xyes; then
58 PKG_CHECK_MODULES(libtorrent,[libtorrent],,
59 [AC_MSG_FAILURE([$libtorrent_PKG_ERRORS])])
60 AC_DEFINE(ENABLE_BITTORRENT, "1", [Define to 1 to enable bittorrent downloads])
63 # Determine whether to use the system sqlite library, or our internal copy
64 if test x$enable_sqlite = xyes; then
65 sqlite_LIBS="../external/sqlite/libsqlite3.la"
66 sqlite_CFLAGS="-I../external/sqlite"
67 INTERNAL_SQLITE="sqlite"
69 AC_SUBST(sqlite_CFLAGS)
70 AC_SUBST(INTERNAL_SQLITE)
71 AC_MSG_NOTICE([using internal copy of libsqlite3])
72 elif test x$enable_sqlite = xno; then
73 PKG_CHECK_MODULES(sqlite,[sqlite3],,[AC_MSG_FAILURE([$sqlite_PKG_ERRORS])])
75 PKG_CHECK_MODULES(sqlite,[sqlite3],
77 AC_MSG_CHECKING([whether libsqlite3 is threadsafe])
82 [ #include <sqlite3.h> ],
83 [ int main (void) { return sqlite3_threadsafe(); } ]
90 [#include <sqlite3.h>],
91 [int main (void) { return sqlite3_threadsafe(); } ]
98 AC_MSG_RESULT([no, using internal copy of libsqlite3])
99 sqlite_LIBS="../external/sqlite/libsqlite3.la"
100 sqlite_CFLAGS="-I../external/sqlite"
101 INTERNAL_SQLITE="sqlite"
106 AC_MSG_RESULT([no, using internal copy of libsqlite3])
107 sqlite_LIBS="../external/sqlite/libsqlite3.la"
108 sqlite_CFLAGS="-I../external/sqlite"
109 INTERNAL_SQLITE="sqlite"
110 AC_SUBST(INTERNAL_SQLITE)
116 AC_MSG_NOTICE([building libundertow with internal copy of libsqlite3])
117 sqlite_LIBS="../external/sqlite/libsqlite3.la"
118 sqlite_CFLAGS="-I../external/sqlite"
119 INTERNAL_SQLITE="sqlite"
120 AC_SUBST(sqlite_LIBS)
121 AC_SUBST(sqlite_CFLAGS)
122 AC_SUBST(INTERNAL_SQLITE)
128 AC_CONFIG_FILES([Makefile
131 external/sqlite/Makefile