root/juggler/tags/1.0_beta_1/configure.in

Revision 1027, 32.2 kB (checked in by patrick, 9 years ago)

When determining whether or not to build Performer, we look for pf.h,
not pfChannel.h as the warning message states if pf.h is not found. This
gets the message right.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 dnl # -------------------------------------------------------------------------
2 dnl # Base configure.in for VR Juggler.
3 dnl # $Date$
4 dnl # -------------------------------------------------------------------------
5 dnl # This file is "compiled" by GNU autoconf to generate the configure script
6 dnl # that is actually run.
7 dnl # -------------------------------------------------------------------------
8
9 AC_REVISION($Revision$)
10 AC_INIT(Config/vjChunkDesc.cpp)
11 AC_CONFIG_HEADER(vjDefines.h)
12
13 dnl # -------------------------------------------------------------------------
14 dnl # Command-line arguments (--enable-option, --with-pkg=package_name).
15 dnl # -------------------------------------------------------------------------
16
17 dnl # -------------------------------------------- #
18 dnl # --with-pkg[=arg] and --without-pkg arguments #
19 dnl # -------------------------------------------- #
20
21 dnl # Enable binary format.  Possible values are "O32", "N32" or "64".
22 dnl # The default is "N32".
23 AC_ARG_WITH(abi,
24             [  --with-abi=[O32|N32_M3|N32_M4|64_M3|64_M4|HP|AOUT_i386|ELF_i386]
25                           define the Application Binary Interface to use
26                           [default=N32_M3]],
27             _abi_type="$withval", _abi_type='N32_M3')
28
29 dnl # Define the location where the library will be built.  This is not
30 dnl # currently used anyhwere in this script.
31 dnl # The default is "$srcdir/lib".
32 AC_ARG_WITH(builddir,
33             [  --with-builddir=[PATH]
34                           define the location where the library will be built
35                           [default=\$srcdir/lib]],
36             _vj_builddir="$withval")
37
38 dnl # Define which threading model to use.  Possible values are "SGI_IPC" or
39 dnl # "POSIX".
40 dnl # The default is "SGI_IPC".
41 AC_ARG_WITH(threads,
42             [  --with-threads=[SGI_IPC|POSIX]
43                           define thread package [default=SGI_IPC]],
44             _thread_pkg="$withval", _thread_pkg='SGI_IPC')
45
46 dnl # Define the root directory for the Java installation.
47 dnl # The default is /usr/java.
48 _JDK_HOME_DEFAULT="/usr/java"
49 _JDK_HOME_ALT_LIST="/usr/local/java"
50 AC_ARG_WITH(jdkhome,
51             [  --with-jdkhome=[PATH]  JDK installation directory [default=/usr/java]],
52             JDK_HOME="$withval", JDK_HOME="${_JDK_HOME_DEFAULT}")
53
54 dnl # Define the root directory for the Performer installation.
55 dnl # The default is /usr.
56 AC_ARG_WITH(pfroot,
57             [  --with-pfroot=[PATH]    Performer installation directory [default=/usr]],
58             PFROOT="$withval", PFROOT='/usr')
59
60 dnl # Define the root directory for the OpenGL installation.
61 dnl # The default is /usr.
62 AC_ARG_WITH(oglroot,
63             [  --with-oglroot=[PATH]   OpenGL installation directory [default=/usr]],
64             OGLROOT="$withval", OGLROOT='/usr')
65
66 dnl # ------------------------------------------------------ #
67 dnl # --enable-feature[=arg] and --disable-feature arguments #
68 dnl # ------------------------------------------------------ #
69
70 dnl # Enable compilation of the OpenGL API.  Possible values are "yes" or
71 dnl # "no".  "yes" is set with --enable-gl-api and "no" is set with
72 dnl # --disable-gl-api.
73 dnl # The default is "yes".
74 AC_ARG_ENABLE(gl-api,
75               [  --enable-gl-api         use OpenGL API [default=yes]],
76               _enable_gl_api="$enableval", _enable_gl_api='yes')
77
78 dnl # Enable compilation of the Performer API.  Possible values are "yes" or
79 dnl # "no".  "yes" is set with --enable-pf-api and "no" is set with
80 dnl # --disable-pf-api.
81 dnl # The default is "yes".
82 AC_ARG_ENABLE(pf-api,
83               [  --enable-pf-api         use Perfromer API [default=yes]],
84               _enable_pf_api="$enableval", _enable_pf_api='yes')
85
86 dnl # Enable performance testing.  Values that enable it are as follows:
87 dnl #
88 dnl #      SGI: Enable SGI IPC performance testing.  This defines
89 dnl #           VJ_PERFORMANCE to be VJ_PERF_SGI
90 dnl #    POSIX: Enable POSIX threads performance testing.  This defines
91 dnl #           VJ_PERFORMANCE to be VJ_PERF_POSIX
92 dnl #
93 dnl # Values that disable it are "no" or "NONE".  The default is "SGI".
94 AC_ARG_ENABLE(performance,
95               [  --enable-performance=[SGI|POSIX|NONE]
96                           enable performance testing [default=SGI] ],
97               [ if test "x$enableval" = "xyes" ; then
98                     _enable_perf='SGI'
99                 elif test "x$enableval" = "xno" ; then
100                     _enable_perf='NONE'
101                 else
102                     _enable_perf="$enableval"
103                 fi
104               ], _enable_perf='SGI')
105
106 dnl # Set default values for these before checking $abi_type.  Currently,
107 dnl # these are for non-SGI platforms.
108 ABI='32'
109 LIBBITSUF=''
110
111 dnl # Based on the value of $abi_type, set $ABI for later use and the Makefile
112 dnl # substitution variables $LIBBITSUF and $ISA.
113 case "x$_abi_type" in
114     x64_M3)
115         ABI='64'
116         ISA='mips3'
117         LIBBITSUF='64'
118         _EXTRA_FLAGS='-64 -mips3'
119         ;;
120     x64_M4)
121         ABI='64'
122         ISA='mips4'
123         LIBBITSUF='64'
124         _EXTRA_FLAGS='-64 -mips4'
125         ;;
126     xN32_M3)
127         ABI='N32'
128         ISA='mips3'
129         LIBBITSUF='32'
130         _EXTRA_FLAGS='-n32 -mips3'
131         ;;
132     xN32_M4)
133         ABI='N32'
134         ISA='mips4'
135         LIBBITSUF='32'
136         _EXTRA_FLAGS='-n32 -mips4'
137         ;;
138     xO32)
139         ABI='O32'
140         ISA='mips2'
141         LIBBITSUF=''
142         _EXTRA_FLAGS='-o32 -mips2'
143         ;;
144     xHP)
145         ABI=''
146         ISA=''
147         LIBBITSUF=''
148         _EXTRA_FLAGS=''
149         ;;
150     xAOUT_i386)
151         ABI='AOUT'
152         ISA='i386'
153         LIBBITSUF=''
154         _EXTRA_FLAGS='-aout'
155         ;;
156     xELF_i386)
157         ABI='ELF'
158         ISA='i386'
159         LIBBITSUF=''
160         _EXTRA_FLAGS='-elf'
161         ;;
162 esac
163
164 dnl # -------------------------------------------------------------------------
165 dnl # System-dependent stuff.
166 dnl # -------------------------------------------------------------------------
167 AC_CANONICAL_HOST
168
169 dnl # Operating system release information.  This may contain anything and
170 dnl # should be treated as a string.
171 _OS_REL_STR=`uname -r`
172
173 dnl # Operating system version number only (any miscellaneous text is
174 dnl # stripped).  This will only contain a number and can be treated as a
175 dnl # float-point value.
176 dnl # NOTE: It is currently not used in config.h.
177 _OS_REL_NUM=`uname -r | sed -e 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\)[^0-9]*$/\1/'`
178
179 dnl # Major and minor version numbers from ${_OS_REL_NUM} separated for use
180 dnl # with the C preprocessor.  Using cut(1) is kind of a hack, but at least
181 dnl # it's a clean one.
182 _OS_REL_NUM_MAJOR=`echo "${_OS_REL_NUM}" | cut -f1 -d'.'`
183 _OS_REL_NUM_MINOR=`echo "${_OS_REL_NUM}" | cut -f2 -d'.'`
184
185 dnl # These are used on all platforms.
186 AC_DEFINE_UNQUOTED(VJ_OS_RELEASE, "${_OS_REL_STR}")
187 AC_DEFINE_UNQUOTED(VJ_OS_RELEASE_MAJOR, ${_OS_REL_NUM_MAJOR})
188 AC_DEFINE_UNQUOTED(VJ_OS_RELEASE_MINOR, ${_OS_REL_NUM_MINOR})
189
190 AR=''                   dnl # Archive library command (generally ar(1))
191 ARFLAGS=''              dnl # Flags for $AR
192 LD=''                   dnl # Shared library command (usually ld(1))
193 LDOPTS=''               dnl # More options for shared library generator
194 SHAREDLIB_EXT=''        dnl # Extension for shared libraries (usually 'so')
195
196 DBG_FLAGS=''            dnl # Compiler debugging flags
197 OPT_FLAGS=''            dnl # Compiler optimization flags
198
199 DSOREGFILE=''
200 DSOVERSION=''
201 DSOVERSIONOPTS=''
202 ABI_LIST=''             dnl # List of supported ABIs on a given platform
203 PLATFORM=''             dnl # Platform name
204
205 dnl # Depending on the host operating system, set various command options and
206 dnl # such.
207 case $host_os in
208     dnl # SGI running IRIX [56].*.
209     irix*)
210         dnl # Set compiler flags and the location of $DSOREGFILE depending on
211         dnl # $ABI.
212         if test "$ABI" = "64" ; then
213             DSOREGFILE='/usr/lib64/so_locations'
214             OPT_FLAGS='-OPT:Olimit=0'
215         elif test "$ABI" = "N32" ; then
216             DSOREGFILE='/usr/lib32/so_locations'
217             OPT_FLAGS='-OPT:Olimit=0'
218         elif test "$ABI" = "O32" ; then
219             DSOREGFILE='/usr/lib/so_locations'
220             OPT_FLAGS='-Olimit 0'
221         fi
222
223         AR='${CXX}'
224         ARFLAGS='-J6 -ar -WR,-v -o'
225         CFLAGS="$CFLAGS"
226         CXXFLAGS="-ptv $CXXFLAGS"
227         DBG_FLAGS="-g -gslim"
228         INCLUDES="$INCLUDES -I/usr/include/CC -I/usr/include"
229         LD='${CXX} -shared'
230         LDFLAGS="$LDFLAGS"
231         _LD_REGOPTS='-check_registry ${DSOREGFILE}'
232         LDOPTS="$LDOPTS -all ${_LD_REGOPTS} -elf -rdata_shared"
233         SHAREDLIB_EXT='so'
234
235         DSOVERSION='sgi4.0'
236         DSOVERSIONOPTS='-set_version ${DSOVERSION}'
237
238         ABI_LIST='64_M4 64_M3 N32_M4 N32_M3'
239         PLATFORM='SGI'
240
241         AC_DEFINE(VJ_OS_SGI,)
242         AC_DEFINE(_BSD_TYPES,)
243         AC_DEFINE(_OLD_TERMIOS,)
244
245         if test ${_OS_REL_NUM_MAJOR} -lt 6 ; then
246             AC_DEFINE(IRIXREL, "IRIX5")
247         else
248             AC_DEFINE(IRIXREL, "IRIX6")
249         fi
250         ;;
251     dnl # HP PA-RISC machine running HP-UX 10.20.
252     hpux10.20)
253         AR='ar'
254         ARFLAGS='r'
255         CFLAGS="-Aa $CFLAGS"
256         CXXFLAGS="+p $CXXFLAGS"
257         LD='ld'
258         LDFLAGS="$LDFLAGS -L/usr/lib/X11R6"
259         LDOPTS='-b'
260         DBG_FLAGS='-g'
261         OPT_FLAGS='+inline_level 3'
262         SHAREDLIB_EXT='sl'
263
264         dnl # We have to use POSIX threads on HP-UX.
265         if test "x${_thread_pkg}" != "xPOSIX" ; then
266             AC_MSG_WARN(*** POSIX threads must be used on $host ***)
267             _thread_pkg='POSIX'
268         fi
269
270         AC_DEFINE(VJ_OS_HPUX,)
271         AC_DEFINE(_HPUX_SOURCE,)
272         AC_DEFINE(_INCLUDE_TERMIO,)
273         AC_DEFINE(_CMA_NOWRAPPERS_,)
274         AC_DEFINE(notdef,)
275         ABI_LIST=''
276         PLATFORM='HP'
277         ;;
278     dnl # DEC Alpha running Digital UNIX 4.0.
279     osf4.0)
280         AC_DEFINE(VJ_OS_DUX,)
281         PLATFORM='alpha-DUX'
282         ;;
283     dnl # A machine running FreeBSD.  Currently only i386 is supported.
284     freebsd*)
285         if test "$ABI" != "ELF" -a "$ABI" != "AOUT" ; then
286             if test -x "/usr/bin/objformat" ; then
287                 _binfmt=`/usr/bin/objformat`
288
289                 if test "$_binfmt" = "elf" ; then
290                     ABI="ELF"
291                     LIBBITSUF=''
292                     _EXTRA_FLAGS='-elf'
293                 else
294                     ABI="AOUT"
295                     LIBBITSUF=''
296                     _EXTRA_FLAGS='-aout'
297                 fi
298             else
299                 ABI="AOUT"
300                 LIBBITSUF=''
301                 _EXTRA_FLAGS='-aout'
302             fi
303         fi
304
305         AR='ar -r'
306         INCLUDES="$INCLUDES -I/usr/include"
307         LD='${CXX} -shared'
308         LDOPTS=''
309         OPT_FLAGS='-O2'
310         SHAREDLIB_EXT='so'
311
312         AC_DEFINE(VJ_OS_FreeBSD,)
313         ISA='i386'
314         ABI_LIST='AOUT ELF'
315         PLATFORM='FreeBSD'
316         ;;
317     dnl # A machine running Linux.  Currently only i386 is supported.
318     linux*)
319         AR='ar -r'
320         INCLUDES="$INCLUDES -I/usr/include"
321         LD='${CXX} -shared'
322         LDOPTS=''
323         OPT_FLAGS='-O2'
324         SHAREDLIB_EXT='so'
325
326         dnl # We have to use POSIX threads on Linux.
327         if test "x${_thread_pkg}" != "xPOSIX" ; then
328             AC_MSG_WARN(*** POSIX threads must be used on $host ***)
329             _thread_pkg='POSIX'
330         fi
331
332         AC_DEFINE(VJ_OS_Linux,)
333         ABI='ELF'
334         ISA='i386'
335         ABI_LIST='ELF'
336         LIBBITSUF=''
337         _EXTRA_FLAGS=''
338         PLATFORM='Linux'
339         ;;
340     dnl # Unkown operating system (to config.guess).
341     unknown)
342         AC_DEFINE(VJ_OS_GENERIC,)
343         PLATFORM='UNKNOWN'
344         ;;
345 esac
346
347 dnl # --------------------------------------------------------------------
348 dnl # Depending on host type and the value in ${_enable_perf}, define the
349 dnl # settings for the performance code.
350 dnl # --------------------------------------------------------------------
351 if test "$PLATFORM" != "SGI" -a "${_enable_perf}" != "NONE" ; then
352     _enable_perf='POSIX'
353 fi
354
355 dnl # Define unique values for each type of performance testing option.
356 dnl # Only one of these may be used for the value to which VJ_PERFORMANCE
357 dnl # is set.
358 AC_DEFINE(VJ_PERF_NONE, 0)
359 AC_DEFINE(VJ_PERF_SGI, 1)
360 AC_DEFINE(VJ_PERF_POSIX, 2)
361
362 dnl # Define VJ_PERFORMANCE based on ${_enable_perf}.  Default to
363 dnl # VJ_PERF_SGI if ${_enable_perf} has some unknown value.
364 if test "x${_enable_perf}" = "xSGI" ; then
365     AC_DEFINE(VJ_PERFORMANCE, VJ_PERF_SGI)
366 elif test "x${_enable_perf}" = "xPOSIX" ; then
367     AC_DEFINE(VJ_PERFORMANCE, VJ_PERF_POSIX)
368 elif test "x${_enable_perf}" = "xNONE" ; then
369     AC_DEFINE(VJ_PERFORMANCE, VJ_PERF_NONE)
370 else
371     AC_DEFINE(VJ_PERFORMANCE, VJ_PERF_SGI)
372 fi
373
374 dnl # -------------------------------------------------------------------------
375 dnl # Checks for programs.
376 dnl # -------------------------------------------------------------------------
377
378 _vjsave_CFLAGS="$CFLAGS"
379 _vjsave_CXXFLAGS="$CXXFLAGS"
380
381 dnl # On HP-UX, we have to use the aCC C++ compiler.
382 if test "$PLATFORM" = "HP" ; then
383     AC_CHECK_PROG(CXX, aCC, aCC,
384         AC_MSG_ERROR(*** The library requires the HP-UX aCC C++ compiler ***))
385 dnl # On IRIX, we have to use cc and CC (not gcc or g++).
386 elif test "$PLATFORM" = "SGI" ; then
387     AC_CHECK_PROG(CC, cc, cc,
388         AC_MSG_ERROR(*** The library requires the IRIX cc C compiler ***))
389     AC_CHECK_PROG(CXX, CC, CC,
390         AC_MSG_ERROR(*** The library requires the IRIX CC C++ compiler ***))
391 fi
392
393 CFLAGS="$CFLAGS ${_EXTRA_FLAGS}"
394 CXXFLAGS="$CXXFLAGS ${_EXTRA_FLAGS}"
395
396 AC_PROG_CC
397 AC_PROG_CXX
398
399 dnl # On FreeBSD, we need to use egcs 1.1.2-release or newer for the C and C++
400 dnl # compilers (especially for C++).
401 if test "$PLATFORM" = "FreeBSD" ; then
402     AC_CACHE_CHECK(if $CC is egcs 1.1.2 or newer,
403         ac_cv_CC_is_egcs,
404         [ _val=`$CC -v 2>&1 | grep -e '^gcc version' | cut -f4 -d' '` ;
405           if test $_val -ge 19990314 ; then
406               ac_cv_CC_is_egcs='yes' ;
407           else
408               ac_cv_CC_is_egcs='no' ;
409           fi
410         ])
411
412     dnl # If the $CC binary is not egcs 1.1.2 or newer, check for egcc.  If
413     dnl # it exists, we will assume that it is new enough.
414     if test $ac_cv_CC_is_egcs = 'no' ; then
415         AC_CHECK_PROG(CC, egcc, egcc,
416             AC_MSG_ERROR(*** The library requires the egcc C compiler ***))
417         AC_CHECK_PROG(CXX, eg++, eg++,
418             AC_MSG_ERROR(*** The library requires the eg++ C++ compiler ***))
419     fi
420 fi
421
422 AC_PROG_CPP
423 AC_PROG_CXXCPP
424
425 CFLAGS="${_vjsave_CFLAGS}"
426 CXXFLAGS="${_vjsave_CXXFLAGS}"
427
428 dnl # Check for the JDK (specifically try to find javac(1) in $JDK_HOME).
429 JAVAC=''
430 JAR=''
431
432 _jdk_path_extra=`echo ${_JDK_HOME_ALT_LIST} | sed -e 's/ /\/bin:/g'`
433 AC_PATH_PROG(JAVAC, javac, no, $PATH:${JDK_HOME}/bin:${_jdk_path_extra})
434
435 dnl # If there is still no value in $JAVAC, then warn that the GUI will not be
436 dnl # built.
437 if test "$JAVAC" = "no" ; then
438     AC_MSG_WARN(*** The GUI requires javac -- it will not be built ***)
439     BUILD_GUI='N'
440 dnl # Otherwise, set $JAR to the path to jar(1) and continue.
441 else
442     JAR="${JDK_HOME}/bin/jar"
443     BUILD_GUI='Y'
444 fi
445
446 AC_PROG_INSTALL
447
448 dnl # Ensure that a version of Perl greater than or equal to 5.004 is
449 dnl # available.
450 chkPerl ( ) {
451     if test -x "$1" ; then
452         retval=`$1 -e 'printf("%s\n", (($] >= 5.004) ? 0 : 1))'`
453     else
454         retval=1
455     fi
456
457     echo $retval
458 }
459
460 _PERL_PATH='/usr/local/bin /usr/bin'
461 AC_CACHE_CHECK(for Perl version >= 5.004,
462                ac_cv_perl_version,
463                [ ac_cv_perl_version='no' ;
464                  for _dir in ${_PERL_PATH} ; do
465                      if eval "test \"`chkPerl ${_dir}/perl`\" -eq 0" ; then
466                          ac_cv_perl_version="${_dir}/perl"
467                          break
468                      elif eval "test \"`chkPerl ${_dir}/perl5`\" -eq 0" ; then
469                          ac_cv_perl_version="${_dir}/perl5"
470                          break
471                      fi
472                  done
473                ])
474
475 PERL="$ac_cv_perl_version"
476
477 AC_CHECK_PROG(MTREE_CMD, mtree, mtree, \${PERL} \${scriptdir}/mtree.pl)
478 AC_PROG_MAKE_SET
479 dnl # AC_PROG_RANLIB
480
481 dnl # -------------------------------------------------------------------------
482 dnl # Checks for libraries.
483 dnl # -------------------------------------------------------------------------
484
485 THREADS=''
486
487 dnl # Test for libpthread or for libcma if libpthread is not present.
488 dnl # If the library is found, check for pthread_kill().  If it is present,
489 dnl # Draft 10 (the "final" draft) of the POSIX threads standard is in place.
490 dnl # If not, Draft 4 is available.
491 if test "x${_thread_pkg}" = "xPOSIX" ; then
492     AC_CHECK_LIB(pthread, pthread_create,
493         AC_CHECK_HEADER(pthread.h,
494             [ THREADS='POSIX'; LIBS="$LIBS -lpthread"; ],
495             AC_MSG_WARN(*** POSIX threads will not be used (header file not found) ***)))
496
497     dnl # On HP-UX 10.20, the pthreads library is in the cma library rather
498     dnl # than pthreads, so test for that if $THREADS was not set above.
499     if test -z "$THREADS" ; then
500         AC_CHECK_LIB(cma, pthread_create,
501             AC_CHECK_HEADER(pthread.h,
502                 [ THREADS='POSIX'; LIBS="$LIBS -lcma"; ],
503                 AC_MSG_WARN(*** POSIX threads will not be used (header file not found) ***)))
504     fi
505
506     dnl # On FreeBSD, the pthreads stuff is in libc_r.
507     if test -z "$THREADS" ; then
508         _vjsave_CFLAGS="$CFLAGS"
509         CFLAGS="$CFLAGS -pthread"
510
511         AC_CHECK_LIB(c_r, pthread_create,
512             AC_CHECK_HEADER(pthread.h,
513                 [ THREADS='POSIX';
514                   CXXFLAGS="$CXXFLAGS -pthread" ;
515                   LIBS="$LIBS -lc_r";
516                 ],
517                 [ CFLAGS="$_vjsave_CFLAGS" ;
518                   AC_MSG_WARN(*** POSIX threads will not be used (header file not found) ***)
519                 ]))
520     fi
521
522     dnl # If $THREADS is equal to "POSIX" at this point, then the pthread
523     dnl # libraries needed are in $LIBS, so now we make a check for the draft
524     dnl # revision being used.  This is done by determining if pthread_kill()
525     dnl # is in the library.  If it is, Draft 10 is in use.  Otherwise, assume
526     dnl # it is Draft 4.
527     if test "$THREADS" = "POSIX" ; then
528         AC_CACHE_CHECK(POSIX threads draft revision,
529             ac_cv_pthread_version,
530             AC_TRY_LINK([ #include <pthread.h> ],
531                 [ pthread_t t; pthread_kill(t, 1); ],
532                 ac_cv_pthread_version='Draft 10',
533                 ac_cv_pthread_version='Draft 4'))
534
535         if test "$ac_cv_pthread_version" = "Draft 10" ; then
536             AC_DEFINE(_PTHREADS_DRAFT_10,)
537         else
538             AC_DEFINE(_PTHREADS_DRAFT_4,)
539         fi
540
541         dnl # Define the default thread scope depending on the platform.  On
542         dnl # IRIX, only process scope is avaiable.  Other systems may support
543         dnl # system scope.
544         if test "$PLATFORM" = "SGI" ; then
545             AC_DEFINE(VJ_THREAD_SCOPE, PTHREAD_SCOPE_PROCESS)
546             AC_DEFINE(VJ_POSIX_C_SOURCE, 199506L)
547         else
548             AC_DEFINE(VJ_THREAD_SCOPE, PTHREAD_SCOPE_SYSTEM)
549             AC_DEFINE(VJ_POSIX_C_SOURCE, 2)
550         fi
551     else
552         AC_MSG_WARN(*** POSIX threads will not be used (no library found) ***)
553     fi
554
555 dnl # If we are not using POSIX threads, we must be using the SGI IPC model,
556 dnl # but we test ${_thread_pkg} just to be sure it is set right.
557 elif test "x${_thread_pkg}" = "xSGI_IPC" ; then
558     AC_CHECK_HEADERS(sys/prctl.h,
559         THREADS='SGI_IPC',
560         AC_MSG_WARN(*** SGI IPC threading will not be used (no headers found) ***))
561 fi
562
563 dnl # Shared memory and synchronization primitives.
564 SYNC_SYS=''                     # POSIX, SGI_IPC
565 SHMEM_SYS=''                    # SGI_IPC
566 THREAD_SYS=''                   # POSIX, SGI_IPC
567
568 dnl # Define various CPP macros depending on which threads implementation will
569 dnl # be used.  If no implementation was defined above, exit configure.
570 if test "$THREADS" = "POSIX" ; then
571     dnl # Do not define _POSIX_C_SOURCE here because it will cause problems
572     dnl # when compiling on IRIX.  Instead, define that in the source files
573     dnl # where appropriate.
574     AC_DEFINE(VJ_USE_PTHREADS,)
575     AC_DEFINE(_THREAD_SAFE,)
576     AC_DEFINE(RWSTD_MULTI_THREAD,)
577     AC_DEFINE(RW_MULTI_THREAD,)
578     AC_DEFINE(_REENTRANT,)
579
580     dnl # Set to POSIX THREADING
581     THREAD_SYS="POSIX"
582
583     dnl # Nothing for these at this time.
584     SYNC_SYS='POSIX'
585     SHMEM_SYS=''
586 elif test "$THREADS" = "SGI_IPC" ; then
587     AC_DEFINE(VJ_SGI_IPC,)
588
589     dnl # Set to SGI_IPC threading
590     THREAD_SYS="SGI_IPC"
591
592     SYNC_SYS='SGI_IPC'
593     SHMEM_SYS='SGI_IPC'
594 elif test -z "$THREADS" ; then
595     AC_MSG_ERROR(No threading package defined!)
596 fi
597
598 dnl # ------------
599 dnl # OpenGL API.
600 dnl # ------------
601 OPENGL_API=''                   dnl # 'Y' then we are using OpenGL
602
603 _LIBOPENGL=''
604 _SYSTEM_OPENGL=''
605
606 dnl # Test for the OpenGL library if the OpenGL API was enabled.
607 if test "x${_enable_gl_api}" = "xyes" ; then
608     dnl # Save these values in case they need to be restored later.
609     _vjsave_CFLAGS="$CFLAGS"
610     _vjsave_CPPFLAGS="$CPPFLAGS"
611     _vjsave_INCLUDES="$INCLUDES"
612     _vjsave_LDFLAGS="$LDFLAGS"
613
614     if test "$PLATFORM" = "FreeBSD" ; then
615         LDFLAGS="$LDFLAGS -lX11 -lXext -lICE -lm"
616     fi
617
618     dnl # Add the user-specified OpenGL installation directory to these paths.
619     dnl # Ensure that /usr/include and /usr/lib are not included multiple times
620     dnl # if $OGLROOT is "/usr".
621     if test "x${OGLROOT}" != "x/usr" ; then
622         CPPFLAGS="$CPPFLAGS -I${OGLROOT}/include"
623         INCLUDES="$INCLUDES -I${OGLROOT}/include"
624         LDFLAGS="-L${OGLROOT}/lib${LIBBITSUF} $LDFLAGS"
625     fi
626
627     CFLAGS="$CFLAGS ${_EXTRA_FLAGS}"
628
629     dnl # On HP-UX, we have to compile the test code with aCC (which is
630     dnl # required by an above test) because the HP-UX OpenGL 1.1
631     dnl # implementation mandates this.
632     if test "$PLATFORM" = "HP" ; then
633         _vjsave_CC="$CC"
634         _vjsave_LIBS="$LIBS"
635         CC="$CXX"
636         LIBS="$LIBS -lGL"
637
638         dnl # Check the cache in case this test was run previously and if not,
639         dnl # compile the given code and try to link it against the GL
640         dnl # library.  We don't need to test for the existence of GL/gl.h
641         dnl # after linking because the test program already includes it.
642         AC_CACHE_CHECK(for glEnable in -lGL, ac_cv_glEnable_available,
643             AC_TRY_LINK([#include <GL/gl.h>], [glEnable(GL_CULL_FACE)],
644                 ac_cv_glEnable_available='yes',
645                 [ LIBS="${_vjsave_LIBS}";
646                   AC_MSG_ERROR(*** OpenGL API will not be used (library not found) ***) ] ))
647
648         dnl # If the library was found, add the OpenGL API object files to
649         dnl # the files to be compiled and enable the OpenGL API compile-time
650         dnl # option.
651         if test "$ac_cv_glEnable_available" = "yes" ; then
652             OPENGL_API="Y"
653             AC_DEFINE(VJ_API_OPENGL,)
654         fi
655
656         CC="${_vjsave_CC}"
657     else
658         dnl # If the OpenGL library was found, add the API object files to the
659         dnl # files to be compiled and enable the OpenGL API compile-time
660         dnl # option.
661         AC_CHECK_LIB(GL, glEnable,
662             AC_CHECK_HEADER(GL/gl.h,
663                 [ OPENGL_API="Y";
664                   AC_DEFINE(VJ_API_OPENGL,) ],
665                 AC_MSG_ERROR(*** OpenGL API will not be used (header not found) ***)),
666             AC_MSG_ERROR(*** OpenGL API will not be used (library not found) ***),
667             -lGLU -lm -lX11 -lXext -lXt)
668     fi
669
670     dnl # Restore $CFLAGS and $CPPFLAGS now that we are done testing.
671     CFLAGS="${_vjsave_CFLAGS}"
672     CPPFLAGS="${_vjsave_CPPFLAGS}"
673
674     dnl # If OpenGL API files were added, define this extra stuff that is
675     dnl # used in some Makefiles.
676     if test ! -z "$OPENGL_API" ; then
677         _LIBOPENGL="-L${OGLROOT} -lGLU -lGL -lXext"
678
679         if test "$PLATFORM" = "HP" ; then
680             _SYSTEM_OPENGL="${_LIBOPENGL} -lX11"
681         else
682             if test "$ABI" = "64" ; then
683                 _SYSTEM_OPENGL="-limage ${_LIBOPENGL} -lXmu -lX11"
684             elif test "$ABI" = "N32" ; then
685                 _SYSTEM_OPENGL="-limage ${_LIBOPENGL} -lXmu -lX11"
686             elif test "$ABI" = "O32" ; then
687                 _SYSTEM_OPENGL="-lmpc -limage -lGLw ${_LIBOPENGL} -lfpe -lXm -lXt -lXmu -lX11 -lmalloc"
688             fi
689         fi
690     dnl # No OpenGL API files were added, so restore $INCLUDES and $LDFLAGS so
691     dnl # that no OpenGL stuff in included in them.
692     else
693         INCLUDES="${_vjsave_INCLUDES}"
694         LDFLAGS="${_vjsave_LDFLAGS}"
695     fi
696 fi
697
698 dnl # --------------------
699 dnl # IRIS Performer API.
700 dnl # --------------------
701 PERFORMER_API=''                dnl # 'Y' then we are using Performer
702
703 dnl # Test for the Performer library if the Performer API was enabled.
704 if test "x${_enable_pf_api}" = "xyes" ; then
705     _vjsave_CFLAGS="$CFLAGS"
706     _vjsave_INCLUDES="$INCLUDES"
707     _vjsave_LDFLAGS="$LDFLAGS"
708
709     dnl # Ensure that /usr/include and /usr/lib are not included multiple
710     dnl # times if $PFROOT is "/usr".
711     if test "x${PFROOT}" != "x/usr" ; then
712         INCLUDES="$INCLUDES -I\${PFROOT}/include"
713         LDFLAGS="-L\${PFROOT}/lib\${LIBBITSUF} $LDFLAGS"
714     fi
715
716     CFLAGS="$CFLAGS $INCLUDES ${_EXTRA_FLAGS}"
717
718     dnl # If the Performer library was found, add the API object files to the
719     dnl # files to be compiled and enable the Performer API compile-time
720     dnl # option.
721     AC_CHECK_LIB(pf, pfInit,
722         AC_CHECK_HEADER(Performer/pf.h,
723             PERFORMER_API="Y";  \
724             _PFOGLLIB='-lpf_ogl -lpfdu_ogl -lpfui -lpfutil_ogl'; \
725             AC_DEFINE(VJ_API_PERFORMER,),
726             AC_MSG_WARN(*** Performer API will not be used (pf.h not found) ***)),
727         AC_MSG_WARN(*** Performer API will not be used (library not found) ***))
728
729     dnl # Restore $CFLAGS now that we are done testing.
730     CFLAGS="${_vjsave_CFLAGS}"
731
732     dnl # No Performer API files were added, so restore $INCLUDES and $LDFLAGS
733     dnl # so that no OpenGL stuff in included in them.
734     if test -z "$PERFORMER_API" ; then
735         INCLUDES="${_vjsave_INCLUDES}"
736         LDFLAGS="${_vjsave_LDFLAGS}"
737     fi
738 fi
739
740 dnl # -------------------------------------------------------------------------
741 dnl # Checks for header files.
742 dnl # -------------------------------------------------------------------------
743 AC_PATH_X
744 AC_HEADER_STDC
745 AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/file.h sys/ioctl.h      \
746                  sys/time.h termio.h unistd.h sys/z8530.h sys/stdsyms.h)
747
748 dnl # All of the above header file checks may not be necessary ...
749
750 dnl # -------------------------------------------------------------------------
751 dnl # Checks for typedefs, structures, and compiler characteristics.
752 dnl # -------------------------------------------------------------------------
753 AC_TYPE_PID_T
754 AC_TYPE_SIZE_T
755 AC_TYPE_SIGNAL
756 AC_HEADER_TIME
757 AC_CHECK_TYPE(u_int, unsigned int)
758
759 dnl # -------------------------------------------------------------------------
760 dnl # Checks for library functions.
761 dnl # -------------------------------------------------------------------------
762 AC_CHECK_FUNCS(gettimeofday socket strdup strerror strtod sginap)
763
764 dnl # All of the above function checks may not be necessary ...
765
766 dnl # -------------------------------------------------------------------------
767 dnl # Do Makefile substitutions.
768 dnl # -------------------------------------------------------------------------
769 if test "$PLATFORM" = "SGI" ; then
770     CFLAGS="$CFLAGS -nostdinc -woff 1685,515,608,658,799,803,852,1048,1233,1499"
771     CXXFLAGS="$CXXFLAGS -nostdinc -woff 3322 -w2"
772 fi
773
774 DEPENDFLAGS=""
775 DEPEND_EXTRAS=""
776
777 dnl # For makedepend(1) to work properly on HP-UX with aCC, we have to
778 dnl # include these extra paths.
779 if test "$PLATFORM" = "HP" ; then
780     _aCC_ROOT="/opt/aCC"
781     DEPEND_EXTRAS="-I${_aCC_ROOT} -I${_aCC_ROOT}/include -I${_aCC_ROOT}/include/iostream"
782 fi
783
784 dnl # This build directory stuff is not presently being used.
785 if test -z "${_vj_builddir}" ; then
786     builddir='${top_srcdir}/lib'
787 else
788     if test -d "${_vj_builddir}" ; then
789         _old_wd=`pwd`
790         cd "${_vj_builddir}"
791         builddir=`pwd`
792         cd "${_old_wd}"
793     else
794         AC_MSG_ERROR(Build directory ${_vj_builddir} does not exist!)
795     fi
796 fi
797
798 dnl # $srcdir is the root directory of the vjlib source tree.  To get a value
799 dnl # for $VJROOT_ABS, we cd there and save the value of running pwd.  Then
800 dnl # return to the directory where configure is being run ($topdir).
801 topdir=`pwd`
802 cd "$srcdir"
803 VJROOT_ABS=`pwd`
804 cd "$topdir"
805
806 dnl # Define the base path to the source directory using ${VJROOT_ABS} as an
807 dnl # alternative to using ${srcdir}.
808 VJ_SRCDIR='${VJROOT_ABS}'
809
810 dnl # Variables set in Makefiles found in the test tree.  All variables
811 dnl # listed are for use only in the Makefile.in's found in that tree unless
812 dnl # otherwise noted.  They are used in the following way:
813 dnl #
814 dnl #     * TEST_VJ_LIBS_BASIC: The basic VR Juggler library.
815 dnl #     * TEST_VJ_LIBS_BASIC_SUBST: Used only in the top-level Makefile.in.
816 dnl #       It is used when generating Makefiles in the test directory tree
817 dnl #       during the installation process.  Some variables in its assigned
818 dnl #       value are not interpolated until that time (making it different
819 dnl #       from $TEST_VJ_LIBS_BASIC whose varabiles are interpolated at
820 dnl #       assignment time).
821 dnl #     * TEST_VJ_LIBS_GL: The VR Juggler OpenGL API library.
822 dnl #     * TEST_VJ_LIBS_PF: The VR Juggler Performer API library.
823 dnl #     * TEST_LIBS_BASIC: The _most basic_ basic libraries needed for
824 dnl #       compiling (e.g., -lC).
825 dnl #     * TEST_EXTRA_LIBS_BASIC: A basic set of extra libraries and linker
826 dnl #       flags needed for compiling.  These are put after those listed in
827 dnl #       the previous variables in the compile line.
828 dnl #     * TEST_EXTRA_LIBS_BASIC_SUBST: Used only in the top-level
829 dnl #       Makefile.in.  It is used in the same way as
830 dnl #       $TEST_VJ_LIBS_BASIC_SUBST but is for the $TEST_EXTRA_LIBS_BASIC
831 dnl #       variable.
832 dnl #     * TEST_VJ_LIBS_GL: The OpenGL libraries needed for compiling with
833 dnl #       the OpenGL API.
834 dnl #     * TEST_VJ_LIBS_GL_SUBST: Used only in the top-level Makefile.in.
835 dnl #       It is used in the same way as $TEST_VJ_LIBS_BASIC_SUBST but is
836 dnl #       for the $TEST_VJ_LIBS_GL variable.
837 dnl #     * TEST_VJ_LIBS_PF: The Performer libraries needed for compiling
838 dnl #       with the Performer API.
839 dnl #
840 TEST_VJ_LIBS_BASIC="-B static -L\${VJ_BASE_DIR}/lib${LIBBITSUF} -lJuggler"
841 TEST_VJ_LIBS_BASIC_SUBST="-B dynamic -L$\${VJ_BASE_DIR}/lib\${LIBBITSUF} -lJuggler"
842 TEST_VJ_LIBS_GL="-lJuggler_ogl"
843 TEST_VJ_LIBS_PF="-lJuggler_pf"
844 TEST_LIBS_BASIC="-B dynamic -lm -lC"
845 TEST_EXTRA_LIBS_BASIC="$LDFLAGS $LIBS"
846 TEST_EXTRA_LIBS_BASIC_SUBST="$LDFLAGS $LIBS"
847 TEST_EXTRA_LIBS_GL="-L${OGLROOT}/lib${LIBBITSUF} ${_SYSTEM_OPENGL}"
848 TEST_EXTRA_LIBS_GL_SUBST="-L${OGLROOT}/lib\${LIBBITSUF} ${_SYSTEM_OPENGL}"
849 TEST_EXTRA_LIBS_PF="${_PFOGLLIB}"
850
851 dnl # AC_SUBST(builddir)
852 AC_SUBST(topdir)
853 AC_SUBST(VJROOT_ABS)
854 AC_SUBST(VJ_SRCDIR)
855
856 AC_SUBST(AR)
857 AC_SUBST(ARFLAGS)
858 AC_SUBST(CFLAGS)
859 AC_SUBST(CXXFLAGS)
860 AC_SUBST(DEPENDFLAGS)
861 AC_SUBST(DEPEND_EXTRAS)
862 AC_SUBST(INCLUDES)
863 AC_SUBST(LD)
864 AC_SUBST(LIBS)
865 AC_SUBST(LDOPTS)
866 AC_SUBST(DBG_FLAGS)
867 AC_SUBST(OPT_FLAGS)
868 AC_SUBST(PERL)
869 AC_SUBST(SHAREDLIB_EXT)
870
871 AC_SUBST(ABI)
872 AC_SUBST(ISA)
873 AC_SUBST(ABI_LIST)
874 AC_SUBST(LIBBITSUF)
875 AC_SUBST(PLATFORM)
876 AC_SUBST(DSOREGFILE)
877 AC_SUBST(DSOVERSION)
878 AC_SUBST(DSOVERSIONOPTS)
879
880 AC_SUBST(JDK_HOME)
881 AC_SUBST(JAVAC)
882 AC_SUBST(JAR)
883 AC_SUBST(BUILD_GUI)
884
885 AC_SUBST(OGLROOT)
886 AC_SUBST(PFROOT)
887
888 AC_SUBST(OPENGL_API)
889 AC_SUBST(PERFORMER_API)
890
891 AC_SUBST(SHMEM_SYS)
892 AC_SUBST(SYNC_SYS)
893 AC_SUBST(THREAD_SYS)
894
895 AC_SUBST(TEST_VJ_LIBS_BASIC)
896 AC_SUBST(TEST_VJ_LIBS_BASIC_SUBST)
897 AC_SUBST(TEST_VJ_LIBS_GL)
898 AC_SUBST(TEST_VJ_LIBS_PF)
899 AC_SUBST(TEST_LIBS_BASIC)
900 AC_SUBST(TEST_EXTRA_LIBS_BASIC)
901 AC_SUBST(TEST_EXTRA_LIBS_BASIC_SUBST)
902 AC_SUBST(TEST_EXTRA_LIBS_GL)
903 AC_SUBST(TEST_EXTRA_LIBS_GL_SUBST)
904 AC_SUBST(TEST_EXTRA_LIBS_PF)
905
906 dnl # -------------------------------------------------------------------------
907 dnl # Final file generation step.
908 dnl # -------------------------------------------------------------------------
909 AC_OUTPUT(Makefile Makefile.base Config/Makefile Environment/Makefile
910           GUI/Makefile Input/Makefile Input/InputManager/Makefile
911           Input/ibox/Makefile Input/vjGesture/Makefile Input/vjGlove/Makefile
912           Input/vjInput/Makefile Input/vjKeyboard/Makefile
913           Input/vjPosition/Makefile Input/vjSim/Makefile Kernel/Makefile
914           Kernel/Pf/Makefile Kernel/GL/Makefile Math/Makefile
915           Performance/Makefile SharedMem/Makefile Sync/Makefile
916           Threads/Makefile
917           test/Makefile test/CfgTest/Makefile test/Math/Makefile
918           test/Matrix/Makefile test/Performance/Makefile
919           test/Performance/analyzer/Makefile
920           test/Performance/perfdatabuffer-test/Makefile test/Quat/Makefile
921           test/Sync/Makefile test/input/Makefile test/ogl/Makefile
922           test/ogl/combo/Makefile test/ogl/cubes/Makefile
923           test/ogl/glove/Makefile test/ogl/simpleGlove/Makefile
924           test/ogl/torus/Makefile test/ogl/wand/Makefile
925           test/pfNav/Makefile test/testDynamicCastSTL/Makefile
926           test/threads/Makefile)
Note: See TracBrowser for help on using the browser.