xref: /freebsd/contrib/sqlite3/configure.ac (revision fed1ca4b719c56c930f2259d80663cd34be812bb)
1
2#-----------------------------------------------------------------------
3# Supports the following non-standard switches.
4#
5#   --enable-threadsafe
6#   --enable-readline
7#   --enable-editline
8#   --enable-static-shell
9#   --enable-dynamic-extensions
10#
11
12AC_PREREQ(2.61)
13AC_INIT(sqlite, 3.12.1, http://www.sqlite.org)
14AC_CONFIG_SRCDIR([sqlite3.c])
15
16# Use automake.
17AM_INIT_AUTOMAKE([foreign])
18
19AC_SYS_LARGEFILE
20
21# Check for required programs.
22AC_PROG_CC
23AC_PROG_LIBTOOL
24AC_PROG_MKDIR_P
25
26# Check for library functions that SQLite can optionally use.
27AC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r])
28AC_FUNC_STRERROR_R
29
30AC_CONFIG_FILES([Makefile sqlite3.pc])
31AC_SUBST(BUILD_CFLAGS)
32
33#-----------------------------------------------------------------------
34#   --enable-editline
35#   --enable-readline
36#
37AC_ARG_ENABLE(editline, [AS_HELP_STRING(
38  [--enable-editline],
39  [use BSD libedit])],
40  [], [enable_editline=yes])
41AC_ARG_ENABLE(readline, [AS_HELP_STRING(
42  [--enable-readline],
43  [use readline])],
44  [], [enable_readline=no])
45if test x"$enable_editline" != xno ; then
46  sLIBS=$LIBS
47  LIBS=""
48  AC_SEARCH_LIBS([readline],[edit],[enable_readline=no],[enable_editline=no])
49  READLINE_LIBS=$LIBS
50  if test x"$LIBS" != "x"; then
51     AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline)
52  else
53    unset ac_cv_search_readline
54  fi
55  LIBS=$sLIBS
56fi
57if test x"$enable_readline" != xno ; then
58  sLIBS=$LIBS
59  LIBS=""
60  AC_SEARCH_LIBS(tgetent, curses ncurses ncursesw, [], [])
61  AC_SEARCH_LIBS(readline, readline, [], [enable_readline=no])
62  AC_CHECK_FUNCS(readline, [], [])
63  READLINE_LIBS=$LIBS
64  LIBS=$sLIBS
65fi
66AC_SUBST(READLINE_LIBS)
67#-----------------------------------------------------------------------
68
69#-----------------------------------------------------------------------
70#   --enable-threadsafe
71#
72AC_ARG_ENABLE(threadsafe, [AS_HELP_STRING(
73  [--enable-threadsafe], [build a thread-safe library [default=yes]])],
74  [], [enable_threadsafe=yes])
75THREADSAFE_FLAGS=-DSQLITE_THREADSAFE=0
76if test x"$enable_threadsafe" != "xno"; then
77  THREADSAFE_FLAGS="-D_REENTRANT=1 -DSQLITE_THREADSAFE=1"
78  AC_SEARCH_LIBS(pthread_create, pthread)
79  AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
80fi
81AC_SUBST(THREADSAFE_FLAGS)
82#-----------------------------------------------------------------------
83
84#-----------------------------------------------------------------------
85#   --enable-dynamic-extensions
86#
87AC_ARG_ENABLE(dynamic-extensions, [AS_HELP_STRING(
88  [--enable-dynamic-extensions], [support loadable extensions [default=yes]])],
89  [], [enable_dynamic_extensions=yes])
90if test x"$enable_dynamic_extensions" != "xno"; then
91  AC_SEARCH_LIBS(dlopen, dl)
92else
93  DYNAMIC_EXTENSION_FLAGS=-DSQLITE_OMIT_LOAD_EXTENSION=1
94fi
95AC_MSG_CHECKING([for whether to support dynamic extensions])
96AC_MSG_RESULT($enable_dynamic_extensions)
97AC_SUBST(DYNAMIC_EXTENSION_FLAGS)
98#-----------------------------------------------------------------------
99
100#-----------------------------------------------------------------------
101#   --enable-fts5
102#
103AC_ARG_ENABLE(fts5, [AS_HELP_STRING(
104  [--enable-fts5], [include fts5 support [default=no]])],
105  [], [enable_fts5=no])
106if test x"$enable_fts5" == "xyes"; then
107  AC_SEARCH_LIBS(log, m)
108  FTS5_FLAGS=-DSQLITE_ENABLE_FTS5
109fi
110AC_SUBST(FTS5_FLAGS)
111#-----------------------------------------------------------------------
112
113#-----------------------------------------------------------------------
114#   --enable-json1
115#
116AC_ARG_ENABLE(json1, [AS_HELP_STRING(
117  [--enable-json1], [include json1 support [default=no]])],
118  [], [enable_json1=no])
119if test x"$enable_json1" == "xyes"; then
120  JSON1_FLAGS=-DSQLITE_ENABLE_JSON1
121fi
122AC_SUBST(JSON1_FLAGS)
123#-----------------------------------------------------------------------
124
125#-----------------------------------------------------------------------
126#   --enable-static-shell
127#
128AC_ARG_ENABLE(static-shell, [AS_HELP_STRING(
129  [--enable-static-shell],
130  [statically link libsqlite3 into shell tool [default=yes]])],
131  [], [enable_static_shell=yes])
132if test x"$enable_static_shell" == "xyes"; then
133  EXTRA_SHELL_OBJ=sqlite3-sqlite3.$OBJEXT
134else
135  EXTRA_SHELL_OBJ=libsqlite3.la
136fi
137AC_SUBST(EXTRA_SHELL_OBJ)
138#-----------------------------------------------------------------------
139
140AC_CHECK_FUNCS(posix_fallocate)
141
142#-----------------------------------------------------------------------
143# UPDATE: Maybe it's better if users just set CFLAGS before invoking
144# configure. This option doesn't really add much...
145#
146#   --enable-tempstore
147#
148# AC_ARG_ENABLE(tempstore, [AS_HELP_STRING(
149#   [--enable-tempstore],
150#   [in-memory temporary tables (never, no, yes, always) [default=no]])],
151#   [], [enable_tempstore=no])
152# AC_MSG_CHECKING([for whether or not to store temp tables in-memory])
153# case "$enable_tempstore" in
154#   never )  TEMP_STORE=0 ;;
155#   no )     TEMP_STORE=1 ;;
156#   always ) TEMP_STORE=3 ;;
157#   yes )    TEMP_STORE=3 ;;
158#   * )
159#     TEMP_STORE=1
160#     enable_tempstore=yes
161#   ;;
162# esac
163# AC_MSG_RESULT($enable_tempstore)
164# AC_SUBST(TEMP_STORE)
165#-----------------------------------------------------------------------
166
167AC_OUTPUT
168