configure.ac 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405
  1. AC_INIT([REDUCE], [from SourceForge], [acn1@cam.ac.uk])
  2. # **************************************************************************
  3. # * Copyright (C) 2017-22, Codemist. A C Norman *
  4. # * *
  5. # * Redistribution and use in source and binary forms, with or without *
  6. # * modification, are permitted provided that the following conditions are *
  7. # * met: *
  8. # * *
  9. # * * Redistributions of source code must retain the relevant *
  10. # * copyright notice, this list of conditions and the following *
  11. # * disclaimer. *
  12. # * * Redistributions in binary form must reproduce the above *
  13. # * copyright notice, this list of conditions and the following *
  14. # * disclaimer in the documentation and/or other materials provided *
  15. # * with the distribution. *
  16. # * *
  17. # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
  18. # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
  19. # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
  20. # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
  21. # * COPYRIGHT OWNERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
  22. # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
  23. # * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
  24. # * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
  25. # * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
  26. # * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF *
  27. # * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
  28. # * DAMAGE. *
  29. # **************************************************************************
  30. # The next line is a dreadful thing and is in case I am launched
  31. # from a bash prompt, in which case the SHELL variable will be set
  32. # to /bin/bash (or perhaps the user's login shell?). Anyway that hurts
  33. # config.guess on Solaris.... so I will force matters so that I use
  34. # plan vanilla /bin/sh henceforth. So BEWARE and do not use bash extensions.
  35. if test -x /bin/sh
  36. then
  37. SHELL=/bin/sh
  38. export SHELL
  39. fi
  40. AC_COPYRIGHT([The REDUCE project])
  41. # $Id$
  42. # If necessary you can fetch source versions of autoconf and automake and
  43. # install private versions for use here. Following discussions with other
  44. # developers I am now going to require autoconf, automake and libtool
  45. # availability, although an enthusiastic person could probably get things
  46. # working without them.
  47. AC_PREREQ(2.61)
  48. AC_CONFIG_MACRO_DIRS([m4])
  49. AC_CONFIG_AUX_DIR([.])
  50. AC_CANONICAL_HOST()
  51. abssrcdir=`"$srcdir/scripts/here.sh"`
  52. if which cygpath 2> /dev/null
  53. then
  54. a=`cygpath -am "$abssrcdir"`
  55. b="${a%%/*}/"
  56. d="${a#${b}}"
  57. c=`cygpath $b`
  58. abssrcdir="$c$d"
  59. fi
  60. AC_MSG_NOTICE([Absolute path to source directory = $abssrcdir])
  61. #
  62. # There is a horror here. If one fetches everything from subversion
  63. # then timstamps can be ill-ordered, and it can seem necessary to
  64. # re-create the autoconf-related files. The standard way that autoconf and
  65. # automake allow for this is not very generous if the version of autoconf
  66. # on the local machine does not match the one used in the files from the
  67. # central site.
  68. #
  69. # I am now going to try to respond to that by forcing a re-generation of
  70. # all the autoconf files each time anybody runs configure. That adds to the
  71. # cost for everybody and means that everybody NEEDS autoconf, automake and
  72. # libtool installed, but may be more robust. I will check the versions of
  73. # autoconf and automake that are present and stop if they are too old.
  74. # If that case hits you you may need to fetch new versions (in source form)
  75. # and build and install them somewhere on your PATH. This is in fact not
  76. # too difficult, it is along the lines of
  77. # <fetch source archive from the Free Software Foundation archives>
  78. # # (please use a local mirror)
  79. # tar xvfz <source-archive.tgz>
  80. # cd <where it unpacked to>
  81. # ./configure --prefix=/usr/local/bin
  82. # make
  83. # sudo make install
  84. # and if you do not have authority to write files to /usr/local/bin then
  85. # set up a directory of your own, put it early in your PATH and use that as
  86. # the "--prefix".
  87. # Note that AS_HELP_STRING has been available since version 2.61 and
  88. # use of AC_HELP_STRING leads to loud moans from version 2.71
  89. AC_ARG_WITH(autogen,
  90. AS_HELP_STRING([--with-autogen], [Regenerate autoconf file at start]),
  91. [],
  92. [with_autogen="yes"])
  93. if test "$with_autogen" = "yes"
  94. then
  95. if ! which autoconf > /dev/null 2> /dev/null
  96. then
  97. printf "You must have autoconf (at least version 2.61) installed to\n"
  98. printf "build this package. Install it and try again please.\n"
  99. exit 1
  100. fi
  101. if ! which automake > /dev/null 2> /dev/null
  102. then
  103. printf "You must have automake (at least version 1.13) installed to\n"
  104. printf "build this package. Install it and try again please.\n"
  105. exit 1
  106. fi
  107. if ! which libtool > /dev/null 2> /dev/null
  108. then
  109. printf "You must have libtool installed to build this package. Install\n"
  110. printf "it and try again please.\n"
  111. printf "Note on some Linux systems it is in a package called libtool-bin\n"
  112. exit 1
  113. fi
  114. # The next fragment should extract version numbers for autoconf and automake
  115. # I extract version info from the two utilities. The first line of
  116. # the output from "autoxx --version" is "autoxx ... nn.nn.nn" with
  117. # a two or three component version number at the end.
  118. acver=`autoconf --version 2> /dev/null | head -1`
  119. amver=`automake --version 2> /dev/null | head -1`
  120. # Get rid of everything as far as the final blank in the data. What is
  121. # left is just the version number, whihc may be two or three components,
  122. # such as 14.2.1 or 15.0
  123. acver=`echo $acver | sed -e 's/.* //'`
  124. amver=`echo $amver | sed -e 's/.* //'`
  125. # The major version number is got by stripping of everything from the "." on.
  126. acmaj=`echo $acver | sed -e 's/\..*//'`
  127. ammaj=`echo $amver | sed -e 's/\..*//'`
  128. # The minor version number is left if one deleted the major number.
  129. acver=`echo $acver | sed -e "s/$acmaj\.//"`
  130. amver=`echo $amver | sed -e "s/$ammaj\.//"`
  131. # What was left could have a patch level - get rid of it.
  132. acmin=`echo $acver | sed -e 's/\..*//'`
  133. ammin=`echo $amver | sed -e 's/\..*//'`
  134. AC_MSG_NOTICE([detected autoconf: $acmaj.$acmin automake: $ammaj.$ammin])
  135. if test $acmaj -lt 2 || test $acmaj -eq 2 && test $acmin -lt 61
  136. then
  137. printf "You have autoconf $acmaj.$acmin but at least 2.61 is needed\n"
  138. printf "to build this package. Install it and try again please.\n"
  139. exit 1
  140. fi
  141. if test $ammaj -lt 1 || test $ammaj -eq 1 && test $ammin -lt 13
  142. then
  143. printf "You have automake $ammaj.$ammin but at least 1.13 is needed\n"
  144. printf "to build this package. Install it and try again please.\n"
  145. exit 1
  146. fi
  147. here=`pwd`
  148. cd $abssrcdir
  149. printf "Regenerate autoconf-related files\n"
  150. find . -name config.cache | xargs rm -f
  151. printf "\n\n+++ About to recreate all autoconf generated files +++\n\n"
  152. if ! eval $SHELL -c \"./autogen.sh $ac_configure_args\"
  153. then
  154. printf "The autogen.sh script seems to have failed. I can not continue\n"
  155. exit 1
  156. fi
  157. cd $here
  158. # It is unexpectedly important the the "--without-autogen" be provided as
  159. # the first argument in the re-try. This is because otherwise some malformed
  160. # input later on (eg "--") could cause it not to be recognised, leading
  161. # to an infinite cycle of attempted re-generation!
  162. printf "Restart: $abssrcdir/configure --without-autogen $ac_configure_args\n"
  163. # Because this uses "exec" it chains into the restarted processing and does
  164. # not proceed further in this shell.
  165. exec $SHELL -c "$abssrcdir/configure --without-autogen $ac_configure_args"
  166. fi
  167. # Next and before I do anything much else I will see if any GUI toolkit that
  168. # I am using needs to be unpacked from source. Well before I do that I need
  169. # to sort out whether I am using CSL or PSL and in the former case whether
  170. # I am using the FOX or wxWidgets toolkit.
  171. AC_ARG_WITH(csl,
  172. AS_HELP_STRING([--with-csl], [Use the CSL Lisp system]),
  173. [],
  174. [with_csl="no"])
  175. AC_ARG_WITH(psl,
  176. AS_HELP_STRING([--with-psl], [Use the PSL Lisp system]),
  177. [],
  178. [with_psl="no"])
  179. AC_ARG_WITH(both,
  180. AS_HELP_STRING([--with-both], [Use both the CSL and PSL Lisp systems]),
  181. [],
  182. [with_both="no"])
  183. if test "$with_both" != "no"
  184. then
  185. with_csl="yes"
  186. with_psl="yes"
  187. fi
  188. # Ensure that at least one Lisp system is selected
  189. if test "$with_psl" = "no" && test "$with_csl" = "no"
  190. then
  191. AC_MSG_ERROR(
  192. [you must specify either --with-csl or --with-psl to select a Lisp])
  193. fi
  194. AC_ARG_WITH(gui,
  195. AS_HELP_STRING([--with-gui],
  196. [use --without-gui to get a text-only system (CSL only)]),
  197. [],
  198. [with_gui="yes"])
  199. # As part of what MAY be a transition I am supporting two possible GUI
  200. # toolkits, viz FOX and wxWidgets. See www.fox-toolkit.org and
  201. # www.wxwidgets.org. If you do not say anything explicit then you will
  202. # get the code built with my default choice and the build will occur in
  203. # un-decorated directory-names. If you explicitly go either "--with-fox"
  204. # or "--with-wx" then you get that GUI toolkit used and the directory will
  205. # be decorated so that this does not interfere with the default. I set the
  206. # default here...
  207. # If you go "--without-fox" or "--without-wx" then that will disable use
  208. # of that toolkit. If the other was selected this will in effect get ignored.
  209. # If the one you say "--without" about is the one that would have been the
  210. # default then you get a system without a GUI at all.
  211. # I reserve the right (one day) to change the default toolkit I use to build
  212. # a GUI, but at the stage I put this in there is a workable one using FOX
  213. # and essentially nothing beyond some configuration steps using wxWidgets!
  214. default_gui="fox"
  215. #default_gui="wx"
  216. AC_ARG_WITH(wx,
  217. AS_HELP_STRING([--with-wx],
  218. [enable or disable use of wxWidgets (CSL only)]),
  219. [],
  220. [with_wx="default"])
  221. AC_ARG_WITH(fox,
  222. AS_HELP_STRING([--with-fox],
  223. [enable or disable use of FOX (CSL only)]),
  224. [],
  225. [with_fox="default"])
  226. if test "$with_psl" != "no" && test "$with_csl" = "no"
  227. then
  228. with_fox=no
  229. with_wx=no
  230. with_gui=no
  231. fi
  232. if test "$with_csl" != "no"
  233. then
  234. # This is where I unpack a new copy of wxWidgets if I need to.
  235. # If the user has said nothing then both with_fox and with_wx will be
  236. # "default", and default_gui will be either"fox" or "wx".
  237. # The things the user can reasonably say will be
  238. # <nothing> build using default GUI in directory x-y-z
  239. # (eg in cslbuild/i386-pc-windows)
  240. # --without-gui build non-GUI version in x-y-x-nogui
  241. # --with-fox build FOX version in x-y-z
  242. # --with-wx build wxWidgets version in x-y-z-wx
  243. # --without-fox if FOX is the default behave as --without -gui
  244. # --without-wx if wxWidgets is the default behave as --without-gui
  245. # If the user says --without-wx when FOX was to be the default GUI then in
  246. # effect this redundant statement is ignored.
  247. # It is not proper to say more than one from --with-fox, --with-wx,
  248. # and --without-gui, but each can be used in separate calls to the
  249. # configure script to build parallel versions.
  250. #
  251. # There is no point or merit in --with-fox=XXXX for some XXX
  252. # other than "yes" OR "no", and "--with-fox=no" is interpreted as being the
  253. # same as "--without-fox" (etc). I use "--with-fox=default" as the situation
  254. # if the user does not specify "--with-fox" at all.
  255. if test "$with_gui" = "no" && (test "$with_fox" != "default" || test "$with_wx" != "default")
  256. then
  257. AC_MSG_ERROR([If you say --without-gui you must not say --with-fox or --with-wx as well
  258. (or even --without-fox or --without-wx)])
  259. fi
  260. if test "$with_fox" != "default" && test "$with_wx" != "default"
  261. then
  262. AC_MSG_ERROR([You must not say --with-fox (or --without-fox) and --with-wx
  263. (or --without-wx) at the same time])
  264. fi
  265. if test "$with_gui" = "no"
  266. then
  267. with_fox="no"
  268. with_wx="no"
  269. else
  270. case $default_gui/$with_fox/$with_wx in
  271. fox/default/default)
  272. # simple default case
  273. with_fox="yes"
  274. with_wx="no";
  275. ;;
  276. fox/yes/*)
  277. # explicit --with-fox. I allow this even though in this situation it
  278. # is redundant because when wxWidgets becomes the default it will be
  279. # needed if you want a fox build.
  280. with_fox="yes"
  281. with_wx="no";
  282. ;;
  283. fox/no/*)
  284. # explicit --without-fox. If fox is that default this
  285. # leads to the without-gui situation.
  286. with_fox="no"
  287. with_wx="no";
  288. ;;
  289. fox/*/yes)
  290. # explicit --with-wx overrides the default
  291. with_fox="no"
  292. with_wx="yes";
  293. ;;
  294. fox/*/no)
  295. # explicit --without-wx. If fox is the default this will not have any
  296. # effect and since maybe somebody thought it would disable the whole
  297. # GUI I will make it an error.
  298. AC_MSG_ERROR([--with-fox is the default configuration so --without-wx is not needed])
  299. ;;
  300. wx/default/default)
  301. # simple default case (if wx is preferred)
  302. with_fox="no"
  303. with_wx="yes";
  304. ;;
  305. wx/*/yes)
  306. # explicit --with-wx is permitted even when not needed
  307. with_fox="no"
  308. with_wx="yes";
  309. ;;
  310. wx/yes/*)
  311. # explicit --with-fox that overrides default
  312. with_fox="yes"
  313. with_wx="no";
  314. ;;
  315. wx/no/*)
  316. # explicit --without-fox
  317. AC_MSG_ERROR([--with-wx is the default configuration so --without-fox is not needed])
  318. ;;
  319. *)
  320. AC_MSG_ERROR([--with-fox=$with_fox and --with-wx=$with_wx inconsistent here])
  321. ;;
  322. esac
  323. fi
  324. AC_MSG_NOTICE([with_fox=$with_fox, with_wx=$with_wx])
  325. # Now at most one of with_wx and with_fox will be "yes". They could both
  326. # be "no".
  327. if test "$with_wx" != "no"
  328. then
  329. d=`pwd`
  330. cd $abssrcdir/csl/support-packages
  331. # The next line should collect the names of all versions of wxWidgets that
  332. # I have .tar.bz2 files for, and they should end up in alphabetic order.
  333. a=`echo wxWidgets-*-*-*.tar.bz2`
  334. # Here I keep the last item in the list, which should be the latest version
  335. # present.
  336. a=${a##* }
  337. # Remove the ".tar.bz2" suffix
  338. b=${a%.tar.bz2}
  339. cd ..
  340. # Now I need to check if the version of wxWidgets I have already got
  341. # in an unpacked state matches the most recent one available. Well I look at
  342. # date-stamps - has the unpacked copy of wxWidgets got a newer date-stamp than
  343. # the archived one?
  344. if test $abssrcdir/csl/support-packages/wxWidgets_revision -nt \
  345. wxWidgets/wxWidgets_revision
  346. then
  347. printf "will unpack a fresh copy of wxWidgets\n"
  348. mkdir wxWidgets-new
  349. cp $abssrcdir/csl/support-packages/wxWidgets_revision wxWidgets-new
  350. mv wxWidgets-new wxWidgets
  351. # At present my wxWidgets archive is packed as for a directory named
  352. # just "wxWidgets", but I will allow for any future change where the
  353. # directory mentioned in the tar archive has a version number included.
  354. tar xfj support-packages/$a -C wxWidgets --strip-components=1
  355. # At one stage I had trouble with the unpacked archive not being all
  356. # readable, so here I forcibly reset permssions
  357. chmod -R +rw wxWidgets
  358. # The official distribution needs its autogen.sh script run to create
  359. # a configure file.
  360. cd wxWidgets
  361. ./autogen.sh
  362. cd ..
  363. printf "wxWidgets unpacked from archive $a\n"
  364. fi
  365. cd $d
  366. fi
  367. fi
  368. # I will only attempt to build a Mac univeral binary if things are
  369. # configured with "--enable-universal", and even then such a build will
  370. # only be possible if enough build libraries have been installed in
  371. # universal mode. At the time of updating this comment (January 2022)
  372. # this seems possible on either an Intel or arm-based Mac running Big Sur.
  373. # It needs universal versions of many of the libraries etc that get
  374. # set up using macports, and scripts/make-universal.sh is available to
  375. # try to establish a suitable encironment. Note that make-universal.sh will
  376. # NOT manage to make every "port" universal, but for me it manages enough.
  377. # and over time the rest may catch up, for what that is worth.
  378. AC_ARG_ENABLE(universal,
  379. AS_HELP_STRING([--enable-universal],
  380. [Try to build universal binary on Mac Big Sur (CSL only)]),
  381. [],
  382. [enable_universal="no"])
  383. ORIG="$CC$CXX"
  384. OLD_CFLAGS="$CFLAGS"
  385. OLD_CXXFLAGS="$CXXFLAGS"
  386. OLD_CPPFLAGS="$CPPFLAGS"
  387. AC_PROG_CC
  388. AC_PROG_CXX
  389. CFLAGS="$OLD_CFLAGS"
  390. CXXFLAGS="$OLD_CXXFLAGS"
  391. CPPFLAGS="$OLD_CPPFLAGS"
  392. uname_m=`uname -m`
  393. uname_s=`uname -s`
  394. case "$uname_s" in
  395. Darwin)
  396. # "uname -o" is not available on the Macintosh!
  397. uname_o="macOS"
  398. if test "$CC" = ""; then CC=clang; fi
  399. if test "$CXX" = ""; then CXX=clang++; fi
  400. if test "$enable_universal" != "no"
  401. then
  402. # I must not add these to CPPFLAGS because the pre-processor does not like
  403. # the idea of dual targets!
  404. OLDCFLAGS="$CFLAGS"
  405. OLDCXXFLAGS="$CXXFLAGS"
  406. OLDLDFLAGS="$LDFLAGS"
  407. CFLAGS="$CFLAGS -arch x86_64 -arch arm64"
  408. CXXFLAGS="$CXXFLAGS -arch x86_64 -arch arm64"
  409. LDFLAGS="$LDFLAGS -arch x86_64 -arch arm64"
  410. AC_LINK_IFELSE([AC_LANG_PROGRAM([],
  411. [[return 0]])],
  412. [AC_MSG_NOTICE(Will build in universal mode)],
  413. [CFLAGS="$OLDCFLAGS"
  414. CXXFLAGS="$OLDCXXFLAGS"
  415. LDFLAGS="$OLDLDFLAGS"
  416. AC_MSG_NOTICE(Universal build not possible on this host)])
  417. fi
  418. ;;
  419. *)
  420. uname_o=`uname -o 2>/dev/null`
  421. ;;
  422. esac
  423. AC_ARG_WITH(build,
  424. AS_HELP_STRING([--with-build], [Used internally to control build directory]),
  425. [],
  426. [with_build="unknown"])
  427. AC_ARG_WITH(pslbuild,
  428. AS_HELP_STRING([--with-pslbuild], [Used internally to control build directory]),
  429. [],
  430. [with_pslbuild="unknown"])
  431. AC_ARG_WITH(cygbuild,
  432. AS_HELP_STRING([--with-cygbuild], [Used internally to control build directory]),
  433. [],
  434. [with_cygbuild="unknown"])
  435. AC_ARG_WITH(cygbuild64,
  436. AS_HELP_STRING([--with-cygbuild64], [Used internally to control build directory]),
  437. [],
  438. [with_cygbuild64="unknown"])
  439. AC_ARG_WITH(force,
  440. AS_HELP_STRING([--with-force], [Forces refresh of windows varients]),
  441. [],
  442. [with_force="no"])
  443. # I could provide a --with-libedit=... option but the plan here is that
  444. # the version used will only change during transitions made by the developers
  445. # and so I limit myself to a fixed setting here. No ordinary person should
  446. # ever need to alter this.
  447. # This is set here so that if I need to experiment with or chance to a
  448. # different version that will be reasonably tidy.
  449. LIBEDIT_VERSION=20140620-3.1
  450. #LIBEDIT_VERSION=20210216-3.1
  451. ############################################################################
  452. #
  453. # Modern versions of the autoconf tools seems to moan dreadfully if you pass
  454. # down a flag that they do not know about, and so I transcribe into here
  455. # all the flags that the CSL configuration may ever want. The down-side of
  456. # this is that "configure --help" shows them all.
  457. AC_ARG_WITH(lto,
  458. AS_HELP_STRING([--with-lto],
  459. [Experiment with extreme optimisation in gcc (CSL only)]),
  460. [],
  461. [with_lto="no"])
  462. AC_ARG_WITH(cygwin,
  463. AS_HELP_STRING([--with-cygwin],
  464. [Force use of raw cygwin (CSL only)]),
  465. [],
  466. [with_cygwin="no"])
  467. AC_ARG_WITH(xft,
  468. AS_HELP_STRING([--with-xft],
  469. [Can be used to disable use of XFT. Default is yes (CSL only)]),
  470. [],
  471. [with_xft="yes"])
  472. AC_ARG_WITH(xim,
  473. AS_HELP_STRING([--with-xim],
  474. [Can be used to control use of XIM. Default is yes (now) (CSL only)]),
  475. [],
  476. [with_xim="yes"])
  477. AC_ARG_ENABLE(debug,
  478. AS_HELP_STRING([--enable-debug],
  479. [compile for debugging (CSL only)]),
  480. [],
  481. [enable_debug="no"])
  482. AC_ARG_ENABLE(profile,
  483. AS_HELP_STRING([--enable-profile],
  484. [compile for profiling (CSL only)]),
  485. [],
  486. [enable_profile="no"])
  487. AC_ARG_ENABLE(conservative,
  488. AS_HELP_STRING([--enable-conservative],
  489. [garbage collect option: testing and development use (CSL only)]),
  490. [],
  491. [enable_conservative="no"])
  492. AC_ARG_ENABLE(test,
  493. AS_HELP_STRING([--enable-test],
  494. [testing-mode version (CSL only)]),
  495. [],
  496. [enable_test="no"])
  497. if test "$enable_test" = "yes"
  498. then
  499. AC_DEFINE([TEST], [1], [For use by developers])
  500. fi
  501. AC_ARG_ENABLE(experiment,
  502. AS_HELP_STRING([--enable-experiment],
  503. [testing-mode version (CSL only)]),
  504. [],
  505. [enable_experiment="no"])
  506. if test "$enable_experiment" = "yes"
  507. then
  508. AC_DEFINE([EXPERIMENT], [1], [For use by developers])
  509. fi
  510. AC_ARG_WITH(arithlib,
  511. AS_HELP_STRING([--with-arithlib],
  512. [development of arithlib.hpp support (CSL only)]),
  513. [],
  514. [with_arithlib="no"])
  515. AC_ARG_ENABLE(static,
  516. AS_HELP_STRING([--enable-static],
  517. [link it all statically (CSL only)]),
  518. [],
  519. [enable_static="no"])
  520. AC_ARG_WITH(throw,
  521. AS_HELP_STRING([--without-throw],
  522. [Avoid C++ catch & throw. Experimental. (CSL only)]),
  523. [],
  524. [with_throw="yes"])
  525. AC_ARG_WITH(threads,
  526. AS_HELP_STRING([--without-theads],
  527. [Experimental Lisp thread support. (CSL only)]),
  528. [],
  529. [with_throw="no"])
  530. CSLBASE=cslbase
  531. GENERATED_C=generated-c
  532. AC_ARG_ENABLE(static,
  533. AS_HELP_STRING([--enable-static],
  534. [link it all statically (CSL only)]),
  535. [],
  536. [enable_static="no"])
  537. ###########################################################################
  538. # Now I want to know if the current directory is the same as $srcdir. At
  539. # one stage I checked that by looking to see if $srcdir was ".". That was OK
  540. # for direct calls of the form "./configure" where the "." as in "./" was
  541. # detected. But the reconfig step messes that up and anyway it is a delicate
  542. # cheat. So here is a different delicate cheat!
  543. rm -f ./testfile.tst "$abssrcdir/testfile.tst"
  544. touch "$abssrcdir/testfile.tst"
  545. if test -f ./testfile.tst
  546. then
  547. rm -f ./testfile.tst
  548. inplace="yes"
  549. else
  550. inplace="no"
  551. fi
  552. printf "in-place build attempt = $inplace\n"
  553. # I have a fairly elaborate scheme to select a directory to use. At present
  554. # for PSL there are no relevant extra configure parameters, so I will not
  555. # pass anthing down even if something has been specified! Thus PSL will get
  556. # built in a simple directory named after the operating system while for
  557. # CSL you may be able to create multiple versions (eg debugging and
  558. # non-debugging) on the same machine, and the binaries will get created in
  559. # separate sub-directories.
  560. # One HORRID issue is that as regards anything that is to do with selecting
  561. # directories to build in etc I want to look at $host as produced by
  562. # just one version of config.guess. This is because in the past I have
  563. # come across cases where different versions or releases of config.guess
  564. # report the same machine with slightly different names. That could cause
  565. # messy confusion! So when I want that information I find it once here and
  566. # as necessary pass it down to lower parts of the tree.
  567. AC_MSG_NOTICE([host=$host args=$ac_configure_args])
  568. if test "$with_psl" != "no"
  569. then
  570. case $host in
  571. *windows | *cygwin)
  572. build="x86_64-pc-windows"
  573. ;;
  574. *)
  575. # For cases other than Windows the PSL case is simpler.
  576. build=`$SHELL $abssrcdir/scripts/findhost.sh $host`
  577. ;;
  578. esac
  579. else
  580. # For PSL find an initial name for the directory to build in. In the Windows
  581. # case this will be messed with further.
  582. build=`eval "$SHELL $abssrcdir/scripts/findhost.sh $host $ac_configure_args"`
  583. fi
  584. AC_MSG_NOTICE([Will build in the $build subdirectory])
  585. # There are many configure options that are valid or relevant at the
  586. # top level but are not needed for sub-configure calls
  587. filtered=`$abssrcdir/scripts/filter.sh "$ac_configure_args"`
  588. nohost=`$abssrcdir/scripts/nohost.sh "$ac_configure_args"`
  589. AC_MSG_NOTICE([args=<$ac_configure_args>])
  590. AC_MSG_NOTICE([filtered=<$filtered>])
  591. AC_MSG_NOTICE([nohost=<$nohost>])
  592. # Hah - the next is a jolly jape. It arranged that when I build on one of my
  593. # own real machines I default to a new and experimental layout for the build
  594. # of windows versions, but everybody else (unless their host has a name
  595. # matching mine!) should be undisturbed.
  596. # I have disabled this just for a while... I am making other changes and I do
  597. # not want this confusion to mess me up. The XXX is there to cause this
  598. # match not to be taken.
  599. case `uname -n` in
  600. *panamintXXX* | *gauguinXXX*)
  601. default_windows_layout="new"
  602. ;;
  603. *)
  604. default_windows_layout="old"
  605. ;;
  606. esac
  607. AC_ARG_WITH(windows_layout,
  608. AS_HELP_STRING([--with-windows_layout], [old or new windows layout]),
  609. [],
  610. [with_windows_layout="$default_windows_layout"])
  611. AC_MSG_NOTICE([default=$default_windows_layout this-layout=$with_windows_layout])
  612. if test "$with_windows_layout" != "new"
  613. then
  614. with_windows_layout="old"
  615. fi
  616. setpasscc ()
  617. {
  618. passcc=""
  619. if test "$CPP" != ""; then passcc="$passcc CPP=\"$CPP\""; fi
  620. if test "$CC" != ""; then passcc="$passcc CC=\"$CC\""; fi
  621. if test "$CXXCPP" != ""; then passcc="$passcc CXXCPP=\"$CXXCPP\""; fi
  622. if test "$CXX" != ""; then passcc="$passcc CXX=\"$CXX\""; fi
  623. if test "$LD" != ""; then passcc="$passcc LD=\"$LD\""; fi
  624. AC_MSG_NOTICE([passcc = $passcc])
  625. }
  626. csl_inplace_cygwin_build ()
  627. {
  628. # The argument here should be x88_64-pc-cygwin
  629. target=$1
  630. forcer=$2
  631. AC_MSG_NOTICE([in csl_inplace_cygwin_build wwl=$with_windows_layout])
  632. # Find the proper name for the target directory, allowing for --enable-debug
  633. # and any other options that may be relevant.
  634. if test "$with_windows_layout" = "new"
  635. then
  636. cygver="cyg64"
  637. build=`eval "$SHELL $abssrcdir/scripts/findhost.sh intel-pc-windows $ac_configure_args --with-cygwin"`
  638. AC_MSG_NOTICE([target=$target => build=$build/$cygver])
  639. mkdir -p "$abssrcdir/cslbuild/$build/$cygver"
  640. cp "$abssrcdir/csl/$CSLBASE/Makefile.windows" "$abssrcdir/cslbuild/$build/Makefile"
  641. cp "$abssrcdir/csl/$CSLBASE/stub2020.c" "$abssrcdir/cslbuild/$build/stub2020.c"
  642. cp "$abssrcdir/csl/$CSLBASE/make-cygwin-symlink.c" "$abssrcdir/cslbuild/$build/make-cygwin-symlink.c"
  643. cp "$abssrcdir/csl/$CSLBASE/redpsl.sh" "$abssrcdir/cslbuild/$build/redpsl"
  644. cd "$abssrcdir/cslbuild/$build/$cygver"
  645. else
  646. build=`eval "$SHELL $abssrcdir/scripts/findhost.sh $target $ac_configure_args --with-cygwin"`
  647. AC_MSG_NOTICE([target=$target => build=$build])
  648. mkdir -p "$abssrcdir/cslbuild/$build"
  649. cd "$abssrcdir/cslbuild/$build"
  650. fi
  651. AC_MSG_NOTICE([host=$host buildmc=$buildmc pass_host=$pass_host])
  652. pass_build="--with-build=\"$build\" --with-pslbuild=\"$pslbuild\""
  653. doconfig="$SHELL $abssrcdir/configure --config-cache $ac_configure_args \
  654. STRIP=\"$STRIP\" RANLIB=\"$RANLIB\" \
  655. $forcer CPPFLAGS=\"$CPPFLAGS\" CFLAGS=\"$CFLAGS\" \
  656. CXXFLAGS=\"$CXXFLAGS\" LDFLAGS=\"$LDFLAGS\" LIBS=\"$LIBS\" \
  657. $pass_build --with-cygwin"
  658. AC_MSG_NOTICE([doconfig = $doconfig])
  659. printf "\n\n+++ About restart configure steps in proper target directory +++\n\n"
  660. eval "$doconfig"
  661. AC_MSG_NOTICE([configuration for cygwin on $target complete])
  662. cd "$abssrcdir"
  663. }
  664. csl_inplace_nativewin_build ()
  665. {
  666. buildmc=$1
  667. host=$2
  668. AC_MSG_NOTICE([CSL inplace for native Windows])
  669. if test "$with_windows_layout" = "new"
  670. then
  671. winver="win64"
  672. build=`eval "$SHELL $abssrcdir/scripts/findhost.sh intel-pc-windows $ac_configure_args"`
  673. AC_MSG_NOTICE([About to configure using $host in $build/$winver])
  674. mkdir -p "$abssrcdir/cslbuild/$build/$winver"
  675. cp "$abssrcdir/csl/$CSLBASE/Makefile.windows" "$abssrcdir/cslbuild/$build/Makefile"
  676. cd "$abssrcdir/cslbuild/$build/$winver"
  677. else
  678. build=`eval "$SHELL $abssrcdir/scripts/findhost.sh $target $ac_configure_args"`
  679. AC_MSG_NOTICE([About to configure using $host in $build])
  680. mkdir -p "$abssrcdir/cslbuild/$build"
  681. cd "$abssrcdir/cslbuild/$build"
  682. fi
  683. if test "$with_windows_layout" = "new"
  684. then
  685. cygextra=
  686. else
  687. # The Windows version would like to know where to find cygwin variants
  688. # at run-time.
  689. cygextra=
  690. ed64="s/.*windows/x86_64-pc-cygwin/; s/.*cygwin/x86_64-pc-cygwin/"
  691. dd64=`echo $build | sed -e "$ed64"`
  692. cygextra="$cygextra --with-cygbuild64=$abssrcdir/cslbuild/$dd64"
  693. AC_MSG_NOTICE([cygextra = $cygextra])
  694. fi
  695. pass_build="--with-build=\"$build\" --with-pslbuild=\"$pslbuild\""
  696. doconfig="$SHELL $abssrcdir/configure --config-cache $ac_configure_args \
  697. CPPFLAGS=\"$CPPFLAGS\" CFLAGS=\"$CFLAGS\" \
  698. CXXFLAGS=\"$CXXFLAGS\" LDFLAGS=\"$LDFLAGS\" LIBS=\"$LIBS\" \
  699. $cygextra $pass_build --host=$host"
  700. AC_MSG_NOTICE([doconfig = $doconfig])
  701. printf "\n\n+++ About restart configure steps in proper target directory +++\n\n"
  702. eval "$doconfig"
  703. AC_MSG_NOTICE([configuration for $target complete])
  704. cd "$abssrcdir"
  705. }
  706. csl_inplace_windows_build ()
  707. {
  708. # If I am on Windows I will configure for variants:
  709. # x86_64-pc-cygwin
  710. # x86_64-w64-mingw
  711. AC_MSG_NOTICE([Inplace Windows build...])
  712. # I am going to suppose that all the compilers I could possibly want
  713. # are installed. That means I do not need to put in code here to test that!
  714. AC_MSG_NOTICE([Configure cygwin64 version])
  715. csl_inplace_cygwin_build "x86_64-pc-cygwin"
  716. AC_MSG_NOTICE([Configure windows64 version])
  717. csl_inplace_nativewin_build "x86_64-pc-windows" "x86_64-w64-mingw32"
  718. }
  719. csl_inplace_build ()
  720. {
  721. mkdir -p "$abssrcdir/cslbuild"
  722. # When I configure I will install a default "profile.dat" if there is
  723. # not one in place already, but the user can always regenerate a newer
  724. # local version of the profile.
  725. # Well in csl/generated-c I keep what I expect to be the "previous released
  726. # profile" as profile.dat.old, and if the user has their own profile.dat
  727. # matching that I will install the newer replacement for them.
  728. if test ! -d "$abssrcdir/cslbuild/$GENERATED_C" ||
  729. test ! -f "$abssrcdir/cslbuild/$GENERATED_C/profile.dat" ||
  730. diff "$abssrcdir/cslbuild/$GENERATED_C/profile.dat" \
  731. "$abssrcdir/csl/$GENERATED_C/profile.dat.old" >/dev/null
  732. then
  733. mkdir -p "$abssrcdir/cslbuild/$GENERATED_C"
  734. cp -r "$abssrcdir/csl/$GENERATED_C" "$abssrcdir/cslbuild"
  735. fi
  736. # Now I am configuring for CSL and am doing so from the top directory.
  737. AC_MSG_NOTICE([CSL in-place build for $build])
  738. case $build in
  739. *cygwin* | *windows* | *mingw*)
  740. csl_inplace_windows_build
  741. ;;
  742. *)
  743. # All other platforms come here...
  744. mkdir -p "$abssrcdir/cslbuild/$build"
  745. cd "$abssrcdir/cslbuild/$build"
  746. pass_build="--with-build=\"$build\" --with-pslbuild=\"$pslbuild\""
  747. doconfig="$SHELL $abssrcdir/configure --config-cache $ac_configure_args \
  748. CPPFLAGS=\"$CPPFLAGS\" CFLAGS=\"$CFLAGS\" \
  749. CXXFLAGS=\"$CXXFLAGS\" LDFLAGS=\"$LDFLAGS\" LIBS=\"$LIBS\" \
  750. $pass_build"
  751. AC_MSG_NOTICE([doconfig = $doconfig])
  752. printf "\n\n+++ About restart configure steps +++\n\n"
  753. eval "$doconfig"
  754. cd "$abssrcdir"
  755. ;;
  756. esac
  757. }
  758. psl_inplace_build ()
  759. {
  760. AC_MSG_NOTICE([+++ Will build in $abssrcdir/pslbuild/$build])
  761. mkdir -p "$abssrcdir/pslbuild/$build"
  762. cd "$abssrcdir/pslbuild/$build"
  763. # This passes down any configure arguments to the PSL-specific configuration
  764. # but at present I do not expect any to be relevant.
  765. pass_build="--with-build=\"$build\""
  766. printf "\n\n+++ About to configure for PSL +++\n\n"
  767. eval "$SHELL $abssrcdir/psl/configure --config-cache $ac_configure_args \
  768. $pass_build CPPFLAGS=\"$CPPFLAGS\" CFLAGS=\"$CFLAGS\" \
  769. CXXFLAGS=\"$CXXFLAGS\" LDFLAGS=\"$LDFLAGS\" "
  770. AC_MSG_NOTICE([About to configure crlibm])
  771. builddir=`pwd`
  772. mkdir -p crlibm
  773. cd crlibm
  774. setpasscc
  775. doconfig="$SHELL $abssrcdir/libraries/crlibm/configure --config-cache $filtered \
  776. $pass_host \
  777. CPPFLAGS=\"$CPPFLAGS\" \
  778. CFLAGS=\"$CFLAGS\" \
  779. CXXFLAGS=\"$CXXFLAGS\" \
  780. LDFLAGS=\"$LDFLAGS\" \
  781. $passcc \
  782. --prefix=\"$builddir\" \
  783. --libdir=\"$builddir/lib\" \
  784. --includedir=\"$builddir/include\""
  785. AC_MSG_NOTICE([doconfig = $doconfig])
  786. printf "\n\n+++ About to configure crlibm +++\n\n"
  787. eval "$doconfig"
  788. cd "$builddir"
  789. case "$host" in
  790. *windows)
  791. ;;
  792. *)
  793. AC_MSG_NOTICE([About to configure libedit])
  794. mkdir -p libedit
  795. cd libedit
  796. doconfig="$SHELL $abssrcdir/libraries/libedit-$LIBEDIT_VERSION/configure --config-cache \
  797. $nohost \
  798. CPPFLAGS=\"$CPPFLAGS\" \
  799. CFLAGS=\"$CFLAGS\" \
  800. CXXFLAGS=\"$CXXFLAGS\" \
  801. LDFLAGS=\"$LDFLAGS\" \
  802. --enable-widec=yes \
  803. --prefix=\"$builddir\" \
  804. --libdir=\"$builddir/lib\" \
  805. --includedir=\"$builddir/include\""
  806. AC_MSG_NOTICE([doconfig = $doconfig])
  807. printf "\n\n+++ About to configure libedit +++\n\n"
  808. eval "$doconfig"
  809. cd "$builddir"
  810. ;;
  811. esac
  812. ln -f -s $abssrcdir/libraries/wineditline .
  813. AC_MSG_NOTICE([About to configure redfront])
  814. mkdir -p redfront
  815. cd redfront
  816. setpasscc
  817. doconfig="$SHELL $abssrcdir/generic/newfront/configure --config-cache $nohost \
  818. $passcc \
  819. CPPFLAGS=\"$CPPFLAGS\" \
  820. CFLAGS=\"$CFLAGS\" \
  821. CXXFLAGS=\"$CXXFLAGS\" \
  822. LDFLAGS=\"$LDFLAGS\" \
  823. --prefix=\"$builddir\" \
  824. --libdir=\"$builddir/lib\" \
  825. --includedir=\"$builddir/include\""
  826. AC_MSG_NOTICE([doconfig = $doconfig])
  827. printf "\n\n+++ About to configure redfront +++\n\n"
  828. eval "$doconfig"
  829. cd "$builddir"
  830. }
  831. # There are many configure options that are valid or relevant at the
  832. # top level but are not needed for sub-configure calls
  833. filtered=`$abssrcdir/scripts/filter.sh "$ac_configure_args"`
  834. nohost=`$abssrcdir/scripts/nohost.sh "$ac_configure_args"`
  835. case $inplace in
  836. yes)
  837. # Here somebody has run the "configure" script within the top-level
  838. # source directory. I really want the build to take place in a
  839. # host-specific subdirectory so I will divert things!
  840. # When testing if --with-csl etc got passed I should check that the option
  841. # NO was NOT given rather than that the option yes was.
  842. if test "$with_csl" != "no"
  843. then
  844. csl_inplace_build
  845. fi
  846. if test "$with_psl" != "no"
  847. then
  848. psl_inplace_build
  849. fi
  850. printf "All sub-tasks should have completed\n"
  851. exit 0
  852. ;;
  853. *)
  854. AC_MSG_NOTICE([+++ standard build case, abssrcdir = $abssrcdir = "$abssrcdir"])
  855. ;;
  856. esac
  857. # This is where the main bit of this script starts.
  858. AC_CONFIG_SRCDIR(scripts/make.sh)
  859. AM_INIT_AUTOMAKE([1.13 -Wno-portability foreign no-dist-gzip dist-bzip2])
  860. LT_INIT
  861. AC_CONFIG_FILES([Makefile])
  862. ###############################################################################
  863. builddir=`pwd`
  864. AC_ARG_WITH(ccache,
  865. AS_HELP_STRING([--with-ccache],
  866. [--without-ccache can be used to disable use of ccache]),
  867. [], [])
  868. AC_CHECK_PROG([CCACHE], [ccache], [ccache], [])
  869. AC_MSG_NOTICE([CC=/$CC/ CXX=/$CXX/ CCACHE=/$CCACHE/])
  870. # The use of ccache here deserves an explanation. The first and maybe obvious
  871. # thing is that if either ccache seems not to to be installed or if the person
  872. # who invoked the configure script had overridden CC or CXX so specify any
  873. # custom compilers that I will not do anything.
  874. # Then the "obvious" thing do do would be to go 'CC="ccache $CC"' so that
  875. # subsequent compilation ended up cached. Well before I can do that I need
  876. # to get CC set - and remember that if --host is set then it may end up
  877. # being a cross-compiler. So 'CC="ccache gcc"' is certainly not good enough.
  878. # However the autoconf macros that set CC (and CXX) also set CFLAGS etc
  879. # in ways I do not want, so I take steps to preserve and restore those.
  880. # Now an issue that caused me much pain. If CC ends up as text with embedded
  881. # whitespace then passing it down to lower-level configure scripts is
  882. # delicate. And at least one library that I use performs a test of the form
  883. # if test $CC = xxx; then
  884. # (where perhaps more properly it would have gone 'test "$CC" = "xxx"') and
  885. # if CC expands to more than one word that gives a syntax error. So to work
  886. # around both those problems I dynamically create short scripts to compile
  887. # via ccache. These are placed in the top level build directory, which should
  888. # be platform specific. This extra layer of shell scripting will have an
  889. # adverse cost, but I hope that will be balanced by the effects of ccache.
  890. # Please note that here (and in other places) that whitespace in the path
  891. # to where Reduce gets built is not supported. If some keen person would
  892. # like to review all the build scripts and get quoting of strings fully
  893. # correct that might be nice!
  894. # Hah - a further issue. On some platforms gcc and g++ (and some others) will
  895. # be links to ccache and so the facility is already used automatically. In
  896. # that case it is not a help to wrap in an extra call to ccache!
  897. if test "$with_ccache" != "no" &&
  898. test "$ORIG" = "" &&
  899. test "$CCACHE" != ""
  900. then
  901. RAWCC="`which $CC 2> /dev/null`"
  902. RAWXX="`which $CXX 2> /dev/null`"
  903. case "$CC$CXX `ls -l $RAWCC 2>/dev/null` `ls -l $RAWCXX 2>/dev/null`" in
  904. *ccache*)
  905. ;;
  906. *)
  907. d=`pwd`
  908. printf "#! /bin/sh\nccache $CC \"\$@\"\n" > $d/cachecc.sh
  909. printf "#! /bin/sh\nccache $CXX \"\$@\"\n" > $d/cachecxx.sh
  910. chmod +x $d/cachecc.sh $d/cachecxx.sh
  911. CC="$d/cachecc.sh"
  912. CXX="$d/cachecxx.sh"
  913. ;;
  914. esac
  915. fi
  916. if test "$with_csl" != "no"
  917. then
  918. # Here I have a bunch of sub-directories that I need to configure
  919. AC_MSG_NOTICE([About to configure CSL core])
  920. mkdir -p csl
  921. cd csl
  922. case $host in
  923. *darwin* | *Darwin*)
  924. if test -d $HOME/ports/include
  925. then
  926. CPPFLAGS="$CPPFLAGS -I$HOME/ports/include"
  927. fi
  928. if test -d $HOME/ports/include/freetype2
  929. then
  930. CPPFLAGS="$CPPFLAGS -I$HOME/ports/include/freetype2"
  931. fi
  932. if test -d $HOME/ports/lib
  933. then
  934. LDFLAGS="$LDFLAGS -L$HOME/ports/lib"
  935. fi
  936. if test -d /opt/local/include
  937. then
  938. CPPFLAGS="$CPPFLAGS -I/opt/local/include"
  939. fi
  940. if test -d /opt/local/lib
  941. then
  942. LDFLAGS="$LDFLAGS -L/opt/local/lib"
  943. fi
  944. # CPPFLAGS="$CPPFLAGS -mmacosx-version-min=10.13"
  945. # CFLAGS="$CFLAGS -mmacosx-version-min=10.13"
  946. # CXXFLAGS="$CXXFLAGS -mmacosx-version-min=10.13"
  947. # LDFLAGS="$LDFLAGS -mmacosx-version-min=10.13"
  948. ;;
  949. esac
  950. # If I am compiling for native Cygwin I will not pass down "--host"
  951. # if I am building for the natural target.
  952. AC_MSG_NOTICE([host=$host build=$build])
  953. pass_host="--host=$host"
  954. if test "$with_cygwin" != "no"
  955. then
  956. pass_host=""
  957. if test "$host" != "x86_64-unknown-cygwin" &&
  958. test "$host" != "x86_64-pc-cygwin"
  959. then
  960. pass_host="--host=$host"
  961. fi
  962. fi
  963. AC_MSG_NOTICE([with_cygwin=$with_cygwin pass_host=$pass_host])
  964. if test "$with_wx" != "no"
  965. then
  966. # A short essay to explain why I pass down "--host=$host" here. There are
  967. # two points. The first is that I cope with 64-bit windows by use of
  968. # cross-compilation using the x86_64-win32-mingw32 toolchain, and I need
  969. # to pass down the information that I am doing that.
  970. # The second reason is that different releases of "config.guess" can report
  971. # machine identities differently. I have particularly observes this on
  972. # openSuSE Linux where some versions brand the host triple with "-suse-" in
  973. # the middle. I do not mind much just what triple is used, but I do mind
  974. # very much it it is not consistent all the way through my build. So I
  975. # let this top-level configure script make the choice and by explicitly
  976. # propagating if to sub-packages I end up safer.
  977. # However if I am building for raw cygwin I find that I have pain if I
  978. # specify --host specifically, so in that case I will not!
  979. pass_build="--with-build=\"$build\""
  980. setpasscc
  981. doconfig="$SHELL $abssrcdir/csl/$CSLBASE/configure -C \
  982. $ac_configure_args \
  983. $passcc \
  984. CPPFLAGS=\"$CPPFLAGS\" CFLAGS=\"$CFLAGS\" \
  985. CXXFLAGS=\"$CXXFLAGS\" LDFLAGS=\"$LDFLAGS\" LIBS=\"$LIBS\" \
  986. $pass_host --with-wx=\"$with_wx\" $pass_build --without-fox"
  987. elif test "$with_fox" != "no"
  988. then
  989. pass_build="--with-build=\"$build\""
  990. setpasscc
  991. doconfig="$SHELL $abssrcdir/csl/$CSLBASE/configure -C \
  992. $ac_configure_args \
  993. $passcc \
  994. CPPFLAGS=\"$CPPFLAGS\" CFLAGS=\"$CFLAGS\" \
  995. CXXFLAGS=\"$CXXFLAGS\" LDFLAGS=\"$LDFLAGS\" LIBS=\"$LIBS\" \
  996. $pass_host --with-fox=\"$builddir\" $pass_build --without-wx"
  997. else
  998. # This final version will be without any GUI.
  999. pass_build="--with-build=\"$build\""
  1000. setpasscc
  1001. doconfig="$SHELL $abssrcdir/csl/$CSLBASE/configure \
  1002. -C \
  1003. $ac_configure_args \
  1004. $passcc \
  1005. CPPFLAGS=\"$CPPFLAGS\" CFLAGS=\"$CFLAGS\" \
  1006. CXXFLAGS=\"$CXXFLAGS\" LDFLAGS=\"$LDFLAGS\" LIBS=\"$LIBS\" \
  1007. $pass_host $pass_build --without-fox --without-wx"
  1008. fi
  1009. AC_MSG_NOTICE([$doconfig])
  1010. printf "\n\n+++ About to configure CSL +++\n\n"
  1011. eval "$doconfig"
  1012. cd "$builddir"
  1013. extras=
  1014. wx=
  1015. case $host in
  1016. *cygwin*)
  1017. if test "$with_cygwin" != "yes"
  1018. then
  1019. AC_MSG_NOTICE([gcc will be used in mingw mode.])
  1020. else
  1021. AC_MSG_NOTICE([Using raw cygwin])
  1022. CPPFLAGS="$CPPFLAGS -I/usr/include/freetype2 -I/usr/include/ncurses "
  1023. extras="--with-xft --with-xim"
  1024. fi
  1025. ;;
  1026. *Darwin* | *darwin*)
  1027. # clang on MacOSX does not provide -mfpmath
  1028. # CFLAGS="$CFLAGS -msse2 -mfpmath=sse"
  1029. # CXXFLAGS="$CXXFLAGS -msse2 -mfpmath=sse"
  1030. MACARCH="--enable-macosx_arch=x86_64"
  1031. extras="--with-xft --with-xim"
  1032. wx="--with-cocoa \
  1033. $MACARCH "
  1034. # --with-macosx-version-min=10.13
  1035. ;;
  1036. *)
  1037. # On most non-windowed platforms Xft is a very good idea! And I am now
  1038. # relying on it. Ditto XIM
  1039. CFLAGS="$CFLAGS "
  1040. CXXFLAGS="$CXXFLAGS "
  1041. extras="--with-xft --with-xim"
  1042. ;;
  1043. esac
  1044. if test "$with_wx" != "no"
  1045. then
  1046. mkdir wxWidgets
  1047. cd wxWidgets
  1048. AC_MSG_NOTICE([About to configure wxWidgets])
  1049. # I need --enable-unicode on Windows at least so that I can use the
  1050. # BaKoMa fonts which remap at least one TeX glyph to outside the range
  1051. # of simple 8-bit characters. This will bring some follow-on pain no doubt
  1052. # but addressing that pain is probably good in the long term.
  1053. setpasscc
  1054. doconfig="$SHELL $abssrcdir/csl/wxWidgets/configure -C $wx \
  1055. $pass_host \
  1056. CPPFLAGS=\"$CPPFLAGS -D_GNU_SOURCE=1\" \
  1057. CFLAGS=\"$CFLAGS\" \
  1058. CFLAGS=\"$CFLAGS\" \
  1059. CXXFLAGS=\"$CXXFLAGS\" \
  1060. LDFLAGS=\"$LDFLAGS\" \
  1061. $passcc \
  1062. --disable-shared \
  1063. --enable-unicode \
  1064. --disable-compat28 \
  1065. --enable-monolithic \
  1066. --disable-sys-libs \
  1067. --without-libjpeg \
  1068. --without-libtiff \
  1069. --disable-svg \
  1070. --without-sdl \
  1071. --without-expat \
  1072. --without-libiconv \
  1073. --without-regex \
  1074. --disable-webview \
  1075. --disable-richtext \
  1076. --disable-gif \
  1077. --disable-pcx \
  1078. --enable-graphics_ctx \
  1079. --disable-tga \
  1080. --disable-pnm \
  1081. --enable-dynlib \
  1082. --enable-dynamicloader \
  1083. --prefix=\"$builddir\" \
  1084. --libdir=\"$builddir/lib\" \
  1085. --includedir=\"$builddir/include\""
  1086. if test "$enable_debug" != "no"
  1087. then
  1088. doconfig="$doconfig --enable-debug"
  1089. else
  1090. doconfig="$doconfig --disable-debug"
  1091. fi
  1092. if test "$with_cygwin" != "no"
  1093. then
  1094. doconfig="$doconfig --with-gtk"
  1095. fi
  1096. AC_MSG_NOTICE([doconfig = $doconfig])
  1097. printf "\n\n+++ About to configure wxWidgets +++\n\n"
  1098. eval "$doconfig"
  1099. cd "$builddir"
  1100. elif test "$with_fox" != "no"
  1101. then
  1102. AC_MSG_NOTICE([About to configure FOX])
  1103. mkdir -p fox/src
  1104. # The Makefile that comes with FOX seems to require these GIF files
  1105. # in the build directory.
  1106. cp "$abssrcdir/csl/fox/src/"*.gif fox/src
  1107. cd fox
  1108. setpasscc
  1109. doconfig="$SHELL $abssrcdir/csl/fox/configure -C $ac_configure_args \
  1110. CPPFLAGS=\"$CPPFLAGS\" \
  1111. CFLAGS=\"$CFLAGS\" \
  1112. CXXFLAGS=\"$CXXFLAGS\" \
  1113. LDFLAGS=\"$LDFLAGS\" \
  1114. $passcc \
  1115. $pass_host \
  1116. --enable-release \
  1117. --with-opengl=no \
  1118. --disable-jpeg \
  1119. --disable-zlib \
  1120. --disable-bz2lib \
  1121. --disable-png \
  1122. --disable-tiff \
  1123. --prefix=\"$builddir\" \
  1124. --libdir=\"$builddir/lib\" \
  1125. --includedir=\"$builddir/include\" \
  1126. $extras"
  1127. printf "\n\n+++ About to configure FOX +++\n\n"
  1128. AC_MSG_NOTICE([doconfig = $doconfig])
  1129. eval "$doconfig"
  1130. cd "$builddir"
  1131. fi
  1132. fi
  1133. AC_MSG_NOTICE([GUI toolkit config spawned])
  1134. if test "$with_crlibm" = "no"
  1135. then
  1136. AC_MSG_NOTICE([crlibm will not be used here])
  1137. else
  1138. AC_MSG_NOTICE([About to configure crlibm])
  1139. mkdir -p crlibm
  1140. cd crlibm
  1141. setpasscc
  1142. doconfig="$SHELL $abssrcdir/libraries/crlibm/configure -C $filtered \
  1143. $pass_host \
  1144. CPPFLAGS=\"$CPPFLAGS\" \
  1145. CFLAGS=\"$CFLAGS\" \
  1146. CXXFLAGS=\"$CXXFLAGS\" \
  1147. LDFLAGS=\"$LDFLAGS\" \
  1148. $passcc \
  1149. --prefix=\"$builddir\" \
  1150. --libdir=\"$builddir/lib\" \
  1151. --includedir=\"$builddir/include\""
  1152. AC_MSG_NOTICE([doconfig = $doconfig])
  1153. printf "\n\n+++ About to configure crlibm +++\n\n"
  1154. eval "$doconfig"
  1155. cd "$builddir"
  1156. fi
  1157. AC_MSG_NOTICE([About to configure libffi])
  1158. mkdir -p libffi
  1159. if test "$enable_universal" = "yes"
  1160. then
  1161. # This is a messy script that arranges to build a universal version of
  1162. # the library on MacOS.
  1163. cp $abssrcdir/libraries/libffi-for-mac/Makefile libffi
  1164. else
  1165. cd libffi
  1166. setpasscc
  1167. doconfig="$SHELL $abssrcdir/libraries/libffi/configure -C $filtered \
  1168. $pass_host \
  1169. CPPFLAGS=\"$CPPFLAGS\" \
  1170. CFLAGS=\"$CFLAGS\" \
  1171. CXXFLAGS=\"$CXXFLAGS\" \
  1172. LDFLAGS=\"$LDFLAGS\" \
  1173. $passcc \
  1174. --disable-multi-os-directory \
  1175. --disable-docs \
  1176. --prefix=\"$builddir\" \
  1177. --libdir=\"$builddir/lib\" \
  1178. --includedir=\"$builddir/include\""
  1179. AC_MSG_NOTICE([doconfig = $doconfig])
  1180. printf "\n\n+++ About to configure libffi +++\n\n"
  1181. eval "$doconfig"
  1182. cd "$builddir"
  1183. fi
  1184. AC_MSG_NOTICE([About to configure libsoftfloat])
  1185. mkdir -p softfloat
  1186. cd softfloat
  1187. setpasscc
  1188. # NOTE that there is now a SoftFloat-3e and I should migrate to use of it!
  1189. doconfig="$SHELL $abssrcdir/libraries/SoftFloat-3a/source/configure -C \
  1190. $filtered \
  1191. $pass_host \
  1192. CPPFLAGS=\"$CPPFLAGS\" \
  1193. CFLAGS=\"$CFLAGS\" \
  1194. CXXFLAGS=\"$CXXFLAGS\" \
  1195. LDFLAGS=\"$LDFLAGS\" \
  1196. $passcc \
  1197. --prefix=\"$builddir\" \
  1198. --libdir=\"$builddir/lib\" \
  1199. --includedir=\"$builddir/include\""
  1200. AC_MSG_NOTICE([doconfig = $doconfig])
  1201. printf "\n\n+++ About to configure softfloat +++\n\n"
  1202. eval "$doconfig"
  1203. cd "$builddir"
  1204. AC_MSG_NOTICE([About to configure libedit])
  1205. mkdir -p libedit
  1206. cd libedit
  1207. setpasscc
  1208. doconfig="$SHELL $abssrcdir/libraries/libedit-$LIBEDIT_VERSION/configure -C \
  1209. $nohost \
  1210. $passcc \
  1211. CPPFLAGS=\"$CPPFLAGS\" \
  1212. CFLAGS=\"$CFLAGS\" \
  1213. CXXFLAGS=\"$CXXFLAGS\" \
  1214. LDFLAGS=\"$LDFLAGS\" \
  1215. --enable-widec=yes \
  1216. --prefix=\"$builddir\" \
  1217. --libdir=\"$builddir/lib\" \
  1218. --includedir=\"$builddir/include\""
  1219. AC_MSG_NOTICE([doconfig = $doconfig])
  1220. printf "\n\n+++ About to configure libedit +++\n\n"
  1221. eval "$doconfig"
  1222. cd "$builddir"
  1223. ln -f -s $abssrcdir/libraries/wineditline .
  1224. AC_MSG_NOTICE([About to configure redfront])
  1225. mkdir -p redfront
  1226. cd redfront
  1227. setpasscc
  1228. doconfig="$SHELL $abssrcdir/generic/newfront/configure -C $nohost \
  1229. $passcc \
  1230. CPPFLAGS=\"$CPPFLAGS\" \
  1231. CFLAGS=\"$CFLAGS\" \
  1232. CXXFLAGS=\"$CXXFLAGS\" \
  1233. LDFLAGS=\"$LDFLAGS\" \
  1234. --prefix=\"$builddir\" \
  1235. --libdir=\"$builddir/lib\" \
  1236. --includedir=\"$builddir/include\""
  1237. AC_MSG_NOTICE([doconfig = $doconfig])
  1238. printf "\n\n+++ About to configure redfront +++\n\n"
  1239. eval "$doconfig"
  1240. cd "$builddir"
  1241. AC_MSG_NOTICE([All sub-packages have had their configure script launched])
  1242. ###############################################################################
  1243. AM_CONDITIONAL(csl, test "$with_csl" != "no")
  1244. AM_CONDITIONAL(psl, test "$with_psl" != "no")
  1245. AM_CONDITIONAL(cslpsl, test "$with_csl" != "no" && test "$with_psl" != "no")
  1246. AM_CONDITIONAL(fox, test "$with_fox" != "no")
  1247. AM_CONDITIONAL(wx, test "$with_wx" != "no")
  1248. AM_CONDITIONAL(crlibm, test "$with_crlibm" != "no")
  1249. AC_MSG_NOTICE([final output from top level configuration])
  1250. AC_OUTPUT
  1251. printf "All sub-tasks should have completed\n"
  1252. # end of configure.ac