0024786: Move functionality of WOK command wgenproj to OCCT tool genproj
[occt.git] / adm / templates / template.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([OpenCASCADE], [6.8.0])
3 AC_CONFIG_AUX_DIR(make)
4 AM_INIT_AUTOMAKE([foreign])
5 AC_CANONICAL_HOST
6 dnl AM_CONFIG_SRCDIR(src/Standard/Standard.cxx)
7
8 CFLAGS="$CFLAGS"
9 CXXFLAGS="$CXXFLAGS"
10
11 AC_PROG_CC
12
13 AM_CONFIG_HEADER(config.h)
14
15 dnl AM_MAINTAINER_MODE
16
17 AC_AIX
18 AC_ISC_POSIX
19 AC_C_BIGENDIAN
20
21 AC_DISABLE_STATIC
22
23 dnl Checks for programs.
24 AM_PROG_LIBTOOL
25 AC_PROG_CXX
26 AC_PROG_CC_C_O
27
28 AC_PROG_AWK
29 AC_PROG_INSTALL
30 AC_PROG_LN_S
31 AC_PROG_YACC
32 AC_PROG_MAKE_SET
33
34 dnl Checks for header files.
35
36 AC_HEADER_STDC
37 AC_LANG([C])
38 AC_MSG_CHECKING([ for C header files ])
39 AC_CHECK_HEADERS(dlfcn.h dl.h ieeefp.h time.h sys/time.h pwd.h)
40 AC_CHECK_HEADERS(sys/statvfs.h sys/vfs.h sys/param.h osfcn.h netdb.h)
41 AC_CHECK_HEADERS(sys/ioctl.h net/if.h sys/systeminfo.h sys/utsname.h)
42 AC_CHECK_HEADERS(sysent.h unistd.h sys/unistd.h sys/socket.h)
43 AC_CHECK_HEADERS(ndir.h sys/ndir.h sys/dir.h signal.h sys/signal.h)
44 AC_CHECK_HEADERS(sigfpe.h floatingpoint.h sys/machsig.h sys/siginfo.h)
45 AC_CHECK_HEADERS(malloc.h strings.h sys/stat.h sys/sem.h sys/ipc.h)
46 AC_CHECK_HEADERS(sys/times.h dirent.h getopt.h sys/vnode.h)
47
48
49 AC_LANG([C++])
50 AC_MSG_CHECKING([ for C++ header files ])
51 AC_CHECK_HEADERS(istream ostream istream fstream ios iomanip iostream )
52 AC_CHECK_HEADERS(stream.h strstream.h istream.h ostream.h fstream.h stdlib.h ios.h iostream.h)
53 AC_CHECK_HEADERS(iomanip.h limits.h values.h float.h)
54 AC_CHECK_HEADERS(siginfo.h bits/sigset.h bstring.h sys/types.h sys/select.h)
55 AC_CHECK_HEADERS(X11/extensions/transovl.h X11/extensions/readdisplay.h)
56 AC_CHECK_HEADERS(X11/extensions/multibuf.h,[],[],[#include <X11/Xlib.h>])
57 AC_CHECK_HEADERS(sys/filio.h sys/mman.h libc.h)
58
59 #-----------------------------------------------------------------------------
60 # Posix threads library is required
61 #-----------------------------------------------------------------------------
62 AC_CHECK_HEADER([pthread.h],[],[AC_MSG_ERROR([Posix threads required])])
63 AC_CHECK_LIB([pthread],[pthread_create],[],[AC_MSG_ERROR([Posix threads required])])
64 CSF_ThreadLibs_LIB=-lpthread
65 AC_SUBST(CSF_ThreadLibs_LIB)
66
67 #-----------------------------------------------------------------------------
68 # dl library is required
69 #-----------------------------------------------------------------------------
70 AC_CHECK_LIB([dl],[dlopen],[],[AC_MSG_ERROR([dl library is required])])
71 CSF_SOCKETLibs_LIB=-ldl
72
73 #---------------------------------------------------------------------
74 #
75 # Test for 64-bit platforms
76 #  
77 #  
78 #---------------------------------------------------------------------
79 AC_MSG_CHECKING([if platform is 64-bit])
80 AC_TRY_COMPILE( [], 
81  [int array[((int)sizeof(void*))-6];],
82  [AC_MSG_RESULT([yes]); ARCH=64; case $platform in Linux*) CPPFLAGS="$CPPFLAGS -m64";; esac],
83  [AC_MSG_RESULT([no]); ARCH=32;] )
84 AC_SUBST(ARCH)
85
86 if test "x${CSF_OPT_INC}" != "x"; then
87    CSF_OPT_INCLUDES=
88    for c in `echo ${CSF_OPT_INC} | sed 's/:/ /g'`; do
89        CSF_OPT_INCLUDES="-I$c ${CSF_OPT_INCLUDES}"
90    done
91 fi
92 if test "$ARCH" = "32" -a "x${CSF_OPT_LIB32}" != "x"; then
93    CSF_OPT_LIB=${CSF_OPT_LIB32}
94    CSF_OPT_LIBS=
95    for c in `echo ${CSF_OPT_LIB32} | sed 's/:/ /g'`; do
96        CSF_OPT_LIBS="-L$c ${CSF_OPT_LIBS}"
97    done
98 fi
99 if test "$ARCH" = "64" -a "x${CSF_OPT_LIB64}" != "x"; then
100    CSF_OPT_LIB=${CSF_OPT_LIB64}
101    CSF_OPT_LIBS=
102    for c in `echo ${CSF_OPT_LIB64} | sed 's/:/ /g'`; do
103        CSF_OPT_LIBS="-L$c ${CSF_OPT_LIBS}"
104    done
105 fi
106
107 AC_SUBST(CSF_OPT_INCLUDES)
108 AC_SUBST(CSF_OPT_LIBS)
109
110 #------------------------------------------------------------------------------
111 # Get Tcl and TK configuration information from tclConfig.sh.
112 #------------------------------------------------------------------------------
113
114 SC_TCL_CFG
115 SC_TK_CFG
116 HAVE_TCLTK=no
117 if test "xyes" = "x$HAVE_TCL"; then
118   if test "xyes" = "x$HAVE_TK"; then
119     HAVE_TCLTK=yes
120     CSF_TclLibs_INCLUDES="${TCL_INCLUDE_SPEC}"
121     CSF_TclTkLibs_INCLUDES="${TK_INCLUDE_SPEC}"
122     CSF_TclLibs_LIB="${TCL_LIB_SPEC}"
123     CSF_TclTkLibs_LIB="${TK_LIB_SPEC}"
124     CSF_OPT_INC="${TCL_PREFIX}/include:${TK_PREFIX}/include:${CSF_OPT_INC}"
125     CSF_OPT_LIB="${TCL_PREFIX}/lib:${TK_PREFIX}/lib:${CSF_OPT_LIB}"
126   fi
127 fi
128 if test "x${HAVE_TCLTK}" != "xyes"; then
129    DISABLE_TCLTK_REASON="(tcltk was not found)"
130 fi
131 AC_SUBST(TCL_VERSION)
132 AC_SUBST(TK_VERSION)
133 AC_SUBST(HAVE_TCLTK)
134 AC_SUBST(CSF_TclLibs_INCLUDES)
135 AC_SUBST(CSF_TclTkLibs_INCLUDES)
136 AC_SUBST(CSF_TclLibs_LIB)
137 AC_SUBST(CSF_TclTkLibs_LIB)
138
139 platform=`uname -s`
140
141 dnl Make sure CSFDB is defined in CXXFLAGS and CFLAGS
142 CXXFLAGS="$CXXFLAGS -DCSFDB -DOCC_CONVERT_SIGNALS"
143 CFLAGS="$CFLAGS -DCSFDB -DOCC_CONVERT_SIGNALS"
144
145 case $platform in
146         Linux*) CXXFLAGS="$CXXFLAGS -DLIN -DLININTEL -D_GNU_SOURCE=1 -mmmx -msse -msse2 -mfpmath=sse -Wall"
147                 CFLAGS="$CFLAGS -DLIN -DLININTEL -fexceptions -mmmx -msse -msse2 -mfpmath=sse -Wall"
148                 LDFLAGS="$LDFLAGS -lstdc++ -lrt";;
149         SunOS*) CXXFLAGS="$CXXFLAGS -Usun -DSOLARIS -instances=static"
150                 CFLAGS="$CFLAGS -Usun -DSOLARIS -instances=static"
151                 LDFLAGS="$LDFLAGS -instances=static"
152                 CSF_SOCKETLibs_LIB="-lnsl ${CSF_SOCKETLibs_LIB}";;
153         OSF1*)  CXXFLAGS="$CXXFLAGS -DDECOSF1 -D__USE_STD_IOSTREAM -D_RWSTD_NO_EXCEPTIONS" 
154                 CFLAGS="$CFLAGS -std1 -DDECOSF1"
155                 LD=$CXX;;
156         *) ;;
157 esac
158 AC_SUBST(CSF_SOCKETLibs_LIB)
159
160 AC_SUBST(platform)
161 AC_LANG([C++])
162
163 dnl Checks for typedefs, structures, and compiler characteristics.
164 AC_TYPE_SIZE_T
165 AC_STRUCT_TM
166
167 dnl Checks for library functions.
168 AC_FUNC_ALLOCA
169 AC_FUNC_MEMCMP
170 AC_TYPE_SIGNAL
171 AC_CHECK_FUNCS(gethostname putenv re_comp regcomp strcspn strdup strtol)
172 AC_CHECK_FUNCS(statfs statvfs)
173
174
175 AC_CACHE_CHECK([if it is OK to define stream input and output],
176 def_cv_ios_ok,
177 [AC_LANG([C++])
178  AC_TRY_COMPILE([#include <stream.h>
179 static const int input = (ios::in) | (ios::nocreate);
180 static const int output= (ios::out);],
181 [return 0;],
182  def_cv_ios_ok=yes, def_cv_ios_ok=no)
183 ])
184 if test "$def_cv_ios_ok" = yes; then
185   AC_DEFINE(DEF_IOS_OK,,[define if the compiler allows redefinition of stream input and output])
186 fi
187
188
189 AC_CACHE_CHECK([if class ostream has member function form],
190 [ostream_cv_form_ok],
191 [AC_LANG([C++])
192  AC_TRY_COMPILE([#include <iostream.h>],
193 [cout << cout.form("%9.3e", 3.14159627e-4) << endl;
194 return 0;],
195  ostream_cv_form_ok=yes, ostream_cv_form_ok=no)
196 ])
197 if test "$ostream_cv_form_ok" = yes; then
198   AC_DEFINE(OSTREAM_FORM_OK,,[define if the class ostream has member function form])
199 fi
200
201
202 dnl Checks for typedefs, structures, and compiler characteristics.
203
204 # if the following code compiles then the union semun is
205 # defined in the header <sys/sem.h>
206
207 AC_CACHE_CHECK([if union semun is defined in <sys/sem.h>],
208 [semun_cv_defined],
209 [AC_LANG([C])
210 AC_TRY_COMPILE([#include <sys/time.h>
211 #include <sys/sem.h>],
212 [union semun c;],
213  semun_cv_defined=yes, semun_cv_defined=no)
214 ])
215 if test "$semun_cv_defined" = yes; then
216   AC_DEFINE(SEMUN_DEFINED,,[define if the union semun is in sys/sem.h])
217 fi
218
219 # if the following code compiles then the union semun has
220 # the member __buf
221
222 if test "$semun_cv_defined" = yes; then
223
224  AC_CACHE_CHECK(if union semun has member __buf,
225  semun_cv_buf_defined,
226  [AC_LANG([C])
227  AC_TRY_COMPILE([#include <sys/sem.h>],
228  [ union semun c; c.__buf = 0;],
229  semun_cv_buf_defined=yes, semun_cv_buf_defined=no)
230  ])
231  if test "$sumun_buf_defined" = yes; then
232   AC_DEFINE(SEMUN_BUF_DEFINED,,[define if semun has member __buf])
233  fi
234 fi
235
236
237 AC_CACHE_CHECK([if function semop takes a value],
238 [semop_cv_no_reference],
239 [AC_LANG([C])
240 AC_TRY_COMPILE([#include <sys/sem.h>
241 static struct sembuf event_flag ;],
242 [int status;
243  int *semid;
244  status = semop(*semid,event_flag,1);
245 ],
246  semop_cv_no_reference=yes, semop_cv_no_reference=no)
247 ])
248 if test "$semop_cv_no_reference" = yes; then
249   AC_DEFINE(SEMOP_NO_REFERENCE,,[define if the function semop takes a value])
250 fi
251
252
253 AC_CACHE_CHECK([if function semctl takes a value],
254 [semctl_cv_no_reference],
255 [AC_LANG([C])
256 AC_TRY_COMPILE([#include <sys/sem.h>
257 int get_semaphore(semid,event,value)
258  int *semid, *event, *value;
259 {
260  int status;
261  status = semctl((*semid),*event,GETVAL,value);
262  return 0;
263 }
264 int *a,*b,*c;],
265 [if(get_semaphore(a,b,c))
266  exit 0;],
267  semctl_cv_no_reference=yes, semctl_cv_no_reference=no)
268 ])
269 if test "$semctl_cv_no_reference" = yes; then
270   AC_DEFINE(SEMCTL_NO_REFERENCE,,[define if the function semctl takes a value])
271 fi
272
273 AC_CHECK_LIB(malloc,mallinfo,[
274   AC_DEFINE(HAVE_MALLINFO,,[Define if we have a function called "mallinfo" in -lmalloc.])
275   LIBS="$LIBS -lmalloc"
276 ])
277
278 AC_CHECK_LIB(sunmath,ieee_handler,[
279   AC_DEFINE(HAVE_SUNMATH,,[Define if we have a function called "ieee_handler" in -lsunmath.])
280   LIBS="$LIBS -lsunmath"
281 ])
282
283 AC_CHECK_LIB(m,finite,[
284   AC_DEFINE(HAVE_FINITE,,[Define if we have a function called "finite" in -lm.])
285 ])
286
287 #---------------------------------------------------------------------
288 #
289 # Check for Java Header Files 
290 #  
291 #  
292 #---------------------------------------------------------------------
293
294 AC_ARG_WITH([java-include],
295   [AC_HELP_STRING([--with-java-include=DIR],[Location of jni.h])],
296   [java_include="${withval}"],[java_include=])
297 if test "xno" = "x$java_include"; then
298   # user specified --without-java-include
299   HAVE_JAVA=no
300 else
301   if test "xyes" != "x$java_include" && test "x" != "x$java_include"; then
302     # user specified some path
303     
304     # test user-specified value is a directory
305     if test ! -d "$java_include"; then
306       AC_MSG_ERROR([$java_include: Not a directory])
307     fi
308     
309     # search for jni_md.h (typically in a system-specific subdir)
310     AC_MSG_CHECKING([for jni_md.h in $java_include])
311     extra_java_include=
312     if test -f "$java_include/jni_md.h"; then
313       result="$java_include/jni_md.h"
314     else
315       result=
316       for d in "$java_include"/*; do
317         if test -f "$d/jni_md.h"; then
318           extra_java_include="-I$d"
319           result="$d/jni_md.h"
320           break
321         fi
322       done
323       AC_MSG_RESULT([$result])
324     fi
325     
326     # put user-specified directory and jni_mh.h directory (if found)
327     # into CPPFLAGS
328     CPPFLAGS="$CPPFLAGS -I$java_include $extra_java_include"
329   fi
330   
331   # Now we check for a working jni.h that is version 1.2 or newer.
332   # Note: This check is done unless user specified --without-java-include
333   #       If --with-java-include wasn't specified, it will check the
334   #       default compiler search path and any paths the user specified
335   #       via CPPFLAGS on the command line.
336   AC_CHECK_HEADER( [jni.h], [HAVE_JAVA=yes], [HAVE_JAVA=no
337     AC_MSG_NOTICE("Specify --with-java-include=<DIR> to enable Java support")] )
338   if test "xyes" = "x$HAVE_JAVA"; then
339     AC_MSG_CHECKING([java JNI version >= 1.2])
340     AC_TRY_COMPILE( [#include <jni.h>],
341   [#ifndef JNI_VERSION_1_2
342      choke me
343    #endif], [HAVE_JAVA=yes],[HAVE_JAVA=no] )
344     AC_MSG_RESULT([$HAVE_JAVA])
345   fi
346   
347   # If user specified --with-java-include, fail if not found
348   # (If user didn't specify, then we gracefully disable things that
349   # require java.)
350   if test "x" != "x$java_include" && test "xyes" != "x$HAVE_JAVA"; then
351     AC_MSG_ERROR([working jni.h not found])
352   fi
353 fi
354
355 CFLAGS_save="$CFLAGS"
356 CXXFLAGS_save="$CXXFLAGS"
357 CPPFLAGS_save="$CPPFLAGS"
358 LDFLAGS_save="$LDFLAGS"
359 LIBS_save="$LIBS"
360
361 #---------------------------------------------------------------------
362 #
363 # Configure X11 and check for utility library
364 #
365 #---------------------------------------------------------------------
366 AC_LANG([C])
367
368 AC_PATH_X
369 HAVE_X11=no
370 X_INCLUDE=""
371 X_LIBS=""
372 CSF_XmuLibs_INCLUDES=""
373 CSF_XmuLibs_LIB=""
374 if test "xyes" != "x$no_x"; then
375   HAVE_X11=yes
376   if test "x" != "x$x_includes"; then
377     X_INCLUDE="-I$x_includes"
378     CSF_XmuLibs_INCLUDES="$X_INCLUDE"
379     CXXFLAGS="$CXXFLAGS -I$x_includes"
380   fi
381   if test "x" != "x$x_libraries"; then
382     X_LIBS="-L$x_libraries"
383     CSF_XmuLibs_LIB="$X_LIBS"
384     LDFLAGS="$LDFLAGS -L$x_libraries"
385   fi
386   AC_CHECK_LIB( [X11], [XCreateWindow], [X_LIBS="${X_LIBS} -lXt -lX11"], [HAVE_X11=no] )
387   AC_CHECK_HEADER( [X11/Xmu/Xmu.h], [], [HAVE_X11=no] )
388   AC_CHECK_LIB( [Xmu], [XmuLookupStandardColormap], [CSF_XmuLibs_LIB="$CSF_XmuLibs_LIB -lXmu"], [HAVE_X11=no], [-lXt -lX11] )
389 fi
390
391 #---------------------------------------------------------------------
392 #
393 # Check for OpenGL Libraries
394 #  
395 #  
396 #---------------------------------------------------------------------
397 CSF_OpenGlLibs_INCLUDES="$X_INCLUDE"
398 CSF_OpenGlLibs_LIB="$X_LIBS"
399 if test "xno" = "x$HAVE_X11"; then
400   HAVE_GL=no
401 else
402 AC_LANG([C])
403   HAVE_GL=yes
404   HAVE_GL_INC=yes
405   AC_CHECK_HEADER( [GL/gl.h], [AC_CHECK_HEADER([GL/glu.h],[],[HAVE_GL_INC=no])], [HAVE_GL_INC=no] )
406   if test "x$HAVE_GL_INC" = "xyes"; then
407     AC_CHECK_TYPE(_GLUfuncptr,[],[CSF_OpenGlLibs_INCLUDES="$CSF_OpenGlLibs_INCLUDES -DNOGLUfuncptr=1"],[#include "GL/glu.h"])
408   else
409     HAVE_GL=no
410     AC_MSG_NOTICE("Specify CPPFLAGS=-I<opengl_inc_dir> to enable OpenGL support")
411   fi
412   CPPFLAGS="$CSF_OpenGlLibs_INCLUDES $CPPFLAGS"
413   HAVE_GL_LIB=yes
414   AC_CHECK_LIB( [GL], [glClear], [AC_CHECK_LIB([GLU],[gluSphere],[CSF_OpenGlLibs_LIB="$CSF_OpenGlLibs_LIB -lGLU -lGL"],[HAVE_GL_LIB=no],[-lGL])], [HAVE_GL_LIB=no] )
415   if test "xno" = "x$HAVE_GL_LIB"; then
416     HAVE_GL=no
417     AC_MSG_NOTICE("Specify LDFLAGS=-L<opengl_lib_dir> to enable OpenGL support")
418   fi
419 fi
420 AM_CONDITIONAL( HAVE_GL, [test "xyes" = "x$HAVE_GL"] )
421
422 #---------------------------------------------------------------------
423 #
424 # Check for FREETYPE Libraries
425
426
427 #---------------------------------------------------------------------
428 AC_ARG_WITH([freetype],
429   [AC_HELP_STRING([--with-freetype=DIR],[Location of FREETYPE])],
430   [freetype="${withval}"],[freetype=yes])
431
432 CSF_FREETYPE_INCLUDES=""
433 CSF_FREETYPE_LIB=""
434 HAVE_FREETYPE=no
435
436 if test "xyes" = "x${HAVE_GL}"; then
437   AC_LANG([C++])
438   if test "xno" = "x${freetype}"; then
439     dnl freetype check is explicitly disabled by --without-freetype or --with-freetype=no
440     AC_MSG_NOTICE([freetype check is explicitly disabled])
441     DISABLE_FREETYPE_REASON="(freetype check was explicitly disabled)"
442   else
443     if test "xyes" = "x${freetype}" -o "x/usr" = "x${freetype}"; then
444       dnl try native freetype (default)
445       AC_MSG_NOTICE(try system freetype)
446       FREETYPE_INCLUDES="-I/usr/include/freetype2"
447       FREETYPE_LIBS="-lfreetype"
448       FREETYPE_OPT_INC="/usr/include/freetype2"
449       FREETYPE_OPT_LIB=
450     else
451       AC_MSG_NOTICE(try freetype in $freetype)
452       if test ! -d ${freetype}; then
453     DISABLE_FREETYPE_REASON="(${freetype} directory does not exists)"
454     AC_MSG_ERROR([${freetype} directory does not exists])
455       fi
456       FREETYPE_INCLUDES="-I${freetype}/include -I${freetype}/include/freetype2"
457       FREETYPE_LIBS="-L${freetype}/lib -lfreetype"
458       FREETYPE_OPT_INC="${freetype}/include:${freetype}/include/freetype2"
459       FREETYPE_OPT_LIB="${freetype}/lib"
460     fi
461     CPPFLAGS_old=${CPPFLAGS}
462     LDFLAGS_old=${LDFLAGS}
463     CPPFLAGS="${FREETYPE_INCLUDES} $CPPFLAGS"
464     LDFLAGS="${FREETYPE_LIBS} $LDFLAGS"
465     AC_CHECK_HEADER( [ft2build.h], [HAVE_FREETYPE_INC=yes], [HAVE_FREETYPE_INC=no] )
466     if test "x${HAVE_FREETYPE_INC}" = "xyes"; then
467       AC_CHECK_LIB(freetype, FT_Init_FreeType,
468       [
469     HAVE_FREETYPE=yes
470         CSF_FREETYPE_INCLUDES="${FREETYPE_INCLUDES}"
471     CSF_FREETYPE_LIB="${FREETYPE_LIBS}"
472         LIBS="$CSF_FREETYPE_LIB $LIBS"
473         CSF_OPT_INC="${FREETYPE_OPT_INC}:${CSF_OPT_INC}"
474         CSF_OPT_LIB="${FREETYPE_OPT_LIB}:${CSF_OPT_LIB}"
475       ],
476       [
477     DISABLE_FREETYPE_REASON="(freetype was not found)"
478     AC_MSG_ERROR([Unable to locate the required FreeType library])
479       ])
480     else
481       DISABLE_FREETYPE_REASON="(freetype was not found)"
482     fi
483     CPPFLAGS=${CPPFLAGS_old}
484     LDFLAGS=${LDFLAGS_old}
485   fi
486 else
487   DISABLE_FREETYPE_REASON="(freetype requires OpenGL support)"
488 fi
489 AM_CONDITIONAL( HAVE_FREETYPE, [test "xyes" = "x$HAVE_FREETYPE"] )
490
491 #---------------------------------------------------------------------
492 #
493 # Check for FTGL Libraries
494
495
496 #---------------------------------------------------------------------
497 AC_ARG_WITH([ftgl],
498   [AC_HELP_STRING([--with-ftgl=DIR],[Location of FTGL])],
499   [ftgl="${withval}"],[ftgl=yes])
500
501 CSF_FTGL_INCLUDES=""
502 CSF_FTGL_LIB=""
503 HAVE_FTGL=no
504
505 if test "xno" = "x${HAVE_FREETYPE}"; then
506   DISABLE_FTGL_REASON=$DISABLE_FREETYPE_REASON
507 else
508   AC_LANG([C++])
509   if test "xno" = "x${ftgl}"; then
510     dnl ftgl check is explicitly disabled by --without-ftgl or --with-ftgl=no
511     AC_MSG_NOTICE([ftgl check is explicitly disabled])
512     DISABLE_FTGL_REASON="(ftgl check was explicitly disabled)"
513   else
514     if test "xyes" = "x${ftgl}" -o "x/usr" = "x${ftgl}"; then
515       dnl try native ftgl (default)
516       ftgl=/usr
517       AC_MSG_NOTICE(try system ftgl)
518       FTGL_INCLUDES="-I/usr/include/FTGL"
519       FTGL_LIBS="-lftgl"
520       FTGL_OPT_INC="/usr/include/FTGL"
521       FTGL_OPT_LIB=
522     else
523       AC_MSG_NOTICE(try ftgl in ${ftgl})
524       if test ! -d ${ftgl}; then
525     DISABLE_FTGL_REASON="(${ftgl} directory does not exists)"
526     AC_MSG_ERROR([${ftgl} directory does not exists])
527       fi
528       FTGL_INCLUDES="-I${ftgl}/include -I${ftgl}/include/FTGL"
529       FTGL_LIBS="-L${ftgl}/lib -lftgl"
530       FTGL_OPT_INC="${ftgl}/include:${ftgl}/include/FTGL"
531       FTGL_OPT_LIB="${ftgl}/lib"
532     fi
533     for hf in ftgl.h FTGL.h; do
534       dnl check presence of ftgl header file in the specified directory
535       test -f ${ftgl}/include/FTGL/${hf} -o -f ${ftgl}/include/${hf} && HAVE_FTGL_INC=yes
536       test "xyes" = "x${HAVE_FTGL_INC}" -a "${hf}" = "FTGL.h" && HAVE_FTGL_UPPERCASE=-DHAVE_FTGL_UPPERCASE
537       test "xyes" = "x${HAVE_FTGL_INC}" && break
538     done
539     if test "xyes" = "x${HAVE_FTGL_INC}" ; then
540       CPPFLAGS_old=${CPPFLAGS}
541       LDFLAGS_old=${LDFLAGS}
542       CPPFLAGS="${FTGL_INCLUDES} ${HAVE_FTGL_UPPERCASE} ${CSF_FREETYPE_INCLUDES} $CPPFLAGS"
543       LDFLAGS="${FTGL_LIBS} ${CSF_FREETYPE_LIB} $LDFLAGS"
544       AC_CHECK_HEADERS([${hf}], 
545       [
546         HAVE_FTGL_INC=yes
547         break
548       ],
549       [
550         HAVE_FTGL_INC=no
551       ])
552       if test "x${HAVE_FTGL_INC}" = "xyes"; then
553         AC_MSG_CHECKING([for FTGLTextureFont in -lftgl])
554         CPPFLAGS="${FTGL_INCLUDES} ${HAVE_FTGL_UPPERCASE} ${CSF_FREETYPE_INCLUDES} ${CPPFLAGS_old}"
555         AC_TRY_LINK(
556         [
557           #ifdef HAVE_FTGL_UPPERCASE
558           #include <FTGL/FTGL.h>
559           #include <FTGL/FTGLTextureFont.h>
560           #else
561           #include <FTGL/ftgl.h>
562           #endif
563         ],
564         [
565           FTGLTextureFont font("");
566         ],
567         [
568           AC_MSG_RESULT(yes)
569           HAVE_FTGL=yes
570           CSF_FTGL_INCLUDES="${FTGL_INCLUDES} ${HAVE_FTGL_UPPERCASE}"
571           CSF_FTGL_LIB="${FTGL_LIBS}"
572           CSF_OPT_INC="${FTGL_OPT_INC}:${CSF_OPT_INC}"
573           CSF_OPT_LIB="${FTGL_OPT_LIB}:${CSF_OPT_LIB}"
574         ],
575         [
576           AC_MSG_RESULT(no)
577           DISABLE_FTGL_REASON="(ftgl was not found)"
578       AC_MSG_ERROR([Unable to locate the required ftgl library])
579         ]) 
580       else
581         DISABLE_FTGL_REASON="(ftgl was not found)"
582       fi
583       CPPFLAGS=${CPPFLAGS_old}
584       LDFLAGS=${LDFLAGS_old}
585     else
586       AC_MSG_RESULT([ftgl was not found])
587       DISABLE_FTGL_REASON="(ftgl was not found)"
588     fi
589   fi
590 fi
591 AM_CONDITIONAL( HAVE_FTGL, [test "xyes" = "x$HAVE_FTGL"] )
592
593 #---------------------------------------------------------------------
594 #
595 # Check for GL2PS Libraries
596 #  
597 #  
598 #---------------------------------------------------------------------
599 AC_ARG_WITH([gl2ps],
600   [AC_HELP_STRING([--with-gl2ps=DIR],[Location of GL2PS])],
601   [gl2ps="${withval}"],[gl2ps=])
602
603 if test "xno" = "xno$gl2ps"; then
604 # user specified --without-gl2ps
605   HAVE_GL2PS=no
606   DISABLE_GL2PS_REASON="(--with-gl2ps=DIR option was not defined)"
607 else
608   CSF_GL2PS_INCLUDES=""
609   CSF_GL2PS_LIB=""
610
611   if test "xno" = "x$HAVE_GL"; then
612         HAVE_GL2PS=no
613         DISABLE_GL2PS_REASON="(OpenGL  was not found)"
614   else
615         AC_LANG([C++])
616         HAVE_GL2PS=no
617         HAVE_GL2PS_INC=no
618         CPPFLAGS="-I$gl2ps/include $CPPFLAGS";
619         AC_CHECK_HEADER( [gl2ps.h], [HAVE_GL2PS_INC=yes], [HAVE_GL2PS_INC=no] )
620         if test ! -d $gl2ps; then
621            DISABLE_GL2PS_REASON="($gl2ps directory is not exists)"
622            AC_MSG_ERROR([$gl2ps directory is not exists])
623         elif test "x$HAVE_GL2PS_INC" = "xyes"; then
624            CSF_GL2PS_INCLUDES=""
625            CSF_OPT_INCLUDES="${CSF_OPT_INCLUDES} -I$gl2ps/include -DHAVE_GL2PS"
626            HAVE_GL2PS_LIB=yes
627            AC_MSG_CHECKING([for gl2psEndPage in -lgl2ps])
628            LDFLAGS="-L$gl2ps/lib $LDFLAGS"
629            LIBS="$CSF_OpenGlLibs_LIB $LIBS"
630            AC_CHECK_LIB( [gl2ps], [gl2psEndPage],
631            [
632                 CSF_GL2PS_LIB="-L$gl2ps/lib -lgl2ps"
633                 CSF_OPT_INC="$gl2ps/include:${CSF_OPT_INC}"
634                 CSF_OPT_LIB="$gl2ps/lib:${CSF_OPT_LIB}"
635                 HAVE_GL2PS_LIB=yes
636            ],
637            [
638                 HAVE_GL2PS_LIB=no
639            ])
640         fi
641         if test "xyes" = "x$HAVE_GL2PS_LIB"; then
642             HAVE_GL2PS=yes
643         else
644             HAVE_GL2PS=no
645             DISABLE_GL2PS_REASON="(gl2ps was not found)"
646         fi
647   fi
648 fi
649 AM_CONDITIONAL( HAVE_GL2PS, [test "xyes" = "x$HAVE_GL2PS"] )
650
651 #---------------------------------------------------------------------
652 #
653 # Check for FREEIMAGE Libraries and Includes
654 #  
655 #  
656 #---------------------------------------------------------------------
657 AC_ARG_WITH([freeimage],
658   [AC_HELP_STRING([--with-freeimage=DIR],[Location of freeimage])],
659   [freeimage="${withval}"],[freeimage=])
660
661 if test "xno" = "xno$freeimage"; then
662   # user specified --without-freeimage
663   HAVE_FREEIMAGE=no
664   DISABLE_FREEIMAGE_REASON="(--with-freeimage=DIR option was not defined)"
665 else
666   CSF_FreeImagePlus_INCLUDES=""
667   CSF_FreeImagePlus_LIB=""
668
669   AC_LANG([C++])
670   HAVE_FREEIMAGE=no
671   HAVE_FREEIMAGE_INC=yes
672   CPPFLAGS="-I$freeimage/include $CPPFLAGS";
673   AC_CHECK_HEADER( [FreeImage.h], [], [HAVE_FREEIMAGE_INC=no] )
674   if test ! -d $freeimage; then
675     DISABLE_FREEIMAGE_REASON="($freeimage directory is not exists)"
676     AC_MSG_ERROR([$freeimage directory is not exists])
677   elif test "x$HAVE_FREEIMAGE_INC" = "xyes"; then
678     CSF_FreeImagePlus_INCLUDES=""
679     CSF_OPT_INCLUDES="${CSF_OPT_INCLUDES} -I$freeimage/include -DHAVE_FREEIMAGE"
680     HAVE_FREEIMAGE_LIB=yes
681     AC_MSG_CHECKING([for FreeImage_OpenMemory in -lfreeimageplus])
682     LDFLAGS="-L$freeimage/lib $LDFLAGS"
683     LIBS="$CSF_FreeImagePlus_LIB $LIBS"
684     AC_CHECK_LIB( [freeimageplus], [FreeImage_OpenMemory],
685     [
686         HAVE_FREEIMAGE_LIB=yes;
687         CSF_OPT_INC="$freeimage/include:${CSF_OPT_INC}"
688         CSF_OPT_LIB="$freeimage/lib:${CSF_OPT_LIB}"
689         CSF_FreeImagePlus_LIB="-L$freeimage/lib -lfreeimageplus"
690     ], [HAVE_FREEIMAGE_LIB=no] )
691   fi
692   if test "xyes" = "x$HAVE_FREEIMAGE_LIB"; then
693     HAVE_FREEIMAGE=yes
694   else
695     HAVE_FREEIMAGE=no
696     DISABLE_FREEIMAGE_REASON="(freeimage was not found)"
697   fi
698 fi
699 AM_CONDITIONAL( HAVE_FREEIMAGE, [test "xyes" = "x$HAVE_FREEIMAGE"] )
700
701 #---------------------------------------------------------------------
702 #
703 # Check for TBB Includes
704 #  
705 #  
706 #---------------------------------------------------------------------
707 AC_ARG_WITH([tbb-include],
708   [AC_HELP_STRING([--with-tbb-include=DIR],[Location of Intel Threading Building Blocks includes])],
709   [tbb_inc="${withval}"],[tbb_inc=])
710
711 if test "xno" = "xno$tbb_inc"; then
712   # user specified --without-tbb-lib
713   HAVE_TBB=no
714   HAVE_TBB_INC=no
715   DISABLE_TBB_REASON_INC="(--with-tbb-include=DIR option was not defined)"
716 else
717   CSF_TBB_INCLUDES=""
718   AC_LANG([C++])
719   HAVE_TBB_INC=yes
720   if test ! -d $tbb_inc; then
721     DISABLE_TBB_REASON_INC="($tbb_inc directory is not exists)"
722     AC_MSG_ERROR([$tbb_inc directory is not exists])
723   elif test "x$tbb_inc" != "x"; then
724      CPPFLAGS="-I$tbb_inc $CPPFLAGS";
725   else
726      AC_MSG_NOTICE("--with-tbb-include key is not defined")
727   fi
728   AC_CHECK_HEADER( [tbb/tbb.h], [], [HAVE_TBB_INC=no] )
729   if test "x$HAVE_TBB_INC" != "xyes"; then
730      AC_MSG_NOTICE("Specify --with-tbb-include to enable TBB support")
731      DISABLE_TBB_REASON_INC="(tbb includes were not found)"
732   fi
733 fi
734
735 #---------------------------------------------------------------------
736 #
737 # Check for OpenCL SDK Includes
738 #  
739 #  
740 #---------------------------------------------------------------------
741 AC_ARG_WITH([opencl-include],
742   [AC_HELP_STRING([--with-opencl-include=DIR],[Location of OpenCL SDK includes])],
743   [opencl_inc="${withval}"],[opencl_inc=])
744
745 if test "xno" = "xno$opencl_inc"; then
746   # user specified --without-opencl-lib
747   HAVE_OPENCL=no
748   HAVE_OPENCL_INC=no
749   DISABLE_OPENCL_REASON_INC="(--with-opencl-include=DIR option was not defined)"
750 else
751   CSF_OPENCL_INCLUDES=""
752   AC_LANG([C++])
753   HAVE_OPENCL_INC=yes
754   if test ! -d $opencl_inc; then
755     DISABLE_OPENCL_REASON_INC="($opencl_inc directory is not exists)"
756     AC_MSG_ERROR([$opencl_inc directory is not exists])
757   elif test "x$opencl_inc" != "x"; then
758      CPPFLAGS="-I$opencl_inc $CPPFLAGS";
759   else
760      AC_MSG_NOTICE("--with-opencl-include key is not defined")
761   fi
762   # TODO: Add MacOS X specific header check
763   AC_CHECK_HEADER( [CL/cl.h], [], [HAVE_OPENCL_INC=no] )
764   if test "x$HAVE_OPENCL_INC" != "xyes"; then
765      AC_MSG_NOTICE("Specify --with-opencl-include to enable OpenCL support")
766      DISABLE_OPENCL_REASON_INC="(OpenCL includes were not found)"
767   fi
768 fi
769
770 #---------------------------------------------------------------------
771 #
772 # Check for VTK Includes
773 #  
774 #  
775 #---------------------------------------------------------------------
776 AC_ARG_WITH([vtk-include],
777   [AC_HELP_STRING([--with-vtk-include=DIR],[Location of VTK includes])],
778   [vtk_inc="${withval}"],[vtk_inc=])
779
780 if test "xno$vtk_inc" = "xno"; then
781   # user specified --without-vtk-lib
782   HAVE_VTK_INC=no
783   DISABLE_VTK_REASON="(--with-vtk-include=DIR option was not defined)"
784 else
785   CSF_VTK_INCLUDES=""
786   AC_LANG([C++])
787   HAVE_VTK_INC=yes
788   if test ! -d $vtk_inc; then
789     DISABLE_VTK_REASON="($vtk_inc directory does not exists)"
790     AC_MSG_ERROR([$vtk_inc directory does not exists])
791   elif test ! -f $vtk_inc/vtkVersion.h; then
792     DISABLE_VTK_REASON="(vtk headers are not found in $vtk_inc)"
793     AC_MSG_ERROR([vtk headers are not found in $vtk_inc])
794   elif test "x$vtk_inc" != "x"; then
795      CPPFLAGS="-I$vtk_inc $CPPFLAGS";
796   else
797      HAVE_VTK_INC=no
798      DISABLE_VTK_REASON="(--with-vtk-include=DIR option was not defined)"
799      AC_MSG_NOTICE("--with-vtk-include=DIR option was not defined")
800   fi
801 fi
802
803 #---------------------------------------------------------------------
804 #
805 # Check for TBB Libraries
806 #  
807 #  
808 #---------------------------------------------------------------------
809 AC_ARG_WITH([tbb-library],
810   [AC_HELP_STRING([--with-tbb-library=DIR],[Location of Intel Threading Building Blocks libraries])],
811   [tbb_lib="${withval}"],[tbb_lib=])
812
813 if test "xno" = "xno$tbb_lib"; then
814   # user specified --without-tbb
815   HAVE_TBB=no
816   DISABLE_TBB_REASON_LIB="(--with-tbb-library=DIR option was not defined)"
817 else
818   CSF_TBB_LIB=""
819   HAVE_TBB=yes
820
821   if test "x$HAVE_TBB_INC" = "xyes"; then
822      if test ! -d $tbb_lib; then
823         DISABLE_TBB_REASON_LIB="($tbb_lib directory is not exists)"
824         AC_MSG_ERROR([$tbb_lib directory is not exists])
825      elif test "x$tbb_lib" != "x"; then
826         LDFLAGS="-L$tbb_lib $LDFLAGS"
827      fi
828      AC_CHECK_LIB([tbb], [TBB_runtime_interface_version], [], [HAVE_TBB=no])
829   else
830      HAVE_TBB=no
831   fi
832
833   if test "x$HAVE_TBB" = "xyes"; then
834      if test "x$tbb_inc" != "x"; then
835       CSF_TBB_INCLUDES=""
836       CSF_OPT_INCLUDES="${CSF_OPT_INCLUDES} -I$tbb_inc -DHAVE_TBB"
837      else
838         HAVE_TBB=no
839      fi
840      if test "x$tbb_lib" != "x"; then
841        if test "x$enable_debug" = "xyes"; then
842         CSF_TBB_LIB="-L$tbb_lib -ltbb_debug -ltbbmalloc_debug"
843        else
844         CSF_TBB_LIB="-L$tbb_lib -ltbb -ltbbmalloc"
845        fi
846      else
847         HAVE_TBB=no
848      fi
849      if test "x$HAVE_TBB" = "xyes"; then
850         CSF_OPT_INC="$tbb_inc:${CSF_OPT_INC}"
851         CSF_OPT_LIB="$tbb_lib:${CSF_OPT_LIB}"
852      else
853         DISABLE_TBB_REASON="(tbb was not found)";
854      fi
855   else
856      AC_MSG_NOTICE("Specify --with-tbb-library to enable TBB support")
857      DISABLE_TBB_REASON_LIB="(tbb libraries were not found)"
858   fi
859 fi
860
861 AM_CONDITIONAL( HAVE_TBB, [test "xyes" = "x$HAVE_TBB"] )
862
863 #---------------------------------------------------------------------
864 #
865 # Check for OpenCL SDK Libraries
866 #  
867 #  
868 #---------------------------------------------------------------------
869 AC_ARG_WITH([opencl-library],
870   [AC_HELP_STRING([--with-opencl-library=DIR],[Location of OpenCL SDK libraries])],
871   [opencl_lib="${withval}"],[opencl_lib=])
872
873 if test "xno" = "xno$opencl_lib"; then
874   # user specified --without-opencl
875   HAVE_OPENCL=no
876   DISABLE_OPENCL_REASON_LIB="(--with-opencl-library=DIR option was not defined)"
877 else
878   CSF_OPENCL_LIB=""
879   HAVE_OPENCL=yes
880
881   if test "x$HAVE_OPENCL_INC" = "xyes"; then
882     if test ! -d $opencl_lib; then
883       DISABLE_OPENCL_REASON_LIB="($opencl_lib directory is not exists)"
884       AC_MSG_ERROR([$opencl_lib directory is not exists])
885     elif test "x$opencl_lib" != "x"; then
886       LDFLAGS="-L$opencl_lib $LDFLAGS"
887     fi
888     AC_CHECK_LIB(OpenCL, [clGetPlatformInfo], [], [HAVE_OPENCL=no])
889   else
890     HAVE_OPENCL=no
891   fi
892
893   if test "x$HAVE_OPENCL" = "xyes"; then
894     if test "x$opencl_inc" != "x"; then
895       CSF_OPENCL_INCLUDES=""
896       CSF_OPT_INCLUDES="${CSF_OPT_INCLUDES} -I$opencl_inc -DHAVE_OPENCL"
897     else
898       HAVE_OPENCL=no
899     fi
900     if test "x$opencl_lib" != "x"; then
901       CSF_OPENCL_LIB="-L$opencl_lib -lOpenCL"
902     else
903       HAVE_OPENCL=no
904     fi
905     
906     if test "x$HAVE_OPENCL" = "xyes"; then
907       CSF_OPT_INC="$opencl_inc:${CSF_OPT_INC}"
908       CSF_OPT_LIB="$opencl_lib:${CSF_OPT_LIB}"
909     else
910       DISABLE_OPENCL_REASON="(OpenCL was not found)";
911     fi
912   else
913     AC_MSG_NOTICE("Specify --with-opencl-library to enable OpenCL support")
914     DISABLE_OPENCL_REASON_LIB="(OpenCL libraries were not found)"
915   fi
916 fi
917
918 AM_CONDITIONAL( HAVE_OPENCL, [test "xyes" = "x$HAVE_OPENCL"] )
919
920 #---------------------------------------------------------------------
921 #
922 # Check for QT Libraries
923 #  
924 #  
925 #---------------------------------------------------------------------
926 AC_ARG_WITH([qt],
927   [AC_HELP_STRING([--with-qt=QTDIR],[Location of QT])],
928   [qt="${withval}"],[qt=])
929
930 if test "xno" = "xno$qt"; then
931 # user specified --without-qt
932   HAVE_QT=no
933   DISABLE_QT_REASON="(--with-qt=DIR option was not defined)"
934 else
935   CSF_QT_INCLUDES=""
936   CSF_QT_LIB=""
937
938   if test "xno" = "x$HAVE_GL"; then
939         HAVE_QT=no
940         DISABLE_QT_REASON="(OpenGL  was not found)"
941   else
942         AC_LANG([C++])
943         HAVE_QT=no
944         HAVE_QT_INC=no
945         CPPFLAGS="-I$qt/include/QtGui -I$qt/include/QtCore -I$qt/include/Qt -I$qt/include $CPPFLAGS"
946         AC_CHECK_HEADER( [Qt/qpixmap.h], [HAVE_QT_INC=yes], [HAVE_QT_INC=no] )
947         if test ! -d $qt; then
948            DISABLE_QT_REASON="($qt directory is not exists)"
949            AC_MSG_ERROR([$qt directory is not exists])
950         elif test "x$HAVE_QT_INC" = "xyes"; then
951            CSF_QT_INCLUDES="-I$qt/include/QtGui -I$qt/include/QtCore -I$qt/include/Qt -I$qt/include"
952            HAVE_QT_LIB=yes
953            AC_MSG_CHECKING([for connect in -lQtGui])
954            LDFLAGS="-L$qt/lib $LDFLAGS"
955            LIBS="$CSF_OpenGlLibs_LIB $LIBS"
956            AC_CHECK_LIB( [QtGui], [connect],
957            [
958                 CSF_QT_LIB="-L$qt/lib -lQtGui -lQtCore"
959                 CSF_OPT_INC="$qt/include/QtGui:$qt/include/QtCore:$qt/include/Qt:$qt/include:${CSF_OPT_INC}"
960                 CSF_OPT_LIB="$qt/lib:${CSF_OPT_LIB}"
961                 HAVE_QT_LIB=yes
962            ],
963            [
964                 HAVE_QT_LIB=no
965            ])
966         fi
967         if test "xyes" = "x$HAVE_QT_LIB"; then
968             HAVE_QT=yes
969         else
970             HAVE_QT=no
971             DISABLE_QT_REASON="(qt was not found)"
972         fi
973   fi
974 fi
975 AM_CONDITIONAL( HAVE_QT, [test "xyes" = "x$HAVE_QT"] )
976
977 AC_LANG([C])
978
979 CFLAGS="$CFLAGS_save"
980 CXXFLAGS="$CXXFLAGS_save"
981 CPPFLAGS="$CPPFLAGS_save"
982 LDFLAGS="$LDFLAGS_save"
983 LIBS="$LIBS_save"
984
985 AC_ARG_ENABLE([debug],
986               [AC_HELP_STRING([--enable-debug],[Debug Symbols])],
987               [enable_debug=${enableval}],[enable_debug=no])
988 AC_ARG_ENABLE([production],
989               [AC_HELP_STRING([--enable-production],[Optimized build (default)])],
990               [enable_prod=${enableval}],[enable_prod=])
991
992 # Enable production unless enable-default was specified
993 if test "x$enable_prod" = "x"; then
994   if test "x$enable_debug" != "xyes"; then
995     enable_prod=yes
996   fi
997 fi
998
999 if test "x$enable_prod" = "xyes"; then
1000   CFLAGS="$CFLAGS -O2"
1001   CXXFLAGS="$CXXFLAGS -O2"
1002 fi
1003 if test "x$enable_debug" = "xyes"; then
1004   CFLAGS="$CFLAGS -g"
1005   CXXFLAGS="$CXXFLAGS -g"
1006   CPPFLAGS="$CPPFLAGS -DDEB -D_DEBUG"
1007 else
1008   CPPFLAGS="$CPPFLAGS -DNDEBUG  -DNo_Exception"
1009 fi
1010
1011 #---------------------------------------------------------------------
1012 #
1013 # Check for VTK Libraries
1014 #  
1015 #  
1016 #---------------------------------------------------------------------
1017 AC_ARG_WITH([vtk-library],
1018   [AC_HELP_STRING([--with-vtk-library=DIR],[Location of VTK libraries])],
1019   [vtk_lib="${withval}"],[vtk_lib=])
1020
1021 if test "xno" = "xno$vtk_lib"; then
1022 # user specified --without-vtk
1023   HAVE_VTK=no
1024   if test "x$DISABLE_VTK_REASON" = "x" ; then
1025     DISABLE_VTK_REASON="(--with-vtk-library=DIR option was not defined)"
1026   fi
1027 else
1028   CSF_VTK_LIB=""
1029   HAVE_VTK=yes
1030
1031   #CPP_FLAGS="-I$vtk $CPPFLAGS"
1032   #AC_CHECK_HEADER( [Vtk/vtkConfigure.h], [HAVE_VTK_INC=yes], [HAVE_VTK_INC=no] )
1033   if test "x$HAVE_VTK_INC" = "xyes"; then
1034     if test ! -d $vtk_lib; then
1035       DISABLE_VTK_REASON="($vtk_lib directory does not exist)"
1036       AC_MSG_ERROR([$vtk_lib directory does not exist])
1037     elif test ! -f $vtk_lib/libvtkCommonCore-6.1.so; then
1038       DISABLE_VTK_REASON="(vtk libraries are not found in $vtk_lib)"
1039       AC_MSG_ERROR([vtk libraries are not found in $vtk_lib])
1040     elif test "x$vtk_lib" != "x" -a "x$vtk_inc" != "x"; then
1041       CSF_VTK_LIB="-L$vtk_lib -lvtkCommonCore-6.1 -lvtkCommonDataModel-6.1 -lvtkCommonExecutionModel-6.1 -lvtkCommonMath-6.1 -lvtkCommonTransforms-6.1 "
1042       CSF_VTK_LIB="${CSF_VTK_LIB} -lvtkRenderingCore-6.1 -lvtkRenderingOpenGL-6.1  -lvtkFiltersGeneral-6.1 -lvtkIOCore-6.1 -lvtkIOImage-6.1 -lvtkImagingCore-6.1 -lvtkInteractionStyle-6.1 "
1043       CSF_OPT_INC="$vtk_inc:${CSF_OPT_INC}"
1044       CSF_OPT_LIB="$vtk_lib:${CSF_OPT_LIB}"
1045       CSF_OPT_INCLUDES="${CSF_OPT_INCLUDES} -I$vtk_inc -DHAVE_VTK"
1046     else
1047       HAVE_VTK=no
1048       AC_MSG_NOTICE("--with-vtk-library=DIR option was not defined")
1049       DISABLE_VTK_REASON="(--with-vtk-library=DIR option was not defined)"
1050     fi
1051   else
1052     HAVE_VTK=no
1053   fi
1054 fi
1055
1056 #CSF_VTK="$CSF_VTK_LIB"
1057 AM_CONDITIONAL( HAVE_VTK, [test "xyes" = "x$HAVE_VTK"] )
1058
1059 #----------------------------------------------------------------------
1060 #
1061 # Enalbe/Disable Modules
1062 #
1063 #----------------------------------------------------------------------
1064 __ENABLEMODULES__
1065 # Process options from above.  The behavior we want is:
1066 #
1067 # ENABLE_X = yes : User specified --enable-x 
1068 #                  print informative error and exit if it cannot be built
1069 #
1070 # ENABLE_X = no :  User specified --disable-x (or --enable-x=no)
1071 #                  silently disable building of component
1072 #
1073 # ENABLE_X =     : User didn't specify either way
1074 #                  Build if possible.  Warn if it cannot be build
1075 #                  because of some missing system requirement.  Inform
1076 #                  if disabled because some other required component 
1077 #                  was disabled.
1078 __CONFMODULES__
1079 # Convert to automake conditional values
1080 __CONDMODULES__
1081 #----------------------------------------------------------------------
1082 #
1083 # Write Output Files
1084 #
1085 #----------------------------------------------------------------------
1086
1087
1088 AC_SUBST(CPPFLAGS)
1089 CXXCPPFLAGS="$CPPFLAGS"
1090 AC_SUBST(CXXCPPFLAGS)
1091 AC_SUBST(CFLAGS)
1092 AC_SUBST(CXXFLAGS)
1093 AC_SUBST(LIBS)
1094 AC_SUBST(LDFLAGS)
1095
1096
1097 CSF_XwLibs_LIB="$X_LIBS"
1098 CSF_MotifLibs_LIB="$X_LIBS"
1099
1100 AC_SUBST(CSF_SOCKETLibs_LIB)
1101 AC_SUBST(CSF_FPELibs_LIB)
1102 AC_SUBST(CSF_OpenGlLibs_INCLUDES)
1103 AC_SUBST(CSF_OpenGlLibs_LIB)
1104 AC_SUBST(HAVE_FREETYPE)
1105 AC_SUBST(CSF_FREETYPE_INCLUDES)
1106 AC_SUBST(CSF_FREETYPE_LIB)
1107 AC_SUBST(HAVE_FTGL)
1108 AC_SUBST(CSF_FTGL_INCLUDES)
1109 AC_SUBST(CSF_FTGL_LIB)
1110 AC_SUBST(HAVE_GL2PS)
1111 AC_SUBST(CSF_GL2PS_INCLUDES)
1112 AC_SUBST(CSF_GL2PS_LIB)
1113 AC_SUBST(HAVE_FREEIMAGE)
1114 AC_SUBST(CSF_FreeImagePlus_INCLUDES)
1115 AC_SUBST(CSF_FreeImagePlus_LIB)
1116 AC_SUBST(CSF_advapi32_LIB)
1117 AC_SUBST(CSF_gdi32_LIB)
1118 AC_SUBST(CSF_user32_LIB)
1119 AC_SUBST(CSF_wsock32_LIB)
1120 AC_SUBST(CSF_XwLibs_LIB)
1121 AC_SUBST(CSF_MotifLibs_LIB)
1122 AC_SUBST(CSF_XmuLibs_LIB)
1123 AC_SUBST(CSF_XmuLibs_INCLUDES)
1124 AC_SUBST(HAVE_TBB)
1125 AC_SUBST(CSF_TBB_INCLUDES)
1126 AC_SUBST(CSF_TBB_LIB)
1127 AC_SUBST(HAVE_OPENCL)
1128 AC_SUBST(CSF_OPENCL_INCLUDES)
1129 AC_SUBST(CSF_OPENCL_LIB)
1130 AC_SUBST(HAVE_QT)
1131 AC_SUBST(CSF_QT_INCLUDES)
1132 AC_SUBST(CSF_QT_LIB)
1133 AC_SUBST(HAVE_VTK)
1134 AC_SUBST(CSF_VTK_INCLUDES)
1135 AC_SUBST(CSF_VTK_LIB)
1136
1137 AC_SUBST(CSF_OPT_INC)
1138 AC_SUBST(CSF_OPT_LIB)
1139 AC_SUBST(CSF_OPT_BIN)
1140
1141 echo
1142 echo "CC       = $CC"
1143 echo "CXX      = $CXX"
1144 echo "CFLAGS   = $CFLAGS"
1145 echo "CXXFLAGS = $CXXFLAGS"
1146 echo "CPPFLAGS = $CPPFLAGS"
1147 echo "LDFLAGS  = $LDFLAGS"
1148 echo 
1149 echo "3rdparty mandatory products       "
1150 echo "---------------------------------"
1151 echo "freetype      : $HAVE_FREETYPE $DISABLE_FREETYPE_REASON"
1152 echo "tcltk         : $HAVE_TCLTK $DISABLE_TCLTK_REASON"
1153 echo
1154 echo "3rdparty optional products       "
1155 echo "---------------------------------"
1156 echo "gl2ps         : $HAVE_GL2PS $DISABLE_GL2PS_REASON"
1157 echo "freeimage     : $HAVE_FREEIMAGE $DISABLE_FREEIMAGE_REASON"
1158 echo "tbb includes  : $HAVE_TBB_INC $DISABLE_TBB_REASON_INC"
1159 echo "tbb libraries : $HAVE_TBB $DISABLE_TBB_REASON_LIB"
1160 echo "opencl        : $HAVE_OPENCL $DISABLE_OPENCL_REASON"
1161 echo "qt            : $HAVE_QT $DISABLE_QT_REASON"
1162 echo "vtk           : $HAVE_VTK $DISABLE_VTK_REASON"
1163 echo
1164 echo "Component                   Build"
1165 echo "--------------------------  -----"
1166 __REPMODULES__
1167 echo
1168
1169 AC_OUTPUT([Makefile adm/lin/amk/Makefile custom.sh \
1170 __ACCONFMODULES__])