1AC_PREREQ(2.52)
2AC_INIT
3
4if test -z "$GNUSTEP_MAKEFILES"; then
5  AC_MSG_ERROR([You must set GNUSTEP_MAKEFILES or run the GNUstep initialization script first!])
6fi
7
8AC_CONFIG_AUX_DIR([$GNUSTEP_MAKEFILES])
9
10#--------------------------------------------------------------------
11# Determine the host, build, and target systems
12#--------------------------------------------------------------------
13AC_CANONICAL_TARGET([])
14
15#--------------------------------------------------------------------
16# Find sqlite
17#--------------------------------------------------------------------
18AC_ARG_WITH(sqlite_library,
19           [  --with-sqlite-library=DIR sqlite library files are in DIR], ,
20           with_sqlite_library=)
21AC_ARG_WITH(sqlite_include,
22 [  --with-sqlite-include=DIR sqlite include files are in DIR], ,
23        with_sqlite_include=)
24
25if test -n "$with_sqlite_library"; then
26  with_sqlite_library="-L$with_sqlite_library"
27fi
28if test -n "$with_sqlite_include"; then
29  with_sqlite_include="-I$with_sqlite_include"
30fi
31
32CPPFLAGS="$with_sqlite_include ${CPPFLAGS}"
33LDFLAGS="$with_sqlite_library -lsqlite3 ${LDFLAGS}"
34
35case "$target_os" in
36  freebsd* | openbsd* )
37	        CPPFLAGS="$CPPFLAGS -I/usr/local/include"
38		LDFLAGS="$LDFLAGS -L/usr/local/lib";;
39  netbsd*)	CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
40		LDFLAGS="$LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib";;
41esac
42
43AC_CHECK_HEADER(sqlite3.h, have_sqlite=yes, have_sqlite=no)
44if test "$have_sqlite" = yes; then
45  AC_CHECK_LIB(sqlite3, sqlite3_get_table)
46  if test "$ac_cv_lib_sqlite3_sqlite3_get_table" = no; then
47     have_sqlite=no
48  fi
49fi
50
51if test "$have_sqlite" = yes; then
52  sqlite_version_ok=yes
53
54  AC_TRY_RUN([
55    #include <stdio.h>
56    #include <stdlib.h>
57    #include <string.h>
58    #include <sqlite3.h>
59
60int main ()
61{
62  unsigned vnum = sqlite3_libversion_number();
63
64  printf("sqlite3 version number %d\n", vnum);
65  return !(vnum >= 3002006);
66}
67  ],, sqlite_version_ok=no,[echo "wrong sqlite3 version"])
68
69  if test "$have_sqlite" = yes; then
70    SQLITE_LIB_DIRS="$with_sqlite_library -lsqlite3"
71    SQLITE_INCLUDE_DIRS="$with_sqlite_include"
72  fi
73fi
74
75if test "$have_sqlite" = no; then
76  AC_MSG_WARN(Cannot find libsqlite3 header and/or library)
77  echo "* GWMetadata requires the sqlite3 library"
78  echo "* Use --with-sqlite-library and --with-sqlite-include"
79  echo "* to specify the sqlite library directory if it is not"
80  echo "* in the usual place(s)"
81  AC_MSG_ERROR(GWMetadata will not compile without sqlite)
82else
83  if test "$sqlite_version_ok" = no; then
84    AC_MSG_WARN(Wrong libsqlite3 version)
85    echo "* GWMetadata requires libsqlite3 >= 3002006 *"
86    AC_MSG_ERROR(GWMetadata will not compile without sqlite)
87  fi
88fi
89
90AC_SUBST(SQLITE_LIB_DIRS)
91AC_SUBST(SQLITE_INCLUDE_DIRS)
92
93
94
95#--------------------------------------------------------------------
96# Debug logging
97#--------------------------------------------------------------------
98AC_ARG_ENABLE(debug_log,
99  [  --enable-debug-log  		Enable debug logging],,
100      enable_debug_log=no)
101
102if test "$enable_debug_log" = "no"; then
103 GW_DEBUG_LOG=0
104else
105 GW_DEBUG_LOG=1
106fi
107
108AC_DEFINE_UNQUOTED([GW_DEBUG_LOG], [$GW_DEBUG_LOG], [debug logging])
109
110AC_CONFIG_HEADERS([config.h])
111
112AC_CONFIG_FILES([GNUmakefile GNUmakefile.preamble])
113
114AC_OUTPUT
115
116
117
118
119