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.

1414 lines
40KB

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