configure.ac 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829
  1. ## Process this file with autoconf to produce a configure script.
  2. # A C Norman. April 2009-2021
  3. #
  4. # The object of this configuration file is not to set the world up to
  5. # compile anything - it is to verify the availability of tools and libraries
  6. # that will be neededto build a CSL-based Reduce. So it will try to test
  7. # for these libraries and STOP with an error message if it finds anything
  8. # out of place.
  9. #
  10. # Specify the name of this "application" and a version number
  11. AC_INIT([CSLCONFIGTEST],[1.0])
  12. AC_PREREQ(2.61)
  13. AC_CONFIG_MACRO_DIRS([m4])
  14. AC_CONFIG_AUX_DIR([.])
  15. AM_INIT_AUTOMAKE([1.13 -Wall -Wno-portability -Wno-override foreign dist-bzip2])
  16. # The next bit is because config.guess fails on Solaris if SHELL=/bin/bash
  17. if test -x /bin/sh
  18. then
  19. SHELL=/bin/sh
  20. export SHELL
  21. fi
  22. #
  23. # There is a horror here. If one fetches everything from subversion
  24. # then timstamps can be ill-ordered, and it can seem necessary to
  25. # re-create the autoconf-related files. The standard way that autoconf and
  26. # automake allow for this is not very generous if the version of autoconf
  27. # on the local machine does not match the one used in the files from the
  28. # central site.
  29. #
  30. # I am now going to try to respond to that by forcing a re-generation of
  31. # all the autoconf files each time anybody runs configure. That adds to the
  32. # cost for everybody and means that everybody NEEDS autoconf, automake and
  33. # libtool installed, but may be more robust.
  34. #
  35. AC_ARG_WITH(autogen,
  36. AS_HELP_STRING([--with-autogen], [Regenerate autoconf file at start]),
  37. [],
  38. [with_autogen="yes"])
  39. if test "x$with_autogen" = "xyes"
  40. then
  41. if ! which autoconf > /dev/null 2> /dev/null
  42. then
  43. printf "You must have autoconf (at least version 2.61) installed to\n"
  44. printf "build this package. Install it and try again please.\n"
  45. exit 1
  46. fi
  47. if ! which automake > /dev/null 2> /dev/null
  48. then
  49. printf "You must have automake (at least version 1.13) installed to\n"
  50. printf "build this package. Install it and try again please.\n"
  51. exit 1
  52. fi
  53. if ! which libtool > /dev/null 2> /dev/null
  54. then
  55. printf "You must have libtool installed to build this package. Install\n"
  56. printf "it and try again please.\n"
  57. exit 1
  58. fi
  59. # The next fragment should extract version numbers for autoconf and automake
  60. # I extract versionm infor from the two utilities. The first line of
  61. # the output from "autoxx --version" is "autoxx ... nn.nn.nn" with
  62. # a two or three component version number at the end.
  63. acver=`autoconf --version 2> /dev/null | head -1`
  64. amver=`automake --version 2> /dev/null | head -1`
  65. # Get rid of everything as far as the final blank in the data. What is
  66. # left is just the version number, whihc may be two or three components,
  67. # such as 14.2.1 or 15.0
  68. acver=`echo $acver | sed -e 's/.* //'`
  69. amver=`echo $amver | sed -e 's/.* //'`
  70. # The major version number is got by stripping of everything from the "." on.
  71. acmaj=`echo $acver | sed -e 's/\..*//'`
  72. ammaj=`echo $amver | sed -e 's/\..*//'`
  73. # The minor version number is left if one deleted the major number.
  74. acver=`echo $acver | sed -e "s/$acmaj\.//"`
  75. amver=`echo $amver | sed -e "s/$ammaj\.//"`
  76. # What was left could have a patch level - get rid of it.
  77. acmin=`echo $acver | sed -e 's/\..*//'`
  78. ammin=`echo $amver | sed -e 's/\..*//'`
  79. AC_MSG_NOTICE([detected autoconf: $acmaj.$acmin automake: $ammaj.$ammin])
  80. if test $acmaj -lt 2 || test $acmaj -eq 2 && test $acmin -lt 61
  81. then
  82. printf "You have autconf $acmaj.$acmin but at least 2.61 is needed\n"
  83. printf "to build this package. Install it and try again please.\n"
  84. exit 1
  85. fi
  86. if test $ammaj -lt 1 || test $ammaj -eq 1 && test $ammin -lt 13
  87. then
  88. printf "You have automake $ammaj.$ammin but at least 1.13 is needed\n"
  89. printf "to build this package. Install it and try again please.\n"
  90. exit 1
  91. fi
  92. here=`pwd`
  93. cd $srcdir
  94. printf "Regenerate autoconf-related files\n"
  95. # Because you will probably not pass arguments to the configure script here
  96. # autogen.sh will re-make autoconf-related files all the way through the
  97. # entire Reduce tree. This is perhaps excessive and expensive, but on the
  98. # other hand it may enhance safety!
  99. if ! ./autogen.sh $ac_configure_args
  100. then
  101. printf "The autogen.sh script seems to have failed. I can not continue\n"
  102. exit 1
  103. fi
  104. cd $here
  105. printf "Restart: $srcdir/configure $ac_configure_args\n"
  106. exec /bin/sh -c "$srcdir/configure $ac_configure_args --without-autogen"
  107. fi
  108. # I am going to expect that you have at least this version of autoconf.
  109. AC_PREREQ(2.59)
  110. AC_CONFIG_SRCDIR(window.cpp)
  111. AC_CONFIG_FILES([Makefile])
  112. AC_CHECK_PROG([ACLOCAL], [aclocal], [yes], [no])
  113. if test "x$ACLOCAL" = "xno"
  114. then
  115. AC_MSG_WARN([Please install aclocal (and other autoconf tools)])
  116. fi
  117. AC_CHECK_PROG([AUTOCONF], [autoconf], [yes], [no])
  118. if test "x$AUTOCONF" = "xno"
  119. then
  120. AC_MSG_WARN([Please install autoconf])
  121. fi
  122. AC_CHECK_PROG([AUTOMAKE], [automake], [yes], [no])
  123. if test "x$AUTOMAKE" = "xno"
  124. then
  125. AC_MSG_WARN([Please install automake])
  126. fi
  127. AC_CHECK_PROG([AUTORECONF], [autoreconf], [yes], [no])
  128. if test "x$AUTORECONF" = "xno"
  129. then
  130. AC_MSG_WARN([Please install autoreconf])
  131. fi
  132. # Part of the idea here is that you can pass THIS configure script a useful
  133. # subset of the options that will go to the top-level one...
  134. AC_ARG_WITH(mingw64,
  135. AS_HELP_STRING([--with-mingw64],
  136. [Should behave like --host=x86_64-w64-mingw32]),
  137. [],
  138. [with_mingw64="no"])
  139. if test "x$with_mingw64" = "xyes"
  140. then
  141. mingw64="yes"
  142. else
  143. mingw64="no"
  144. fi
  145. if test "x$mingw64" = "xyes"
  146. then
  147. AC_MSG_NOTICE([You have selected --with-mingw64. This is much like --host=x86_64-w64-mingw32])
  148. AC_MSG_NOTICE([and requires cross-compilation tools such as x86_64-w64-mingw32-gcc])
  149. host="x86_64-w64-mingw32"
  150. ac_tool_prefix="x86_64-w64-mingw32-"
  151. cross_compiling=yes
  152. STRIP="x86_64-w64-mingw32-strip"
  153. AR="x86_64-w64-mingw32-ar"
  154. fi
  155. # What host am I on?
  156. AC_CANONICAL_HOST()
  157. case $host in
  158. x86_64-w64-*)
  159. AC_DEFINE(WIN32, [1], [True if we are running on Windows])
  160. AC_DEFINE(WIN64, [1], [True if we are running on 64-bit Windows])
  161. CPPFLAGS="$CPPFLAGS"
  162. CFLAGS="$CFLAGS -funsigned-char"
  163. CXXFLAGS="$CXXFLAGS -funsigned-char"
  164. windows_build="yes"
  165. exeext="yes"
  166. X_BASE_LIBS=""
  167. ;;
  168. *-*-cygwin* | *-*-*mingw*)
  169. AC_MSG_NOTICE([Building under cygwin])
  170. AC_ARG_WITH(cygwin,
  171. AS_HELP_STRING([--with-cygwin],
  172. [Force use of raw cywgin (note license consequences please)]),
  173. [],
  174. [with_cygwin="no"])
  175. if test "x$with_cywgin" = "xyes"
  176. then
  177. really_use_cygwin="yes"
  178. fi
  179. x86="yes"
  180. if test "x$really_use_cygwin" = "xyes"
  181. then
  182. AC_DEFINE(UNIX,[1],[True if we are running on Unix, Linux, BSD etc])
  183. AC_DEFINE(RAW_CYGWIN, [1], [True if we are running on RAW Cygwin])
  184. CFLAGS="$CFLAGS -funsigned-char"
  185. CXXFLAGS="$CXXFLAGS -funsigned-char"
  186. LDFLAGS="$LDFLAGS -L/usr/X11R6/lib"
  187. XLIBS="-lXext -lX11"
  188. cygwin_build="yes"
  189. exeext="yes"
  190. else
  191. AC_DEFINE(WIN32, [1], [True if we are running on Windows])
  192. CPPFLAGS="$CPPFLAGS "
  193. CFLAGS="$CFLAGS -funsigned-char"
  194. CXXFLAGS="$CXXFLAGS -funsigned-char"
  195. LDFLAGS="$LDFLAGS "
  196. foxdir=`echo $foxdir | sed -e 's/cygwin/windows/'`
  197. fi
  198. windows_build="yes"
  199. exeext="yes"
  200. X_BASE_LIBS=""
  201. ;;
  202. *-*-msdos* | *-*-go32* | *-*-windows*)
  203. AC_MSG_ERROR([For Windows you are expected to use cygwin/mingw32])
  204. ;;
  205. *-*solaris*)
  206. AC_MSG_NOTICE([Building for Solaris])
  207. if test "x$CC" = "x"
  208. then
  209. AC_PATH_PROGS(CC, gcc, gcc, [/usr/sfw/bin:$PATH])
  210. fi
  211. if test "x$CXX" = "x"
  212. then
  213. AC_PATH_PROGS(CXX, g++, g++, [/usr/sfw/bin:$PATH])
  214. fi
  215. if test "x$MAKE" = "x"
  216. then
  217. AC_PATH_PROGS(MAKE, [gmake make], make, [/usr/sfw/bin:$PATH])
  218. fi
  219. if test "x$AR" = "x"
  220. then
  221. AC_PATH_PROGS(AR, [gar ar], ar, [/usr/sfw/bin:$PATH])
  222. fi
  223. if test "x$STRIP" = "x"
  224. then
  225. AC_PATH_PROGS(STRIP, [gstrip strip], strip, [/usr/sfw/bin:$PATH])
  226. fi
  227. if test "x$SED" = "x"
  228. then
  229. AC_PATH_PROGS(SED, [gsed sed], sed, [/usr/sfw/bin:$PATH])
  230. fi
  231. LDFLAGS="$LDFLAGS -L/usr/X11R6/lib"
  232. XLIBS="-lXext -lX11"
  233. AC_DEFINE(SOLARIS, [1], [True if we are running on Solaris])
  234. solaris="yes"
  235. # I think that my Solaris settings may not be fully complete or up to date...
  236. ;;
  237. *darwin*)
  238. AC_MSG_NOTICE([Building for Macintosh/Darwin with X11])
  239. darwin_build="yes"
  240. AC_DEFINE(MACINTOSH, [1], [True if we are running on Macintosh])
  241. # If the person who invoked the configure script had set CC or CXX so as to
  242. # override any default selection of which C and C++ compiler to use then
  243. # it will be THEIR business to set up any associated CFLAGS, LDFLAGS etc so
  244. # as to access an appropriate SDK. If I am on a Mac and the person who
  245. # invoked configure did NOT specify options to force which compilers were to
  246. # be used I will feel entitled to use "gcc" and "g++", and with them I
  247. # will make assumptions about where the proper SDKs will have been installed
  248. # and what compiler options will behave properly. Once again any individual or
  249. # script that forces CC or CXX to values other the gcc or g++ have to take
  250. # responsibility for ALL consequences of their actions, and they must also
  251. # pass CFLAGS, LDFLAGS, LIBS and anything else needed.
  252. if test "x$CC$CXX" == "x" || (test "x$CC" == "xgcc" && test "x$CXX" == "xg++")
  253. then
  254. CFLAGS="$CFLAGS -fno-common -no-cpp-precomp"
  255. CXXFLAGS="$CXXFLAGS -fno-common -no-cpp-precomp"
  256. CPPFLAGS="$CPPFLAGS -fno-common -no-cpp-precomp -flat_namespace -I/usr/X11R6/include"
  257. AC_DEFINE(UNIX,[1],[True if we are running on Unix, Linux, BSD etc])
  258. LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -flat_namespace"
  259. XLIBS="-lXext -lX11"
  260. macintosh_build="yes"
  261. darwin_build="yes"
  262. LDFLAGS="$LDFLAGS -framework Carbon -framework CoreServices -framework ApplicationServices"
  263. fi
  264. ;;
  265. *-freebsd*)
  266. AC_MSG_NOTICE([Building on FreeBSD])
  267. AC_DEFINE(UNIX,[1],[True if we are running on Unix, Linux, BSD etc])
  268. if test "x$target" = "x"
  269. then
  270. xtarget="$host"
  271. else
  272. xtarget="$target"
  273. fi
  274. case $xtarget in
  275. *i386* | *i486* | *i586* | *i686* | *x86* | *amd64*)
  276. x86="yes"
  277. ;;
  278. esac
  279. if test "x$cross_compiling" != "xyes"
  280. then
  281. AC_CHECK_FILE([/usr/X11R6/lib64],[XLL=lib64],[XLL=lib])
  282. else
  283. XLL=lib
  284. fi
  285. LDFLAGS="$LDFLAGS -L/usr/X11R6/$XLL -pthread"
  286. XLIBS="-lXext -lX11"
  287. ;;
  288. *)
  289. AC_MSG_NOTICE([Assuming a Unix-like environment, including Linux])
  290. AC_MSG_NOTICE([host=$host, target=$target])
  291. AC_DEFINE(UNIX,[1],[True if we are running on Unix, Linux, BSD etc])
  292. if test "x$target" = "x"
  293. then
  294. xtarget="$host"
  295. else
  296. xtarget="$target"
  297. fi
  298. case $xtarget in
  299. *i386* | *i486* | *i586* | *i686* | *x86* | *amd64*)
  300. x86="yes"
  301. ;;
  302. esac
  303. if test "x$cross_compiling" != "xyes"
  304. then
  305. AC_CHECK_FILE([/usr/X11R6/lib64],[XLL=lib64],[XLL=lib])
  306. else
  307. XLL=lib
  308. fi
  309. LDFLAGS="$LDFLAGS -L/usr/X11R6/$XLL"
  310. XLIBS="-lXext -lX11"
  311. ;;
  312. esac
  313. if test "x$MAKE" = "x"
  314. then
  315. AC_CHECK_PROGS(MAKE,[gmake make],[no])
  316. if test "x$MAKE" = "xno"
  317. then
  318. AC_MSG_ERROR([Please install (the GNU version of) "make"])
  319. fi
  320. fi
  321. if test "x$AR" = "x"
  322. then
  323. AC_CHECK_PROGS(AR,[gar ar],[no])
  324. if test "x$AR" = "xno"
  325. then
  326. AC_MSG_ERROR([Please install "ar"])
  327. fi
  328. fi
  329. if test "x$STRIP" = "x"
  330. then
  331. AC_CHECK_PROGS(STRIP,[gstrip strip],[echo])
  332. fi
  333. if test "x$SED" = "x"
  334. then
  335. AC_CHECK_PROGS(SED,[gsed sed],[no])
  336. if test "x$SED" = "xno"
  337. then
  338. AC_MSG_ERROR([Please install "sed"])
  339. fi
  340. fi
  341. # Debugging turned on?
  342. AC_MSG_CHECKING(for debugging)
  343. AC_ARG_ENABLE(debug,
  344. AS_HELP_STRING([--enable-debug],
  345. [compile for debugging]),
  346. [],
  347. [enable_debug="no"])
  348. AC_MSG_RESULT([$enable_debug])
  349. if test "x$x86" = "xyes"
  350. then
  351. AC_DEFINE(X86, [1], [True if Intel or AMD (32 or 64-bit)])
  352. fi
  353. old_CFLAGS="$CFLAGS"
  354. old_CXXFLAGS="$CXXFLAGS"
  355. AC_MSG_NOTICE([Looking for C pre-processor])
  356. AC_PROG_CPP
  357. AC_MSG_NOTICE([Looking for C compiler])
  358. AC_PROG_CC
  359. AM_PROG_CC_C_O
  360. AC_MSG_NOTICE([Looking for C++ pre-processor])
  361. AC_PROG_CXXCPP
  362. AC_MSG_NOTICE([Looking for C++ compiler])
  363. AC_PROG_CXX
  364. CFLAGS="$old_CFLAGS"
  365. CXXFLAGS="$old_CXXFLAGS"
  366. LT_INIT
  367. if test "x$CC" = "x"
  368. then
  369. AC_MSG_ERROR([Please install a C compiler and try again])
  370. fi
  371. if test "x$CXX" = "x"
  372. then
  373. AC_MSG_ERROR([Please install a C++ compiler and try again])
  374. fi
  375. AC_MSG_NOTICE([Checking for "--hash-style=both"])
  376. if test "x$GCC" = "xyes"
  377. then
  378. OLDLDFLAGS="$LDFLAGS"
  379. LDFLAGS="$LDFLAGS -Wl,--hash-style=both"
  380. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
  381. [[printf("\n");]])],
  382. [AC_MSG_NOTICE(Will use --hash-style=both)],
  383. [LDFLAGS="$OLDLDFLAGS"
  384. AC_MSG_NOTICE(--hash-style=both not available)])
  385. fi
  386. if test "x$windows_build" = "xyes"
  387. then
  388. if test "x$WINDRES" = "x"
  389. then
  390. AC_CHECK_TOOL([WINDRES], [windres], [no])
  391. if test "x$WINDRES" = "xno"
  392. then
  393. AC_MSG_ERROR([windres tool needed for windows builds: please install it])
  394. fi
  395. fi
  396. fi
  397. if test "x$windows_build" != "xyes"
  398. then
  399. if test "x$macintosh_build" != "xyes"
  400. then
  401. AC_MSG_NOTICE([Checking for "-rdynamic"])
  402. if test "x$GCC" = "xyes"
  403. then
  404. OLDLDFLAGS="$LDFLAGS"
  405. LDFLAGS="$LDFLAGS -rdynamic"
  406. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
  407. [[printf("\n");]])],
  408. [rdynamic_available="yes"],
  409. [LDFLAGS="$OLDLDFLAGS"
  410. rdynamic_available="no"])
  411. else
  412. rdynamic_available="no"
  413. fi
  414. else
  415. rdynamic_available="no"
  416. fi
  417. AC_MSG_NOTICE([rdynamic=$rdynamic_available])
  418. fi
  419. if test "x$darwin_build" = "xyes"
  420. then
  421. AC_MSG_NOTICE([Checking for "-framework"])
  422. if test "x$GCC" = "xyes"
  423. then
  424. OLDLDFLAGS="$LDFLAGS"
  425. LDFLAGS="$LDFLAGS -framework Carbon -framework CoreServices -framework ApplicationServices"
  426. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
  427. [[printf("\n");]])],
  428. [framework_available="yes"],
  429. [LDFLAGS="$OLDLDFLAGS"
  430. framework_available="no"])
  431. else
  432. framework_available="no"
  433. fi
  434. AC_MSG_NOTICE([framework=$framework_available])
  435. if test "x$framework_available" = "xyes"
  436. then
  437. AC_DEFINE(MAC_FRAMEWORK,[1],[Apple MacOS frameworks available])
  438. fi
  439. fi
  440. if test "x$windows_build" != "xyes"
  441. then
  442. AC_MSG_NOTICE([Checking for "-fPIC"])
  443. if test "x$GCC" = "xyes"
  444. then
  445. OLDCFLAGS="$CFLAGS"
  446. CFLAGS="$CFLAGS -fPIC"
  447. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
  448. [[printf("\n");]])],
  449. [fpic_available="yes"],
  450. [fpic_available="no"])
  451. CFLAGS="$OLDCFLAGS"
  452. else
  453. fpic_available="no"
  454. fi
  455. AC_MSG_NOTICE([-fPIC=$fpic_available])
  456. fi
  457. if test "x$solaris" = "xyes"
  458. then
  459. OLDCFLAGS="$CFLAGS"
  460. CFLAGS="$CFLAGS -mt"
  461. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
  462. [[printf("\n");]])],
  463. [CXXFLAGS="$CXXFLAGS -mt"],
  464. [CFLAGS="$OLDCFLAGS"])
  465. fi
  466. if test "x$windows_build" != "xyes" || test "x$with_cygwin" = "xyes"
  467. then
  468. AC_ARG_WITH(xft,
  469. AS_HELP_STRING([--with-xft],
  470. [Can be used to disable use of XFT. Default is yes]),
  471. [],
  472. [with_xft="yes"])
  473. if test "x$with_xft" != "xno" && test "x$cross_compiling" != "xyes"
  474. then
  475. AC_PATH_PROGS(XFT_CONFIG, xft-config, [no],
  476. [/usr/local/bin:/usr/X11R6/bin:/usr/sfw/bin:$PATH])
  477. if test "$XFT_CONFIG" != "no"
  478. then
  479. xft_cflags=`$XFT_CONFIG --cflags`
  480. CFLAGS="$CFLAGS $xft_cflags"
  481. CXXFLAGS="$CXXFLAGS $xft_cflags"
  482. CPPFLAGS="$CPPFLAGS $xft_cflags"
  483. xft_libs=`$XFT_CONFIG --libs`
  484. XLIBS="$XLIBS $xft_libs"
  485. xft_found="yes"
  486. AC_DEFINE(HAVE_LIBXFT, [1], [True Xft is available])
  487. AC_MSG_NOTICE([xft-config found, so Xft should be available])
  488. else
  489. AC_PATH_PROGS(FREETYPE_CONFIG, freetype-config, [no],
  490. [/usr/local/bin:/usr/sfw/bin:$PATH])
  491. if test "$FREETYPE_CONFIG" != "no"
  492. then
  493. freetype_cflags=`$FREETYPE_CONFIG --cflags`
  494. CFLAGS="$CFLAGS $freetype_cflags"
  495. CXXFLAGS="$CXXFLAGS $freetype_cflags"
  496. CPPFLAGS="$CPPFLAGS $freetype_cflags"
  497. freetype_libs=`$FREETYPE_CONFIG --libs`
  498. XLIBS="$XLIBS $freetype_libs"
  499. xft_found="yes"
  500. AC_CHECK_LIB(fontconfig, FcConfigCreate)
  501. AC_CHECK_LIB(Xft, XftFontOpen,,[xft_found="no"])
  502. AC_CHECK_HEADER(X11/Xft/Xft.h,,[xft_found="no"])
  503. if test "$xft_found" = "yes"
  504. then
  505. AC_DEFINE(HAVE_LIBXFT, [1], [True Xft is available])
  506. AC_MSG_NOTICE([freetype-config found, and Xft should be available])
  507. fi
  508. fi
  509. fi
  510. fi
  511. if test "x$xft_found" != "xyes"
  512. then
  513. AC_MSG_NOTICE([On non-Windows platforms the Xft library development files are required])
  514. fi
  515. fi
  516. AC_PROG_LN_S
  517. AC_MSG_CHECKING(for static linking)
  518. AC_ARG_ENABLE(static,
  519. AS_HELP_STRING([--enable-static],
  520. [link it all statically]),
  521. [],
  522. [enable_static="no"])
  523. if test "x$win32" != "xyes"
  524. then
  525. # Well in this particular case I reall DO NOT WANT static linking since
  526. # it seems to cause me some pain!
  527. enable_static="no"
  528. fi
  529. LOWOPT="-O0"
  530. HIGHOPT="-O2"
  531. case $CC in
  532. x86_64-w64-*)
  533. AC_DEFINE(WIN64, [1], [True if we are running on Windows (64 bit)])
  534. ;;
  535. esac
  536. if test "x$GCC" = "xyes"
  537. then
  538. if test "x$enable_debug" = "xyes"
  539. then
  540. CFLAGS="${CFLAGS} -fno-strict-aliasing ${LOWOPT} -g -DDEBUG=1 -Wall"
  541. CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing ${LOWOPT} -g -DDEBUG=1 -Wall"
  542. LDFLAGS="${LDFLAGS} -g"
  543. else
  544. CFLAGS="$CFLAGS -fno-strict-aliasing ${HIGHOPT} -Wall"
  545. CXXFLAGS="$CXXFLAGS -fno-strict-aliasing ${HIGHOPT} -Wall"
  546. fi
  547. if test "x$enable_static" = "xyes"
  548. then
  549. LDFLAGS="${LDFLAGS} -static"
  550. echo "++++ enable_static set +++++"
  551. fi
  552. else
  553. if test "x$enable_debug" = "xyes"
  554. then
  555. CFLAGS="${CFLAGS} -g -DDEBUG=1"
  556. CXXFLAGS="${CXXFLAGS} -g -DDEBUG=1"
  557. LDFLAGS="${LDFLAGS} -g"
  558. fi
  559. fi
  560. AC_CHECK_LIB(dl, dlopen)
  561. AC_CHECK_LIB(rt, clock_nanosleep)
  562. AC_CHECK_LIB(pthread, pthread_create)
  563. LIBS="$XLIBS $LIBS"
  564. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
  565. [[printf("\n");]])],
  566. [],
  567. [AC_MSG_ERROR([Unable to link with X libraries. Please install them])])
  568. if test "x$windows_build" != "xyes" || test "x$with_cygwin" = "xyes"
  569. then
  570. AC_CHECK_HEADER(termios.h,
  571. [AC_DEFINE(HAVE_TERMIOS_H, [1], [Header file termios.h available])],
  572. [AC_MSG_ERROR([Header file "termios.h" needed but not found])])
  573. AC_CHECK_HEADER(sys/ioctl.h,
  574. [AC_DEFINE(HAVE_SYS_IOCTL_H, [1], [Header file sys/ioctl.h available])],
  575. [AC_MSG_ERROR([Header file "sys/ioctl.h" needed but not found])])
  576. curses_header="no"
  577. AC_CHECK_HEADER(curses.h,
  578. [AC_DEFINE(HAVE_CURSES_H, [1], [Header file curses.h available])
  579. curses_header="yes"])
  580. AC_CHECK_HEADER(ncurses.h,
  581. [AC_DEFINE(HAVE_NCURSES_H, [], [Header file ncurses.h available])
  582. curses_header="yes"])
  583. if test "x$curses_header" = "xno"
  584. then
  585. AC_MSG_ERROR([neither "curses.h" nor "ncurses.h" found])
  586. fi
  587. curses_tgetent="no"
  588. AC_CHECK_LIB(curses, tgetent,
  589. [curses_tgetent="yes"
  590. LIBS=" -lcurses $LIBS"],
  591. [AC_CHECK_LIB(ncurses, tgetent,
  592. [curses_tgetent="yes"
  593. LIBS=" -lncurses $LIBS"])])
  594. if test "x$curses_tgetent" = "xyes"
  595. then
  596. AC_DEFINE([HAVE_TGETENT])
  597. else
  598. AC_MSG_ERROR([curses library containing "tgetent" not available])
  599. fi
  600. curses_term_h="no"
  601. AC_CHECK_HEADER(term.h,
  602. [AC_DEFINE(HAVE_TERM_H, [1], [Header file term.h available])
  603. curses_term_h="yes"],
  604. [],
  605. [#if HAVE_CURSES_H
  606. #include <curses.h>
  607. #else
  608. #if HAVE_NCURSES_H
  609. #include <ncurses.h>
  610. #endif
  611. #endif])
  612. AC_CHECK_HEADER(ncurses/term.h,
  613. [AC_DEFINE(HAVE_NCURSES_TERM_H, [1], [Header file ncurses/term.h available])
  614. curses_term_h="yes"],
  615. [],
  616. [#if HAVE_CURSES_H
  617. #include <curses.h>
  618. #else
  619. #if HAVE_NCURSES_H
  620. #include <ncurses.h>
  621. #endif
  622. #endif])
  623. if test "x$curses_term_h" = "xno"
  624. then
  625. AC_CHECK_FUNCS([tgetent],
  626. AC_DEFINE(HAVE_TGETENT, [1], [Function tgetent available]),
  627. AC_MSG_ERROR([Neither function "tgetent" nor header "term.h" available]))
  628. fi
  629. AC_CHECK_FUNCS([tputs],
  630. AC_DEFINE(HAVE_TPUTS, [1], [Function tputs available]),
  631. AC_MSG_ERROR([Function "tputs" not available]))
  632. AC_CHECK_FUNCS([cfmakeraw])
  633. fi
  634. if test "x$solaris" != "xyes" && test "x$windows_build" != "xyes"
  635. then
  636. # I am not certain how current the avoidance of these tests on Solaris is,
  637. # and it may reflect issues that are now in the past!
  638. AC_SEARCH_LIBS(XRenderCreateCursor, Xrender,
  639. [AC_DEFINE(HAVE_XRENDERCREATECURSOR, [1], [Function XRenderCreateCursor available])],
  640. [AC_MSG_ERROR([Function "XRenderCreateCursor" not available])])
  641. AC_SEARCH_LIBS(XcursorImageCreate, Xcursor)
  642. AC_SEARCH_LIBS(XRRQueryVersion, Xrandr)
  643. fi
  644. # For MANY of the following I should maybe upgrade my tests so that if the
  645. # functions are not present I moan. But actually the easiest way of getting
  646. # that effect will be to put code in the program I try to compile along
  647. # the lines of
  648. # #ifnder HAVE_XXX
  649. # #error XXX seems to be unavailable
  650. # #endif
  651. #
  652. # I will maybe stick that sort of stuff in soon.
  653. # Checks for header files.
  654. AC_FUNC_ALLOCA
  655. AC_HEADER_DIRENT
  656. AC_HEADER_SYS_WAIT
  657. AC_CHECK_HEADERS([fcntl.h float.h malloc.h memory.h dlfcn.h])
  658. AC_CHECK_HEADERS([stddef.h stdlib.h string.h stdint.h])
  659. AC_CHECK_HEADERS([sys/param.h sys/time.h sys/times.h unistd.h utime.h])
  660. AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h sys/socket.h sys/stat.h])
  661. AC_CHECK_HEADERS([sys/types.h sys/wait.h sys/shm.h sys/ipc.h signal.h])
  662. AC_CHECK_HEADERS([sys/sysctl.h syscall.h sched.h])
  663. AC_CHECK_TYPES([cpu_set_t], [], [],
  664. [#ifdef HAVE_SCHED_H
  665. #include <sched.h>
  666. #endif])
  667. AC_HEADER_STAT
  668. AC_C_CONST
  669. AC_STRUCT_TM
  670. AC_C_VOLATILE
  671. # If I were keen I would check that a lot of the above actually found the
  672. # headers and definitions they were looking for... but in general they have
  673. # not been the most troublesome cases so I will worry about that later.
  674. AC_CHECK_TYPES([int8_t,int16_t,int32_t,int64_t,intptr_t], [], [],
  675. [#ifdef HAVE_STDINT_H
  676. #include <stdint.h>
  677. #endif])
  678. AC_CHECK_TYPES([uint8_t,uint16_t,uint32_t,uint64_t,uintptr_t], [], [],
  679. [#ifdef HAVE_STDINT_H
  680. #include <stdint.h>
  681. #endif])
  682. AC_CHECK_TYPES([u_int8_t,u_int16_t,u_int32_t,u_int64_t,u_intptr_t], [], [],
  683. [#ifdef HAVE_STDINT_H
  684. #include <stdint.h>
  685. #endif])
  686. AC_CHECK_SIZEOF(void *)
  687. AC_CHECK_SIZEOF(short int)
  688. AC_CHECK_SIZEOF(int)
  689. AC_CHECK_SIZEOF(long)
  690. AC_CHECK_SIZEOF(long long)
  691. AC_C_BIGENDIAN
  692. AC_CHECK_TYPES([socklen_t],[],[],[#include <sys/socket.h>])
  693. AC_CHECK_LIB(socket, socket)
  694. AC_CHECK_LIB(nsl, gethostbyname)
  695. AC_FUNC_CLOSEDIR_VOID
  696. AC_FUNC_ERROR_AT_LINE
  697. AC_FUNC_LSTAT
  698. AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
  699. AC_FUNC_MEMCMP
  700. AC_FUNC_STAT
  701. AC_FUNC_UTIME_NULL
  702. AC_FUNC_VPRINTF
  703. AC_CHECK_FUNCS([atexit ftruncate getcwd gethostbyaddr gethostbyname inet_ntoa])
  704. AC_CHECK_FUNCS([memmove memset mkdir pow rmdir socket sqrt strchr strdup])
  705. AC_CHECK_FUNCS([strrchr strstr utime popen])
  706. AC_CHECK_FUNCS([fork wait waitpid shmget shmat shmdt shmctl])
  707. AC_CHECK_FUNCS([vsnprintf sysctlbyname])
  708. if test "x$windows_build" = "xyes"
  709. then
  710. case $CC in
  711. x86_64-w64-*)
  712. LIBS="$LIBS -ladvapi32 -lshell32 -lcomctl32 -lgdi32 -lws2_32 -lmswsock -lwinspool -lmpr -luser32"
  713. ;;
  714. *)
  715. LIBS="$LIBS -lcomctl32 -lgdi32 -lws2_32 -lwsock32 -lwinspool -lmpr"
  716. ;;
  717. esac
  718. fi
  719. if test "x$macintosh_build" = "xyes"
  720. then
  721. ENVP=MACOSX_DEPLOYMENT_TARGET=10.13
  722. CC="$ENVP $CC"
  723. CXX="$ENVP $CXX"
  724. fi
  725. AC_CHECK_PROGS(CYGPATH,[cygpath],[no])
  726. AC_CONFIG_HEADERS([config.h])
  727. AC_OUTPUT
  728. AC_MSG_NOTICE([Build environment seems OK])
  729. # end of "configure.ac"