configure.in 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396
  1. dnl -*- sh -*-
  2. dnl the "configure" script is made from this by running GNU "autoconf"
  3. dnl
  4. dnl "$Id: configure.in 9990 2013-09-24 09:10:04Z ossman $"
  5. dnl
  6. dnl Configuration script for the Fast Light Tool Kit (FLTK).
  7. dnl
  8. dnl Copyright 1998-2013 by Bill Spitzak and others.
  9. dnl
  10. dnl This library is free software. Distribution and use rights are outlined in
  11. dnl the file "COPYING" which should have been included with this file. If this
  12. dnl file is missing or damaged, see the license at:
  13. dnl
  14. dnl http://www.fltk.org/COPYING.php
  15. dnl
  16. dnl Please report all bugs and problems on the following page:
  17. dnl
  18. dnl http://www.fltk.org/str.php
  19. dnl
  20. dnl We need at least autoconf 2.50...
  21. AC_PREREQ(2.50)
  22. dnl Required file in package...
  23. AC_INIT(src/Fl.cxx)
  24. AC_CANONICAL_HOST
  25. dnl So --with-archflags option is used during "checking size of long"
  26. case $host_os in
  27. darwin*)
  28. if test "x$with_archflags" != x ; then
  29. CFLAGS="$CFLAGS $with_archflags"
  30. fi
  31. USEMMFILES="Yes"
  32. ;;
  33. *)
  34. USEMMFILES="No"
  35. ;;
  36. esac
  37. AC_SUBST(USEMMFILES)
  38. dnl FLTK library versions...
  39. FL_MAJOR_VERSION=1
  40. FL_MINOR_VERSION=3
  41. FL_PATCH_VERSION=2
  42. FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
  43. AC_SUBST(FL_MAJOR_VERSION)
  44. AC_SUBST(FL_MINOR_VERSION)
  45. AC_SUBST(FL_PATCH_VERSION)
  46. AC_SUBST(FL_API_VERSION)
  47. dnl Do not automatically add "-g" to compiler options...
  48. ARCHFLAGS="${ARCHFLAGS:=}"
  49. CFLAGS="${CFLAGS:=}"
  50. CPPFLAGS="${CPPFLAGS:=}"
  51. CXXFLAGS="${CXXFLAGS:=}"
  52. DSOFLAGS="${DSOFLAGS:=}"
  53. LDFLAGS="${LDFLAGS:=}"
  54. OPTIM="${OPTIM:=}"
  55. AC_SUBST(ARCHFLAGS)
  56. AC_SUBST(OPTIM)
  57. dnl OS-specific pre-tests...
  58. dnl host_os_gui equals $host_os unless we target Cygwin in combination with X11.
  59. host_os_gui=$host_os
  60. case $host_os in
  61. cygwin*)
  62. # Handle Cygwin option *first*, before all other tests.
  63. AC_ARG_ENABLE(cygwin, [ --enable-cygwin use the Cygwin libraries [(default=no)]])
  64. AC_ARG_ENABLE(x11, [ --enable-x11 use Cygwin with X11 [(default=no)]])
  65. if test x$enable_cygwin != xyes; then
  66. # NOTE: We can't use ARCHFLAGS for this, since it does not work
  67. # with some of the function tests - Cygwin uses a
  68. # different C library...
  69. CFLAGS="$CFLAGS -mno-cygwin"
  70. CPPFLAGS="$CPPFLAGS -mno-cygwin"
  71. CXXFLAGS="$CXXFLAGS -mno-cygwin"
  72. LDFLAGS="$LDFLAGS -mno-cygwin"
  73. DSOFLAGS="$DSOFLAGS -mno-cygwin"
  74. else
  75. # we target Cygwin in combination with X11
  76. if test x$enable_x11 = xyes; then
  77. host_os_gui="X11$host_os"
  78. fi
  79. fi
  80. ;;
  81. esac
  82. dnl Define the libraries and link options we will need.
  83. LINKFLTK="../lib/libfltk.a"
  84. LINKFLTKFORMS="../lib/libfltk_forms.a"
  85. LINKFLTKGL="../lib/libfltk_gl.a"
  86. LINKFLTKIMG="../lib/libfltk_images.a"
  87. GLDEMOS="gldemos"
  88. LIBEXT=".a"
  89. LIBNAME="../lib/libfltk.a"
  90. FLLIBNAME="../lib/libfltk_forms.a"
  91. GLLIBNAME="../lib/libfltk_gl.a"
  92. IMGLIBNAME="../lib/libfltk_images.a"
  93. CAIROLIBNAME="../lib/libfltk_cairo.a"
  94. LIBBASENAME="libfltk.a"
  95. FLLIBBASENAME="libfltk_forms.a"
  96. GLLIBBASENAME="libfltk_gl.a"
  97. IMGLIBBASENAME="libfltk_images.a"
  98. CAIROLIBBASENAME="libfltk_cairo.a"
  99. dnl Check for Cairo library unless disabled...
  100. CAIRODIR=""
  101. CAIROFLAGS=""
  102. LINKFLTKCAIRO=""
  103. FLTKCAIROOPTION=""
  104. CAIROLIBS=""
  105. AC_ARG_ENABLE(cairoext,[ --enable-cairoext use fltk code instrumentation for cairo extended use (default=no)])
  106. AC_ARG_ENABLE(cairo,[ --enable-cairo use lib Cairo (default=no)])
  107. if test x$enable_cairoext = xyes; then
  108. AC_DEFINE(FLTK_USE_CAIRO)
  109. AC_DEFINE(FLTK_HAVE_CAIRO)
  110. dnl FIXME This part should be fixed so configure do not depend on
  111. dnl we do not rely on pkg-config .
  112. CAIRODIR="cairo"
  113. CAIROFLAGS="`pkg-config --cflags cairo`"
  114. CAIROLIBS="-lcairo -lpixman-1"
  115. CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
  116. LINKFLTKCAIRO="../lib/libfltk_cairo.a"
  117. FLTKCAIROOPTION="-L ../cairo -lfltk_cairo$SHAREDSUFFIX"
  118. LIBS="$CAIROLIBS $LIBS"
  119. dnl $LINKFLTKCAIRO
  120. LINKFLTK+=" $LINKFLTKCAIRO"
  121. else
  122. if test x$enable_cairo = xyes; then
  123. AC_DEFINE(FLTK_HAVE_CAIRO)
  124. dnl FIXME This part should be fixed so configure do not depend on
  125. dnl we do not rely on pkg-config .
  126. CAIRODIR="cairo"
  127. CAIROFLAGS="`pkg-config --cflags cairo`"
  128. CAIROLIBS="-lcairo -lpixman-1"
  129. CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
  130. LINKFLTKCAIRO="../lib/libfltk_cairo.a"
  131. FLTKCAIROOPTION="-L ../cairo -lfltk_cairo$SHAREDSUFFIX"
  132. fi
  133. fi
  134. AC_SUBST(CAIRODIR)
  135. AC_SUBST(CAIROFLAGS)
  136. AC_SUBST(CAIROLIBS)
  137. AC_SUBST(LINKFLTKCAIRO)
  138. AC_SUBST(FLTKCAIROOPTION)
  139. AC_SUBST(FLLIBNAME)
  140. AC_SUBST(GLDEMOS)
  141. AC_SUBST(GLLIBNAME)
  142. AC_SUBST(IMGLIBNAME)
  143. AC_SUBST(CAIROLIBNAME)
  144. AC_SUBST(LIBEXT)
  145. AC_SUBST(LIBNAME)
  146. AC_SUBST(LINKFLTK)
  147. AC_SUBST(LINKFLTKFORMS)
  148. AC_SUBST(LINKFLTKGL)
  149. AC_SUBST(LINKFLTKIMG)
  150. AC_SUBST(LIBBASENAME)
  151. AC_SUBST(FLLIBBASENAME)
  152. AC_SUBST(GLLIBBASENAME)
  153. AC_SUBST(IMGLIBBASENAME)
  154. AC_SUBST(CAIROLIBBASENAME)
  155. dnl Handle compile-time options...
  156. AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]])
  157. if test x$enable_debug = xyes; then
  158. DEBUGFLAG="-g "
  159. else
  160. DEBUGFLAG=""
  161. fi
  162. AC_ARG_ENABLE(cp936, [ --enable-cp936 turn on CP936 [default=no]])
  163. if test x$enable_cp936 = xyes; then
  164. CFLAGS="$CFLAGS -DCP936"
  165. fi
  166. AC_ARG_ENABLE(gl, [ --enable-gl turn on OpenGL support [default=yes]])
  167. AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries [default=no]])
  168. if test x$enable_shared = xyes; then
  169. PICFLAG=1
  170. SHAREDSUFFIX=""
  171. FLUID="fluid-shared"
  172. case $host_os in
  173. darwin*)
  174. DSONAME="libfltk.$FL_API_VERSION.dylib"
  175. FLDSONAME="libfltk_forms.$FL_API_VERSION.dylib"
  176. GLDSONAME="libfltk_gl.$FL_API_VERSION.dylib"
  177. IMGDSONAME="libfltk_images.$FL_API_VERSION.dylib"
  178. CAIRODSONAME="libfltk_cairo.$FL_API_VERSION.dylib"
  179. DSOCOMMAND="\$(CXX) \$(ARCHFLAGS) \$(DSOFLAGS) -dynamiclib -lc -o"
  180. ;;
  181. solaris*)
  182. DSONAME="libfltk.so.$FL_API_VERSION"
  183. FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
  184. GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
  185. IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
  186. CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
  187. DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -h \$@ \$(LDLIBS) -G $DEBUGFLAG -o"
  188. if test "x$libdir" != "x/usr/lib"; then
  189. DSOLINK="-R$libdir"
  190. fi
  191. ;;
  192. hpux*)
  193. DSONAME="libfltk.sl.$FL_API_VERSION"
  194. FLDSONAME="libfltk_forms.sl.$FL_API_VERSION"
  195. GLDSONAME="libfltk_gl.sl.$FL_API_VERSION"
  196. IMGDSONAME="libfltk_images.sl.$FL_API_VERSION"
  197. CAIRODSONAME="libfltk_cairo.sl.$FL_API_VERSION"
  198. DSOCOMMAND="ld \$(DSOFLAGS) -b -z +h \$@ $DEBUGFLAG -o"
  199. if test "x$libdir" != "x/usr/lib"; then
  200. DSOLINK="-Wl,-rpath,$libdir"
  201. fi
  202. ;;
  203. irix*)
  204. DSONAME="libfltk.so.$FL_API_VERSION"
  205. FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
  206. GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
  207. IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
  208. CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
  209. DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@,-set_version,sgi1.1 \$(LDLIBS) -shared $DEBUGFLAG -o"
  210. if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32" -a "x$libdir" != "x/usr/lib64"; then
  211. DSOLINK="-Wl,-rpath,$libdir"
  212. fi
  213. ;;
  214. osf*)
  215. DSONAME="libfltk.so.$FL_API_VERSION"
  216. FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
  217. GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
  218. IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
  219. CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
  220. DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
  221. if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32"; then
  222. DSOLINK="-Wl,-rpath,$libdir"
  223. fi
  224. ;;
  225. linux* | *bsd*)
  226. DSONAME="libfltk.so.$FL_API_VERSION"
  227. FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
  228. GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
  229. IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
  230. CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
  231. DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
  232. if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib64"; then
  233. DSOLINK="-Wl,-rpath,$libdir"
  234. fi
  235. ;;
  236. aix*)
  237. DSONAME="libfltk_s.a"
  238. FLDSONAME="libfltk_forms_s.a"
  239. GLDSONAME="libfltk_gl_s.a"
  240. IMGDSONAME="libfltk_images_s.a"
  241. CAIRODSONAME="libfltk_cairo_s.a"
  242. DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-bexpall,-bM:SRE,-bnoentry -o"
  243. SHAREDSUFFIX="_s"
  244. ;;
  245. cygwin* | mingw*)
  246. PICFLAG=0
  247. if test x$enable_cygwin != xyes; then
  248. DSONAME="mgwfltknox-$FL_API_VERSION.dll"
  249. FLDSONAME="mgwfltknox_forms-$FL_API_VERSION.dll"
  250. GLDSONAME="mgwfltknox_gl-$FL_API_VERSION.dll"
  251. IMGDSONAME="mgwfltknox_images-$FL_API_VERSION.dll"
  252. CAIRODSONAME="mgwfltknox_cairo-$FL_API_VERSION.dll"
  253. else
  254. if test x$enable_x11 = xyes; then
  255. DSONAME="cygfltk-$FL_API_VERSION.dll"
  256. FLDSONAME="cygfltk_forms-$FL_API_VERSION.dll"
  257. GLDSONAME="cygfltk_gl-$FL_API_VERSION.dll"
  258. IMGDSONAME="cygfltk_images-$FL_API_VERSION.dll"
  259. CAIRODSONAME="cygfltk_cairo-$FL_API_VERSION.dll"
  260. else
  261. DSONAME="cygfltknox-$FL_API_VERSION.dll"
  262. FLDSONAME="cygfltknox_forms-$FL_API_VERSION.dll"
  263. GLDSONAME="cygfltknox_gl-$FL_API_VERSION.dll"
  264. IMGDSONAME="cygfltknox_images-$FL_API_VERSION.dll"
  265. CAIRODSONAME="cygfltknox_cairo-$FL_API_VERSION.dll"
  266. fi
  267. fi
  268. #-----------------------------------------------------------
  269. # -Wl,--enable-runtime-pseudo-reloc: See str 1585
  270. # appears to be necessary for older binutils versions < 2.16
  271. #-----------------------------------------------------------
  272. LDFLAGS="$LDFLAGS -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
  273. DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -shared \
  274. -Wl,--whole-archive -Wl,--export-all-symbols \
  275. -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-import \
  276. -Wl,--enable-auto-image-base -o \$@"
  277. ;;
  278. *)
  279. AC_MSG_WARN(Shared libraries may not be supported. Trying -shared option with compiler.)
  280. DSONAME="libfltk.so.$FL_API_VERSION"
  281. FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
  282. GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
  283. IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
  284. CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
  285. DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
  286. ;;
  287. esac
  288. LINKSHARED="-L../src $FLTKCAIROOPTION -lfltk_images$SHAREDSUFFIX -lfltk_forms$SHAREDSUFFIX -lfltk$SHAREDSUFFIX"
  289. else
  290. DSOCOMMAND="echo"
  291. DSOLINK=""
  292. DSONAME=""
  293. FLDSONAME=""
  294. GLDSONAME=""
  295. IMGDSONAME=""
  296. CAIRODSONAME=""
  297. PICFLAG=0
  298. SHAREDSUFFIX=""
  299. FLUID="fluid"
  300. LINKSHARED="$LINKFLTKCAIRO ../lib/libfltk_images.a ../lib/libfltk_forms.a ../lib/libfltk.a"
  301. fi
  302. AC_SUBST(DSOCOMMAND)
  303. AC_SUBST(DSOFLAGS)
  304. AC_SUBST(DSOLINK)
  305. AC_SUBST(DSONAME)
  306. AC_SUBST(FLDSONAME)
  307. AC_SUBST(GLDSONAME)
  308. AC_SUBST(IMGDSONAME)
  309. AC_SUBST(CAIRODSONAME)
  310. AC_SUBST(SHAREDSUFFIX)
  311. AC_SUBST(LINKSHARED)
  312. AC_SUBST(FLUID)
  313. AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support (default=yes)])
  314. AC_ARG_WITH(optim, [ --with-optim="flags" use custom optimization flags])
  315. AC_ARG_WITH(archflags, [ --with-archflags="flags"
  316. use custom architecture flags
  317. (possible Mac OS X values include -arch i386, -arch x86_64, -arch ppc)],
  318. ARCHFLAGS="$withval")
  319. case $host_os in
  320. darwin*)
  321. # QD is not supported anymore since 1.3
  322. AC_DEFINE(__APPLE_QUARTZ__)
  323. ;;
  324. esac
  325. dnl Find commands...
  326. AC_PROG_CC
  327. AC_PROG_CXX
  328. AC_PROG_INSTALL
  329. case $host_os in
  330. osf*)
  331. INSTALL="`pwd`/install-sh -c"
  332. ;;
  333. esac
  334. if test "$INSTALL" = "$ac_install_sh"; then
  335. # Use full path to install-sh script...
  336. INSTALL="`pwd`/install-sh -c"
  337. fi
  338. AC_PATH_PROG(NROFF,nroff)
  339. if test "x$NROFF" = "x:"; then
  340. # Try groff instead of nroff...
  341. AC_PATH_PROG(GROFF,groff)
  342. if test "x$GROFF" = "x:"; then
  343. NROFF="echo"
  344. else
  345. NROFF="$GROFF -T ascii"
  346. fi
  347. fi
  348. AC_PATH_PROG(HTMLDOC,htmldoc)
  349. AC_PATH_PROG(DOXYDOC,doxygen)
  350. dnl How do we make libraries?
  351. AC_PROG_RANLIB
  352. AC_PATH_TOOL(AR, ar)
  353. if test "x$AR" = "x:"; then
  354. AC_MSG_ERROR(Configure could not find the library archiver, aborting.)
  355. fi
  356. if test "x$RANLIB" != "x:"; then
  357. LIBCOMMAND="$AR cr"
  358. else
  359. LIBCOMMAND="$AR crs"
  360. fi
  361. AC_SUBST(LIBCOMMAND)
  362. dnl how to compile (Windows) resource files
  363. dnl this will only be used to compile resources for Windows .exe files
  364. AC_PATH_TOOL(RC,windres)
  365. dnl Architecture checks...
  366. AC_CHECK_SIZEOF(short, 2)
  367. AC_CHECK_SIZEOF(int, 4)
  368. AC_CHECK_SIZEOF(long, 4)
  369. if test $ac_cv_sizeof_short -eq 2; then
  370. AC_DEFINE(U16,unsigned short)
  371. fi
  372. if test $ac_cv_sizeof_int -eq 4; then
  373. AC_DEFINE(U32,unsigned)
  374. else
  375. if test $ac_cv_sizeof_long -eq 4; then
  376. AC_DEFINE(U32,unsigned long)
  377. fi
  378. fi
  379. case $host_os in
  380. darwin*)
  381. ;;
  382. *)
  383. AC_C_BIGENDIAN
  384. if test $ac_cv_sizeof_int -eq 8; then
  385. AC_DEFINE(U64,unsigned)
  386. else
  387. if test $ac_cv_sizeof_long -eq 8; then
  388. AC_DEFINE(U64,unsigned long)
  389. fi
  390. fi
  391. ;;
  392. esac
  393. dnl Does the C++ compiler support the bool type?
  394. AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
  395. ac_cv_cxx_bool,[
  396. AC_LANG_SAVE
  397. AC_LANG_CPLUSPLUS
  398. AC_TRY_COMPILE([
  399. int f(int x){return 1;}
  400. int f(char x){return 1;}
  401. int f(bool x){return 1;}
  402. ],[
  403. bool b = true;
  404. return f(b);
  405. ], ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
  406. AC_LANG_RESTORE
  407. ])
  408. if test "$ac_cv_cxx_bool" != yes; then
  409. CXXFLAGS="-Dbool=char -Dfalse=0 -Dtrue=1 $CXXFLAGS"
  410. fi
  411. dnl Standard headers and functions...
  412. AC_HEADER_DIRENT
  413. AC_CHECK_HEADER(sys/select.h,AC_DEFINE(HAVE_SYS_SELECT_H))
  414. AC_CHECK_HEADER(sys/stdtypes.h,AC_DEFINE(HAVE_SYS_SELECT_H))
  415. dnl Do we have the POSIX compatible scandir() prototype?
  416. AC_CACHE_CHECK([whether we have the POSIX compatible scandir() prototype],
  417. ac_cv_cxx_scandir_posix,[
  418. AC_LANG_SAVE
  419. AC_LANG_CPLUSPLUS
  420. AC_TRY_COMPILE([
  421. #include <dirent.h>
  422. int func (const char *d, dirent ***list, void *sort) {
  423. int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
  424. }
  425. ],[
  426. ], ac_cv_cxx_scandir_posix=yes, ac_cv_cxx_scandir_posix=no)
  427. AC_LANG_RESTORE
  428. ])
  429. dnl Define both HAVE_SCANDIR... macros, if the POSIX compatible function is
  430. dnl available. Otherwise: check, whether any scandir prototype is available,
  431. dnl but dont use it on SunOS and QNX because of an incompatibility in pre-Y2K
  432. dnl SunOS scandir versions. We assume, though, that the POSIX compatible
  433. dnl version on newer SunOS/Solaris versions works as expected.
  434. if test "$ac_cv_cxx_scandir_posix" = yes; then
  435. AC_DEFINE(HAVE_SCANDIR)
  436. AC_DEFINE(HAVE_SCANDIR_POSIX)
  437. else
  438. AC_CHECK_FUNC(scandir,[
  439. case $host_os in
  440. solaris* | *qnx*)
  441. AC_MSG_WARN(Not using $host_os scandir emulation function.)
  442. ;;
  443. *)
  444. AC_DEFINE(HAVE_SCANDIR)
  445. ;;
  446. esac])
  447. fi
  448. AC_CHECK_FUNC(vsnprintf,[
  449. case $host_os in
  450. hpux1020)
  451. AC_MSG_WARN(Not using built-in vsnprintf function because you are running HP-UX 10.20.)
  452. ;;
  453. osf4)
  454. AC_MSG_WARN(Not using built-in vsnprintf function because you are running Tru64 4.0.)
  455. ;;
  456. *)
  457. AC_DEFINE(HAVE_VSNPRINTF)
  458. ;;
  459. esac])
  460. AC_CHECK_FUNC(snprintf,[
  461. case $host_os in
  462. hpux1020)
  463. AC_MSG_WARN(Not using built-in snprintf function because you are running HP-UX 10.20.)
  464. ;;
  465. osf4)
  466. AC_MSG_WARN(Not using built-in snprintf function because you are running Tru64 4.0.)
  467. ;;
  468. *)
  469. AC_DEFINE(HAVE_SNPRINTF)
  470. ;;
  471. esac])
  472. AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
  473. AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
  474. AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
  475. AC_CHECK_FUNCS(localeconv)
  476. dnl FLTK library uses math library functions...
  477. AC_SEARCH_LIBS(pow, m)
  478. dnl Check for largefile support...
  479. AC_SYS_LARGEFILE
  480. dnl Define largefile options as needed...
  481. LARGEFILE=""
  482. if test x$enable_largefile != xno; then
  483. LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
  484. if test x$ac_cv_sys_large_files = x1; then
  485. LARGEFILE="$LARGEFILE -D_LARGE_FILES"
  486. fi
  487. if test x$ac_cv_sys_file_offset_bits = x64; then
  488. LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"
  489. fi
  490. fi
  491. AC_SUBST(LARGEFILE)
  492. dnl Check for "long long" support...
  493. AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
  494. [if test "$GCC" = yes; then
  495. ac_cv_c_long_long=yes
  496. else
  497. AC_TRY_COMPILE(,[long long int i;],
  498. ac_cv_c_long_long=yes,
  499. ac_cv_c_long_long=no)
  500. fi])
  501. if test $ac_cv_c_long_long = yes; then
  502. AC_DEFINE(HAVE_LONG_LONG)
  503. fi
  504. dnl Check for dlopen/dlsym...
  505. AC_SEARCH_LIBS(dlsym, dl, AC_DEFINE(HAVE_DLSYM))
  506. AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H))
  507. dnl Check for audio libraries...
  508. AUDIOLIBS=""
  509. case $host_os in
  510. cygwin* | mingw*)
  511. dnl Cygwin environment...
  512. AUDIOLIBS="-lwinmm"
  513. ;;
  514. darwin*)
  515. AUDIOLIBS="-framework CoreAudio"
  516. ;;
  517. *)
  518. AC_CHECK_HEADER(alsa/asoundlib.h,
  519. AC_DEFINE(HAVE_ALSA_ASOUNDLIB_H)
  520. AUDIOLIBS="-lasound")
  521. ;;
  522. esac
  523. AC_SUBST(AUDIOLIBS)
  524. dnl Check for image libraries...
  525. SAVELIBS="$LIBS"
  526. IMAGELIBS=""
  527. STATICIMAGELIBS=""
  528. AC_SUBST(IMAGELIBS)
  529. AC_SUBST(STATICIMAGELIBS)
  530. # Handle the JPEG lib linking mode (use fltk local or system lib)
  531. # If --enable-(resp. --disable-)localjpeg parameter is not set by user
  532. # Then we check the JPEG lib usability, with result in sysjpeglib_ok variable
  533. AC_ARG_ENABLE(localjpeg, [ --enable-localjpeg use local JPEG library, default=auto])
  534. # Check for System lib use if automatic mode or --disable-localjpeg is requested
  535. sysjpeglib_ok=no
  536. sysjpeginc_ok=no
  537. if test x$enable_localjpeg != xyes; then
  538. AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
  539. [AC_CHECK_HEADER(jpeglib.h,
  540. sysjpeginc_ok=yes)
  541. if test x$sysjpeginc_ok = xyes; then
  542. sysjpeglib_ok=yes
  543. fi])
  544. fi
  545. # Now set the jpeg lib and include flags according to the requested mode and availability
  546. if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then
  547. JPEGINC="-I../jpeg"
  548. JPEG="jpeg"
  549. IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
  550. STATICIMAGELIBS="\$libdir/libfltk_jpeg.a $STATICIMAGELIBS"
  551. AC_DEFINE(HAVE_LIBJPEG)
  552. #ac_cv_lib_jpeg_jpeg_CreateCompress=no # from ima: should not be necessary
  553. # Finally, warn user if system lib was requested but not found
  554. if test x$enable_localjpeg = xno; then
  555. AC_MSG_WARN(Cannot find system jpeg lib or header: choosing the local lib mode.)
  556. fi
  557. else
  558. JPEGINC=""
  559. JPEG=""
  560. IMAGELIBS="-ljpeg $IMAGELIBS"
  561. STATICIMAGELIBS="-ljpeg $STATICIMAGELIBS"
  562. AC_DEFINE(HAVE_LIBJPEG)
  563. fi
  564. # Handle the ZLIB lib linking mode (use fltk local or system lib)
  565. # If --enable-(resp. --disable-)localzlib parameter is not set by user
  566. # Then we check the ZLIB lib usability, with result in syszlib_ok variable
  567. AC_ARG_ENABLE(localzlib, [ --enable-localzlib use local ZLIB library, default=auto])
  568. # Check for System lib use if automatic mode or --disable-localzlib is requested
  569. syszlib_ok=no
  570. syszinc_ok=no
  571. if test x$enable_localzlib != xyes; then
  572. AC_CHECK_LIB(z,gzgets,
  573. [AC_CHECK_HEADER(zlib.h,
  574. syszinc_ok=yes)
  575. if test x$syszinc_ok = xyes; then
  576. syszlib_ok=yes
  577. fi])
  578. fi
  579. # Now set the Z lib and include flags according to the requested mode and availability
  580. if test x$enable_localzlib = xyes -o x$syszlib_ok = xno ; then
  581. ZLIBINC="-I../zlib"
  582. ZLIB="zlib"
  583. LIBS="-lfltk_z $LIBS"
  584. IMAGELIBS="-lfltk_z $IMAGELIBS"
  585. STATICIMAGELIBS="\$libdir/libfltk_z.a $STATICIMAGELIBS"
  586. AC_DEFINE(HAVE_LIBZ)
  587. ac_cv_lib_z_gzgets=no # fc: is still necessary ?
  588. # Finally, warn user if system lib was requested but not found
  589. if test x$enable_localzlib = xno; then
  590. AC_MSG_WARN(Cannot find system z lib or header: choosing the local lib mode.)
  591. fi
  592. else
  593. ZLIBINC=""
  594. ZLIB=""
  595. LIBS="-lz $LIBS"
  596. IMAGELIBS="-lz $IMAGELIBS"
  597. STATICIMAGELIBS="-lz $STATICIMAGELIBS"
  598. AC_DEFINE(HAVE_LIBZ)
  599. fi
  600. # Handle the PNG lib linking mode (use fltk local or system lib)
  601. # If --enable-(resp. --disable-)localpng parameter is not set by user
  602. # Then we check the png lib usability with result in syspng_lib variable
  603. AC_ARG_ENABLE(localpng, [ --enable-localpng use local PNG library, default=auto])
  604. # Now check if system lib is usable, we check Lib AND include availability with inc variant,
  605. # but only, if the builtin lib is not requested
  606. syspnglib_ok=no
  607. syspnginc_ok=no
  608. if test x$enable_localpng != xyes; then
  609. AC_CHECK_LIB(png, png_read_info,
  610. [AC_CHECK_HEADER(png.h,
  611. AC_DEFINE(HAVE_PNG_H)
  612. syspnginc_ok=yes)
  613. AC_CHECK_HEADER(libpng/png.h,
  614. AC_DEFINE(HAVE_LIBPNG_PNG_H)
  615. syspnginc_ok=yes)
  616. if test x$syspnginc_ok = xyes; then
  617. syspnglib_ok=yes
  618. fi])
  619. fi
  620. # The following is executed if the lib was not found usable or if local lib is required explicitly
  621. if test x$enable_localpng = xyes -o x$syspnglib_ok = xno ; then
  622. PNGINC="-I../png"
  623. PNG="png"
  624. IMAGELIBS="-lfltk_png $IMAGELIBS"
  625. STATICIMAGELIBS="\$libdir/libfltk_png.a $STATICIMAGELIBS"
  626. AC_DEFINE(HAVE_LIBPNG)
  627. AC_DEFINE(HAVE_PNG_H)
  628. AC_DEFINE(HAVE_PNG_GET_VALID)
  629. AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA)
  630. # Finally, warn user if system lib was requested but not found
  631. if test x$enable_localpng = xno; then
  632. AC_MSG_WARN(Cannot find system png lib or header: choosing the local lib mode.)
  633. fi
  634. else
  635. PNGINC=""
  636. PNG=""
  637. IMAGELIBS="-lpng $IMAGELIBS"
  638. STATICIMAGELIBS="-lpng $STATICIMAGELIBS"
  639. AC_DEFINE(HAVE_LIBPNG)
  640. AC_CHECK_LIB(png,png_get_valid, AC_DEFINE(HAVE_PNG_GET_VALID))
  641. AC_CHECK_LIB(png,png_set_tRNS_to_alpha, AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA))
  642. fi
  643. AC_SUBST(JPEG)
  644. AC_SUBST(JPEGINC)
  645. AC_SUBST(PNG)
  646. AC_SUBST(PNGINC)
  647. AC_SUBST(ZLIB)
  648. AC_SUBST(ZLIBINC)
  649. dnl Restore original LIBS settings...
  650. LIBS="$SAVELIBS"
  651. dnl See if we need a .exe extension on executables...
  652. AC_EXEEXT
  653. dnl Check for pthreads for multi-threaded apps...
  654. have_pthread=no
  655. PTHREAD_FLAGS=""
  656. dnl Test whether we want to check for pthreads. We must not do it on Windows
  657. dnl unless we run under Cygwin with --enable-cygwin, since we always use
  658. dnl native threads on Windows (even if libpthread is available)
  659. check_pthread=yes
  660. case $host_os in
  661. mingw*)
  662. check_pthread=no
  663. ;;
  664. cygwin*)
  665. if test "x$enable_cygwin" != xyes; then
  666. check_pthread=no
  667. fi
  668. ;;
  669. *)
  670. ;;
  671. esac
  672. if test "x$enable_threads" != xno -a x$check_pthread = xyes; then
  673. AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
  674. if test x$ac_cv_header_pthread_h = xyes; then
  675. dnl Check various threading options for the platforms we support
  676. for flag in -lpthreads -lpthread -pthread; do
  677. AC_MSG_CHECKING([for pthread_create using $flag])
  678. SAVELIBS="$LIBS"
  679. LIBS="$flag $LIBS"
  680. AC_TRY_LINK([#include <pthread.h>],
  681. [pthread_create(0, 0, 0, 0);],
  682. have_pthread=yes,
  683. LIBS="$SAVELIBS")
  684. AC_MSG_RESULT([$have_pthread])
  685. if test $have_pthread = yes; then
  686. AC_DEFINE(HAVE_PTHREAD)
  687. PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
  688. # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
  689. # be POSIX-compliant... :(
  690. case $host_os in
  691. solaris*)
  692. PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
  693. ;;
  694. esac
  695. break
  696. fi
  697. done
  698. fi
  699. fi
  700. AC_SUBST(PTHREAD_FLAGS)
  701. dnl Define OS-specific stuff...
  702. HLINKS=
  703. OSX_ONLY=:
  704. THREADS=
  705. AC_ARG_WITH(links, [ --with-links make header links for common misspellings (default=no)])
  706. INSTALL_DESKTOP=""
  707. UNINSTALL_DESKTOP=""
  708. case $host_os_gui in
  709. cygwin* | mingw*)
  710. dnl Cygwin environment, using windows GDI ...
  711. # Recent versions of Cygwin are seriously broken and the size
  712. # checks don't work because the shell puts out \r\n instead of
  713. # \n. Here we just force U32 to be defined to "unsigned"...
  714. AC_DEFINE(U32,unsigned)
  715. CFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CFLAGS"
  716. CXXFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CXXFLAGS"
  717. LDFLAGS="-mwindows $LDFLAGS"
  718. DSOFLAGS="-mwindows $DSOFLAGS"
  719. LIBS="$LIBS -lole32 -luuid -lcomctl32"
  720. if test "x$with_optim" = x; then
  721. dnl Avoid -Os optimization on Cygwin/MinGW
  722. with_optim="-O3"
  723. fi
  724. if test x$enable_gl != xno; then
  725. AC_CHECK_HEADER(GL/gl.h,
  726. AC_DEFINE(HAVE_GL)
  727. GLLIB="-lopengl32")
  728. AC_CHECK_HEADER(GL/glu.h,
  729. AC_DEFINE(HAVE_GL_GLU_H)
  730. GLLIB="-lglu32 $GLLIB")
  731. else
  732. LINKFLTKGL=""
  733. GLLIBNAME=""
  734. GLDSONAME=""
  735. GLDEMOS=""
  736. fi
  737. if test "x$enable_threads" != xno; then
  738. if test x$have_pthread = xyes; then
  739. AC_DEFINE(HAVE_PTHREAD)
  740. fi
  741. fi
  742. THREADS="threads$EXEEXT"
  743. # Don't make symlinks since Windows is not case sensitive.
  744. if test "x$with_links" != xyes; then
  745. HLINKS="#"
  746. fi
  747. ;;
  748. darwin*)
  749. # MacOS X uses Cocoa for graphics.
  750. LIBS="$LIBS -framework Cocoa"
  751. if test x$have_pthread = xyes; then
  752. AC_DEFINE(HAVE_PTHREAD)
  753. THREADS="threads$EXEEXT"
  754. fi
  755. if test x$enable_gl != xno; then
  756. AC_DEFINE(HAVE_GL)
  757. AC_DEFINE(HAVE_GL_GLU_H)
  758. GLLIB="-framework AGL -framework OpenGL -framework ApplicationServices"
  759. else
  760. LINKFLTKGL=""
  761. GLLIBNAME=""
  762. GLDSONAME=""
  763. GLDEMOS=""
  764. fi
  765. # Don't make symlinks because HFS+ is not case sensitive...
  766. if test "x$with_links" != xyes; then
  767. HLINKS="#"
  768. fi
  769. # Some steps are only done for OS X package management
  770. OSX_ONLY=
  771. # Install/Uninstall FLUID application
  772. INSTALL_DESKTOP="install-osx"
  773. UNINSTALL_DESKTOP="uninstall-osx"
  774. ;;
  775. *)
  776. # All others are UNIX/X11...
  777. # This includes Cygwin target combined with X11
  778. if test x$have_pthread = xyes; then
  779. AC_DEFINE(HAVE_PTHREAD)
  780. THREADS="threads$EXEEXT"
  781. fi
  782. dnl Check for X11...
  783. AC_PATH_XTRA
  784. if test x$no_x = xyes; then
  785. AC_MSG_ERROR(Configure could not find required X11 libraries, aborting.)
  786. fi
  787. if test "x$X_PRE_LIBS" != x; then
  788. AC_MSG_WARN(Ignoring libraries \"$X_PRE_LIBS\" requested by configure.)
  789. fi
  790. LIBS="$LIBS -lX11 $X_EXTRA_LIBS"
  791. CFLAGS="$CFLAGS $X_CFLAGS"
  792. CXXFLAGS="$CXXFLAGS $X_CFLAGS"
  793. LDFLAGS="$X_LIBS $LDFLAGS"
  794. DSOFLAGS="$X_LIBS $DSOFLAGS"
  795. AC_DEFINE(USE_X11)
  796. if test "x$x_includes" != x; then
  797. ac_cpp="$ac_cpp -I$x_includes"
  798. fi
  799. dnl Check for OpenGL unless disabled...
  800. GLLIB=
  801. if test x$enable_gl != xno; then
  802. AC_SEARCH_LIBS(dlopen, dl)
  803. AC_CHECK_HEADER(GL/gl.h,
  804. AC_CHECK_LIB(GL, glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB="-lGL",
  805. AC_CHECK_LIB(MesaGL,glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB=" -lMesaGL",,
  806. -lm),
  807. -lm)
  808. AC_CHECK_LIB(GL, glXGetProcAddressARB,
  809. AC_DEFINE(HAVE_GLXGETPROCADDRESSARB),, -lm)
  810. )
  811. AC_CHECK_HEADER(GL/glu.h,
  812. AC_DEFINE(HAVE_GL_GLU_H)
  813. if test x$ac_cv_lib_GL_glXMakeCurrent = xyes; then
  814. GLLIB="-lGLU $GLLIB"
  815. fi
  816. if test x$ac_cv_lib_MesaGL_glXMakeCurrent = xyes; then
  817. GLLIB="-lMesaGLU $GLLIB"
  818. fi
  819. )
  820. if test x$ac_cv_lib_GL_glXMakeCurrent != xyes -a x$ac_cv_lib_MesaGL_glXMakeCurrent != xyes; then
  821. LINKFLTKGL=""
  822. GLLIBNAME=""
  823. GLDSONAME=""
  824. GLDEMOS=""
  825. fi
  826. else
  827. LINKFLTKGL=""
  828. GLLIBNAME=""
  829. GLDSONAME=""
  830. GLDEMOS=""
  831. fi
  832. dnl Check for Xinerama support unless disabled...
  833. AC_ARG_ENABLE(xinerama, [ --enable-xinerama turn on Xinerama support [default=yes]])
  834. if test x$enable_xinerama != xno; then
  835. AC_CHECK_LIB(Xinerama,XineramaIsActive,
  836. AC_DEFINE(HAVE_XINERAMA)
  837. LIBS="-lXinerama $LIBS")
  838. fi
  839. dnl Check for the Xft library unless disabled...
  840. AC_ARG_ENABLE(xft, [ --enable-xft turn on Xft support [default=yes]])
  841. if test x$enable_xft != xno; then
  842. AC_PATH_PROG(FTCONFIG,freetype-config)
  843. if test "x$FTCONFIG" != x; then
  844. CPPFLAGS="`$FTCONFIG --cflags` $CPPFLAGS"
  845. CXXFLAGS="`$FTCONFIG --cflags` $CXXFLAGS"
  846. AC_CHECK_LIB(fontconfig, FcPatternCreate)
  847. AC_CHECK_HEADER(X11/Xft/Xft.h,
  848. AC_CHECK_LIB(Xft, XftDrawCreate,
  849. AC_DEFINE(USE_XFT)
  850. LIBS="-lXft $LIBS"))
  851. fi
  852. fi
  853. dnl Check for the Xdbe extension unless disabled...
  854. AC_ARG_ENABLE(xdbe, [ --enable-xdbe turn on Xdbe support [default=yes]])
  855. if test x$enable_xdbe != xno; then
  856. AC_CHECK_HEADER(X11/extensions/Xdbe.h, AC_DEFINE(HAVE_XDBE),,
  857. [#include <X11/Xlib.h>])
  858. AC_CHECK_LIB(Xext, XdbeQueryExtension,
  859. LIBS="-lXext $LIBS")
  860. fi
  861. dnl Check for the Xfixes extension unless disabled...
  862. AC_ARG_ENABLE(xfixes, [ --enable-xfixes turn on Xfixes support [default=yes]])
  863. if test x$enable_xfixes != xno; then
  864. AC_CHECK_HEADER(X11/extensions/Xfixes.h, AC_DEFINE(HAVE_XFIXES),,
  865. [#include <X11/Xlib.h>])
  866. AC_CHECK_LIB(Xfixes, XFixesQueryExtension,
  867. LIBS="-lXfixes $LIBS")
  868. fi
  869. dnl Check for overlay visuals...
  870. AC_PATH_PROG(XPROP, xprop)
  871. AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
  872. if test "x$XPROP" != x; then
  873. if $XPROP -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null; then
  874. ac_cv_have_overlay=yes
  875. else
  876. ac_cv_have_overlay=no
  877. fi
  878. else
  879. ac_cv_have_overlay=no
  880. fi)
  881. if test x$ac_cv_have_overlay = xyes; then
  882. AC_DEFINE(HAVE_OVERLAY)
  883. fi
  884. # Make symlinks since UNIX/Linux is case sensitive,
  885. # but Cygwin in general not.
  886. case $host_os in
  887. cygwin*)
  888. HLINKS="#"
  889. ;;
  890. *)
  891. ;;
  892. esac
  893. # Make symlinks since UNIX/Linux is case sensitive,
  894. # but only if explicitly configured (default=no)
  895. if test "x$with_links" != xyes; then
  896. HLINKS="#"
  897. fi
  898. # Install/Uninstall FLUID application support files
  899. INSTALL_DESKTOP="install-linux"
  900. UNINSTALL_DESKTOP="uninstall-linux"
  901. ;;
  902. esac
  903. AC_SUBST(GLDEMOS)
  904. AC_SUBST(GLLIB)
  905. AC_SUBST(HLINKS)
  906. AC_SUBST(OSX_ONLY)
  907. AC_SUBST(THREADS)
  908. AC_SUBST(INSTALL_DESKTOP)
  909. AC_SUBST(UNINSTALL_DESKTOP)
  910. dnl Figure out the appropriate formatted man page extension...
  911. case "$host_os" in
  912. *bsd* | darwin*)
  913. # *BSD
  914. CAT1EXT=0
  915. CAT3EXT=0
  916. CAT6EXT=0
  917. ;;
  918. irix*)
  919. # SGI IRIX
  920. CAT1EXT=z
  921. CAT3EXT=z
  922. CAT6EXT=z
  923. ;;
  924. *)
  925. # All others
  926. CAT1EXT=1
  927. CAT3EXT=3
  928. CAT6EXT=6
  929. ;;
  930. esac
  931. AC_SUBST(CAT1EXT)
  932. AC_SUBST(CAT3EXT)
  933. AC_SUBST(CAT6EXT)
  934. dnl Fix "mandir" variable...
  935. if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
  936. case "$host_os" in
  937. *bsd* | darwin* | linux*)
  938. # *BSD, Darwin, and Linux
  939. mandir="\${prefix}/share/man"
  940. ;;
  941. irix*)
  942. # SGI IRIX
  943. mandir="\${prefix}/share/catman"
  944. ;;
  945. esac
  946. fi
  947. dnl Fix "libdir" variable...
  948. if test "$prefix" = NONE; then
  949. prefix=/usr/local
  950. fi
  951. if test "$exec_prefix" = NONE; then
  952. exec_prefix="\${prefix}"
  953. fi
  954. case $host_os in
  955. irix[1-5]*)
  956. ;;
  957. irix*)
  958. if test "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"; then
  959. libdir="/usr/lib32"
  960. fi
  961. ;;
  962. esac
  963. dnl Define the command used to update the dependencies (this option
  964. dnl mainly for FLTK core developers - not necessary for users)
  965. MAKEDEPEND="\$(CXX) -M"
  966. AC_SUBST(MAKEDEPEND)
  967. dnl Add warnings to compiler switches:
  968. dnl do this last so messing with switches does not break tests
  969. if test -n "$GCC"; then
  970. # Show all standard warnings + unused variables, conversion errors,
  971. # and inlining problems when compiling...
  972. OPTIM="-Wall -Wunused -Wno-format-y2k $OPTIM"
  973. # The following additional warnings are useful for tracking down problems...
  974. #OPTIM="-Wshadow -Wconversion $OPTIM"
  975. # We know that Carbon is deprecated on OS X 10.4. To avoid hundreds of warnings
  976. # we will temporarily disable 'deprecated' warnings on OS X.
  977. case $host_os in
  978. darwin[1-7])
  979. ;;
  980. darwin*)
  981. OPTIM="-Wno-deprecated-declarations $OPTIM"
  982. ;;
  983. esac
  984. # Set the default compiler optimizations...
  985. if test -z "$DEBUGFLAG"; then
  986. #
  987. # Note: Can't use -fomit-frame-pointer - prevents tools like
  988. # libsafe from working!
  989. #
  990. # Don't use -fforce-mem, -fforce-addr, or -fcaller-saves.
  991. # They all seem to make either no difference or enlarge
  992. # the code by a few hundred bytes.
  993. #
  994. # "-Os" seems to be the best compromise between speed and
  995. # code size. "-O3" and higher seem to make no effective
  996. # difference in the speed of the code, but does bloat the
  997. # library 10+%.
  998. #
  999. if test "x$with_optim" != x; then
  1000. OPTIM="$with_optim $OPTIM"
  1001. else
  1002. OPTIM="-Os $OPTIM"
  1003. fi
  1004. fi
  1005. # Generate position-independent code when needed...
  1006. if test $PICFLAG = 1; then
  1007. OPTIM="$OPTIM -fPIC"
  1008. fi
  1009. # See if GCC supports -fno-exceptions...
  1010. AC_MSG_CHECKING(if GCC supports -fno-exceptions)
  1011. OLDCFLAGS="$CFLAGS"
  1012. CFLAGS="$CFLAGS -fno-exceptions"
  1013. AC_TRY_COMPILE(,,
  1014. OPTIM="$OPTIM -fno-exceptions"
  1015. AC_MSG_RESULT(yes),
  1016. AC_MSG_RESULT(no))
  1017. CFLAGS="$OLDCFLAGS"
  1018. # See if GCC supports -fno-strict-aliasing...
  1019. AC_MSG_CHECKING(if GCC supports -fno-strict-aliasing)
  1020. OLDCFLAGS="$CFLAGS"
  1021. CFLAGS="$CFLAGS -fno-strict-aliasing"
  1022. AC_TRY_COMPILE(,,
  1023. OPTIM="$OPTIM -fno-strict-aliasing"
  1024. AC_MSG_RESULT(yes),
  1025. AC_MSG_RESULT(no))
  1026. CFLAGS="$OLDCFLAGS"
  1027. # See if we are running Solaris; if so, try the -fpermissive option...
  1028. # This option is required on some versions of Solaris to work around
  1029. # bugs in the X headers up through Solaris 7.
  1030. #
  1031. # Unlike the other compiler/optimization settings, this one is placed
  1032. # in CFLAGS and CXXFLAGS so that fltk-config will provide the option
  1033. # to clients - otherwise client apps will not compile properly...
  1034. case $host_os in
  1035. solaris*)
  1036. AC_MSG_CHECKING(if GCC supports -fpermissive)
  1037. OLDCFLAGS="$CFLAGS"
  1038. CFLAGS="$CFLAGS -fpermissive"
  1039. AC_TRY_COMPILE(,,
  1040. CXXFLAGS="$CXXFLAGS -fpermissive"
  1041. AC_MSG_RESULT(yes),
  1042. CFLAGS="$OLDCFLAGS"
  1043. AC_MSG_RESULT(no))
  1044. ;;
  1045. esac
  1046. else
  1047. case "$host_os" in
  1048. irix*)
  1049. # Running some flavor of IRIX; see which version and
  1050. # set things up according...
  1051. if test "$uversion" -ge 62; then
  1052. # We are running IRIX 6.2 or higher; uncomment the following
  1053. # lines if you don't have IDO 7.2 or higher:
  1054. #
  1055. # CXX="CC -n32 -mips3"
  1056. # CC="cc -n32 -mips3"
  1057. # LD="ld -n32 -mips3"
  1058. # MAKEDEPEND="CC -M"
  1059. if test "x`grep abi=n32 /etc/compiler.defaults`" = x; then
  1060. AC_MSG_WARN(FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI \"-n32 -mips3\")
  1061. fi
  1062. OPTIM="-fullwarn $OPTIM"
  1063. fi
  1064. if test -z "$DEBUGFLAG"; then
  1065. if test "x$with_optim" != x; then
  1066. OPTIM="$with_optim $OPTIM"
  1067. else
  1068. OPTIM="-O2 $OPTIM"
  1069. if test $uversion -gt 62; then
  1070. OPTIM="-OPT:Olimit=4000 $OPTIM"
  1071. fi
  1072. fi
  1073. fi
  1074. ;;
  1075. hpux*)
  1076. # Running HP-UX; these options should work for the HP compilers.
  1077. if test -z "$DEBUGFLAG"; then
  1078. if test "x$with_optim" != x; then
  1079. OPTIM="$with_optim $OPTIM"
  1080. else
  1081. OPTIM="+O2 $OPTIM"
  1082. fi
  1083. fi
  1084. if test $PICFLAG = 1; then
  1085. OPTIM="+z $OPTIM"
  1086. fi
  1087. CXXFLAGS="$CXXFLAGS +W336,501,736,740,749,829"
  1088. ;;
  1089. OSF1*)
  1090. # Running Digital/Tru64 UNIX; these options should work for the
  1091. # Digital/Compaq/NewHP compilers.
  1092. if test -z "$DEBUGFLAG"; then
  1093. if test "x$with_optim" != x; then
  1094. OPTIM="$with_optim $OPTIM"
  1095. else
  1096. OPTIM="-O2 $OPTIM"
  1097. fi
  1098. fi
  1099. ;;
  1100. solaris*)
  1101. # Solaris
  1102. if test -z "$DEBUGFLAG"; then
  1103. if test "x$with_optim" != x; then
  1104. OPTIM="$with_optim $OPTIM"
  1105. else
  1106. OPTIM="-xO3 $OPTIM"
  1107. fi
  1108. fi
  1109. if test $PICFLAG = 1; then
  1110. OPTIM="-KPIC $OPTIM"
  1111. fi
  1112. ;;
  1113. aix*)
  1114. if test -z "$DEBUGFLAG"; then
  1115. if test "x$with_optim" != x; then
  1116. OPTIM="$with_optim $OPTIM"
  1117. else
  1118. OPTIM="-O2 $OPTIM"
  1119. fi
  1120. fi
  1121. AC_MSG_WARN(The AIX C and C++ compilers are known not to correctly compile the FLTK library.)
  1122. ;;
  1123. *)
  1124. # Running some other operating system; inform the user they
  1125. # should contribute the necessary options via the STR form..
  1126. AC_MSG_WARN(Building FLTK with default compiler optimizations)
  1127. AC_MSG_WARN(Send the FLTK developers your uname and compiler options via http://www.fltk.org/str.php)
  1128. ;;
  1129. esac
  1130. fi
  1131. OPTIM="$DEBUGFLAG $OPTIM"
  1132. dnl Take archflags away from CFLAGS (makefiles use ARCHFLAGS explicitly)
  1133. case $host_os in
  1134. darwin*)
  1135. if test "x$with_archflags" != x ; then
  1136. CFLAGS="`echo $CFLAGS | sed -e "s/$with_archflags//g"`"
  1137. fi
  1138. ;;
  1139. esac
  1140. dnl Define the FLTK documentation directory...
  1141. case $host_os in
  1142. mingw*)
  1143. # Determine the path where MSys has /usr installed
  1144. msyspath=`mount | grep '\/usr ' | cut -d ' ' -f -1 | sed -e 's/\\\/\// g'`
  1145. # Then substitute that in the WIN32 path instead of /usr
  1146. AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$msyspath/local/share/doc/fltk")
  1147. ;;
  1148. *)
  1149. if test x$prefix = xNONE; then
  1150. AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "/usr/local/share/doc/fltk")
  1151. else
  1152. AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/fltk")
  1153. fi
  1154. ;;
  1155. esac
  1156. dnl Define the FLTK data directory...
  1157. if test x$prefix = xNONE; then
  1158. AC_DEFINE_UNQUOTED(FLTK_DATADIR, "/usr/local/share/fltk")
  1159. else
  1160. AC_DEFINE_UNQUOTED(FLTK_DATADIR, "$prefix/share/fltk")
  1161. fi
  1162. dnl Summarize results of configure tests...
  1163. echo ""
  1164. echo "Configuration Summary"
  1165. echo "-------------------------------------------------------------------------"
  1166. case $host_os_gui in
  1167. cygwin* | mingw*)
  1168. graphics="GDI"
  1169. ;;
  1170. darwin*)
  1171. graphics="Quartz"
  1172. ;;
  1173. *)
  1174. graphics="X11"
  1175. if test x$enable_xft != xno; then
  1176. graphics="$graphics+Xft"
  1177. fi
  1178. if test x$enable_xdbe != xno; then
  1179. graphics="$graphics+Xdbe"
  1180. fi
  1181. if test x$enable_xinerama != xno; then
  1182. graphics="$graphics+Xinerama"
  1183. fi
  1184. ;;
  1185. esac
  1186. echo " Directories: prefix=$prefix"
  1187. echo " bindir=$bindir"
  1188. echo " datadir=$datadir"
  1189. echo " datarootdir=$datarootdir"
  1190. echo " exec_prefix=$exec_prefix"
  1191. echo " includedir=$includedir"
  1192. echo " libdir=$libdir"
  1193. echo " mandir=$mandir"
  1194. case $host_os in
  1195. mingw*)
  1196. echo " MSys docpath=$msyspath/local/share/doc/fltk"
  1197. ;;
  1198. esac
  1199. echo " Graphics: $graphics"
  1200. if test x$JPEG = x; then
  1201. echo "Image Libraries: JPEG=System"
  1202. else
  1203. echo "Image Libraries: JPEG=Builtin"
  1204. fi
  1205. if test x$PNG = x; then
  1206. echo " PNG=System"
  1207. else
  1208. echo " PNG=Builtin"
  1209. fi
  1210. if test x$ZLIB = x; then
  1211. echo " ZLIB=System"
  1212. else
  1213. echo " ZLIB=Builtin"
  1214. fi
  1215. if test x$enable_cairo = xyes; then
  1216. echo " CAIRO=lib"
  1217. fi
  1218. if test x$enable_cairoext = xyes; then
  1219. echo " CAIRO=internal_use"
  1220. fi
  1221. if test x$enable_largefile != xno; then
  1222. echo " Large Files: YES"
  1223. else
  1224. echo " Large Files: NO"
  1225. fi
  1226. if test x$GLDEMOS = x; then
  1227. echo " OpenGL: NO"
  1228. else
  1229. echo " OpenGL: YES"
  1230. fi
  1231. if test x$THREADS = x; then
  1232. echo " Threads: NO"
  1233. else
  1234. echo " Threads: YES"
  1235. fi
  1236. dnl Write all of the files...
  1237. AC_CONFIG_HEADER(config.h:configh.in)
  1238. AC_OUTPUT(makeinclude fltk.list fltk-config fltk.spec FL/Makefile)
  1239. dnl Make sure the fltk-config script is executable...
  1240. chmod +x fltk-config
  1241. dnl
  1242. dnl End of "$Id: configure.in 9990 2013-09-24 09:10:04Z ossman $".
  1243. dnl