configure.ac 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. #
  2. # This file describes a "configure" script that is used to build
  3. # makefiles for a particular platform. Process this file using
  4. # Autoconf version 1.13 in order to generate that script. All
  5. # lines of this file up to the AC_INIT macro are ignored.
  6. #
  7. # The build process allows for using a cross-compiler. But the default
  8. # action is to target the same platform that we are running on. The
  9. # configure script needs to discover the following properties of the
  10. # build and target systems:
  11. #
  12. # srcdir
  13. #
  14. # The is the name of the directory that contains the
  15. # "configure" shell script. All source files are
  16. # located relative to this directory.
  17. #
  18. # bindir
  19. #
  20. # The name of the directory where executables should be
  21. # written by the "install" target of the makefile.
  22. #
  23. # program_prefix
  24. #
  25. # Add this prefix to the names of all executables that run
  26. # on the target machine. Default: ""
  27. #
  28. # ENABLE_SHARED
  29. #
  30. # True if shared libraries should be generated.
  31. #
  32. # BUILD_CC
  33. #
  34. # The name of a command that is used to convert C
  35. # source files into executables that run on the build
  36. # platform.
  37. #
  38. # BUILD_CFLAGS
  39. #
  40. # Switches that the build compiler needs in order to construct
  41. # command-line programs.
  42. #
  43. # BUILD_LIBS
  44. #
  45. # Libraries that the build compiler needs in order to construct
  46. # command-line programs.
  47. #
  48. # BUILD_EXEEXT
  49. #
  50. # The filename extension for executables on the build
  51. # platform. "" for Unix and ".exe" for Windows.
  52. #
  53. # TARGET_CC
  54. #
  55. # The name of a command that runs on the build platform
  56. # and converts C source files into *.o files for the
  57. # target platform. In other words, the cross-compiler.
  58. #
  59. # TARGET_CFLAGS
  60. #
  61. # Switches that the target compiler needs to turn C source files
  62. # into *.o files. Do not include TARGET_TCL_INC in this list.
  63. # Makefiles might add additional switches such as "-I.".
  64. #
  65. # TARGET_TCL_LIBS
  66. #
  67. # This is the library directives passed to the target linker
  68. # that cause the executable to link against Tcl. This might
  69. # be a switch like "-ltcl8.0" or pathnames of library file
  70. # like "../../src/libtcl8.0.a".
  71. #
  72. # TARGET_TCL_INC
  73. #
  74. # This variables define the directory that contain header
  75. # files for Tcl. If the compiler is able to find <tcl.h>
  76. # on its own, then this can be blank.
  77. #
  78. # TARGET_READLINE_LIBS
  79. #
  80. # This is the library directives passed to the target linker
  81. # that cause the executable to link against the readline library.
  82. # This might be a switch like "-lreadline" or pathnames of library
  83. # file like "../../src/libreadline.a".
  84. #
  85. # TARGET_READLINE_INC
  86. #
  87. # This variables define the directory that contain header
  88. # files for the readline library. If the compiler is able
  89. # to find <readline.h> on its own, then this can be blank.
  90. #
  91. # TARGET_LINK
  92. #
  93. # The name of the linker that combines *.o files generated
  94. # by TARGET_CC into executables for the target platform.
  95. #
  96. # TARGET_LIBS
  97. #
  98. # Additional libraries or other switch that the target linker needs
  99. # to build an executable on the target. Do not include
  100. # on this list any libraries in TARGET_TCL_LIBS and
  101. # TARGET_READLINE_LIBS, etc.
  102. #
  103. # TARGET_EXEEXT
  104. #
  105. # The filename extension for executables on the
  106. # target platform. "" for Unix and ".exe" for windows.
  107. #
  108. # The generated configure script will make an attempt to guess
  109. # at all of the above parameters. You can override any of
  110. # the guesses by setting the environment variable named
  111. # "config_AAAA" where "AAAA" is the name of the parameter
  112. # described above. (Exception: srcdir cannot be set this way.)
  113. # If you have a file that sets one or more of these environment
  114. # variables, you can invoke configure as follows:
  115. #
  116. # configure --with-hints=FILE
  117. #
  118. # where FILE is the name of the file that sets the environment
  119. # variables. FILE should be an absolute pathname.
  120. #
  121. # If you have a Tcl/Tk/BLT source distribution available, then the
  122. # files in that distribution will be used instead of any other
  123. # Tcl/Tk/BLT files the script might discover if you tell the configure
  124. # script about the source tree. Use commandline options:
  125. #
  126. # --with-tcl=PATH --with-tk=PATH --with-blt=PATH
  127. #
  128. # Or set environment variables config_WITH_TCL, config_WITH_TK, or
  129. # config_WITH_BLT.
  130. #
  131. # This configure.in file is easy to reuse on other projects. Just
  132. # change the argument to AC_INIT(). And disable any features that
  133. # you don't need (for example BLT) by erasing or commenting out
  134. # the corresponding code.
  135. #
  136. AC_INIT(src/sqlite.h.in)
  137. dnl Put the RCS revision string after AC_INIT so that it will also
  138. dnl show in in configure.
  139. # The following RCS revision string applies to configure.in
  140. # $Revision: 1.1 $
  141. #########
  142. # Programs needed
  143. #
  144. AC_PROG_LIBTOOL
  145. AC_PROG_INSTALL
  146. #########
  147. # Set up an appropriate program prefix
  148. #
  149. if test "$program_prefix" = "NONE"; then
  150. program_prefix=""
  151. fi
  152. AC_SUBST(program_prefix)
  153. #########
  154. # Check to see if the --with-hints=FILE option is used. If there is none,
  155. # then check for a files named "$host.hints" and ../$hosts.hints where
  156. # $host is the hostname of the build system. If still no hints are
  157. # found, try looking in $system.hints and ../$system.hints where
  158. # $system is the result of uname -s.
  159. #
  160. AC_ARG_WITH(hints,
  161. [ --with-hints=FILE Read configuration options from FILE],
  162. hints=$withval)
  163. if test "$hints" = ""; then
  164. host=`hostname | sed 's/\..*//'`
  165. if test -r $host.hints; then
  166. hints=$host.hints
  167. else
  168. if test -r ../$host.hints; then
  169. hints=../$host.hints
  170. fi
  171. fi
  172. fi
  173. if test "$hints" = ""; then
  174. sys=`uname -s`
  175. if test -r $sys.hints; then
  176. hints=$sys.hints
  177. else
  178. if test -r ../$sys.hints; then
  179. hints=../$sys.hints
  180. fi
  181. fi
  182. fi
  183. if test "$hints" != ""; then
  184. AC_MSG_RESULT(reading hints from $hints)
  185. . $hints
  186. fi
  187. #########
  188. # Locate a compiler for the build machine. This compiler should
  189. # generate command-line programs that run on the build machine.
  190. #
  191. default_build_cflags="-g"
  192. if test "$config_BUILD_CC" = ""; then
  193. AC_PROG_CC
  194. if test "$cross_compiling" = "yes"; then
  195. AC_MSG_ERROR([unable to find a compiler for building build tools])
  196. fi
  197. BUILD_CC=$CC
  198. default_build_cflags=$CFLAGS
  199. else
  200. BUILD_CC=$config_BUILD_CC
  201. AC_MSG_CHECKING([host compiler])
  202. CC=$BUILD_CC
  203. AC_MSG_RESULT($BUILD_CC)
  204. fi
  205. AC_MSG_CHECKING([switches for the host compiler])
  206. if test "$config_BUILD_CFLAGS" != ""; then
  207. CFLAGS=$config_BUILD_CFLAGS
  208. BUILD_CFLAGS=$config_BUILD_CFLAGS
  209. else
  210. BUILD_CFLAGS=$default_build_cflags
  211. fi
  212. AC_MSG_RESULT($BUILD_CFLAGS)
  213. if test "$config_BUILD_LIBS" != ""; then
  214. BUILD_LIBS=$config_BUILD_LIBS
  215. fi
  216. AC_SUBST(BUILD_CC)
  217. AC_SUBST(BUILD_CFLAGS)
  218. AC_SUBST(BUILD_LIBS)
  219. ##########
  220. # Locate a compiler that converts C code into *.o files that run on
  221. # the target machine.
  222. #
  223. AC_MSG_CHECKING([target compiler])
  224. if test "$config_TARGET_CC" != ""; then
  225. TARGET_CC=$config_TARGET_CC
  226. else
  227. TARGET_CC=$BUILD_CC
  228. fi
  229. AC_MSG_RESULT($TARGET_CC)
  230. AC_MSG_CHECKING([switches on the target compiler])
  231. if test "$config_TARGET_CFLAGS" != ""; then
  232. TARGET_CFLAGS=$config_TARGET_CFLAGS
  233. else
  234. TARGET_CFLAGS=$BUILD_CFLAGS
  235. fi
  236. AC_MSG_RESULT($TARGET_CFLAGS)
  237. AC_MSG_CHECKING([target linker])
  238. if test "$config_TARGET_LINK" = ""; then
  239. TARGET_LINK=$TARGET_CC
  240. else
  241. TARGET_LINK=$config_TARGET_LINK
  242. fi
  243. AC_MSG_RESULT($TARGET_LINK)
  244. AC_MSG_CHECKING([switches on the target compiler])
  245. if test "$config_TARGET_TFLAGS" != ""; then
  246. TARGET_TFLAGS=$config_TARGET_TFLAGS
  247. else
  248. TARGET_TFLAGS=$BUILD_CFLAGS
  249. fi
  250. if test "$config_TARGET_RANLIB" != ""; then
  251. TARGET_RANLIB=$config_TARGET_RANLIB
  252. else
  253. AC_PROG_RANLIB
  254. TARGET_RANLIB=$RANLIB
  255. fi
  256. if test "$config_TARGET_AR" != ""; then
  257. TARGET_AR=$config_TARGET_AR
  258. else
  259. TARGET_AR='ar cr'
  260. fi
  261. AC_MSG_RESULT($TARGET_TFLAGS)
  262. AC_SUBST(TARGET_CC)
  263. AC_SUBST(TARGET_CFLAGS)
  264. AC_SUBST(TARGET_LINK)
  265. AC_SUBST(TARGET_LFLAGS)
  266. AC_SUBST(TARGET_RANLIB)
  267. AC_SUBST(TARGET_AR)
  268. # Set the $cross variable if we are cross-compiling. Make
  269. # it 0 if we are not.
  270. #
  271. AC_MSG_CHECKING([if host and target compilers are the same])
  272. if test "$BUILD_CC" = "$TARGET_CC"; then
  273. cross=0
  274. AC_MSG_RESULT(yes)
  275. else
  276. cross=1
  277. AC_MSG_RESULT(no)
  278. fi
  279. ##########
  280. # Are we using UTF-8 or iso8859 encodings?
  281. #
  282. AC_ARG_ENABLE(utf8,
  283. [ --enable-utf8 Use UTF-8 encodings],,enable_utf8=no)
  284. AC_MSG_CHECKING([character encoding])
  285. if test "$enable_utf8" = "no"; then
  286. ENCODING=ISO8859
  287. AC_MSG_RESULT([iso8859])
  288. else
  289. ENCODING=UTF8
  290. AC_MSG_RESULT([UTF-8])
  291. fi
  292. AC_SUBST(ENCODING)
  293. ###########
  294. # Lots of things are different if we are compiling for Windows using
  295. # the CYGWIN environment. So check for that special case and handle
  296. # things accordingly.
  297. #
  298. AC_MSG_CHECKING([if executables have the .exe suffix])
  299. if test "$config_BUILD_EXEEXT" = ".exe"; then
  300. CYGWIN=yes
  301. AC_MSG_RESULT(yes)
  302. else
  303. AC_MSG_RESULT(unknown)
  304. fi
  305. if test "$CYGWIN" != "yes"; then
  306. AC_CYGWIN
  307. fi
  308. if test "$CYGWIN" = "yes"; then
  309. BUILD_EXEEXT=.exe
  310. else
  311. BUILD_EXEEXT=""
  312. fi
  313. if test "$cross" = "0"; then
  314. TARGET_EXEEXT=$BUILD_EXEEXT
  315. else
  316. TARGET_EXEEXT=$config_TARGET_EXEEXT
  317. fi
  318. if test "$TARGET_EXEEXT" = ".exe"; then
  319. OS_UNIX=0
  320. OS_WIN=1
  321. tclsubdir=win
  322. else
  323. OS_UNIX=1
  324. OS_WIN=0
  325. tclsubdir=unix
  326. fi
  327. TARGET_CFLAGS="$TARGET_CFLAGS -DOS_UNIX=$OS_UNIX -DOS_WIN=$OS_WIN"
  328. AC_SUBST(BUILD_EXEEXT)
  329. AC_SUBST(OS_UNIX)
  330. AC_SUBST(OS_WIN)
  331. AC_SUBST(TARGET_EXEEXT)
  332. ##########
  333. # Extract generic linker options from the environment.
  334. #
  335. if test "$config_TARGET_LIBS" != ""; then
  336. TARGET_LIBS=$config_TARGET_LIBS
  337. else
  338. TARGET_LIBS=""
  339. fi
  340. AC_SUBST(TARGET_LIBS)
  341. ##########
  342. # Figure out what C libraries are required to compile Tcl programs.
  343. #
  344. if test "$config_TARGET_TCL_LIBS" != ""; then
  345. TARGET_TCL_LIBS="$config_TARGET_TCL_LIBS"
  346. else
  347. if test "$with_tcl" != ""; then
  348. extra=`echo $with_tcl/$tclsubdir/libtcl8*.a`
  349. fi
  350. CC=$TARGET_CC
  351. AC_CHECK_FUNC(sin, LIBS="", LIBS="-lm")
  352. AC_CHECK_LIB(dl, dlopen)
  353. otherlibs=$LIBS
  354. if test "$extra" != ""; then
  355. LIBS=$extra
  356. else
  357. LIBS=""
  358. AC_SEARCH_LIBS(Tcl_Init, dnl
  359. tcl8.4 tcl8.3 tcl8.2 tcl8.1 tcl8.0 tcl80 tcl,,,$otherlibs)
  360. fi
  361. TARGET_TCL_LIBS="$LIBS $otherlibs"
  362. fi
  363. AC_SUBST(TARGET_TCL_LIBS)
  364. ##########
  365. # Figure out where to get the TCL header files.
  366. #
  367. AC_MSG_CHECKING([TCL header files])
  368. found=no
  369. if test "$config_TARGET_TCL_INC" != ""; then
  370. TARGET_TCL_INC=$config_TARGET_TCL_INC
  371. found=yes
  372. else
  373. if test "$with_tcl" != ""; then
  374. TARGET_TCL_INC="-I$with_tcl/generic -I$with_tcl/$tclsubdir"
  375. found=yes
  376. else
  377. TARGET_TCL_INC=""
  378. found=no
  379. fi
  380. fi
  381. if test "$found" = "yes"; then
  382. AC_MSG_RESULT($TARGET_TCL_INC)
  383. else
  384. AC_MSG_RESULT(not specified: still searching...)
  385. AC_CHECK_HEADER(tcl.h, [found=yes])
  386. fi
  387. if test "$found" = "no"; then
  388. for dir in /usr/local /usr/X11 /usr/X11R6 /usr/pkg /usr/contrib /usr; do
  389. AC_CHECK_FILE($dir/include/tcl.h, found=yes)
  390. if test "$found" = "yes"; then
  391. TARGET_TCL_INC="-I$dir/include"
  392. break
  393. fi
  394. done
  395. fi
  396. if test "$found" = "no"; then
  397. TARGET_TCL_INC="-DNO_TCL=1"
  398. fi
  399. AC_SUBST(TARGET_TCL_INC)
  400. ##########
  401. # Figure out what C libraries are required to compile programs
  402. # that use "readline()" library.
  403. #
  404. if test "$config_TARGET_READLINE_LIBS" != ""; then
  405. TARGET_READLINE_LIBS="$config_TARGET_READLINE_LIBS"
  406. else
  407. CC=$TARGET_CC
  408. LIBS=""
  409. AC_SEARCH_LIBS(readline, readline,,,)
  410. TARGET_READLINE_LIBS="$LIBS"
  411. fi
  412. AC_SUBST(TARGET_READLINE_LIBS)
  413. ##########
  414. # Figure out where to get the READLINE header files.
  415. #
  416. AC_MSG_CHECKING([readline header files])
  417. found=no
  418. if test "$config_TARGET_READLINE_INC" != ""; then
  419. TARGET_READLINE_INC=$config_TARGET_READLINE_INC
  420. found=yes
  421. fi
  422. if test "$found" = "yes"; then
  423. AC_MSG_RESULT($TARGET_READLINE_INC)
  424. else
  425. AC_MSG_RESULT(not specified: still searching...)
  426. AC_CHECK_HEADER(readline.h, [found=yes])
  427. fi
  428. if test "$found" = "no"; then
  429. for dir in /usr /usr/local /usr/local/readline /usr/contrib; do
  430. AC_CHECK_FILE($dir/include/readline.h, found=yes)
  431. if test "$found" = "yes"; then
  432. TARGET_READLINE_INC="-I$dir/include"
  433. break
  434. fi
  435. AC_CHECK_FILE($dir/include/readline/readline.h, found=yes)
  436. if test "$found" = "yes"; then
  437. TARGET_READLINE_INC="-I$dir/include/readline"
  438. break
  439. fi
  440. done
  441. fi
  442. if test "$found" = "yes"; then
  443. if test "$TARGET_READLINE_LIBS" = ""; then
  444. TARGET_HAVE_READLINE=0
  445. else
  446. TARGET_HAVE_READLINE=1
  447. fi
  448. else
  449. TARGET_HAVE_READLINE=0
  450. fi
  451. AC_SUBST(TARGET_READLINE_INC)
  452. AC_SUBST(TARGET_HAVE_READLINE)
  453. #########
  454. # Figure out whether or not we have a "usleep()" function.
  455. #
  456. AC_CHECK_FUNC(usleep, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_USLEEP=1"])
  457. #########
  458. # Generate the output files.
  459. #
  460. AC_OUTPUT(Makefile)