1## Process this file with autoconf to produce a configure script. 2 3# A C Norman. May 2008-2021 4 5# This is for building the FOX test programs in the CSL/Reduce environment, 6# and the sources for the FOX tests have been moved to a distinct directory 7# to make it clear that they are not part of CSL or Reduce but are merely 8# aggregated with same. 9 10# 11# --with-cygwin Build native cygwin X11 based system. 12# --enable-debug Switch on debugging. 13# 14# 15 16 17# FOX gets built in a directory whose name is based on the platform 18# it supports. In simple cases this is just the GNU triple, as in 19# i686-pc-linux etc. However there are a range of cases when I will 20# change that. These are the things I note above as "special flags" 21 22# Specify the name of this "application" and a version number 23AC_INIT([FOXTESTS],[1.4.21]) 24 25# This seemed to work with 2.57 so despite other parts of the code needing 26# a yet newer version I will leave this here. 27AC_PREREQ(2.57) 28 29here=`pwd` 30AC_MSG_NOTICE([+++ Configuring FOX tests in directory $here +++]) 31 32AC_CONFIG_SRCDIR(scribble.cpp) 33AC_CONFIG_FILES(Makefile) 34 35AC_CONFIG_MACRO_DIRS([m4]) 36AC_CONFIG_AUX_DIR([.]) 37 38AM_INIT_AUTOMAKE([1.8.3 -Wall -Wno-override -Wno-portability foreign dist-bzip2]) 39 40# What host am I on? 41AC_CANONICAL_HOST() 42 43AC_SUBST(DLL_CFLAGS) 44 45# The following are always to be defined when I go through this route 46 47AC_DEFINE_UNQUOTED(HOST_CPU,"$host_cpu",[Name of CPU]) 48AC_DEFINE_UNQUOTED(HOST_VENDOR,"$host_vendor",[Name of vendor]) 49AC_DEFINE_UNQUOTED(HOST_OS,"$host_os",[Name of Operating System]) 50 51foxdir="$host" 52 53 54AC_ARG_WITH(csl, 55 AS_HELP_STRING([--with-csl], [Use the CSL Lisp system]), 56 [], 57 [with_csl="no"]) 58 59AC_ARG_WITH(psl, 60 AS_HELP_STRING([--with-psl], [Use the PSL Lisp system]), 61 [], 62 [with_psl="no"]) 63 64AC_ARG_WITH(mingw64, 65 AS_HELP_STRING([--with-mingw64], [Use internally with CSL]), 66 [], 67 [with_mingw64="no"]) 68 69AC_ARG_WITH(build, 70 AS_HELP_STRING([--with-build], [Used internally to control build directory]), 71 [], 72 [with_build="unknown"]) 73 74AC_ARG_WITH(pslbuild, 75 AS_HELP_STRING([--with-pslbuild], [Used internally to control build directory]), 76 [], 77 [with_pslbuild="unknown"]) 78 79AC_ARG_WITH(cygbuild, 80 AS_HELP_STRING([--with-cygbuild], [Used internally to control build directory]), 81 [], 82 [with_cygbuild="unknown"]) 83 84AC_ARG_WITH(cygbuild64, 85 AS_HELP_STRING([--with-cygbuild64], [Used internally to control build directory]), 86 [], 87 [with_cygbuild64="unknown"]) 88 89AC_ARG_WITH(force, 90 AS_HELP_STRING([--with-force], [Used internally]), 91 [], 92 []) 93 94AC_ARG_WITH(crlibm, 95 AS_HELP_STRING([--with-crlibm], [Used internally]), 96 [], 97 []) 98 99AC_SUBST(MAKE) 100AC_SUBST(AR) 101AC_SUBST(STRIP) 102AC_SUBST(SED) 103AC_SUBST(WINDRES) 104 105if test "x$WINDRES" = "x" 106then 107 AC_CHECK_TOOL(WINDRES, windres, windres) 108fi 109 110case $host in 111x86_64-w64-*) 112 AC_DEFINE(WIN32, [1], [True if we are running on Windows]) 113 AC_DEFINE(WIN64, [1], [True if we are running on 64-bit Windows]) 114 CPPFLAGS="$CPPFLAGS" 115 CFLAGS="$CFLAGS -funsigned-char" 116 CXXFLAGS="$CXXFLAGS -funsigned-char" 117 DLL_CFLAGS="$CFLAGS -shared" 118 windows_build="yes" 119 exeext="yes" 120 X_BASE_LIBS="" 121 ;; 122*-*-cygwin* | *mingw*) 123 AC_MSG_NOTICE([Building under cygwin]) 124 AC_ARG_WITH(cygwin, 125 [ --with-cygwin Force use of raw cywgin (note GPL)], 126 really_use_cygwin="yes") 127 x86="yes" 128 if test "x$really_use_cygwin" = "xyes" 129 then 130 CFLAGS="$CFLAGS -funsigned-char" 131 CXXFLAGS="$CXXFLAGS -funsigned-char" 132 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib" 133 DLL_CFLAGS="$CFLAGS -shared" 134 XLIBS="-lXext -lX11 -lXft" 135 cygwin_build="yes" 136 exeext="yes" 137# Here is the normal situation where cygwin is the BUILD environment. Mostly 138# that means mingw-style usage. 139 else 140 AC_DEFINE(WIN32, [1], [True if we are running on Windows]) 141 CPPFLAGS="$CPPFLAGS " 142 CFLAGS="$CFLAGS -funsigned-char" 143 CXXFLAGS="$CXXFLAGS -funsigned-char" 144 LDFLAGS="$LDFLAGS " 145# In this case I make the machine appear to be "i686-pc-windows" or some 146# such to distinguish it from the case where cygwin1.dll might be involved. 147 foxdir=`echo $foxdir | sed -e 's/cygwin/windows/'` 148 fi 149 windows_build="yes" 150 exeext="yes" 151 X_BASE_LIBS="" 152 ;; 153*-*-msdos* | *-*-go32* | *-*-windows*) 154 AC_MSG_ERROR([For Windows you are expected to use cygwin/mingw32]) 155 ;; 156*-*solaris*) 157 AC_MSG_NOTICE([Building for Solaris]) 158# I USED to somewhat encourage the use of the Sun compiler "cc" here but now 159# I am testing using Solaris 10 x86 and gcc seems available and adequate. 160# Note that by setting CC and CXX before using "configure" you can select 161# the compiler of your choice. However there is a risk that I need to 162# specify explicit paths so if they are not set by the user I will force 163# something here! The paths shown here are the ones I find installed on 164# Solaris 10 x86 from the Software Companion DVD. This all seems pretty 165# HORRID to me! 166 if test "x$CC" = "x" 167 then 168 AC_PATH_PROGS(CC, gcc, gcc, [/usr/sfw/bin:$PATH]) 169 fi 170 if test "x$CXX" = "x" 171 then 172 AC_PATH_PROGS(CXX, g++, g++, [/usr/sfw/bin:$PATH]) 173 fi 174 if test "x$MAKE" = "x" 175 then 176 AC_PATH_PROGS(MAKE, [gmake make], make, [/usr/sfw/bin:$PATH]) 177 fi 178 if test "x$AR" = "x" 179 then 180 AC_PATH_PROGS(AR, [gar ar], ar, [/usr/sfw/bin:$PATH]) 181 fi 182 if test "x$STRIP" = "x" 183 then 184 AC_PATH_PROGS(STRIP, [gstrip strip], strip, [/usr/sfw/bin:$PATH]) 185 fi 186 if test "x$SED" = "x" 187 then 188 AC_PATH_PROGS(SED, [gsed sed], sed, [/usr/sfw/bin:$PATH]) 189 fi 190 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib" 191 XLIBS="-lXext -lX11 -lXft" 192 DLL_CFLAGS="$CFLAGS -shared" 193 AC_DEFINE(SOLARIS, [1], [True if we are running on Solaris]) 194 solaris="yes" 195 ;; 196*darwin*) 197 AC_MSG_NOTICE([Building for Macintosh/Darwin with X11]) 198 macintosh_build="yes" 199 darwin_build="yes" 200 XLIBS="-lXext -lX11 -lXft -lfontconfig" 201 AC_DEFINE(MACINTOSH, [1], [True if we are running on Macintosh]) 202 if test "x$CC$CXX" == "x" || (test "x$CC" == "xgcc" && test "x$CXX" == "xg++") 203 then 204# The following line was suggested by the libEDIT configuration files. 205# Even though I no longer use libEDIT I will keep it! 206# 207# OK. -fno-common causes C programs to lead to a linker error if you have 208# declarations of variables in several files. It may thus count as 209# and extra safety measure. 210 CFLAGS="$CFLAGS -fno-common" 211 CXXFLAGS="$CXXFLAGS -fno-common" 212# At least maybe MacOS 10.2 may not put X11 headers on the standard include 213# path by default, so I help it out here. In later releases it should be 214# present already, but an extra chance to scan ought not to hurt anybody. 215 CPPFLAGS="$CPPFLAGS -fno-common -I/usr/X11R6/include" 216 DLL_CFLAGS="$CFLAGS -bundle -undefined suppress" 217 AC_DEFINE(UNIX,[1],[True if we are running on Unix, Linux, BSD etc]) 218 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -L/opt/local/lib -L/opt/X11/lib" 219 LDFLAGS="$LDFLAGS -framework Carbon -framework CoreServices -framework ApplicationServices" 220 fi 221 ;; 222*-freebsd*) 223 AC_MSG_NOTICE([Building on FreeBSD]) 224 AC_DEFINE(UNIX,[1],[True if we are running on Unix, Linux, BSD etc]) 225 if test "x$target" = "x" 226 then 227 xtarget="$host" 228 else 229 xtarget="$target" 230 fi 231 case $xtarget in 232 *i386* | *i486* | *i586* | *i686* | *x86* | *amd64*) 233 x86="yes" 234 ;; 235 esac 236# To survive 64-bit Linux the next line seems needed. I will leave it for 237# BSD since is a /usr/X11R6/lib64 directory does not exist no harm will 238# be done. 239 if test "x$cross_compiling" != "xyes" 240 then 241 AC_CHECK_FILE([/usr/X11R6/lib64],[XLL=lib64],[XLL=lib]) 242 else 243 XLL=lib 244 fi 245 LDFLAGS="$LDFLAGS -L/usr/X11R6/$XLL -pthread" 246 DLL_CFLAGS="$CFLAGS -shared" 247 XLIBS="-lXext -lX11 -lXft" 248 ;; 249*) 250 AC_MSG_NOTICE([Assuming a Unix-like environment, including Linux]) 251 AC_MSG_NOTICE([host=$host, target=$target]) 252 AC_DEFINE(UNIX,[1],[True if we are running on Unix, Linux, BSD etc]) 253 if test "x$target" = "x" 254 then 255 xtarget="$host" 256 else 257 xtarget="$target" 258 fi 259 case $xtarget in 260 *i386* | *i486* | *i586* | *i686* | *x86* | *amd64*) 261 x86="yes" 262 ;; 263 esac 264# To survive 64-bit Linux the next line seems needed. 265 if test "x$cross_compiling" != "xyes" 266 then 267 AC_CHECK_FILE([/usr/X11R6/lib64],[XLL=lib64],[XLL=lib]) 268 else 269 XLL=lib 270 fi 271 LDFLAGS="$LDFLAGS -L/usr/X11R6/$XLL" 272 DLL_CFLAGS="$CFLAGS -shared" 273 XLIBS="-lXext -lX11 -lXft" 274 ;; 275esac 276 277# In some cases there may be explicitly GNU versions of various utilities, 278# and I will perhaps use them if I find them. 279 280if test "x$MAKE" = "x" 281then 282 AC_CHECK_PROGS(MAKE,[gmake make],[make]) 283fi 284if test "x$AR" = "x" 285then 286 AC_CHECK_PROGS(AR,[gar ar],[ar]) 287fi 288if test "x$STRIP" = "x" 289then 290 AC_CHECK_PROGS(STRIP,[gstrip strip],[echo]) 291fi 292if test "x$SED" = "x" 293then 294 AC_CHECK_PROGS(SED,[gsed sed],[sed]) 295fi 296 297 298AC_ARG_WITH(fox, [ --with-fox[=DIR] FOX installation location]) 299AC_ARG_WITH(fox-pending, [ --with-fox-pending do not check dir from --with-fox]) 300 301 302# Here I will adjust foxdir to mention the Linux distribution involved 303# in case that I can discover that. The effect is that my (adjusted) 304# "triple" will be something like say 305# i686-pc-fedora_6 OR powerpc-macos_10.4_tiger-darwin8.8.0 306# rather than 307# i686-pc=linux-gnu OR powerpc-apple-darwin8.8.0 308 309distrib=`"$srcdir/../../scripts/findos.sh"` 310AC_MSG_NOTICE([distrib = $distrib]) 311 312if test "x$distrib" != "xunknown" 313then 314 foxdir=`echo $foxdir | sed -e s/linux-gnu/$distrib/` 315 foxdir=`echo $foxdir | sed -e s/apple/$distrib/` 316fi 317 318# Debugging turned on? 319AC_MSG_CHECKING(for debugging) 320AC_ARG_ENABLE(debug,[ --enable-debug compile for debugging]) 321AC_MSG_RESULT([$enable_debug]) 322 323if test "x$enable_debug" = "xyes" 324then 325 foxdir="$foxdir-debug" 326fi 327 328AC_MSG_NOTICE([foxdir = $foxdir]) 329 330# Checks for programs. 331 332# 333# AC_PROG_CC sets CFLAGS to "-g -O2" if it was not already set to 334# something else and if gcc was in use. I view that as not what I want! 335# so I try to preserve CFLAGS here 336# 337 338# find C compiler & preprocessor 339# I will not need C++ unless FOX is available and I try to build a GUI 340# version, but maybe it does not hurt a lot to look for it regardless. 341 342old_CFLAGS="$CFLAGS" 343old_CXXFLAGS="$CXXFLAGS" 344AC_MSG_NOTICE([Looking for C pre-processor]) 345AC_PROG_CPP 346AC_MSG_NOTICE([Looking for C compiler]) 347AC_PROG_CC 348AC_MSG_NOTICE([Looking for C++ pre-processor]) 349AC_PROG_CXXCPP 350AC_MSG_NOTICE([Looking for C++ compiler]) 351AC_PROG_CXX 352CFLAGS="$old_CFLAGS" 353CXXFLAGS="$old_CXXFLAGS" 354 355 356# Some newer versions of gcc support a new gnu (rather then sysv) format 357# of part of object files. The effect of this new format it to speed up 358# dynamic linking, perhaps by a factor of 2. That is good! But an object 359# made using only the new scheme fails with a floating point exception 360# when you try to run it on an older system. That is it fails while being 361# loaded, not while being run. Fedora Core 6 (at least) by default 362# uses just the new format, and so generates VERY non-portable executables. 363# Enabling the "both" option here should soften the impact... 364 365AC_MSG_NOTICE([Checking for "--hash-style=both"]) 366if test "x$GCC" = "xyes" 367then 368 OLDLDFLAGS="$LDFLAGS" 369 LDFLAGS="$LDFLAGS -Wl,--hash-style=both" 370 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], 371 [[printf("Hello\n");]])], 372 [AC_MSG_NOTICE(Will use --hash-style=both)], 373 [LDFLAGS="$OLDLDFLAGS" 374 AC_MSG_NOTICE(--hash-style=both not available)]) 375fi 376 377if test "x$darwin_build" = "xyes" 378then 379# I COULD be trying to build on raw Darwin without MacOS present, and in that 380# case Carbon etc will not be available. 381 AC_MSG_NOTICE([Checking for "-framework"]) 382 if test "x$GCC" = "xyes" 383 then 384 OLDLDFLAGS="$LDFLAGS" 385 LDFLAGS="$LDFLAGS -framework Carbon -framework CoreServices -framework ApplicationServices" 386 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], 387 [[printf("Hello\n");]])], 388 [framework_available="yes"], 389 [LDFLAGS="$OLDLDFLAGS" 390 framework_available="no"]) 391 else 392 framework_available="no" 393 fi 394 AC_MSG_NOTICE([framework=$framework_available]) 395 if test "x$framework_available" = "xyes" 396 then 397 AC_DEFINE(MAC_FRAMEWORK,[1],[Apple MacOS frameworks available]) 398 fi 399fi 400 401# I might like to be able to force generation of position-independent 402# code, and GCC has a directive -fPIC. This checks if it is accepted. 403# Specifically when I am generating a loadable module this can be needed. 404# However for Windows the option does not cause GCC to fail but it does 405# load to a warning that it has no effect, so I will avoid even trying to 406# activate it then (for x86 all case is position independent anyway). 407 408if test "x$windows_build" != "xyes" 409then 410 AC_MSG_NOTICE([Checking for "-fPIC"]) 411 if test "x$GCC" = "xyes" 412 then 413 OLDCFLAGS="$CFLAGS" 414 CFLAGS="$CFLAGS -fPIC" 415 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], 416 [[printf("Hello\n");]])], 417 [fpic_available="yes"], 418 [fpic_available="no"]) 419 CFLAGS="$OLDCFLAGS" 420 else 421 fpic_available="no" 422 fi 423 AC_MSG_NOTICE([-fPIC=$fpic_available]) 424 425 if test "x$fpic_available" = "xyes" 426 then 427 DLL_CFLAGS="$DLL_CFLAGS -fPIC" 428 fi 429fi 430 431if test "x$solaris" = "xyes" 432then 433# I believe that the Sun C compilers need a "-mt" flag so here I check if 434# such a flag is accepted and if so I will use it. 435 OLDCFLAGS="$CFLAGS" 436 CFLAGS="$CFLAGS -mt" 437 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], 438 [[printf("Hello\n");]])], 439 [CXXFLAGS="$CXXFLAGS -mt"], 440 [CFLAGS="$OLDCFLAGS"]) 441fi 442 443if (test "x$windows_build" != "xyes" || test "x$with_cygwin" = "xyes") 444then 445 AC_ARG_WITH(xim, 446 [ --with-xim Can be used to control use of XIM]) 447# I will not even look for Xft if I am building for win32 not X. 448# 449# Furthermore I will not try xft-config if I am cross-compiling. This may 450# be a mess if I ever try to cross compile towards a machine that needs it. 451# 452# All of the above is more of a worry now I am starting to assume that 453# Xft is available... 454 AC_ARG_WITH(xft, 455 [ --with-xft Can be used to disable use of XFT]) 456 if test "x$with_xft" != "xno" && test "x$cross_compiling" != "xyes" 457 then 458 AC_PATH_PROGS(XFT_CONFIG, xft-config, [no], 459 [/usr/local/bin:/usr/X11R6/bin:/usr/sfw/bin:$PATH]) 460 if test "$XFT_CONFIG" != "no" 461 then 462# I will add to CFLAGS and XLIBS if xft-config is found 463 xft_cflags=`$XFT_CONFIG --cflags` 464 CFLAGS="$CFLAGS $xft_cflags" 465 CXXFLAGS="$CXXFLAGS $xft_cflags" 466 CPPFLAGS="$CPPFLAGS $xft_cflags" 467 xft_libs=`$XFT_CONFIG --libs` 468 XLIBS="$XLIBS $xft_libs" 469# NB that xft-config hands back some stuff that I might believe should 470# perhaps be in LDFLAGS not LIBS, but never mind! Also done this way we 471# may get some libraries mentioned more than once in LIBS - I hope that 472# will not cause pain. 473 AC_DEFINE(HAVE_LIBXFT, [1], [True Xft is available]) 474 AC_MSG_NOTICE([xft-config found, so Xft should be available]) 475 else 476# here xft-config is NOT present, but it may be that xft headers and 477# libraries are nevertheless available. I will look for freetype-config 478# which may also help me... 479 AC_PATH_PROGS(FREETYPE_CONFIG, freetype-config, [no], 480 [/usr/local/bin:/usr/sfw/bin:$PATH]) 481 if test "$FREETYPE_CONFIG" != "no" 482 then 483# I will add to CFLAGS and XLIBS if freetype-config is found, an in fact I 484# will then leave them there even if then Xft is not found. That is perhaps 485# slightly untidy. 486 freetype_cflags=`$FREETYPE_CONFIG --cflags` 487 CFLAGS="$CFLAGS $freetype_cflags" 488 CXXFLAGS="$CXXFLAGS $freetype_cflags" 489 CPPFLAGS="$CPPFLAGS $freetype_cflags" 490 freetype_libs=`$FREETYPE_CONFIG --libs` 491 XLIBS="$XLIBS $freetype_libs" 492 xft_found="yes" 493 AC_CHECK_LIB(fontconfig, FcConfigCreate) 494 AC_CHECK_LIB(Xft, XftFontOpen,,[xft_found="no"]) 495 AC_CHECK_HEADER(X11/Xft/Xft.h,,[xft_found="no"]) 496 if test "$xft_found" = "yes" 497 then 498 AC_DEFINE(HAVE_LIBXFT, [1], [True Xft is available]) 499 AC_MSG_NOTICE([freetype-config found, and Xft should be available]) 500 fi 501 fi 502 fi 503 fi 504fi 505 506AC_CHECK_HEADERS([X11/extensions/Xrandr.h]) 507AC_CHECK_LIB(Xrandr, XRRQueryExtension) 508 509# find command to do best approx to "ln -s" and set LN_S 510AC_PROG_LN_S 511 512 513# In lots of cases I will be using gcc. In that case I will use -O2 for 514# release code, but -O0 when debugging. I also stick in -Wall so I get 515# loads of comments about code style etc. For other C compilers I do 516# not set any optimisation flags but I do expect "-g" to be available 517# to enable debugging. 518 519# 520# Well as of late 2003/early 2004 some versions of gcc appears to compile 521# some of my code at -O3 in ways that hurt me, but at -O2 mostly things seem 522# better behaved. At one stage I believed that my trouble might have been 523# to do with "Strict Aliasing" but I am less convinced of that now - however 524# to be cautious I switch off that aspect of gcc. I really want this code 525# to compile and run first-time on as many systems as I can and so tuning 526# down the optimisation level from -O3 to -O2 is probably worthwhile even 527# though it hits performance a little. Furthermore in 2008 I found that 528# some things behaved in ways I did not understand with "-O1 -g" hence I 529# drop back to "-O0 -g". 530# 531 532LOWOPT="-O0" 533HIGHOPT="-O2" 534 535case $CC in 536x86_64-w64-*) 537 AC_DEFINE(WIN64, [1], [True if we are running on Windows (64 bit)]) 538 ;; 539esac 540 541if test "x$GCC" = "xyes" 542then 543 if test "x$enable_debug" = "xyes" 544 then 545 CFLAGS="${CFLAGS} -fno-strict-aliasing ${LOWOPT} -g -DDEBUG=1 -Wall" 546 CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing ${LOWOPT} -g -DDEBUG=1 -Wall" 547 DLL_CFLAGS="${DLL_CFLAGS} -fno-strict-aliasing ${LOWOPT} -g -DDEBUG=1 -Wall" 548 LDFLAGS="${LDFLAGS} -g" 549 else 550 CFLAGS="$CFLAGS -fno-strict-aliasing ${HIGHOPT} -Wall" 551 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing ${HIGHOPT} -Wall" 552 DLL_CFLAGS="${DLL_CFLAGS} -fno-strict-aliasing ${HIGHOPT}" 553 fi 554 if test "x$enable_static" = "xyes" 555 then 556 LDFLAGS="${LDFLAGS} -static" 557 fi 558else 559# 560# BEWARE any other C compilers that take an enthusiastic view on Strict 561# Aliasing! It causes real problems with the way that Lisp data is mapped onto 562# machine resources. Actually my current reading of the standard makes it feel 563# perhaps less horrid than I had at one stage thought... 564# I am 565 if test "x$enable_debug" = "xyes" 566 then 567 CFLAGS="${CFLAGS} -g -DDEBUG=1" 568 CXXFLAGS="${CXXFLAGS} -g -DDEBUG=1" 569 DLL_CFLAGS="${DLL_CFLAGS} -g -DDEBUG=1" 570 LDFLAGS="${LDFLAGS} -g" 571 fi 572fi 573 574# On at least some systems static linking against X11 needs -ldl 575# Also I will use dlopen (and friends) for dynamic loading of stuff 576# compiled via C. 577AC_CHECK_LIB(dl, dlopen) 578 579# Fox 1.6 seems to use nanosleep in FXThread and on some systems at least 580# the means I must link against librt. 581AC_CHECK_LIB(rt, clock_nanosleep) 582 583AC_CHECK_LIB(pthread, pthread_create) 584 585LIBS="$XLIBS $LIBS" 586 587# Some platforms appear to require the Xcursor library. The next line 588# should arrange that it gets scanned if it is available. This test 589# does not make a lot of sense on Windows, but in that case it will 590# just harmlessly fail. And sometimes (especially for static linking) 591# a Xrender library is needed too... However Solarix 10 x86 seems to 592# misdetect Xrender when in 64-bit mode so I fudge that away here. 593 594if test "x$solaris" != "xyes" 595then 596AC_CHECK_LIB(Xrender, XRenderCreateCursor) 597AC_CHECK_LIB(Xcursor, XcursorImageCreate) 598fi 599 600# Checks for header files. 601AC_FUNC_ALLOCA 602AC_HEADER_DIRENT 603AC_HEADER_SYS_WAIT 604 605AC_CHECK_HEADERS([fcntl.h float.h malloc.h memory.h]) 606AC_CHECK_HEADERS([stddef.h stdlib.h string.h stdint.h]) 607AC_CHECK_HEADERS([sys/param.h sys/time.h sys/times.h unistd.h utime.h]) 608AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h sys/socket.h sys/stat.h]) 609AC_CHECK_HEADERS([sys/types.h sys/wait.h sys/shm.h sys/ipc.h signal.h]) 610 611# Checks for typedefs, structures, and compiler characteristics. 612AC_HEADER_STAT 613AC_C_CONST 614AC_STRUCT_TM 615AC_C_VOLATILE 616 617AC_CHECK_TYPES([int8_t,int16_t,int32_t,int64_t,intptr_t], [], [], 618 [#ifdef HAVE_STDINT_H 619 #include <stdint.h> 620 #endif]) 621AC_CHECK_TYPES([uint8_t,uint16_t,uint32_t,uint64_t,uintptr_t], [], [], 622 [#ifdef HAVE_STDINT_H 623 #include <stdint.h> 624 #endif]) 625AC_CHECK_TYPES([u_int8_t,u_int16_t,u_int32_t,u_int64_t,u_intptr_t], [], [], 626 [#ifdef HAVE_STDINT_H 627 #include <stdint.h> 628 #endif]) 629 630# With luck the above types from newer C standards will ba available. If 631# they are I can rely on them an I then do not need to worry about 632# the sized of the older-style native types such as "long". And for 633# cross compilation and multi-architecture builds it can be delicate to 634# work out the size of types at configure time! But I will do so now and 635# use what I find as a fall-back for when (mostly) intptr_t is not 636# available. 637 638AC_CHECK_SIZEOF(void *) 639AC_CHECK_SIZEOF(short int) 640AC_CHECK_SIZEOF(int) 641AC_CHECK_SIZEOF(long) 642AC_CHECK_SIZEOF(long long) 643AC_C_BIGENDIAN 644 645AC_CHECK_TYPES([socklen_t],[],[],[#include <sys/socket.h>]) 646 647AC_CHECK_LIB(socket, socket) 648AC_CHECK_LIB(nsl, gethostbyname) 649 650# Checks for library functions. 651AC_FUNC_CLOSEDIR_VOID 652AC_FUNC_ERROR_AT_LINE 653AC_FUNC_LSTAT 654AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK 655# AC_FUNC_MALLOC this seems unduly fussy? 656AC_FUNC_MEMCMP 657# AC_FUNC_MKTIME causes a hang in on some systems! 658# AC_FUNC_REALLOC 659AC_FUNC_SETVBUF_REVERSED 660AC_TYPE_SIGNAL 661AC_FUNC_STAT 662AC_FUNC_UTIME_NULL 663AC_FUNC_VPRINTF 664AC_CHECK_FUNCS([atexit ftruncate getcwd gethostbyaddr gethostbyname inet_ntoa]) 665AC_CHECK_FUNCS([memmove memset mkdir pow rmdir socket sqrt strchr strdup]) 666AC_CHECK_FUNCS([strrchr strstr utime popen]) 667AC_CHECK_FUNCS([fork wait waitpid shmget shmat shmdt shmctl]) 668AC_CHECK_FUNCS([vsnprintf]) 669 670if test "x$with_fox" = "xno" 671then 672 AC_MSG_NOTICE("Will not even attempt to look for FOX") 673else 674 675 if test "x$with_fox_pending" != "xno" 676 then 677 fox_present="yes" 678 AC_MSG_NOTICE([Will expect FOX to be in $with_fox]) 679 CPPFLAGS="$CPPFLAGS -I \"$with_fox/include/fox-1.6\"" 680 LDFLAGS="$LDFLAGS -L \"$with_fox/lib\"" 681 AC_SUBST(FOXLIB) 682 FOXLIB="$with_fox/lib/libFOX*" 683 LIBS="-lFOX-1.6 $LIBS" 684 AC_SUBST(FOXDEPS) 685 FOXDEPS="$with_fox/lib/libFOX-1.6.a" 686 AC_DEFINE(HAVE_LIBFOX, [1], [Fox library present]) 687# Display FOX level (ie minor version number) if actually present 688 if test -f "$with_fox/include/fox-1.6/fxver.h" 689 then 690 grep LEVEL "$with_fox/include/fox-1.6/fxver.h" 691 fi 692 else 693 if test "x$with_fox" = "x" 694 then 695 with_fox="/usr/local" 696 else if test "x$with_fox" = "xyes" 697 then 698 with_fox="/usr/local" 699 fi 700 fi 701 702 if test -d "$with_fox/$foxdir" 703 then 704 with_fox="$with_fox/$foxdir" 705 fi 706 707 AC_MSG_NOTICE("Will look for FOX in $with_fox") 708 709# FOX is unhappy if you try to link (or even compile) in C 710# mode so set C++ usage here. Because some other things get confused in 711# C++ mode I make this test happen here at the end of my configure script. 712 713# Also I will not even want to try using C++ for anything unless FOX is 714# goin to be used. Another reason to put this stuff late her. 715 716 AC_LANG(C++) 717 718 cppflags_save="$CPPFLAGS" 719 ldflags_save="$LDFLAGS" 720 libs_save="$LIBS" 721 722# NB that for FOX I am going to expect the library to be in 723# $with_fox/lib 724# and $with_fox has had a subdir tagged on its end to reflect a 725# modified GNU-style triple, as in i686-pc-linux. So if the 726# user says --with-fox=/homes/myself/foxplace and the build is for 727# Windows-64 the location inspected will end up 728# /homes/myself/foxplace/x86_64-w64-windows64. Etc etc. 729 730# Only look for FOX 1.6. That is because at present the changes 731# introduced since then are not important to me but the additional licensing 732# constraints are ones I am unwilling to accept. 733 734 AC_SUBST(FOXLIB) 735 CPPFLAGS="$CPPFLAGS -I \"$with_fox/include/fox-1.6\"" 736 LDFLAGS="$LDFLAGS -L \"$with_fox/lib\"" 737 FOXLIB="$with_fox/lib/libFOX*" 738 LIBS="-lFOX-1.6 $LIBS" 739 AC_MSG_NOTICE([FOX libraries probably as $FOXLIB]) 740 741 AC_LINK_IFELSE( 742 [AC_LANG_PROGRAM([#define exit(x) acnexit(x) 743 #include "fx.h" 744 extern "C" char fxfindfox();], 745 [fxfindfox();])], 746 [AC_DEFINE(HAVE_LIBFOX, [1], [Fox library present]) 747 AC_MSG_NOTICE([Found FOX version 1.6])], 748 [fox_not_found=1]) 749 750 if test "x$fox_not_found" != "x" 751 then 752 AC_MSG_NOTICE([FOX libraries not found: will not build GUI code]) 753 CPPFLAGS="$cppflags_save" 754 LDFLAGS="$ldflags_save" 755 LIBS="$libs_save" 756 else 757 fox_present="yes" 758# Display FOX level (ie minor version number) 759 grep LEVEL "$with_fox/include/fox-1.6/fxver.h" 760 fi 761 762 fi 763 764fi 765 766# 767# The extra libraries listed here seem to need to be scanned last. 768# 769 770if test "x$windows_build" = "xyes" 771then 772 case $CC in 773 x86_64-w64-*) 774 LIBS="$LIBS -ladvapi32 -lshell32 -lcomctl32 -lgdi32 -lws2_32 -lmswsock -lwinspool -lmpr -luser32" 775 ;; 776 *) 777 LIBS="$LIBS -lcomctl32 -lgdi32 -lws2_32 -lwsock32 -lwinspool -lmpr" 778 ;; 779 esac 780fi 781 782if test "x$macintosh_build" = "xyes" 783then 784 ENVP=MACOSX_DEPLOYMENT_TARGET=10.11 785 CC="$ENVP $CC" 786 CXX="$ENVP $CXX" 787fi 788 789AC_CHECK_PROGS(CYGPATH,[cygpath],[no]) 790 791AC_OUTPUT 792 793# end of "configure.ac" 794