configure.ac 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. #
  2. # The build process allows for using a cross-compiler. But the default
  3. # action is to target the same platform that we are running on. The
  4. # configure script needs to discover the following properties of the
  5. # build and target systems:
  6. #
  7. # srcdir
  8. #
  9. # The is the name of the directory that contains the
  10. # "configure" shell script. All source files are
  11. # located relative to this directory.
  12. #
  13. # bindir
  14. #
  15. # The name of the directory where executables should be
  16. # written by the "install" target of the makefile.
  17. #
  18. # program_prefix
  19. #
  20. # Add this prefix to the names of all executables that run
  21. # on the target machine. Default: ""
  22. #
  23. # ENABLE_SHARED
  24. #
  25. # True if shared libraries should be generated.
  26. #
  27. # BUILD_CC
  28. #
  29. # The name of a command that is used to convert C
  30. # source files into executables that run on the build
  31. # platform.
  32. #
  33. # BUILD_CFLAGS
  34. #
  35. # Switches that the build compiler needs in order to construct
  36. # command-line programs.
  37. #
  38. # BUILD_LIBS
  39. #
  40. # Libraries that the build compiler needs in order to construct
  41. # command-line programs.
  42. #
  43. # BUILD_EXEEXT
  44. #
  45. # The filename extension for executables on the build
  46. # platform. "" for Unix and ".exe" for Windows.
  47. #
  48. # TCL_*
  49. #
  50. # Lots of values are read in from the tclConfig.sh script,
  51. # if that script is available. This values are used for
  52. # constructing and installing the TCL extension.
  53. #
  54. # TARGET_READLINE_LIBS
  55. #
  56. # This is the library directives passed to the target linker
  57. # that cause the executable to link against the readline library.
  58. # This might be a switch like "-lreadline" or pathnames of library
  59. # file like "../../src/libreadline.a".
  60. #
  61. # TARGET_READLINE_INC
  62. #
  63. # This variables define the directory that contain header
  64. # files for the readline library. If the compiler is able
  65. # to find <readline.h> on its own, then this can be blank.
  66. #
  67. # TARGET_EXEEXT
  68. #
  69. # The filename extension for executables on the
  70. # target platform. "" for Unix and ".exe" for windows.
  71. #
  72. # The generated configure script will make an attempt to guess
  73. # at all of the above parameters. You can override any of
  74. # the guesses by setting the environment variable named
  75. # "config_AAAA" where "AAAA" is the name of the parameter
  76. # described above. (Exception: srcdir cannot be set this way.)
  77. # If you have a file that sets one or more of these environment
  78. # variables, you can invoke configure as follows:
  79. #
  80. # configure --with-hints=FILE
  81. #
  82. # where FILE is the name of the file that sets the environment
  83. # variables. FILE should be an absolute pathname.
  84. #
  85. # This configure.in file is easy to reuse on other projects. Just
  86. # change the argument to AC_INIT(). And disable any features that
  87. # you don't need (for example BLT) by erasing or commenting out
  88. # the corresponding code.
  89. #
  90. AC_INIT(sqlite, m4_esyscmd([cat VERSION | tr -d '\n']))
  91. dnl Make sure the local VERSION file matches this configure script
  92. sqlite_version_sanity_check=`cat $srcdir/VERSION | tr -d '\n'`
  93. if test "$PACKAGE_VERSION" != "$sqlite_version_sanity_check" ; then
  94. AC_MSG_ERROR([configure script is out of date:
  95. configure \$PACKAGE_VERSION = $PACKAGE_VERSION
  96. top level VERSION file = $sqlite_version_sanity_check
  97. please regen with autoconf])
  98. fi
  99. dnl Put the RCS revision string after AC_INIT so that it will also
  100. dnl show in in configure.
  101. # The following RCS revision string applies to configure.in
  102. # $Revision: 1.56 $
  103. #########
  104. # Programs needed
  105. #
  106. AC_PROG_LIBTOOL
  107. AC_PROG_INSTALL
  108. AC_PROG_AWK
  109. #########
  110. # Enable large file support (if special flags are necessary)
  111. #
  112. AC_SYS_LARGEFILE
  113. #########
  114. # Check for needed/wanted data types
  115. AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t,
  116. uint16_t, uint32_t, uint64_t, uintptr_t])
  117. #########
  118. # Check for needed/wanted headers
  119. AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h])
  120. #########
  121. # Figure out whether or not we have these functions
  122. #
  123. AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size])
  124. #########
  125. # By default, we use the amalgamation (this may be changed below...)
  126. #
  127. USE_AMALGAMATION=1
  128. #########
  129. # See whether we can run specific tclsh versions known to work well;
  130. # if not, then we fall back to plain tclsh.
  131. # TODO: try other versions before falling back?
  132. #
  133. AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.6 tclsh8.5 tclsh], none)
  134. if test "$TCLSH_CMD" = "none"; then
  135. # If we can't find a local tclsh, then building the amalgamation will fail.
  136. # We act as though --disable-amalgamation has been used.
  137. echo "Warning: can't find tclsh - defaulting to non-amalgamation build."
  138. USE_AMALGAMATION=0
  139. TCLSH_CMD="tclsh"
  140. fi
  141. AC_SUBST(TCLSH_CMD)
  142. AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin])
  143. if test "x${TCLLIBDIR+set}" != "xset" ; then
  144. TCLLIBDIR='$(libdir)'
  145. for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do
  146. TCLLIBDIR=$i
  147. break
  148. done
  149. TCLLIBDIR="${TCLLIBDIR}/sqlite3"
  150. fi
  151. #########
  152. # Set up an appropriate program prefix
  153. #
  154. if test "$program_prefix" = "NONE"; then
  155. program_prefix=""
  156. fi
  157. AC_SUBST(program_prefix)
  158. VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
  159. AC_MSG_NOTICE(Version set to $VERSION)
  160. AC_SUBST(VERSION)
  161. RELEASE=`cat $srcdir/VERSION`
  162. AC_MSG_NOTICE(Release set to $RELEASE)
  163. AC_SUBST(RELEASE)
  164. VERSION_NUMBER=[`cat $srcdir/VERSION \
  165. | sed 's/[^0-9]/ /g' \
  166. | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
  167. AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
  168. AC_SUBST(VERSION_NUMBER)
  169. #########
  170. # Check to see if the --with-hints=FILE option is used. If there is none,
  171. # then check for a files named "$host.hints" and ../$hosts.hints where
  172. # $host is the hostname of the build system. If still no hints are
  173. # found, try looking in $system.hints and ../$system.hints where
  174. # $system is the result of uname -s.
  175. #
  176. AC_ARG_WITH(hints,
  177. AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
  178. hints=$withval)
  179. if test "$hints" = ""; then
  180. host=`hostname | sed 's/\..*//'`
  181. if test -r $host.hints; then
  182. hints=$host.hints
  183. else
  184. if test -r ../$host.hints; then
  185. hints=../$host.hints
  186. fi
  187. fi
  188. fi
  189. if test "$hints" = ""; then
  190. sys=`uname -s`
  191. if test -r $sys.hints; then
  192. hints=$sys.hints
  193. else
  194. if test -r ../$sys.hints; then
  195. hints=../$sys.hints
  196. fi
  197. fi
  198. fi
  199. if test "$hints" != ""; then
  200. AC_MSG_RESULT(reading hints from $hints)
  201. . $hints
  202. fi
  203. #########
  204. # Locate a compiler for the build machine. This compiler should
  205. # generate command-line programs that run on the build machine.
  206. #
  207. if test x"$cross_compiling" = xno; then
  208. BUILD_CC=$CC
  209. BUILD_CFLAGS=$CFLAGS
  210. else
  211. if test "${BUILD_CC+set}" != set; then
  212. AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
  213. fi
  214. if test "${BUILD_CFLAGS+set}" != set; then
  215. BUILD_CFLAGS="-g"
  216. fi
  217. fi
  218. AC_SUBST(BUILD_CC)
  219. ##########
  220. # Do we want to support multithreaded use of sqlite
  221. #
  222. AC_ARG_ENABLE(threadsafe,
  223. AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
  224. AC_MSG_CHECKING([whether to support threadsafe operation])
  225. if test "$enable_threadsafe" = "no"; then
  226. SQLITE_THREADSAFE=0
  227. AC_MSG_RESULT([no])
  228. else
  229. SQLITE_THREADSAFE=1
  230. AC_MSG_RESULT([yes])
  231. fi
  232. AC_SUBST(SQLITE_THREADSAFE)
  233. if test "$SQLITE_THREADSAFE" = "1"; then
  234. AC_SEARCH_LIBS(pthread_create, pthread)
  235. fi
  236. ##########
  237. # Do we want to allow a connection created in one thread to be used
  238. # in another thread. This does not work on many Linux systems (ex: RedHat 9)
  239. # due to bugs in the threading implementations. This is thus off by default.
  240. #
  241. AC_ARG_ENABLE(cross-thread-connections,
  242. AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
  243. AC_MSG_CHECKING([whether to allow connections to be shared across threads])
  244. if test "$enable_xthreadconnect" = "no"; then
  245. XTHREADCONNECT=''
  246. AC_MSG_RESULT([no])
  247. else
  248. XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
  249. AC_MSG_RESULT([yes])
  250. fi
  251. AC_SUBST(XTHREADCONNECT)
  252. ##########
  253. # Do we want to support release
  254. #
  255. AC_ARG_ENABLE(releasemode,
  256. AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
  257. AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
  258. if test "$enable_releasemode" = "no"; then
  259. ALLOWRELEASE=""
  260. AC_MSG_RESULT([no])
  261. else
  262. ALLOWRELEASE="-release `cat $srcdir/VERSION`"
  263. AC_MSG_RESULT([yes])
  264. fi
  265. AC_SUBST(ALLOWRELEASE)
  266. ##########
  267. # Do we want temporary databases in memory
  268. #
  269. AC_ARG_ENABLE(tempstore,
  270. AC_HELP_STRING([--enable-tempstore],[Use an in-ram database for temporary tables (never,no,yes,always)]),,enable_tempstore=no)
  271. AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
  272. case "$enable_tempstore" in
  273. never )
  274. TEMP_STORE=0
  275. AC_MSG_RESULT([never])
  276. ;;
  277. no )
  278. TEMP_STORE=1
  279. AC_MSG_RESULT([no])
  280. ;;
  281. yes )
  282. TEMP_STORE=2
  283. AC_MSG_RESULT([yes])
  284. ;;
  285. always )
  286. TEMP_STORE=3
  287. AC_MSG_RESULT([always])
  288. ;;
  289. * )
  290. TEMP_STORE=1
  291. AC_MSG_RESULT([no])
  292. ;;
  293. esac
  294. AC_SUBST(TEMP_STORE)
  295. ###########
  296. # Lots of things are different if we are compiling for Windows using
  297. # the CYGWIN environment. So check for that special case and handle
  298. # things accordingly.
  299. #
  300. AC_MSG_CHECKING([if executables have the .exe suffix])
  301. if test "$config_BUILD_EXEEXT" = ".exe"; then
  302. CYGWIN=yes
  303. AC_MSG_RESULT(yes)
  304. else
  305. AC_MSG_RESULT(unknown)
  306. fi
  307. if test "$CYGWIN" != "yes"; then
  308. AC_CYGWIN
  309. fi
  310. if test "$CYGWIN" = "yes"; then
  311. BUILD_EXEEXT=.exe
  312. else
  313. BUILD_EXEEXT=$EXEEXT
  314. fi
  315. if test x"$cross_compiling" = xno; then
  316. TARGET_EXEEXT=$BUILD_EXEEXT
  317. else
  318. TARGET_EXEEXT=$config_TARGET_EXEEXT
  319. fi
  320. if test "$TARGET_EXEEXT" = ".exe"; then
  321. SQLITE_OS_UNIX=0
  322. SQLITE_OS_WIN=1
  323. CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
  324. else
  325. SQLITE_OS_UNIX=1
  326. SQLITE_OS_WIN=0
  327. CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
  328. fi
  329. AC_SUBST(BUILD_EXEEXT)
  330. AC_SUBST(SQLITE_OS_UNIX)
  331. AC_SUBST(SQLITE_OS_WIN)
  332. AC_SUBST(TARGET_EXEEXT)
  333. ##########
  334. # Figure out all the parameters needed to compile against Tcl.
  335. #
  336. # This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
  337. # macros in the in the tcl.m4 file of the standard TCL distribution.
  338. # Those macros could not be used directly since we have to make some
  339. # minor changes to accomodate systems that do not have TCL installed.
  340. #
  341. AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
  342. [use_tcl=$enableval],[use_tcl=yes])
  343. if test "${use_tcl}" = "yes" ; then
  344. AC_ARG_WITH(tcl, AC_HELP_STRING([--with-tcl=DIR],[directory containing tcl configuration (tclConfig.sh)]), with_tclconfig=${withval})
  345. AC_MSG_CHECKING([for Tcl configuration])
  346. AC_CACHE_VAL(ac_cv_c_tclconfig,[
  347. # First check to see if --with-tcl was specified.
  348. if test x"${with_tclconfig}" != x ; then
  349. if test -f "${with_tclconfig}/tclConfig.sh" ; then
  350. ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
  351. else
  352. AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
  353. fi
  354. fi
  355. # Start autosearch by asking tclsh
  356. if test x"${ac_cv_c_tclconfig}" = x ; then
  357. if test x"$cross_compiling" = xno; then
  358. for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
  359. do
  360. if test -f "$i/tclConfig.sh" ; then
  361. ac_cv_c_tclconfig="$i"
  362. break
  363. fi
  364. done
  365. fi
  366. fi
  367. # then check for a private Tcl installation
  368. if test x"${ac_cv_c_tclconfig}" = x ; then
  369. for i in \
  370. ../tcl \
  371. `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  372. `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  373. `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
  374. ../../tcl \
  375. `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  376. `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  377. `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
  378. ../../../tcl \
  379. `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  380. `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  381. `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
  382. do
  383. if test -f "$i/unix/tclConfig.sh" ; then
  384. ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
  385. break
  386. fi
  387. done
  388. fi
  389. # check in a few common install locations
  390. if test x"${ac_cv_c_tclconfig}" = x ; then
  391. for i in \
  392. `ls -d ${libdir} 2>/dev/null` \
  393. `ls -d /usr/local/lib 2>/dev/null` \
  394. `ls -d /usr/contrib/lib 2>/dev/null` \
  395. `ls -d /usr/lib 2>/dev/null`
  396. do
  397. if test -f "$i/tclConfig.sh" ; then
  398. ac_cv_c_tclconfig=`(cd $i; pwd)`
  399. break
  400. fi
  401. done
  402. fi
  403. # check in a few other private locations
  404. if test x"${ac_cv_c_tclconfig}" = x ; then
  405. for i in \
  406. ${srcdir}/../tcl \
  407. `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  408. `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  409. `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
  410. do
  411. if test -f "$i/unix/tclConfig.sh" ; then
  412. ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
  413. break
  414. fi
  415. done
  416. fi
  417. ])
  418. if test x"${ac_cv_c_tclconfig}" = x ; then
  419. use_tcl=no
  420. AC_MSG_WARN(Can't find Tcl configuration definitions)
  421. AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
  422. AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
  423. else
  424. TCL_BIN_DIR=${ac_cv_c_tclconfig}
  425. AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
  426. AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
  427. if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
  428. AC_MSG_RESULT([loading])
  429. . $TCL_BIN_DIR/tclConfig.sh
  430. else
  431. AC_MSG_RESULT([file not found])
  432. fi
  433. #
  434. # If the TCL_BIN_DIR is the build directory (not the install directory),
  435. # then set the common variable name to the value of the build variables.
  436. # For example, the variable TCL_LIB_SPEC will be set to the value
  437. # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
  438. # instead of TCL_BUILD_LIB_SPEC since it will work with both an
  439. # installed and uninstalled version of Tcl.
  440. #
  441. if test -f $TCL_BIN_DIR/Makefile ; then
  442. TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
  443. TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
  444. TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
  445. fi
  446. #
  447. # eval is required to do the TCL_DBGX substitution
  448. #
  449. eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
  450. eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
  451. eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
  452. eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
  453. eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
  454. eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
  455. AC_SUBST(TCL_VERSION)
  456. AC_SUBST(TCL_BIN_DIR)
  457. AC_SUBST(TCL_SRC_DIR)
  458. AC_SUBST(TCL_INCLUDE_SPEC)
  459. AC_SUBST(TCL_LIB_FILE)
  460. AC_SUBST(TCL_LIB_FLAG)
  461. AC_SUBST(TCL_LIB_SPEC)
  462. AC_SUBST(TCL_STUB_LIB_FILE)
  463. AC_SUBST(TCL_STUB_LIB_FLAG)
  464. AC_SUBST(TCL_STUB_LIB_SPEC)
  465. fi
  466. fi
  467. if test "${use_tcl}" = "no" ; then
  468. HAVE_TCL=""
  469. else
  470. HAVE_TCL=1
  471. fi
  472. AC_SUBST(HAVE_TCL)
  473. ##########
  474. # Figure out what C libraries are required to compile programs
  475. # that use "readline()" library.
  476. #
  477. TARGET_READLINE_LIBS=""
  478. TARGET_READLINE_INC=""
  479. TARGET_HAVE_READLINE=0
  480. AC_ARG_ENABLE([readline],
  481. [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
  482. [with_readline=$enableval],
  483. [with_readline=auto])
  484. if test x"$with_readline" != xno; then
  485. found="yes"
  486. AC_ARG_WITH([readline-lib],
  487. [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
  488. [with_readline_lib=$withval],
  489. [with_readline_lib="auto"])
  490. if test "x$with_readline_lib" = xauto; then
  491. save_LIBS="$LIBS"
  492. LIBS=""
  493. AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
  494. AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
  495. TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
  496. LIBS="$save_LIBS"
  497. else
  498. TARGET_READLINE_LIBS="$with_readline_lib"
  499. fi
  500. AC_ARG_WITH([readline-inc],
  501. [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
  502. [with_readline_inc=$withval],
  503. [with_readline_inc="auto"])
  504. if test "x$with_readline_inc" = xauto; then
  505. AC_CHECK_HEADER(readline.h, [found="yes"], [
  506. found="no"
  507. if test "$cross_compiling" != yes; then
  508. for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
  509. for subdir in include include/readline; do
  510. AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
  511. if test "$found" = "yes"; then
  512. TARGET_READLINE_INC="-I$dir/$subdir"
  513. break
  514. fi
  515. done
  516. test "$found" = "yes" && break
  517. done
  518. fi
  519. ])
  520. else
  521. TARGET_READLINE_INC="$with_readline_inc"
  522. fi
  523. if test x"$found" = xno; then
  524. TARGET_READLINE_LIBS=""
  525. TARGET_READLINE_INC=""
  526. TARGET_HAVE_READLINE=0
  527. else
  528. TARGET_HAVE_READLINE=1
  529. fi
  530. fi
  531. AC_SUBST(TARGET_READLINE_LIBS)
  532. AC_SUBST(TARGET_READLINE_INC)
  533. AC_SUBST(TARGET_HAVE_READLINE)
  534. ##########
  535. # Figure out what C libraries are required to compile programs
  536. # that use "fdatasync()" function.
  537. #
  538. AC_SEARCH_LIBS(fdatasync, [rt])
  539. #########
  540. # check for debug enabled
  541. AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
  542. [use_debug=$enableval],[use_debug=no])
  543. if test "${use_debug}" = "yes" ; then
  544. TARGET_DEBUG="-DSQLITE_DEBUG=1"
  545. else
  546. TARGET_DEBUG="-DNDEBUG"
  547. fi
  548. AC_SUBST(TARGET_DEBUG)
  549. #########
  550. # See whether we should use the amalgamation to build
  551. AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
  552. [Disable the amalgamation and instead build all files separately]),
  553. [use_amalgamation=$enableval],[use_amalgamation=yes])
  554. if test "${use_amalgamation}" != "yes" ; then
  555. USE_AMALGAMATION=0
  556. fi
  557. AC_SUBST(USE_AMALGAMATION)
  558. #########
  559. # See whether we should allow loadable extensions
  560. AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
  561. [Enable loading of external extensions]),
  562. [use_loadextension=$enableval],[use_loadextension=no])
  563. if test "${use_loadextension}" = "yes" ; then
  564. OPT_FEATURE_FLAGS=""
  565. AC_SEARCH_LIBS(dlopen, dl)
  566. else
  567. OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
  568. fi
  569. #########
  570. # attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
  571. for option in $CFLAGS $CPPFLAGS
  572. do
  573. case $option in
  574. -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
  575. -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
  576. esac
  577. done
  578. AC_SUBST(OPT_FEATURE_FLAGS)
  579. # attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
  580. ac_temp_CFLAGS=""
  581. for option in $CFLAGS
  582. do
  583. case $option in
  584. -DSQLITE_OMIT*) ;;
  585. -DSQLITE_ENABLE*) ;;
  586. *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
  587. esac
  588. done
  589. CFLAGS=$ac_temp_CFLAGS
  590. # attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
  591. ac_temp_CPPFLAGS=""
  592. for option in $CPPFLAGS
  593. do
  594. case $option in
  595. -DSQLITE_OMIT*) ;;
  596. -DSQLITE_ENABLE*) ;;
  597. *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
  598. esac
  599. done
  600. CPPFLAGS=$ac_temp_CPPFLAGS
  601. # attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
  602. ac_temp_BUILD_CFLAGS=""
  603. for option in $BUILD_CFLAGS
  604. do
  605. case $option in
  606. -DSQLITE_OMIT*) ;;
  607. -DSQLITE_ENABLE*) ;;
  608. *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
  609. esac
  610. done
  611. BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
  612. #########
  613. # See whether we should use GCOV
  614. AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
  615. [Enable coverage testing using gcov]),
  616. [use_gcov=$enableval],[use_gcov=no])
  617. if test "${use_gcov}" = "yes" ; then
  618. USE_GCOV=1
  619. else
  620. USE_GCOV=0
  621. fi
  622. AC_SUBST(USE_GCOV)
  623. #########
  624. # Output the config header
  625. AC_CONFIG_HEADERS(config.h)
  626. #########
  627. # Generate the output files.
  628. #
  629. AC_SUBST(BUILD_CFLAGS)
  630. AC_OUTPUT([
  631. Makefile
  632. sqlite3.pc
  633. ])