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.

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