1dnl Process this file with autoconf to produce a configure script.
2dnl This autoconf script is free software; the Free Software Foundation
3dnl gives unlimited permission to copy, distribute and modify it.
4
5AC_INIT()
6
7SELFDIR=`dirname $0`/
8
9echo '#define FFMPEG 0' > $SELFDIR/src/config.h
10
11AC_CONFIG_HEADER($SELFDIR/src/config.h)
12
13OS=`uname`
14
15dnl build version number
16# snap compile is in directory build...
17WHITE_DUNE_PATH=`pwd`
18export WHITE_DUNE_PATH
19if test X_`basename $WHITE_DUNE_PATH` = X_build ; then
20   WHITE_DUNE_PATH=`(cd ../../../../.. && pwd)`
21   DUNE_VERSION="white_dune `(cd ../../../../.. && sh ./batch/getversion.sh)`"
22else
23   DUNE_VERSION="white_dune `$SELFDIR/batch/getversion.sh`"
24fi
25AC_DEFINE_UNQUOTED(HAVE_DUNE_VERSION,"${DUNE_VERSION}")
26
27dnl fix unix filepermissions first
28echo fix unix filepermissions
29sh $SELFDIR/batch/fixpermissions.sh
30
31OLD_CFLAGS="$CFLAGS"
32OLD_CXXFLAGS="$CXXFLAGS"
33
34dnl search for vcglib flags via pkg-config
35dnl if not sucessfull guess different paths
36VCGLIB_FLAGS=`pkg-config --cflags vcglib 2> /dev/null`
37if test "X_$VCGLIB_FLAGS" != "X_" ; then
38   CPPFLAGS="$CPPFLAGS $VCGLIB_FLAGS"
39else
40   CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/usr/local/include/eigenlib -I/usr/include/vcglib -I$SELFDIR/src -I$SELFDIR/vcglib -I$SELFDIR/vcglib/eigenlib -I$HOME/vcglib -I$SELFDIR/../vcglib -I$HOME/vcglib/eigenlib -I$SELFDIR/../vcglib/eigenlib"
41fi
42
43dnl search for freetype2 flags via pkg-config
44dnl if not sucessfull guess different paths
45FREETYPE2_FLAGS=`pkg-config --cflags freetype2 2> /dev/null`
46if test "X_$FREETYPE2_FLAGS" != "X_" ; then
47   CPPFLAGS="$CPPFLAGS $FREETYPE2_FLAGS"
48else
49   CPPFLAGS="$CPPFLAGS -I/usr/include/freetype2/ -I/opt/X11/include/freetype2/"
50fi
51export CPPFLAGS
52
53if test "X_'ls -d I/usr/include/ffmpeg/ 2>/dev/null" != "X_" ; then
54   dnl guess ffmeg flags
55   CPPFLAGS="$CPPFLAGS -I/usr/include/ffmpeg/ "
56   export CPPFLAGS
57else
58   # avoid ffmpget check for mageia Linux which misses something in /usr/include
59   FFMPEG=no
60fi
61
62dnl Check for compiler programs
63
64dnl fix wrong "-g -O2" flags settings by some autoconf versions when
65dnl detecting gcc/g++
66export OLD_CFLAGS="-g -O0"
67export OLD_CXXFLAGS="-g -O0 $CXXFLAGS"
68
69AC_PROG_CC
70AC_PROG_CXX
71AC_PROG_CXXCPP
72
73if test "$CFLAGS" != "$OLD_CFLAGS"; then
74 CFLAGS="$OLD_CFLAGS"
75 echo reseting CFLAGS to $CFLAGS
76fi
77
78if test "$CXX_FLAGS" != "$OLD_CXXFLAGS"; then
79 CXXFLAGS="$OLD_CXXFLAGS"
80 echo reseting CXXFLAGS to $CXXFLAGS
81fi
82
83dnl Warn about defect compilers
84
85if test "X_$OS" = "X_Linux" ; then
86 echo xxxxxxxxx Warning xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
87 echo problems with the buggy Redhat/SuSE Linux \"gcc 2.96\" compiler '?' Use
88 echo
89 echo  rm -f config.cache
90 echo  sh ./configure --with-kgcc
91 echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
92fi
93
94dnl Checks for special options.
95
96AC_ARG_WITH(clang,--with-clang              use clang complier: detects gcc/g++ but uses clang,
97            export CLANG=1;export CC=clang;export CXX=clang++;export CXXFLAGS=-Wno-tautological-undefined-compare)
98
99AC_ARG_WITH(oldmotif,--with-oldmotif           used for compatibility with old motif/lesstif versions,
100            AC_DEFINE(HAVE_OLD_MOTIF))
101
102AC_ARG_WITH(olpc,--with-olpc               used for compatibility with the one laptop per child computer,
103            HAVE_OLPC=1;CPPFLAGS="$CPPFLAGS -I/usr/local/include/freetype2";export CPPFLAGS;OPTIM="$OPTIM -O3 -mmmx -m3dnow -ffast-math";export OPTIM;AC_DEFINE(HAVE_OLPC))
104
105if test "X_$OPTIM" = "X_" ;then
106   OPTIM=-g
107fi
108AC_ARG_WITH(optimization,--with-optimization       optimize for speed,
109            OPTIM="-O2 -g";export OPTIM; NOFORT="-O2 -g";export NOFORT)
110
111AC_ARG_WITH(partical-fortify,--with-partical-fortify partical use -D_FORTIFY_SOURCE=2,
112            OPTIM="-D_FORTIFY_SOURCE=2 -O2";export OPTIM; NOFORT="-O2";export NOFORT)
113
114LIBS="$LIBS $EXTRA_LIBS"
115export LIBS
116
117AC_ARG_WITH(iconscale2,--with-iconscale2         used to scale major icons by factor 2,
118            AC_DEFINE(HAVE_ICON_SCALE_2))
119
120AC_ARG_WITH(devil,--without-devil           do not use DevIL library to load textureimages,
121            DEVIL=no)
122
123AC_ARG_WITH(cgal,--without-cgal            do not use CGAL library e.g. to use convex hull,
124            CGAL=no)
125
126AC_ARG_WITH(cgalheaders,--with-cgalheaders        use the headers only version of the CGAL library,
127            AC_DEFINE(HAVE_LIBCGAL) CGALHEADERS=yes)
128
129AC_ARG_WITH(omp,--without-omp             do not use OpenMP,
130            OMP=no)
131
132AC_ARG_WITH(aqsis,--without-aqsis           do not use aqsis to render .RIB files,
133            AQSIS=no)
134
135AC_ARG_WITH(ffmpeg,--without-ffmpeg          do not use ffmpeg libraries to load movie texture,
136            FFMPEG=no)
137
138AC_ARG_WITH(png_handle_unknown,--without-png_handle_unknown  use if link fails cause of png_handle_unknown,
139            AC_DEFINE(HAVE_NO_PNG_HANDLE_UNKNOWN))
140
141AC_ARG_WITH(sdljoystick,--with-sdljoystick 	  use SDL joystick code,
142            SDL_JOYSTICK=yes)
143
144AC_ARG_WITH(helpurl,--with-helpurl=\"helpurl\"  URL of the \"docs\" directory,
145            HELPURL="$withval";export HELPURL)
146if test "X_$HELPURL" != "X_" ; then
147   AC_DEFINE_UNQUOTED(HAVE_HELP_URL,"${HELPURL}")
148   AC_SUBST(HELPURL)
149else
150   if test -d docs ; then
151      AC_DEFINE_UNQUOTED(HAVE_HELP_URL,"${WHITE_DUNE_PATH}/docs/index.html")
152      HELPURL="${WHITE_DUNE_PATH}/docs/index.html"
153      export HELPURL
154      AC_SUBST(HELPURL)
155   fi
156   if test X_`basename $PWD` = X_build ; then
157      AC_DEFINE_UNQUOTED(HAVE_HELP_URL,"http://wdune.ourproject.org/docs/index.html")
158   fi
159fi
160
161AC_ARG_WITH(vrmlnodesurl,--with-vrmlnodesurl=\"vrmlnodesurl\" URL of ISO standard vrml97 node list e.g. downloaded version of  http://www.web3d.org/documents/specifications/14772/V2.0/part1/nodesRef.html,
162            VRMLNODESURL="$withval";export VRMLNODESURL)
163if test "X_$VRMLNODESURL" != "X_" ; then
164   AC_DEFINE_UNQUOTED(HAVE_VRML_NODES_URL,"${VRMLNODESURL}")
165fi
166
167AC_ARG_WITH(x3durl,--with-x3durl=\"x3durl\" URL of ISO standard X3D e.g. downloaded version of http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01
168            X3DURL="$withval";export X3DURL)
169if test "X_$X3DURL" != "X_" ; then
170   AC_DEFINE_UNQUOTED(HAVE_X3D_URL,"${X3DURL}")
171fi
172
173AC_ARG_WITH(protobaseurl, --with-protobaseurl=\"url\" URL of base directory of PROTOs for needed EXTERNPROTO statements,
174            PROTO_BASE_URL="$withval";export PROTO_BASE_URL)
175
176AC_ARG_WITH(debian,--with-debian             optimize library usage for debian,
177            DEBIAN=yes;export DEBIAN)
178
179AC_ARG_WITH(x3domurl,--with-x3domurl=\"x3domurl\" URL to X3DOM support files,
180            X3DDOMURL="$withval";export X3DOMURL)
181if test "X_$X3DOMURL" != "X_" ; then
182   AC_DEFINE_UNQUOTED(HAVE_X3DOM_PATH,"${X3DOMURL}")
183fi
184
185VRML97_AMENDMENT1=vrml97Amendment1
186X3D=x3d
187SCRIPTED_NODES=scripted_Nodes
188COVER_NODES=coverNodes
189EXPORT_CONTAINER=exportContainers
190
191for i in VRML97_AMENDMENT1 X3D SCRIPTED_NODES COVER_NODES EXPORT_CONTAINER; do
192   x=`eval echo '$'"$i"`
193   if test "X_$PROTO_BASE_URL" != "X_"; then
194      url=HAVE_''$i''_PROTO_URL
195      AC_DEFINE_UNQUOTED($url,"$PROTO_BASE_URL/$x")
196   else
197      if test -d docs/$x ; then
198         url=HAVE_''$i''_PROTO_URL
199         AC_DEFINE_UNQUOTED($url,"${SELFDIR}/docs/$x")
200      fi
201   fi
202done
203
204AC_ARG_WITH(coverwave,--with-coverwave          allow creation of deprecated cover node Wave,
205            AC_DEFINE(HAVE_COVER_WAVE))
206
207AC_ARG_WITH(covertuimap,--with-covertuimap        allow creation of incomplete cover node TUIMap,
208            AC_DEFINE(HAVE_COVER_TUI_MAP))
209
210AC_ARG_WITH(wwwbrowser,--with-wwwbrowser=wwwbrowser  webbrowser eg. netscape firefox mozilla...,
211            WWWBROWSER="$withval";export WWWBROWSER)
212
213AC_ARG_WITH(vrmlbrowser,--with-vrmlbrowser=vrmlbrowser  VRML browser eg. firefox view3dscene freewrl ...,
214            VRMLBROWSER="$withval";export VRMLBROWSER)
215if (echo "$VRMLBROWSER" | grep "freewrl" > /dev/null) ; then
216   VRMLBROWSER="LD_LIBRARY_PATH=/usr/local/lib $VRMLBROWSER"
217   export VRMLBROWSER
218fi
219
220AC_ARG_WITH(x11-editor,--with-x11-editor=editor  X11 text editor eg. gedit gvim ...,
221            X11_EDITOR="$withval";export X11_EDITOR)
222if (echo "$X11_EDITOR" | grep "gvim" > /dev/null) ; then
223    AC_DEFINE_UNQUOTED(HAVE_X11_EDITOR,"$X11_EDITOR -f ")
224fi
225
226KNOWN_IMAGE_EDITORS="gimp imgworks krita kolourpaint xpaint gpaint"
227AC_ARG_WITH(imageeditor,--with-imageeditor=imageeditor  object editor for bitmap (.jpg/.png/.gif) files eg. gimp krita xpaint imgworks...,
228            IMAGEEDITOR="$withval";export IMAGEEDITOR)
229
230KNOWN_IMAGE_EDITORS_4KIDS="imgworks kolourpaint gpaint krita xpaint gimp"
231AC_ARG_WITH(imageeditor4kids,--with-imageeditor4kids=imageeditor  simple object editor for bitmap (.jpg/.png/.gif) files usefull for kids eg. kolourpaint gpaint...,
232            IMAGEEDITOR4KIDS="$withval";export IMAGEEDITOR4KIDS)
233
234KNOWN_SOUND_EDITORS="audacity rezound wavesurfer gnusound sweep soundeditor"
235AC_ARG_WITH(soundeditor,--with-soundeditor=soundeditor  object editor for sound (.wav) files eg. audacity rezound wavesurfer gnusound sweep soundeditor...,
236            SOUNDEDITOR="$withval";export SOUNDEDITOR)
237
238KNOWN_MOVIE_EDITORS="cinelerra avidemux2 avidemux moviemaker"
239AC_ARG_WITH(movieeditor,--with-movieeditor=movieeditor  object editor for movie (.mpeg) files eg. cinelerra avidemux2 avidemux moviemaker...,
240            MOVIEEDITOR="$withval";export MOVIEEDITOR)
241
242AC_ARG_WITH(checkincommand,--with-checkincommand=checkincommand  default check in command of a revision control system,
243            CHECK_IN_COMMAND="$withval";export CHECK_IN_COMMAND)
244
245KNOWN_IMAGE_CONVERTERS="convert"
246AC_ARG_WITH(imageconverter,--with-imageconverter=imageconverter  converter for bitmap (.jpg/.png/.gif) files to bmp files for ac3d export...,
247            IMAGECONVERTER="$withval";export IMAGECONVERTER)
248
249AC_ARG_WITH(ant,--with-ant=/path/to/ant   compile with support for ant "Another Neat Tool",
250            ANT="$withval";export ANT)
251
252AC_ARG_WITH(usrlocalinclude,--without-usrlocalinclude use when the compiler refuse -I/usr/local/include ,
253            USRLOCALINCLUDE=no)
254
255AC_ARG_WITH(kgcc,--with-kgcc 	 	  use to avoid the buggy Redhat/SuSE Linux \"gcc 2.96\",
256            CC=kgcc;export CC)
257
258AC_ARG_WITH(eulerrotation,--with-eulerrotation      use for euler angles instead of VRML like rotations,
259            AC_DEFINE(HAVE_EULER_ROT))
260
261AC_ARG_WITH(routeatend,--with-routeatend         write route statement at end into file,
262            AC_DEFINE(HAVE_ROUTE_AT_END))
263
264AC_ARG_WITH(uninstallcomment, --with-uninstallcomment=\"uninstallcomment\"  use to document a uninstall command,
265            UNINSTALL_COMMENT="$withval";export UNINSTALL_COMMENT)
266if test "X_$UNINSTALL_COMMENT" != "X_" ; then
267   AC_DEFINE_UNQUOTED(HAVE_UNINSTALL_COMMENT,"${UNINSTALL_COMMENT}")
268else
269   AC_DEFINE_UNQUOTED(HAVE_UNINSTALL_COMMENT,"no information how to uninstall white_dune: possibly it has been installed from source")
270fi
271
272AC_ARG_WITH(xj3drigidbodyphysicscomponent,--with-xj3drigidbodyphysicscomponent  use special component name xj3d_RigidBodyPhysics,
273            AC_DEFINE(HAVE_XJ3D_RIGID_BODY_PHYSICS_COMPONENT))
274
275
276AC_ARG_WITH(dontreplacevrmlscript,--with-dontreplacevrmlscript  do not replace vrmlscript: with javascript:,
277            AC_DEFINE(HAVE_DONT_REPLACE_VRMLSCRIPT))
278
279AC_ARG_WITH(stereo,--without-stereo 	  use if you do not have shutterglases,
280            AC_DEFINE(HAVE_NO_STEREO))
281
282AC_ARG_WITH(stereocommand,--with-stereocommand=\"stereocommand\"   how to switch to stereomode (e.g. \"/usr/gfx/setmon -n 1024x768_96s\" on some SGI IRIX systems),
283            STEREOCOMMAND="$withval";export STEREOCOMMAND)
284if test "X_$STEREOCOMMAND" != "X_" ;then
285   AC_DEFINE_UNQUOTED(HAVE_STEREOCOMMAND,"${STEREOCOMMAND}")
286fi
287
288AC_ARG_WITH(updatedebug,--with-updatedebug        use debug messages for updates between views,
289            AC_DEFINE(HAVE_UPDATE_DEBUG))
290
291AC_ARG_WITH(aflockdebug,--with-aflockdebug        use debug messages for Ascention Flock of birds,
292            AC_DEFINE(HAVE_AFLOCK_DEBUG))
293
294AC_ARG_WITH(coredump,--with-coredump 	  switch off emergencysave signalhandling,
295            AC_DEFINE(HAVE_WANT_CORE))
296
297AC_ARG_WITH(ttf-file,--with-ttf-file=ttffile     select .ttf file for UNIX/Linux font rendering,
298            AC_DEFINE_UNQUOTED(HAVE_DEFAULT_TTF_FILE,"$withval"),TTF_FILE=0)
299
300unset TEST_FPU_INTERRUPTS
301AC_ARG_WITH(fpuinterrupts,--with-fpuinterrupts      switch on interrupts on invalid fpu operations,
302            export TEST_FPU_INTERRUPTS="yes")
303if test "X_$TEST_FPU_INTERRUPTS" != "X_" ; then
304   AC_MSG_CHECKING(for _FPU_SETCW)
305   AC_TRY_COMPILE(
306                  [
307                    #include "fpu_control.h"
308                  ],
309                  [
310                    unsigned int cw;_FPU_SETCW(cw);
311                  ],
312                  echo yes;AC_DEFINE(HAVE_FPU_SETCW),echo no
313                 )
314  AC_CHECK_LIB(fpe,handle_sigfpes)
315  AC_CHECK_FUNCS(handle_sigfpes)
316fi
317
318AC_ARG_WITH(efence,--with-efence 	          use the efence malloc debugging routines,
319            HAVE_WANT_EFENCE="yes")
320
321AC_ARG_WITH(duma,--with-duma               use the duma malloc debugging routines,
322            HAVE_WANT_DUMA="yes")
323
324AC_ARG_WITH(gif,--without-gif             avoid code to render gif textures,
325            HAVE_WANT_GIF=no)
326
327if test "X_$HAVE_WANT_GIF" != "X_no" ; then
328  GIF=gif.o
329  AC_SUBST(GIF)
330  AC_DEFINE(HAVE_GIF)
331fi
332
333AC_ARG_WITH(usb,--without-usb             avoid code to use libusb/NXT inputdevice,
334            HAVE_WANT_USB=no)
335
336AC_ARG_WITH(teachermenu,--with-teachermenu        add a extra submenu useful for teaching things,
337            AC_DEFINE(HAVE_TEACHER_MENU))
338
339AC_ARG_WITH(testinmenu,--with-testinmenu         insert a extra menupoint for testing of developers,
340            AC_DEFINE(HAVE_TEST_IN_MENU))
341
342AC_ARG_WITH(cut,--with-cut                currently you better use copy/paste/delete instead...,
343            AC_DEFINE(HAVE_CUT))
344
345AC_ARG_WITH(textedit,--without-textedit        disable file -> textedit cause it would do not return,
346            AC_DEFINE(HAVE_NO_TEXTEDIT))
347
348AC_ARG_WITH(nebula,--with-nebula 	          use if you want to convert to The Nebula Device,
349            NEBULA=nebula/ExportNebula.o;export NEBULA;AC_DEFINE(HAVE_SAND))
350AC_SUBST(NEBULA)
351
352AC_ARG_WITH(textureimagemode,--with-textureimagemode   use nonstandard mode field in TextureImage node,
353            AC_DEFINE(HAVE_TEXTUREIMAGE_MODE))
354
355AC_ARG_WITH(optbigfiles,--without-optbigfiles     do not optimize compiling of big files ,
356            OPT_BIG_FILES=no)
357if test "X_$OPT_BIG_FILES" = "X_no" ;then
358    OPTIM=-O2
359    OPTBIG=-g
360else
361    OPTBIG=$OPTIM
362fi
363AC_SUBST(OPTIM)
364AC_SUBST(OPTBIG)
365AC_SUBST(NOFORT)
366
367AC_ARG_WITH(gprof,--with-gprof              compile with support for the gprof analyser,
368            OPTIM="-pg -DNDEBUG=1";export OPTIM;AC_DEFINE(HAVE_WANT_CORE))
369AC_ARG_WITH(gcov,--with-gcov               compile with support for the gcov analyser,
370            OPTIM="-fprofile-arcs -ftest-coverage -DNDEBUG=1";export OPTIM;AC_DEFINE(HAVE_WANT_CORE))
371AC_SUBST(OPTIM)
372
373if test "X_$STATIC" = "X_" ;then
374   STATIC=""
375fi
376
377OBJS='$(OBJS)'
378AC_ARG_WITH(archives,--with-archives           link via archives,
379            OBJS='$(ARCHIVES)')
380export OBJS
381AC_SUBST(OBJS)
382
383AC_ARG_WITH(static,--with-static             link with the -static option,
384            STATIC=-static;export STATIC)
385AC_SUBST(STATIC)
386
387AC_ARG_WITH(ranlib,--without-ranlib          avoid the usage of the ranlib command,
388            AVOID_RANLIB="yes")
389
390AC_ARG_WITH(osmesa,--with-osmesa 	          use mesa off screen rendering (avoid with real OpenGL),
391            HAVE_WANT_OSMESA="yes")
392
393AC_ARG_WITH(debug,--with-debug 	          set -DDEBUG=1 to enable debugging code,
394            CXXFLAGS="-DDEBUG=1 $CXXFLAGS";export CXXFLAGS;
395            CFLAGS="-DDEBUG=1 $CFLAGS";export CFLAGS)
396
397
398dnl Checks for programs.
399
400AC_PROG_AWK
401AC_PROG_YACC
402if test "X_$YACC" = "X_yacc" ; then
403    WARNING_YACC="Warning: not all versions of yacc will work, you better use bison instead"
404    echo $WARNING_YACC 1>&2
405fi
406RC_YACC=$YACC
407export RC_YACC
408AC_SUBST(RC_YACC)
409AC_PROG_LEX
410
411if test "X_$LEX" = "X_lex" ; then
412    RC_LIBS=-ll
413else
414    if ls /usr/lib*/libfl.* /usr/local/lib*/libfl.* >/dev/null 2>/dev/null; then
415       RC_LIBS=-lfl
416    fi
417fi
418
419export RC_LIBS
420AC_SUBST(RC_LIBS)
421
422if test "X_$LEX" = "X_lex" ; then
423    WARNING_LEX="Warning: not all versions of lex will work, you better use flex instead"
424    echo $WARNING_LEX 1>&2
425    export LEX
426    AC_SUBST(LEX)
427fi
428
429dnl use --nounistd when $LEX is flex
430NOUNISTD=""
431if test "X_$LEX" = "X_flex" ; then
432   AC_MSG_CHECKING(for flex --nounistd option)
433   if flex --help 2>&1 | grep '\--nounistd' > /dev/null ; then
434       echo yes
435       NOUNISTD="--nounistd"
436   else
437       echo no
438   fi
439fi
440export NOUNISTD
441AC_SUBST(NOUNISTD)
442
443dnl test for egrep compatibility problems when filtering flex/lex output
444EGREP_PROBLEMS="yes"
445AC_MSG_CHECKING(for specific egrep pattern compatibility)
446ONE=`echo '#include <unistd.h>' | egrep '#include *.unistd\.h.' | wc -l`
447if test "X_$ONE" = "X_1" ; then
448   echo yes
449   EGREP_PROBLEMS="no"
450else
451   echo no
452fi
453export EGREP_PROBLEMS
454AC_SUBST(EGREP_PROBLEMS)
455
456dnl test for grep --binary-files=text compatibility problems when filtering flex/lex output
457GREP_FLAGS=""
458echo file > /tmp/file_$$.txt
459AC_MSG_CHECKING(for grep --binary-files=text compatibility)
460FILE=`grep --binary-files=text file /tmp/file_$$.txt`
461rm /tmp/file_$$.txt
462if test "X_$FILE" = "X_file" ; then
463   echo yes
464   GREP_FLAGS="--binary-files=text"
465else
466   echo no
467fi
468export GREP_FLAGS
469AC_SUBST(GREP_FLAGS)
470
471if test "X_$X11_EDITOR" = "X_" ; then
472   AC_PATH_PROGS(X11_EDITOR,[gedit gvim])
473   if (echo "$X11_EDITOR" | grep "gvim" > /dev/null) ; then
474      AC_DEFINE_UNQUOTED(HAVE_X11_EDITOR,"$X11_EDITOR -f ")
475   else
476      if test "X_$X11_EDITOR" != "X_" ; then
477         AC_DEFINE_UNQUOTED(HAVE_X11_EDITOR,"${X11_EDITOR}")
478      else
479         dnl add your favorite xterm replacement here...
480         dnl beware of "xfce4-terminal": xfce4-terminal -e sh -c "something" is not working 8-(
481         AC_PATH_PROGS(TERM,[lxterminal xterm rxvt gnome-terminal konsole aterm eterm])
482         if (echo "$TERM" | grep "lxterminal" > /dev/null) ; then
483             AC_DEFINE_UNQUOTED(HAVE_TERM,"$TERM --no-remote ")
484         else
485            if test "X_$TERM" != "X_" ; then
486               AC_DEFINE_UNQUOTED(HAVE_TERM,"${TERM}")
487            fi
488         fi
489      fi
490   fi
491fi
492
493dnl check for webbrowsers
494if test "X_$WWWBROWSER" = "X_" ; then
495   AC_PATH_PROGS(WWWBROWSER,[xdg-open firefox x-www-browser epiphany iceweasel phoenix galeon firebird opera mozilla seamonkey lynx links netscape])
496fi
497
498if test "X_$WWWBROWSER" = "X_" ; then
499   WWWBROWSER=firefox
500else
501  dnl handle commandline browsers
502
503  if test "X_$TERM" != "X_" ; then
504      TERM="$TERM -e"
505   fi
506
507  if test "X_`basename \"$WWWBROWSER\"`" = "X_lynx" ; then
508     WWWBROWSER="$TERM $WWWBROWSER"
509  else
510     if test "X_`basename \"$WWWBROWSER\"`" = "X_links" ; then
511        WWWBROWSER="$TERM $WWWBROWSER"
512     fi
513  fi
514fi
515
516dnl check for object editors
517if test "X_$IMAGEEDITOR" = "X_" ; then
518   AC_PATH_PROGS(IMAGEEDITOR,[$KNOWN_IMAGE_EDITORS])
519fi
520AC_DEFINE_UNQUOTED(HAVE_IMAGE_EDITOR,"${IMAGEEDITOR}")
521
522dnl check for object editors
523if test "X_$IMAGEEDITOR4KIDS" = "X_" ; then
524   AC_PATH_PROGS(IMAGEEDITOR4KIDS,[$KNOWN_IMAGE_EDITORS_4KIDS])
525fi
526AC_DEFINE_UNQUOTED(HAVE_IMAGE_EDITOR4KIDS,"${IMAGEEDITOR4KIDS}")
527
528
529if test "X_$SOUNDEDITOR" = "X_" ; then
530   AC_PATH_PROGS(SOUNDEDITOR,[$KNOWN_SOUND_EDITORS])
531fi
532AC_DEFINE_UNQUOTED(HAVE_SOUND_EDITOR,"${SOUNDEDITOR}")
533
534if test "X_$MOVIEEDITOR" = "X_" ; then
535   AC_PATH_PROGS(MOVIEEDITOR,[$KNOWN_MOVIE_EDITORS])
536fi
537AC_DEFINE_UNQUOTED(HAVE_MOVIE_EDITOR,"${MOVIEEDITOR}")
538
539if test "X_$CHECK_IN_COMMAND" = "X_" ; then
540   AC_PATH_PROGS(CHECK_IN_COMMAND,[ci])
541fi
542if test "X_$CHECK_IN_COMMAND" != "X_" ; then
543   if test "X_`basename $CHECK_IN_COMMAND`" = "X_ci" ; then
544      CHECK_IN_COMMAND="ci -l -q -f \\\"%s\\\" < /dev/null"
545      echo using ${CHECK_IN_COMMAND} as revision control checkin command
546   fi
547   AC_DEFINE_UNQUOTED(HAVE_CHECK_IN_COMMAND, "${CHECK_IN_COMMAND}")
548fi
549
550if test "X_$IMAGECONVERTER" = "X_" ; then
551   AC_PATH_PROGS(IMAGECONVERTER,[$KNOWN_IMAGE_CONVERTERS])
552fi
553if test "X_$IMAGECONVERTER" != "X_" ; then
554   AC_DEFINE_UNQUOTED(HAVE_IMAGE_CONVERTER,"${IMAGECONVERTER}")
555else
556   echo "unable to convert textures to bmp for ac3d export and unable to convert textures for RIB export" 1>&2
557fi
558
559if test "X_$AQSIS" != "X_no" ; then
560   AC_PATH_PROGS(RIB_TEXTURER,[teqser txmake])
561   if test "X_$RIB_TEXTURER" != "X_" ; then
562      AC_DEFINE_UNQUOTED(HAVE_RIB_TEXTURER,"${RIB_TEXTURER}")
563   fi
564fi
565
566SDL_JOYSTICK_BSD="no"
567SDL_JOYSTICK_LINUX="no"
568SDL_JOYSTICK_MACOSX="yes"
569
570dnl check for operation system dependend things
571AC_PATH_XTRA
572
573LD_OPTIONS=
574COMMONFLAGS=
575PARSER_CPP_CFLAG=
576export PARSER_CPP_CFLAG
577X_LIBS="$X_LIBS -L/usr/lib/X11 -L/usr/lib"
578if test "X_$OS" = "X_Linux" ; then
579    CPPFLAGS="$CPPFLAGS $X_CFLAGS -I/usr/X11R6/include/ -I/usr/X11R6/LessTif/Motif1.2/include"
580    LIBS="$LIBS -L/usr/local/lib $X_LIBS -L/usr/X11R6/LessTif/Motif1.2/lib"
581    SDL_JOYSTICK_LINUX="yes"
582    export LDFLAGS="$LIBS"
583elif test "X_$OS" = "X_IRIX" ; then
584    LD_OPTIONS="-n32"
585    CPPFLAGS="$CPPFLAGS -I/usr/freeware/include $X_CFLAGS"
586    LIBS="$LIBS -L/usr/local/lib32 -L/usr/freeware/lib32 -L/usr/lib32 $X_LIBS"
587
588    dnl check for cosmoplayer
589    if test -f "/var/netscape/communicator/plugins/libcosmoplayer.so" ; then
590       VRMLBROWSER=netscape
591       echo using netscape as default VRML browser on SGI IRIX
592    fi
593    if test -f "/var/netscape/communicator/plugins32/libcosmoplayer.so" ; then
594       VRMLBROWSER=netscape
595       echo using netscape as default VRML browser on SGI IRIX
596    fi
597elif test "X_$OS" = "X_IRIX64" ; then
598    if test "`echo $CC | grep 64`" = "" ; then
599       CPPFLAGS="$CPPFLAGS -I/usr/freeware/include $X_CFLAGS"
600       LIBS="$LIBS -L/usr/local/lib32 -L/usr/freeware/lib32 -L/usr/lib32 $X_LIBS"
601    else
602       CPPFLAGS="$CPPFLAGS -I/usr/freeware/include $X_CFLAGS"
603       LIBS="$LIBS -L/usr/local/lib64 -L/usr/freeware/lib64 -L/usr/lib64 $X_LIBS"
604    fi
605
606    if test "X_$VRMLBROWSER" = "X_" ; then
607       dnl check for cosmoplayer
608       if test -f "/var/netscape/communicator/plugins/libcosmoplayer.so" ; then
609          VRMLBROWSER=netscape
610       fi
611       if test -f "/var/netscape/communicator/plugins32/libcosmoplayer.so" ; then
612          VRMLBROWSER=netscape
613       fi
614    fi
615elif test "X_$OS" = "X_SunOS" ; then
616    LIBS="$LDFLAGS $LIBS $X_LIBS"
617    export LIBS
618    PARSER_CPP_CFLAG=-U__GNUC_MINOR__
619    export PARSER_CPP_CFLAG
620    # some solaris sfw bison crash on src/swt/rcparser.y
621    RC_YACC=yacc
622    export RC_YACC
623    AC_SUBST(RC_YACC)
624elif test "X_$OS" = "X_Darwin" ; then
625    MACOSX=`sw_vers | awk '/ProductVersion:/ {split($2,a,".");print a[[1]] "." a[[2]]}'`
626    MACSDK=MacOSX""$MACOSX""u.sdk
627    if test "X_$MACOSX" = "X_10.7" ; then
628        dnl yet another workaround for MacOSX 10.7 "lion"
629        FAT_COMMONFLAGS="-I/usr/include -arch i386 -arch x86_64"
630        FAT_LIBS=" -flat_namespace -arch i386 -arch x86_64 -Wl,-multiply_defined,warning"
631        CPPFLAGS="$CPPFLAGS $X_CFLAGS -I/usr/X11R6/include -DMACOSX=1"
632        LIBS="$FAT_LIBS $LIBS $X_LIBS -L/usr/X11R6/lib -multiply_defined warning -lXft -lXrender -lfontconfig"
633        COMMONFLAGS="$FAT_COMMONFLAGS"
634    elif test "X_$MACOSX" = "X_10.6" ; then
635        dnl yet another workaround for MacOSX 10.6 "snowleopard"
636        FAT_COMMONFLAGS="-I/usr/include -arch i386 -arch ppc -arch x86_64"
637        FAT_LIBS=" -flat_namespace -Wl,-syslibroot,/Developer/SDKs/$MACSDK -arch ppc -arch i386 -arch x86_64 -Wl,-multiply_defined,warning"
638        CPPFLAGS="$CPPFLAGS $X_CFLAGS -I/usr/X11R6/include -DMACOSX=1"
639        LIBS="$FAT_LIBS $LIBS $X_LIBS -L/usr/X11R6/lib -multiply_defined warning -lXft -lXrender -lfontconfig"
640        COMMONFLAGS="$FAT_COMMONFLAGS"
641    else
642        CPPFLAGS="$CPPFLAGS $X_CFLAGS -I/usr/X11R6/include -DMACOSX=1"
643        export CPPFLAGS
644        CXXFLAGS="$CXXFLAGS -Wno-c++11-extensions -Wno-tautological-undefined-compare -Wno-tautological-pointer-compare"
645        export CXXFLAGS
646        dnl fat binaries options
647        dnl
648        if test "X_$MACOSX" = "X_10.5" ; then
649            FAT_COMMONFLAGS="-arch i386 -arch ppc"
650#        else
651#            FAT_COMMONFLAGS="-isysroot /Developer/SDKs/$MACSDK -arch i386 -arch ppc"
652        fi
653#        FAT_LIBS=" -flat_namespace -Wl,-syslibroot,/Developer/SDKs/$MACSDK -arch ppc -arch i386 -Wl,-multiply_defined,warning"
654        dnl
655        COMMONFLAGS="$FAT_COMMONFLAGS"
656        dnl -force_flat_namespace as workaround for defect XFree86 4.2 compile
657        dnl LIBS="$FAT_LIBS $LIBS $X_LIBS -force_flat_namespace -lXft"
658        dnl known to work in MacOSX 10.4.2 "tiger"
659        LIBS="$FAT_LIBS $LIBS $X_LIBS -multiply_defined warning -lXft -lXrender -lfontconfig"
660        if test "X_$MACOSX" = "X_10.5" ; then
661           dnl yet another workaround for MacOSX 10.5 "leopard"
662           LIBS="$LIBS -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
663        fi
664        export LIBS="-L/usr/X11R6/lib $LIBS "
665    fi
666    dnl check for Firefox or Internet explorer (cortona VRML browser)
667    if test -d "/Applications/Firefox.app" ; then
668       WWWBROWSER="/usr/bin/open -a \\\"/Applications/Firefox.app\\\""
669       VRMLBROWSER="/usr/bin/open -a \\\"/Applications/Firefox.app\\\""
670    else
671       if test -d "/Applications/Internet Explorer.app" ; then
672          if test "X_$WWWBROWSER" = "X_" ; then
673             WWWBROWSER="/usr/bin/open -a \\\"/Applications/Internet Explorer.app\\\""
674          fi
675          if test "X_$VRMLBROWSER" = "X_" ; then
676             VRMLBROWSER="/usr/bin/open -a \\\"/Applications/Internet Explorer.app\\\""
677          fi
678       fi
679    fi
680    (DUNE=$SELFDIR/bin/dune && cd desktop/macosx/white_dune.app/Contents/MacOS && rm -f dune && ln -s $DUNE .)
681    if test -d "/Applications/X11.app" ; then
682       if test -x "/usr/bin/open" ; then
683          AC_DEFINE_UNQUOTED(HAVE_X11STARTCOMMAND,"/usr/bin/open -a /Applications/Utilities/XQuartz.app/Contents/MacOS/X11")
684       else
685          AC_DEFINE_UNQUOTED(HAVE_X11STARTCOMMAND,"/Applications/Utilities/XQuartz.app/Contents/MacOS/X11")
686       fi
687    else
688       if test -d "/Applications/Utilities/X11.app" ; then
689          if test -x "/usr/bin/open" ; then
690             AC_DEFINE_UNQUOTED(HAVE_X11STARTCOMMAND,"/usr/bin/open -a /Applications/Utilities/X11.app/Contents/MacOS/X11")
691          else
692             AC_DEFINE_UNQUOTED(HAVE_X11STARTCOMMAND,"/Applications/Utilities/X11.app/Contents/MacOS/X11")
693          fi
694       else
695          if test -f "/usr/X11R6/bin/X" ; then
696             AC_DEFINE_UNQUOTED(HAVE_X11STARTCOMMAND,"/usr/X11R6/bin/X")
697          else
698             AC_DEFINE_UNQUOTED(HAVE_X11STARTCOMMAND,"X")
699          fi
700       fi
701    fi
702    if test "X_$SDL_JOYSTICK_MACOSX" = "X_yes" ; then
703       if test "X_$MACOSX" = "X_10.6" ; then
704          dnl yet another workaround for MacOSX 10.6 "snowleopard"
705          SYSTEM_LIBS="$SYSTEM_LIBS -lIOKit"
706       else
707          SYSTEM_LIBS="$SYSTEM_LIBS -framework IOKit"
708       fi
709       LIBS="$LIBS $SYSTEM_LIBS"
710       SDL_JOYSTICK_SUBDIR="darwin"
711       SDL_JOYSTICK_LIBS="SDLjoystick/libSDLjoystick.a"
712    fi
713elif test "X_$OS" = "X_NetBSD" ; then
714    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
715    LIBS="$LIBS $X_LIBS"
716    SDL_JOYSTICK_BSD="yes"
717elif test "X_$OS" = "X_OpenBSD" ; then
718    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
719    LIBS="$LIBS $X_LIBS"
720    SDL_JOYSTICK_BSD="yes"
721    CPPFLAGS="$CPPFLAGS -I/usr/local/include/libpng"
722elif test "X_$OS" = "X_FreeBSD" ; then
723    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
724    LIBS="$LIBS $X_LIBS -lXft"
725    SDL_JOYSTICK_BSD="yes"
726elif test "X_$OS" = "X_AIX" ; then
727    CPPFLAGS="$CPPFLAGS -DAIX=1"
728    export CPPFLAGS
729elif test "X_$OS" = "X_HP-UX" ; then
730    CPPFLAGS="$CPPFLAGS -I/usr/contrib/X11R6/include -I/opt/graphics/OpenGL/include -I/usr/include/Motif2.1"
731    export CPPFLAGS
732    LDFLAGS="$LDFLAGS -L/opt/graphics/OpenGL/lib -L/usr/lib/Motif2.1 -L/usr/contrib/X11R6/lib"
733    export LDFLAGS
734elif test "X_$OS" = "X_OSF1"; then
735    LDFLAGS="$LDFLAGS -lrt"
736fi
737export LD_OPTIONS
738AC_SUBST(LD_OPTIONS)
739export PARSER_CPP_FLAG
740AC_SUBST(PARSER_CPP_CFLAG)
741export CPPFLAGS
742AC_SUBST(CPPFLAGS)
743export COMMONFLAGS
744AC_SUBST(COMMONFLAGS)
745export CFLAGS
746AC_SUBST(CFLAGS)
747export CXXFLAGS
748AC_SUBST(CXXFLAGS)
749
750if test "X_$CC" != "X_" ; then
751    AC_MSG_CHECKING($CC support -I/usr/local/include)
752    cat > /tmp/_white_dune_test_$$.c << EOF
753    int main(int argc, char** argv)
754        {
755        return 0;
756        }
757EOF
758    if test "X_$USRLOCALINCLUDE" != "X_no" ;then
759        if $CC -I/usr/local/include -c -o /tmp/_white_dune_test_$$.o /tmp/_white_dune_test_$$.c ; then
760           CPPFLAGS="$CPPFLAGS -I/usr/local/include"
761           LDFLAGS="$LDFLAGS -L/usr/local/lib"
762           echo yes
763        else
764           echo no
765        fi
766        rm -f /tmp/_white_dune_test_$$.c
767        rm -f /tmp/_white_dune_test_$$.o
768    fi
769fi
770
771
772if test "X_$CC" != "X_" ; then
773    AC_MSG_CHECKING(void * size)
774    cat > /tmp/_white_dune_test2_$$.c << EOF
775    #include <stdio.h>
776    int main(int argc, char** argv)
777        {
778        printf("%ld\n", (long)sizeof(void *));
779        }
780EOF
781    if test "X_$USRLOCALINCLUDE" != "X_no" ;then
782        if $CC -o /tmp/_white_dune_test2_$$ /tmp/_white_dune_test2_$$.c -lc ; then
783           CPPFLAGS="$CPPFLAGS -I/usr/local/include"
784           LDFLAGS="$LDFLAGS -L/usr/local/lib"
785           echo `/tmp/_white_dune_test2_$$`
786           if test "X_"`/tmp/_white_dune_test2_$$` = "X_8" ;then
787              AC_DEFINE(HAVE_VOID_PTR_SIZE_8)
788           fi
789        else
790           echo failed
791        fi
792        rm -f /tmp/_white_dune_test2_$$.c
793        rm -f /tmp/_white_dune_test2_$$
794    fi
795fi
796
797if test "X_$VRMLBROWSER" = "X_" ;then
798   dnl check for known vrmlbrowsers
799   AC_PATH_PROGS(VRMLBROWSER,[view3dscene /opt/instantReality/bin/InstantPlayer /Applications/FreeWRL/FreeWRL.app/Contents/MacOS/FreeWRL freewrl cc3dglut xj3d vrwave lookat])
800   if (echo "$VRMLBROWSER" | grep "freewrl" > /dev/null) ; then
801       VRMLBROWSER="LD_LIBRARY_PATH=/usr/local/lib $VRMLBROWSER"
802       export VRMLBROWSER
803   fi
804fi
805
806if test "X_$VRMLBROWSER" = "X_" ;then
807   if test "X_$WWWBROWSER" != "X_" ;then
808      VRMLBROWSER=$WWWBROWSER
809   fi
810fi
811
812MOZILLA_OPENURL=FALSE
813if test  "`basename \"$WWWBROWSER\"`" = "netscape" ; then
814   MOZILLA_OPENURL=TRUE
815fi
816if test  "`basename \"$WWWBROWSER\"`" = "mozilla" ; then
817   MOZILLA_OPENURL=TRUE
818fi
819if test  "`basename \"$WWWBROWSER\"`" = "firefox" ; then
820   MOZILLA_OPENURL=TRUE
821fi
822if test  "`basename \"$WWWBROWSER\"`" = "seamonkey" ; then
823   MOZILLA_OPENURL=TRUE
824fi
825if test  "`basename \"$WWWBROWSER\"`" = "galeon" ; then
826   MOZILLA_OPENURL=TRUE
827fi
828
829if test  "X_$MOZILLA_OPENURL" = "X_TRUE" ; then
830   VRMLREMOTEBROWSER="$WWWBROWSER -remote OpenURL\\\\(%s\\\\)"
831else
832   VRMLREMOTEBROWSER="$WWWBROWSER %s"
833fi
834AC_DEFINE_UNQUOTED(HAVE_VRML_REMOTE_BROWSER,"${VRMLREMOTEBROWSER}")
835
836if test "X_$VRMLBROWSER" != "X_" ;then
837   AC_DEFINE_UNQUOTED(HAVE_VRML_BROWSER,"${VRMLBROWSER} %s")
838fi
839
840MOZILLA_OPENURL=FALSE
841if test  "`basename \"$WWWBROWSER\"`" = "netscape" ; then
842   MOZILLA_OPENURL=TRUE
843fi
844if test  "`basename \"$WWWBROWSER\"`" = "mozilla" ; then
845   MOZILLA_OPENURL=TRUE
846fi
847if test  "`basename \"$WWWBROWSER\"`" = "phoenix" ; then
848   MOZILLA_OPENURL=TRUE
849fi
850if test  "`basename \"$WWWBROWSER\"`" = "galeon" ; then
851   MOZILLA_OPENURL=TRUE
852fi
853
854if test  "X_$MOZILLA_OPENURL" = "X_TRUE" ; then
855   WWWREMOTEBROWSER="$WWWBROWSER -remote OpenURL\\\\(%s\\\\)"
856else
857   if test "X_$WWWBROWSER" != "X_" ;then
858      WWWREMOTEBROWSER="$WWWBROWSER %s &"
859   fi
860fi
861AC_DEFINE_UNQUOTED(HAVE_WWW_BROWSER,"${WWWREMOTEBROWSER}")
862
863if test "X_$AVOID_RANLIB" = "X_yes" ; then
864   RANLIB=echo
865   export RANLIB
866else
867   AC_PATH_PROGS(RANLIB,ranlib,echo)
868fi
869
870if test "X_$SDL_JOYSTICK" = "X_yes" ; then
871
872   if test "X_$SDL_JOYSTICK_LINUX" = "X_yes" ; then
873      dnl from configure.in of SDL for joystick
874      dnl Check for Linux 2.4 unified input event interface support
875      AC_ARG_ENABLE(input-events,
876           [  --enable-input-events   use Linux 2.4 unified input interface [default=yes]],
877                     , enable_input_events=yes)
878       if true; then
879           AC_MSG_CHECKING(for Linux 2.4 unified input interface)
880           use_input_events=no
881           AC_TRY_COMPILE([
882             #include <linux/input.h>
883           ],[
884             #ifndef EVIOCGNAME
885             #error EVIOCGNAME() ioctl not available
886             #endif
887           ],[
888           use_input_events=yes
889           ])
890           AC_MSG_RESULT($use_input_events)
891           if test x$use_input_events = xyes; then
892               SDLCFLAGS="-DUSE_INPUT_EVENTS"
893               SDL_JOYSTICK_SUBDIR="linux"
894               SDL_JOYSTICK_LIBS="SDLjoystick/libSDLjoystick.a"
895           fi
896       fi
897   fi
898
899   if test "X_$SDL_JOYSTICK_BSD" = "X_yes" ; then
900      dnl from configure.in of SDL for joystick
901      dnl Check for the usbhid(3) library on *BSD
902      if true ; then
903           have_libusbhid=no
904           have_libusb=no
905           AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
906           AC_CHECK_LIB(usb, hid_init, have_libusb=yes)
907           if test x$have_libusbhid = xyes; then
908               SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid"
909           fi
910           if test x$have_libusb = xyes; then
911               SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
912           fi
913
914           AC_CHECK_HEADER(usb.h, have_usb_h=yes)
915           AC_CHECK_HEADER(usbhid.h, have_usbhid_h=yes)
916           AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
917           AC_CHECK_HEADER(libusbhid.h, have_libusbhid_h=yes)
918           if test x$have_usb_h = xyes; then
919               SDLCFLAGS="$SDLCFLAGS -DHAVE_USB_H"
920               LIBS="$LIBS $SYSTEM_LIBS"
921               SDL_JOYSTICK_SUBDIR="bsd"
922               SDL_JOYSTICK_LIBS="SDLjoystick/libSDLjoystick.a"
923           fi
924           if test x$have_usbhid_h = xyes; then
925               SDLCFLAGS="$SDLCFLAGS -DHAVE_USBHID_H"
926               LIBS="$LIBS $SYSTEM_LIBS"
927               SDL_JOYSTICK_SUBDIR="bsd"
928               SDL_JOYSTICK_LIBS="SDLjoystick/libSDLjoystick.a"
929           fi
930           if test x$have_libusb_h = xyes; then
931               SDLCFLAGS="$SDLCFLAGS -DHAVE_LIBUSB_H"
932               LIBS="$LIBS $SYSTEM_LIBS"
933               SDL_JOYSTICK_SUBDIR="bsd"
934               SDL_JOYSTICK_LIBS="SDLjoystick/libSDLjoystick.a"
935           fi
936           if test x$have_libusbhid_h = xyes; then
937               SDLCFLAGS="$SDLCFLAGS -DHAVE_LIBUSBHID_H"
938               LIBS="$LIBS $SYSTEM_LIBS"
939               SDL_JOYSTICK_SUBDIR="bsd"
940               SDL_JOYSTICK_LIBS="SDLjoystick/libSDLjoystick.a"
941           fi
942
943           AC_MSG_CHECKING(for usbhid)
944           have_usbhid=no
945           AC_TRY_COMPILE([
946             #include <sys/types.h>
947             #if defined(HAVE_USB_H)
948             #include <usb.h>
949             #endif
950             #include <dev/usb/usb.h>
951             #include <dev/usb/usbhid.h>
952             #if defined(HAVE_USBHID_H)
953             #include <usbhid.h>
954             #elif defined(HAVE_LIBUSB_H)
955             #include <libusb.h>
956             #elif defined(HAVE_LIBUSBHID_H)
957             #include <libusbhid.h>
958             #endif
959           ],[
960             struct report_desc *repdesc;
961             struct usb_ctl_report *repbuf;
962             hid_kind_t hidkind;
963           ],[
964           have_usbhid=yes
965           ])
966           AC_MSG_RESULT($have_usbhid)
967
968           if test x$have_usbhid = xyes; then
969               AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
970               have_usbhid_ucr_data=no
971               AC_TRY_COMPILE([
972                 #include <sys/types.h>
973                 #if defined(HAVE_USB_H)
974                 #include <usb.h>
975                 #endif
976                 #include <dev/usb/usb.h>
977                 #include <dev/usb/usbhid.h>
978                 #if defined(HAVE_USBHID_H)
979                 #include <usbhid.h>
980                 #elif defined(HAVE_LIBUSB_H)
981                 #include <libusb.h>
982                 #elif defined(HAVE_LIBUSBHID_H)
983                 #include <libusbhid.h>
984                 #endif
985               ],[
986                 struct usb_ctl_report buf;
987                 if (buf.ucr_data) { }
988               ],[
989               have_usbhid_ucr_data=yes
990               ])
991               if test x$have_usbhid_ucr_data = xyes; then
992                   SDLCFLAGS="$SDLCFLAGS -DUSBHID_UCR_DATA"
993                   LIBS="$LIBS $SYSTEM_LIBS"
994                   SDL_JOYSTICK_SUBDIR="bsd"
995                   SDL_JOYSTICK_LIBS="SDLjoystick/libSDLjoystick.a"
996               fi
997               AC_MSG_RESULT($have_usbhid_ucr_data)
998
999   	    AC_MSG_CHECKING(for new usbhid API)
1000               have_usbhid_new=no
1001               AC_TRY_COMPILE([
1002                 #include <sys/types.h>
1003                 #if defined(HAVE_USB_H)
1004                 #include <usb.h>
1005                 #endif
1006                 #include <dev/usb/usb.h>
1007                 #include <dev/usb/usbhid.h>
1008                 #if defined(HAVE_USBHID_H)
1009                 #include <usbhid.h>
1010                 #elif defined(HAVE_LIBUSB_H)
1011                 #include <libusb.h>
1012                 #elif defined(HAVE_LIBUSBHID_H)
1013                 #include <libusbhid.h>
1014                 #endif
1015               ],[
1016                 report_desc_t d;
1017   	      hid_start_parse(d, 1, 1);
1018               ],[
1019               have_usbhid_new=yes
1020               ])
1021               if test x$have_usbhid_new = xyes; then
1022                   SDLCFLAGS="$SDLCFLAGS -DUSBHID_NEW"
1023                   LIBS="$LIBS $SYSTEM_LIBS"
1024                   SDL_JOYSTICK_SUBDIR="bsd"
1025                   SDL_JOYSTICK_LIBS="SDLjoystick/libSDLjoystick.a"
1026               fi
1027               AC_MSG_RESULT($have_usbhid_new)
1028           fi
1029       fi
1030   fi
1031
1032   AC_SUBST(SDLCFLAGS)
1033   AC_SUBST(SDL_JOYSTICK_SUBDIR)
1034   AC_SUBST(SDL_JOYSTICK_LIBS)
1035
1036   if test "X_$SDL_JOYSTICK_SUBDIR" != "X_" ; then
1037      AC_DEFINE(HAVE_SDL_JOYSTICK)
1038   fi
1039fi
1040
1041LDFLAGS="$LDFLAGS $OPTIM"
1042export LDFLAGS
1043
1044dnl extend CC with $CPPFLAGS for tests
1045
1046OLD_CC=$CC
1047CC="$CC $CPPFLAGS"
1048export CC
1049
1050
1051dnl Checks for header files.
1052
1053AC_HEADER_STDC
1054AC_CHECK_HEADER(stdarg.h, AC_DEFINE(HAVE_STDARG_H))
1055AC_CHECK_HEADER(varargs.h, AC_DEFINE(HAVE_VARARGS_H))
1056
1057AC_CHECK_HEADER(Xm/Xm.h, , MOTIF_ERROR=1)
1058
1059if test "X_$MOTIF_ERROR" = "X_1" ; then
1060[
1061cat 1>&2 << EOF
1062
1063 *** couldn't find Motif/Lesstif develop file ***
1064
1065 This package will not compile without a Motif/Lesstif devel package.
1066 If Motif is not available, or too bloody expensive, you can use LessTif,
1067 which is available open source from:
1068
1069	http://www.lesstif.org/download.html
1070
1071EOF
1072 exit 1
1073]
1074fi
1075
1076AC_CHECK_HEADER(X11/Xlib.h,,X11_ERROR=1)
1077AC_CHECK_HEADER(X11/keysym.h,,X11_ERROR=1)
1078AC_CHECK_HEADER(X11/cursorfont.h,,X11_ERROR=1)
1079AC_CHECK_HEADER(X11/Intrinsic.h,,X11_ERROR=1)
1080AC_CHECK_HEADER(X11/IntrinsicP.h,,X11_ERROR=1)
1081
1082if test "X_$X11_ERROR" = "X_1" ; then
1083[
1084 cat 1>&2 << EOF
1085
1086 *** couldn't find basic X11 develop file ***
1087
1088 This package will not compile without serveral X11 library headers
1089
1090EOF
1091 exit 1
1092]
1093fi
1094
1095HAVE_OMP_FLAGS=""
1096if test "X_$OMP" != "X_no" ; then
1097 AC_CHECK_HEADER(omp.h,HAVE_OMP_FLAGS=-fopenmp;AC_DEFINE(HAVE_OMP))
1098 if test "X_$HAVE_OMP_FLAGS" != ""; then
1099     CFLAGS="$CFLAGS $HAVE_OMP_FLAGS"
1100     CXXFLAGS="$CXXFLAGS $HAVE_OMP_FLAGS"
1101     if test "X_$CLANG" != "X_"; then
1102        export LIBS="$LIBS -fopenmp"
1103     else
1104        AC_HAVE_LIBRARY(gomp)
1105     fi
1106 fi
1107fi
1108
1109dnl Checks for libraries.
1110LDFLAGS="$LDFLAGS -L/usr/lib/X11"
1111if test "X_$DEBIAN" = "X_" ; then
1112   AC_HAVE_LIBRARY(dl)
1113fi
1114if test "X_$NEBULA" != "X_" ;then
1115   AC_HAVE_LIBRARY(stlport_gcc)
1116fi
1117AC_CHECK_FUNCS(atexit)
1118AC_CHECK_FUNCS(_exit)
1119AC_CHECK_FUNCS(snprintf)
1120AC_CHECK_FUNCS(gettimeofday)
1121AC_CHECK_LIB(m, sin)
1122AC_CHECK_FUNCS(powf)
1123AC_CHECK_FUNCS(powl)
1124AC_CHECK_FUNCS(rint)
1125AC_CHECK_LIB(X11, XCreateWindow)
1126AC_CHECK_FUNCS(XkbKeycodeToKeysym)
1127AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
1128AC_CHECK_LIB(Xt, XtCreateWidget)
1129if test "X_$DEBIAN" = "X_" ; then
1130   AC_CHECK_LIB(Xext, XShmQueryVersion)
1131fi
1132AC_HAVE_LIBRARY(Xp)
1133AC_CHECK_LIB(Xm, XmCreateMainWindow , ,MOTIF_ERROR=1)
1134if test "X_$MOTIF_ERROR" = "X_1" ; then
1135[
1136cat 1>&2 << EOF
1137
1138 *** couldn't find a working Motif/Lesstif development system ***
1139
1140 This package will not compile without a working Motif/Lesstif development
1141 system.
1142
1143 Inspect the config.log file to find out, what part of the Motif/Lesstif X11
1144 development system is not available/working.
1145
1146 If Motif or OpenMotif is not available, or too expensive, you can use LessTif,
1147 which is available open source from:
1148
1149	http://www.lesstif.org/download.html
1150
1151EOF
1152 exit 1
1153]
1154fi
1155
1156
1157TTF_ERROR=0
1158if test "X_$TTF_FILE" = "X_0" ; then
1159   TTF_ERROR=1
1160   AC_MSG_CHECKING(for ttf-file)
1161   for i in /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf \
1162            /usr/share/fonts/truetype/Vera.ttf \
1163            /usr/share/fonts/bitstream-vera/Vera.ttf \
1164            /usr/share/fonts/TTF/Vera.ttf \
1165            /usr/local/share/fonts/bitstream-vera/Vera.ttf \
1166            /opt/X11/share/fonts/TTF/Vera.ttf ; do
1167      if test -f $i; then
1168         AC_DEFINE_UNQUOTED(HAVE_DEFAULT_TTF_FILE, "$i")
1169         TTF_ERROR=0
1170         echo $i
1171         break
1172      fi
1173  done
1174fi
1175if test "X_$TTF_ERROR" = "X_1" ; then
1176   echo no
1177fi
1178
1179AC_CHECK_HEADER(ft2build.h,,FREE_TYPE_ERROR=1)
1180if test "X_$TTF_ERROR" = "X_0" ; then
1181   AC_HAVE_LIBRARY(freetype,,FREE_TYPE_ERROR=1)
1182else
1183   AC_DEFINE_UNQUOTED(HAVE_DEFAULT_TTF_FILE, "")
1184fi
1185if test "X_$FREE_TYPE_ERROR" = "X_1" ; then
1186[
1187 cat 1>&2 << EOF
1188
1189 *** couldn't find freetype2 develop files ***
1190
1191 This package will not compile without freetype2 headers
1192
1193EOF
1194 exit 1
1195]
1196fi
1197
1198if test "X_$CGALHEADERS" != "X_yes" ; then
1199  if test "X_$CGAL" != "X_no" ; then
1200    AC_MSG_CHECKING(for libCGAL)
1201    AC_LANG_PUSH(C++)
1202    SAVE_LIBS="$LIBS"
1203    LIBS="$LIBS -lCGAL"
1204    AC_TRY_LINK([], [;], ,CGAL_ERROR=1)
1205    AC_LANG_POP(C++)
1206    if test "X_$CGAL_ERROR" = "X_1" ; then
1207      echo no
1208    LIBS="$SAVE_LIBS"
1209    cat 1>&2 << EOF
1210
1211 *** couldn't find a working CGAL development system ***
1212
1213 if CGAL is not available, the convex hull and CSG functions are not available
1214
1215EOF
1216    else
1217      AC_DEFINE(HAVE_LIBCGAL)
1218      echo yes
1219      AC_CHECK_LIB(gmp, __gmpn_sub_1, , GMP_ERROR=1)
1220      if test "X_$GMP_ERROR" = "X_1" ; then
1221         echo CGAL requires libgmp 1>&2
1222         exit 1
1223      fi
1224      AC_CHECK_LIB(mpfr, mpfr_set, , MPFR_ERROR=1)
1225      if test "X_$MPFR_ERROR" = "X_1" ; then
1226        echo CGAL requires libmpfr 1>&2
1227        exit 1
1228      fi
1229      if test "X_$DEBIAN" = "X_" ; then
1230        AC_MSG_CHECKING([for libboost_thread])
1231        AC_LANG_PUSH(C++)
1232        SAVE_LIBS="$LIBS"
1233        LIBS="$LIBS -lboost_thread"
1234        AC_TRY_LINK([], [;], ,BOOST_THREAD_ERROR=1)
1235        AC_LANG_POP(C++)
1236        if test "X_$BOOST_THREAD_ERROR" == "X_1"; then
1237          msg=no
1238          LIBS="$SAVE_LIBS"
1239        else
1240          msg=yes
1241        fi
1242        AC_MSG_RESULT($msg)
1243        if test "X_$BOOST_THREAD_ERROR" = "X_1" ; then
1244          echo CGAL may require libboost_thread 1>&2
1245        fi
1246        AC_MSG_CHECKING([for libboost_system])
1247        AC_LANG_PUSH(C++)
1248        SAVE_LIBS="$LIBS"
1249        LIBS="$LIBS -lboost_system"
1250        AC_TRY_LINK([], [;], ,BOOST_SYSTEM_ERROR=1)
1251        AC_LANG_POP(C++)
1252        if test "X_$BOOST_SYSTEM_ERROR" == "X_1"; then
1253          msg=no
1254          LIBS="$SAVE_LIBS"
1255        else
1256          msg=yes
1257        fi
1258        AC_MSG_RESULT($msg)
1259        if test "X_$BOOST_SYSTEM_ERROR" = "X_1" ; then
1260          echo CGAL may require libboost_system 1>&2
1261        fi
1262      fi
1263    fi
1264  fi
1265else
1266  AC_CHECK_LIB(gmp, __gmpn_sub_1, , GMP_ERROR=1)
1267  if test "X_$GMP_ERROR" = "X_1" ; then
1268    echo CGAL requires libgmp 1>&2
1269    exit 1
1270  fi
1271  AC_CHECK_LIB(mpfr, mpfr_set, , MPFR_ERROR=1)
1272  if test "X_$MPFR_ERROR" = "X_1" ; then
1273     echo CGAL requires libmpfr 1>&2
1274     exit 1
1275  fi
1276fi
1277
1278AC_LANG_PUSH(C++)
1279AC_CHECK_HEADER(opensubdiv/far/topologyRefiner.h,,OPENSUBDIV_ERROR=1)
1280AC_LANG_POP()
1281if test "X_OPENSUBDIV_ERROR" = "X_1" ; then
1282[
1283cat 1>&2 << EOF
1284
1285 *** couldn't find a working OpenSubdiv development system ***
1286
1287 if OpenSubdiv is not available, the subdivide function is limited
1288
1289EOF
1290]
1291fi
1292
1293AC_MSG_CHECKING(for OpenSubdiv CPU library)
1294AC_LANG_PUSH(C++)
1295SAVE_LIBS="$LIBS"
1296LIBS="$LIBS -losdCPU"
1297AC_TRY_LINK([], [;], ,OPENSUBDIV_ERROR=1)
1298AC_LANG_POP(C++)
1299if test "X_$OPENSUBDIV_ERROR" = "X_1" ; then
1300  echo no
1301  LIBS="$SAVE_LIBS"
1302  cat 1>&2 << EOF
1303
1304 *** couldn't find a working OpenSubdiv development system ***
1305
1306 if OpenSubdiv is not available, the subdivide functions are limited
1307
1308EOF
1309else
1310 AC_DEFINE(HAVE_LIBOSDCPU)
1311 echo yes
1312fi
1313
1314AC_LANG_PUSH(C++)
1315AC_CHECK_HEADER(vcg/complex/complex.h,,VCG_ERROR=1)
1316AC_LANG_POP()
1317if test "X_$VCG_ERROR" = "X_1" ; then
1318 [
1319 cat 1>&2 << EOF
1320
1321 *** couldn't find a working vcglib development system (headers ony) ***
1322
1323 if vcglib is not available, the polygon reducer function is not available
1324
1325EOF
1326 ]
1327else
1328  VCG=yes
1329  AC_DEFINE(HAVE_LIBVCG)
1330fi
1331
1332if test "X_$OS" = "X_SunOS" ; then
1333 dnl Warn about known problematic LessTif implementations
1334 if (pkginfo | grep LessTif) ; then
1335  echo xxxxxxxxx Warning xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1336  echo Solaris can deliver a doubtfull version of LessTif in /opt/sfw/LessTif
1337  echo e.g. 0.92.26
1338  echo
1339  echo if you click to a icon, but get no reaction, temporary deinstall
1340  echo the LessTif package and install a modern version of LessTif
1341  echo or use:
1342  echo
1343  echo rm -f config.cache
1344  echo  sh ./configure --with-buginlesstif
1345  echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1346 fi
1347fi
1348AC_CHECK_HEADER(X11/extensions/XInput.h, AC_DEFINE(HAVE_XINPUT))
1349AC_CHECK_LIB(Xi, XOpenDevice)
1350
1351if test "X_$OS" = "X_Darwin" ; then
1352 AC_MSG_CHECKING(for libcrypto)
1353 SAVE_LIBS="$LIBS"
1354 LIBS="$LIBS /usr/lib/libcrypto.dylib"
1355 AC_TRY_LINK([], [;], ,CRYPTO_ERROR=1)
1356 if test "X_$CRYPTO_ERROR" = "X_1" ; then
1357   echo no
1358   LIBS="$SAVE_LIBS"
1359   echo curl need libcrypto on mac 1>&2
1360 else
1361  echo yes
1362 fi
1363 AC_MSG_CHECKING(for libssl)
1364 SAVE_LIBS="$LIBS"
1365 LIBS="$LIBS /usr/lib/libssl.dylib"
1366 AC_TRY_LINK([], [;], ,SSL_ERROR=1)
1367 if test "X_$SSL_ERROR" = "X_1" ; then
1368   echo no
1369   LIBS="$SAVE_LIBS"
1370   echo curl need libssl,curl need it 1>&2
1371 else
1372  echo yes
1373 fi
1374fi
1375
1376AC_CHECK_LIB(curl, curl_global_init, , CURL_ERROR=1)
1377if test "X_$CURL_ERROR" = "X_1" ; then
1378 echo "curl library not found, the downlad function is not available" 1>&2
1379fi
1380
1381
1382AC_CHECK_HEADER(GL/gl.h,,GL_ERROR=1)
1383AC_CHECK_HEADER(GL/glu.h,,GLU_ERROR=1)
1384
1385if test "X_$GLU_ERROR" = "X_1" ; then
1386   echo "GLU Library header (part of OpenGL/Mesa) not found" 1>&2
1387   GL_ERROR=1
1388fi
1389
1390AC_MSG_CHECKING(for GLU_NURBS_TESSELLATOR)
1391AC_COMPILE_IFELSE(
1392  [
1393  AC_LANG_SOURCE(
1394    [[
1395    #include <GL/glu.h>
1396
1397    GLUnurbsObj *theNurb;
1398    int main() {
1399        gluNurbsProperty(theNurb, GLU_NURBS_MODE, GLU_NURBS_TESSELLATOR);
1400        return 0;
1401    }
1402    ]]
1403  )
1404  ]
1405, [echo yes;AC_DEFINE(HAVE_GLU_NURBS_TESSELLATOR)],[echo no])
1406
1407if test "X_$GL_ERROR" = "X_1" ; then
1408[
1409 cat 1>&2 << EOF
1410
1411 *** couldn't find OpenGL develop file ***
1412
1413 This package will not compile without OpenGL.  If your OS does not
1414 support it natively you can use Mesa, the open source OpenGL workalike.
1415 Mesa is available for download from:
1416
1417	http://www.mesa3d.org/download.html
1418
1419EOF
1420 exit 1
1421]
1422fi
1423
1424AC_CHECK_LIB(GL, glBegin , , GL_ERROR=1)
1425if test "X_$GL_ERROR" = "X_1" ; then
1426   AC_CHECK_LIB(MesaGL, glBegin , GL_ERROR=0)
1427fi
1428
1429AC_CHECK_FUNCS(glVertex3f)
1430AC_CHECK_FUNCS(glFogCoordf)
1431AC_CHECK_FUNCS(glDeleteTextures)
1432AC_CHECK_FUNCS(glGenTextures)
1433AC_CHECK_FUNCS(glBindTexture)
1434AC_CHECK_FUNCS(glActiveTexture)
1435AC_CHECK_LIB(GLU, gluProject , , GLU_ERROR=1)
1436if test "X_$GLU_ERROR" = "X_1" ; then
1437   AC_CHECK_LIB(MesaGLU, gluProject , GLU_ERROR=0)
1438fi
1439
1440if test "X_$GLU_ERROR" = "X_1" ; then
1441   echo "GLU library (part of OpenGL/Mesa) problem"
1442   GL_ERROR=1
1443fi
1444
1445if test "X_$GL_ERROR" = "X_1" ; then
1446[
1447 cat 1>&2 << EOF
1448
1449 *** OpenGL library problem ***
1450
1451 This package will not compile without a working OpenGL development system.
1452
1453 Inspect the config.log file to find out, what part of the OpenGL
1454 development system is not available/working.
1455
1456 If your OS does not support it natively you can use Mesa, the open source
1457 OpenGL workalike.
1458 Mesa is available for download from:
1459
1460	http://www.mesa3d.org/download.html
1461
1462EOF
1463 exit 1
1464]
1465fi
1466
1467AC_CHECK_FUNCS(gluNewTess)
1468
1469AC_MSG_CHECKING(for _GLUfuncptr)
1470AC_TRY_LINK(
1471            [
1472              #include "GL/gl.h"
1473              #include "GL/glu.h"
1474              static void Callback(GLenum type, void *data)
1475                 {}
1476              void test_GLUfuncptr(void) {
1477                   GLUtesselator *tess=0;
1478                   gluTessCallback(tess, GLU_TESS_BEGIN_DATA,
1479		                   (_GLUfuncptr)0);
1480
1481                   }
1482            ],
1483            [
1484             /* dummy */
1485            ],
1486            echo  yes;AC_DEFINE(HAVE_GLU_FUNC_PTR),
1487            echo  no
1488           )
1489
1490dnl check for Mesa Off Screen rendering
1491
1492if test "X_$HAVE_WANT_OSMESA" = "yes" ; then
1493   AC_CHECK_LIB(OSMesa,OSMesaMakeCurrent)
1494   AC_CHECK_FUNCS(OSMesaCreateContext)
1495   AC_CHECK_FUNCS(OSMesaCreateContextExt)
1496fi
1497
1498dnl use prefined libraries for libexpat
1499AC_CHECK_LIB(expat, XML_ParserCreate, ,EXPAT_ERROR=1)
1500if test "X_$EXPAT_ERROR" = "X_1" ; then
1501   cat 1>&2 << EOF
1502
1503*** couldn't find matching libexpat version, libexpat 2.0.1 would work ***
1504
1505Couldn't find libexpat, the XML parsing C library.
1506This is not a fatal error; the package will be simply built without
1507the possiblity to read XML encoded X3D files (ISO/IEC 19776-1).
1508It is recommended to add it, or download and install it from:
1509
1510	http://expat.sourceforge.net
1511
1512and re-run configure.
1513
1514EOF
1515   EXPAT_WARNING="no usable expat library: no parsing of XML encoded X3D (ISO/IEC 19776-1)"
1516else
1517   AC_CHECK_FUNCS(XML_StopParser)
1518fi
1519
1520
1521dnl use prefined libraries for libz, libpng, libjpeg
1522if test "X_$LIBS_Z_PNG_JPEG" != "X_" ; then
1523   AC_DEFINE(HAVE_LIBPNG)
1524   AC_DEFINE(HAVE_LIBZ)
1525   AC_DEFINE(HAVE_LIBJPEG)
1526   LIBS="$LIBS_Z_PNG_JPEG $LIBS"
1527else
1528   AC_CHECK_LIB(z, gzopen, , ZLIB_ERROR=1)
1529   if test "X_$ZLIB_ERROR" = "X_1" ; then
1530      cat 1>&2 << EOF
1531
1532*** couldn't find working zlib (==libz) version, zlib 1.1.3 would work ***
1533
1534Couldn't find zlib(==libz) develop package.
1535zlib/libz is a library for lossless data-compression.
1536The package would simply built without support to open gz compressed VRML files,
1537but the png library also need zlib for linking.
1538
1539It is to recommended to add it, or download and install it from:
1540
1541	http://www.gzip.org/zlib/
1542
1543and re-run configure.
1544
1545EOF
1546      exit 1
1547   fi
1548
1549   AC_CHECK_LIB(png, png_init_io, , PNG_ERROR=1)
1550   if test "X_PNG_ERROR" = "X_1" ; then
1551      cat 1>&2 << EOF
1552
1553*** couldn't find working libpng version ***
1554
1555libjpeg is a library for rendering png images.
1556
1557It is recommended to add it, or download and install it from:
1558
1559	http://www.libpng.org/pub/png/libpng.html
1560
1561and re-run configure.
1562
1563EOF
1564     exit 1
1565   else
1566     AC_DEFINE(HAVE_LIBPNG)
1567   fi
1568
1569   AC_CHECK_LIB(jpeg, jpeg_start_decompress, , JPEG_ERROR=1)
1570   if test "X_$JPEG_ERROR" = "X_1" ; then
1571      cat 1>&2 << EOF
1572
1573*** couldn't find working jpeg library (libjpeg) version ***
1574
1575Couldn't find libjpeg develop package.
1576libjpeg is a library for rendering jpeg images.
1577
1578It is recommended to add it, or download and install it from:
1579
1580	http://libjpeg.sourceforge.net/
1581
1582and re-run configure.
1583
1584EOF
1585      exit 1
1586   else
1587      AC_DEFINE(HAVE_LIBJPEG)
1588   fi
1589
1590   if test "X_$HAVE_OLPC" = "X_1" ; then
1591      AC_CHECK_LIB(expat, XML_ExpatVersion)
1592      AC_CHECK_LIB(freetype, FT_Library_Version)
1593      AC_CHECK_LIB(fontconfig, FcGetVersion)
1594      AC_CHECK_LIB(Xrender, XRenderQueryVersion)
1595      AC_CHECK_LIB(Xft, XftGetVersion)
1596   fi
1597
1598   if test "X_$DEVIL" != "X_no" ; then
1599      AC_CHECK_LIB(IL, ilInit , , HAVE_IL=no)
1600
1601      if test "X_$HAVE_IL" != "X_no" ; then
1602         AC_CHECK_LIB(ILU, iluInit , , HAVE_ILU=no)
1603         if test "X_$HAVE_ILU" != "X_no" ; then
1604            HAVE_ILU=yes
1605         fi
1606      fi
1607   fi
1608fi
1609
1610AC_MSG_CHECKING(for png_handle_unknown linking)
1611AC_TRY_LINK(
1612            [
1613              #include "png.h"
1614              #include <setjmp.h>
1615              void png_handle_unknown PNGARG((png_structp png_ptr,
1616                    png_infop info_ptr, png_uint_32 length))
1617                    { longjmp(NULL, 0); }
1618            ],
1619            [
1620             /* dummy */
1621            ],
1622            echo  yes,
1623            echo  no;AC_DEFINE(HAVE_NO_PNG_HANDLE_UNKNOWN)
1624           )
1625
1626if test "X_$FFMPEG" != "X_no" ; then
1627   AC_CHECK_LIB(avcodec, av_parser_init, ,FFMPEG_ERROR=1)
1628   AC_CHECK_LIB(avutil, av_expr_eval, ,FFMPEG_ERROR=1)
1629   AC_CHECK_LIB(avformat, avformat_configuration, ,FFMPEG_ERROR=1)
1630   AC_CHECK_LIB(swscale, swscale_configuration, ,FFMPEG_ERROR=1)
1631   AC_CHECK_LIB(swresample, swr_init, ,FFMPEG_ERROR=1)
1632   if test "X_$FFMPEG_ERROR" = "X_1" ; then
1633      cat 1>&2 << EOF
1634
1635*** couldn't find matching ffmpeg version ***
1636
1637Couldn't find ffmpeg, the movie library.
1638This is not a fatal error; the package will be simply built without
1639support to display MovieTexture.  It is recommended to add it, download and
1640install it from:
1641
1642	https://ffmpeg.org/
1643
1644and re-run configure.
1645The development version (-dev/-devel) of the following libraries are need:
1646libavcodec libavutil libavformat libswscale libswresample
1647
1648EOF
1649         FFMPEG_WARNING="no usable ffmpeg libraries: no rendering of MovieTexture"
1650         AC_DEFINE_UNQUOTED(HAVE_FFMPEG,0)
1651   else
1652      AC_DEFINE(HAVE_FFMPEG)
1653   fi
1654fi
1655
1656AC_CHECK_HEADER(linux/joystick.h,AC_DEFINE(LINUX_JOYSTICK))
1657AC_CHECK_HEADER(sball.h, SBALL_HEADER=yes;export SBALL_HEADER)
1658if test "X_$SBALL_HEADER" = "X_yes" ; then
1659 AC_CHECK_LIB(sball, sball_open)
1660fi
1661if test "X_$HAVE_WANT_USB" != "X_no" ; then
1662 AC_CHECK_LIB(usb, usb_init)
1663fi
1664
1665if test "X_$HAVE_WANT_EFENCE" = "X_yes" ; then
1666   AC_CHECK_LIB(efence, Page_AllowAccess)
1667fi
1668
1669if test "X_$HAVE_WANT_DUMA" = "X_yes" ; then
1670   // duma usually use the pthread library
1671   AC_CHECK_LIB(pthread, pthread_start_thread)
1672   AC_CHECK_LIB(duma, Page_AllowAccess)
1673fi
1674
1675dnl check for signal_handler(int);
1676
1677AC_MSG_CHECKING(for signal_handler(int))
1678cat > /tmp/test_$$.cpp << EOT
1679#include <signal.h>
1680   void signal_fatal_handler(int sign){}
1681   int main(int argc,char** argv) {signal(1,&signal_fatal_handler);return 0;}
1682EOT
1683$CXX -o /tmp/a_$$.out /tmp/test_$$.cpp 2>/dev/null > /dev/null
1684RET=$?
1685if test "X_$RET" = "X_0" ;then
1686  AC_DEFINE(HAVE_SIGNAL_INT)
1687  echo yes
1688else
1689  echo no
1690fi
1691rm -f /tmp/a_$$.out /tmp/test_$$.cpp
1692
1693dnl check for typename
1694
1695AC_MSG_CHECKING(for typename)
1696cat > /tmp/test_$$.cpp << EOT
1697template <class c> class a { typedef typename c::d e;};
1698EOT
1699$CXX -c -o /tmp/a_$$.out /tmp/test_$$.cpp 2>/dev/null > /dev/null
1700RET=$?
1701if test "X_$RET" = "X_0" ;then
1702  AC_DEFINE(HAVE_TYPENAME)
1703  echo yes
1704else
1705  echo no
1706fi
1707rm -f /tmp/a_$$.out /tmp/test_$$.cpp
1708
1709dnl check if -fpermissive is needed for g++
1710if test "X_"`echo $CXX|awk '{print $1}'` = "X_g++" ; then
1711
1712   AC_MSG_CHECKING(for g++ -fpermissive)
1713   cat > /tmp/test_$$.cpp << EOT
1714   #include <stddef.h>
1715
1716   class test {};
1717
1718   test *ptr = NULL;
1719EOT
1720   $CXX -c -o /tmp/a_$$.out /tmp/test_$$.cpp 2>/dev/null > /dev/null
1721   RET=$?
1722   if test "X_$RET" = "X_0" ;then
1723      echo not needed
1724   else
1725      echo yes
1726      CXXFLAGS="$CXXFLAGS -fpermissive"
1727   fi
1728   rm -f /tmp/a_$$.out /tmp/test_$$.cpp
1729fi
1730
1731AC_MSG_CHECKING(for -std=c99)
1732cat > /tmp/test_$$.c << EOT
1733int main(int argc, char** argv) {return 0;}
1734EOT
1735$CC -std=c99 -c -o /tmp/test_$$.o /tmp/test_$$.c 2>/dev/null > /dev/null
1736RET=$?
1737if test "X_$RET" = "X_0" ;then
1738  C99="-std=c99"
1739  AC_SUBST(C99)
1740  echo yes
1741else
1742  echo no
1743fi
1744rm -f /tmp/test_$$.o /tmp/test_$$.c
1745
1746AC_MSG_CHECKING(for fpclassify)
1747AC_TRY_LINK(
1748               [
1749                 #include "math.h"
1750               ],
1751               [
1752                 int result = fpclassify(1.0);
1753               ],
1754               echo yes;AC_DEFINE(HAVE_FPCLASSIFY),echo no;TEST_XOPEN_SOURCE=yes
1755               )
1756
1757if test "$TEST_XOPEN_SOURCE" = yes ; then
1758   AC_MSG_CHECKING(for _XOPEN_SOURCE 600 for fpclassify)
1759   AC_TRY_LINK(
1760               [
1761                 #define _XOPEN_SOURCE 600
1762                 #include "math.h"
1763               ],
1764               [
1765                 int result = fpclassify(1.0);
1766               ],
1767               echo yes;AC_DEFINE(HAVE_XOPEN_SOURCE_4_FPCLASSIFY),echo no
1768               )
1769fi
1770
1771# AC_MSG_CHECKING(for isless)
1772# AC_TRY_LINK(
1773#                [
1774#                  #include "math.h"
1775#                ],
1776#                [
1777#                  int result = isless(0.0,1.1);
1778#                ],
1779#                echo yes;AC_DEFINE(HAVE_ISLESS),echo no
1780#                )
1781
1782AC_MSG_CHECKING(for termios.c_ospeed)
1783cat > /tmp/test_$$.cpp << EOT
1784#include <termios.h>
1785   void test(void) {struct termios t;t.c_ospeed=B19200}
1786EOT
1787$CXX -o /tmp/a_$$.out /tmp/test_$$.cpp 2>/dev/null > /dev/null
1788RET=$?
1789if test "X_$RET" = "X_0" ;then
1790  AC_DEFINE(HAVE_C_OSPEED)
1791  echo yes
1792else
1793  echo no
1794fi
1795rm -f /tmp/a_$$.out /tmp/test_$$.cpp
1796
1797dnl check for libefence.a
1798
1799ARXSTRDUP_O="echo no way to extract strdup efence may fail in strdup"
1800STRDUP_O=
1801
1802LIBEFENCE_A=
1803EFENCE_EXTRA_LIBS=
1804AC_MSG_CHECKING(for libefence.a location)
1805for i in /usr/lib32 /usr/lib64 /usr/lib /usr/local/lib32 /usr/local/lib64 /usr/local/lib ; do
1806   if test -f $i/libefence.a ; then
1807       LIBEFENCE_A=$i/libefence.a
1808       export LIBEFENCE_A
1809
1810       EFENCE_EXTRA_LIBS=-lpthread
1811       export EFENCE_EXTRA_LIBS
1812   fi
1813done
1814if test "X_$LIBEFENCE_A" != "X_" ; then
1815    echo $LIBEFENCE_A
1816    AC_MSG_CHECKING(for strdup extraction)
1817    CURRENT_DIR=$SELFDIR
1818    for i in /usr/lib /usr/lib/debug/usr/lib /usr/lib/debug/usr/lib64 ; do
1819        cd /tmp &&
1820            if ar x $i/libc.a strdup.o 2>/dev/null ; then
1821                echo yes
1822
1823                ARXSTRDUP_O="(cd /tmp && ar x $i/libc.a strdup.o)"
1824                export ARXSTRDUP_O
1825
1826                STRDUP_O=/tmp/strdup.o
1827                export STRDUP_O
1828
1829                rm -f $STRDUP_O
1830            else
1831                echo no
1832            fi
1833        cd $CURRENT_DIR
1834    done
1835else
1836    echo none
1837fi
1838AC_SUBST(LIBEFENCE_A)
1839AC_SUBST(EFENCE_EXTRA_LIBS)
1840
1841LIBDUMA_A=
1842DUMA_EXTRA_LIBS=
1843AC_MSG_CHECKING(for libduma.a location)
1844for i in /usr/lib32 /usr/lib64 /usr/lib /usr/local/lib32 /usr/local/lib64 /usr/local/lib ; do
1845   if test -f $i/libduma.a ; then
1846       LIBDUMA_A=$i/libduma.a
1847       export LIBDUMA_A
1848
1849       DUMA_EXTRA_LIBS=-lpthread
1850       export DUMA_EXTRA_LIBS
1851   fi
1852done
1853if test "X_$LIBDUMA_A" != "X_" ; then
1854    echo $LIBDUMA_A
1855    AC_MSG_CHECKING(for strdup extraction)
1856    for i in /usr/lib /usr/lib/debug/usr/lib /usr/lib/debug/usr/lib64 ; do
1857        pushd $PWD
1858        cd /tmp &&
1859            if ar x $i/libc.a strdup.o 2>/dev/null ; then
1860                echo yes
1861
1862                ARXSTRDUP_O="(cd /tmp && ar x $i/libc.a strdup.o)"
1863                export ARXSTRDUP_O
1864
1865                STRDUP_O=/tmp/strdup.o
1866                export STRDUP_O
1867
1868                rm -f $STRDUP_O
1869            else
1870                echo no
1871            fi
1872        popd
1873    done
1874else
1875    echo none
1876fi
1877AC_SUBST(LIBDUMA_A)
1878AC_SUBST(DUMA_EXTRA_LIBS)
1879
1880AC_SUBST(ARXSTRDUP_O)
1881AC_SUBST(STRDUP_O)
1882
1883AC_ARG_WITH(about,--with-about=\"about text\" about text,
1884            DUNE_VERSION2="$withval";export DUNE_VERSION2)
1885if test "X_$DUNE_VERSION2" != "X_" ; then
1886   AC_DEFINE_UNQUOTED(HAVE_DUNE_VERSION,"${DUNE_VERSION2}")
1887fi
1888
1889AC_ARG_WITH(allow-multiple-definition,--with-allow-multiple-definition allow multiple linker symbols,
1890            [LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"];export LDFLAGS)
1891
1892
1893dnl automatic generate functions/lists for VRML types (e.g. SFBool <=> SFBOOL)
1894
1895(cd $SELFDIR && sh batch/mkSFMFTypes.sh)
1896
1897dnl CC="$OLD_CC"
1898dnl export CC
1899
1900AC_LANG_CPLUSPLUS
1901
1902AC_MSG_CHECKING(for new handler)
1903AC_TRY_COMPILE(
1904                  [
1905                    #include <new.h>
1906                  ],
1907                  [
1908                    void handler(void);
1909                    set_new_handler(handler);
1910                  ],
1911                  echo yes;AC_DEFINE(HAVE_NEW_HANDLER),echo no
1912                 )
1913
1914AC_MSG_CHECKING(for new new handler)
1915AC_TRY_COMPILE(
1916                  [
1917                    #include <new>
1918                    void handler(void);
1919                  ],
1920                  [
1921                    std::set_new_handler(handler);
1922                  ],
1923                  echo yes;AC_DEFINE(HAVE_NEW_NEW_HANDLER),echo no
1924                 )
1925
1926CC="$OLD_CC"
1927export CC
1928
1929dnl generate command to generate dune.rc file from dune.*.rc files
1930RCFILE_FIRST=dune.english.rc
1931RCFILE_REST=`(cd src && ls dune.*.rc | grep -v $RCFILE_FIRST | xargs echo)`
1932RESOURCE_FILES="$RCFILE_FIRST singleResources.rc $RCFILE_REST"
1933AC_SUBST(RESOURCE_FILES)
1934
1935dnl generate command to test icon size
1936AC_PATH_PROGS(BMPTOPNM,[bmptopnm])
1937if test "X_$BMPTOPNM" = "X_" ; then
1938   echo "unable to test for icon size without bmptopnm (harmless)" 1>&2
1939   TESTICONSIZE="@echo no bmptopnm: can not compare iconsize of "
1940   TESTICONSIZE2="@echo no bmptopnm: can not compare iconsize of "
1941else
1942   TESTICONSIZE="../batch/testiconsize.sh $BMPTOPNM"
1943   TESTICONSIZE2="../batch/testiconsize2.sh $BMPTOPNM"
1944fi
1945AC_SUBST(TESTICONSIZE)
1946AC_SUBST(TESTICONSIZE2)
1947
1948AC_PATH_PROGS(JAVAC,javac,echo)
1949AC_SUBST(JAVAC)
1950if test "X_$JAVAC" = "X_echo" ; then
1951    JAVA="echo"
1952else
1953    AC_PATH_PROGS(JAVA,java,echo)
1954fi
1955AC_SUBST(JAVA)
1956
1957if test "X_$ANT" = "X_" ; then
1958    AC_PATH_PROGS(ANT,ant,)
1959fi
1960if test "X_$ANT" != "X_" ; then
1961   AC_DEFINE_UNQUOTED(HAVE_ANT,"${ANT}")
1962fi
1963
1964if test X_`ls -d /usr/include/X11/Xmu 2>/dev/null` != X_ ; then
1965    AC_DEFINE_UNQUOTED(HAVE_INCLUDE_X11_XMU,"1")
1966fi
1967
1968
1969LIBS="$LIBS $EXTRA_LIBS"
1970
1971AC_OUTPUT($SELFDIR/src/Makefile $SELFDIR/src/swt/motif/Makefile \
1972          $SELFDIR/src/swt/tests/Makefile $SELFDIR/src/swt/rc/Makefile\
1973          $SELFDIR/src/SDLjoystick/Makefile $SELFDIR/test/Makefile \
1974          $SELFDIR/docs/export_example_c/simple_example/Makefile \
1975          $SELFDIR/docs/export_example_c++/simple_example/Makefile \
1976          $SELFDIR/docs/export_example_java/simple_example/Makefile )
1977
1978(cd $SELFDIR/src && make resource.h)
1979
1980(cd $SELFDIR/src/swt/motif && make $DUNEMAKEFLAGS depend)
1981(cd $SELFDIR/src && make $DUNEMAKEFLAGS depend)
1982
1983if test "X_" != "X_$SDL_JOYSTICK_SUBDIR" ; then
1984   (cd $SELFDIR/src/SDLjoystick && make $DUNEMAKEFLAGS depend)
1985fi
1986
1987(cd $SELFDIR/src/SDLjoystick && touch SDL_error.h)
1988(cd $SELFDIR/src/SDLjoystick && touch SDL_joystick_c.h)
1989
1990dnl repeat warnings at end
1991
1992if test "X_$WARNING_LEX" != "X_" ; then
1993    echo " " 1>&2
1994    echo "Warning:" 1>&2
1995    echo " " $WARNING_LEX 1>&2
1996else
1997    touch $SELFDIR/src/lexer.l $SELFDIR/src/swt/rc/rclex.l
1998fi
1999
2000if test "X_$WARNING_YACC" != "X_" ; then
2001    echo " " 1>&2
2002    echo "Warning:" 1>&2
2003    echo " " $WARNING_YACC 1>&2
2004else
2005    touch $SELFDIR/src/parser.y $SELFDIR/src/swt/rc/rcparse.y
2006fi
2007
2008if test "X_$XLSFONTS_WARNING" != "X_" ; then
2009    echo " " 1>&2
2010    echo "Warning:" 1>&2
2011    echo " " $XLSFONTS_WARNING 1>&2
2012fi
2013
2014if test "X_$GLUT_WARNING" != "X_" ; then
2015    echo " " 1>&2
2016    echo "Warning:" 1>&2
2017    echo " " $GLUT_WARNING 1>&2
2018fi
2019
2020if test "X_$EXPAT_WARNING" != "X_" ; then
2021    echo " " 1>&2
2022    echo "Warning:" 1>&2
2023    echo " " $EXPAT_WARNING 1>&2
2024fi
2025
2026if test "X_$FFMPEG_WARNING" != "X_" ; then
2027    echo " " 1>&2
2028    echo "Warning:" 1>&2
2029    echo " " $FFMPEG_WARNING 1>&2
2030fi
2031
2032if test "X_$IMAGEEDITOR" = "X_" ; then
2033    echo " " 1>&2
2034    echo "Warning:" 1>&2
2035    echo "  no known program to change jpeg (.jpg) and png (.png) files" 1>&2
2036    echo "  if you have such a program, you should" 1>&2
2037    echo "  restart configure with the --with-imageeditor= option" 1>&2
2038fi
2039
2040if test "X_$SOUNDEDITOR" = "X_" ; then
2041    echo " " 1>&2
2042    echo "Warning:" 1>&2
2043    echo "  no known program to change wave (.wav) files" 1>&2
2044    echo "  if you have such a program, you should" 1>&2
2045    echo "  restart configure with the --with-soundeditor= option" 1>&2
2046fi
2047
2048if test "X_$MOVIEEDITOR" = "X_" ; then
2049    echo " " 1>&2
2050    echo "Warning:" 1>&2
2051    echo "  no known program to change mpeg1 (.mpeg) files" 1>&2
2052    echo "  if you have such a program, you should" 1>&2
2053    echo "  restart configure with the --with-movieeditor= option" 1>&2
2054fi
2055
2056if test "X_$IMAGECONVERTER" = "X_" ; then
2057    echo " " 1>&2
2058    echo "Warning:" 1>&2
2059    echo "  no known program to convert bitmap files (.jpg, .png) to bmp files for ac3d export" 1>&2
2060    echo "  if you have such a program, you should" 1>&2
2061    echo "  restart configure with the --with-imageconverter= option" 1>&2
2062fi
2063
2064if test "X_$AVOID_RANLIB" = "X_yes" ; then
2065    if test "X_$OS" = "X_Darwin" ; then
2066        echo " " 1>&2
2067        echo "Warning:" 1>&2
2068        echo "  the usage of the --without-ranlib option may be not wise of MacOSX" 1>&2
2069        echo "  a lot of MacOSX versions require the usage of the ranlib command" 1>&2
2070    fi
2071fi
2072
2073if test "X_$CGAL_ERROR" = "X_1" ; then
2074    echo " " 1>&2
2075    echo "Warning:" 1>&2
2076    echo "  couldn't find a working CGAL development system" 1>&2
2077    echo "  if CGAL is not available, the convex hull and CSG functions are not available" 1>&2
2078fi
2079
2080if test "X_$VCG_ERROR" = "X_1" ; then
2081    echo " " 1>&2
2082    echo "Warning:" 1>&2
2083    echo "  couldn't find a working libvcg development system (headers ony)" 1>&2
2084    echo "if libvcg is not available, the polygon reducer function is not available" 1>&2
2085fi
2086
2087
2088
2089