You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1386 lines
38KB

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