root/juggler/tags/1.0.2/configure.in

Revision 5820, 73.1 kB (checked in by anonymous, 7 years ago)

This commit was manufactured by cvs2svn to create tag
'RELENG_1_0_2_RELEASE'.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
<
Line 
1 dnl # ************ <auto-copyright.pl BEGIN do not edit this line> ************
2 dnl #
3 dnl # VR Juggler is (C) Copyright 1998, 1999, 2000 by Iowa State University
4 dnl #
5 dnl # Original Authors:
6 dnl #   Allen Bierbaum, Christopher Just,
7 dnl #   Patrick Hartling, Kevin Meinert,
8 dnl #   Carolina Cruz-Neira, Albert Baker
9 dnl #
10 dnl # This library is free software; you can redistribute it and/or
11 dnl # modify it under the terms of the GNU Library General Public
12 dnl # License as published by the Free Software Foundation; either
13 dnl # version 2 of the License, or (at your option) any later version.
14 dnl #
15 dnl # This library is distributed in the hope that it will be useful,
16 dnl # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 dnl # Library General Public License for more details.
19 dnl #
20 dnl # You should have received a copy of the GNU Library General Public
21 dnl # License along with this library; if not, write to the
22 dnl # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 dnl # Boston, MA 02111-1307, USA.
24 dnl #
25 dnl # -----------------------------------------------------------------
26 dnl # File:          $RCSfile$
27 dnl # Date modified: $Date$
28 dnl # Version:       $Revision$
29 dnl # -----------------------------------------------------------------
30 dnl #
31 dnl # ************* <auto-copyright.pl END do not edit this line> *************
32
33 dnl # -------------------------------------------------------------------------
34 dnl # Base configure.in for VR Juggler.
35 dnl # -------------------------------------------------------------------------
36 dnl # This file is "compiled" by GNU autoconf to generate the configure script
37 dnl # that is actually run.
38 dnl # -------------------------------------------------------------------------
39 dnl #
40
41 AC_REVISION($Revision$)
42 AC_INIT(vjConfig.h)
43 AC_CONFIG_HEADER(vjDefines.h)
44
45 dnl # -------------------------------------------------------------------------
46 dnl # Helper subroutines.
47 dnl # -------------------------------------------------------------------------
48
49 dnl # UNIX path translator.  This converts a UNIX-style path to a DOS/Win32
50 dnl # path.  With this routine, we can safely use UNIX paths for all Win32
51 dnl # variables while the configure script runs.  Then, immediately before
52 dnl # Makefile substitution is done, we can translate all the paths to
53 dnl # DOS-style for use in the Makefiles.
54 unix2dos ( ) {
55     dnl # The first expression changes a "//C" drive name to "C:".  It has a
56     dnl # pair of surrounding []'s because those symbols have special meaning
57     dnl # to m4(1).  Without them, the first pair of []'s in the regular
58     dnl # expression will be lost.
59     dnl # The second expression ensures that a path beginning with / is
60     dnl # returned as being a directory on the home drive.  The UNIX utilities
61     dnl # treat $HOMEDRIVE as the root directory and will give, for example,
62     dnl # /tmp instead of //D/tmp if D: is the home drive.  The expression
63     dnl # simply prepends "$HOMEDRIVE" (after evaluation) to the path.
64     _drive_exp=['s/^\/\/\([[:alpha:]]\)/\1:/']
65     _drive_exp2=['s/^\/cygdrive\/\([[:alpha:]]\)/\1:/']
66     _add_home_exp=["s/^\//$HOMEDRIVE\//"]
67     _retval=`echo $1 | sed -e "${_drive_exp}" -e "${_drive_exp2}" -e "${_add_home_exp}"`
68
69     echo "${_retval}"
70 }
71
72 dnl # DOS path translator.  This converts a DOS-style path to a UNIX path.
73 dos2unix ( ) {
74     dnl # All expressions hers are enclosed in []'s because those symbols
75     dnl # have special meaning to m4(1).  This is the same situation as
76     dnl # above.
77
78     dnl # This changes \'s to /'s and escapes any whitespace in the path.
79     _slash_exp=['s/\\/\//g']
80     _ws_esc_exp=['s/ /\\ /g']
81     _unix_root=`echo "$1" | sed -e "${_slash_exp}" -e "${_ws_esc_exp}"`
82
83     dnl # This changes the leading "C:" to "//C" (for the appropriate drive
84     dnl # letter).
85     _colon_rem_exp=['s/^\([[:alpha:]]\):/\/\/\1/']
86     _retval=`echo "${_unix_root}" | sed -e "${_colon_rem_exp}"`
87
88     echo "${_retval}"
89 }
90
91 dnl # -------------------------------------------------------------------------
92 dnl # Command-line arguments (--enable-option, --with-pkg=package_name).
93 dnl # -------------------------------------------------------------------------
94
95 dnl # -------------------------------------------- #
96 dnl # --with-pkg[=arg] and --without-pkg arguments #
97 dnl # -------------------------------------------- #
98
99 dnl # Override the C compiler that configure would otherwise find itself.
100 AC_ARG_WITH(cc, [  --with-cc=<PATH>        Alternate C compiler ],
101             _alt_cc="$withval", _alt_cc='none')
102
103 dnl # Override the C++ compiler that configure would otherwise find itself.
104 AC_ARG_WITH(cxx, [  --with-cxx=<PATH>       Alternate C++ compiler ],
105             _alt_cxx="$withval", _alt_cxx='none')
106
107 dnl # Force the use of GCC as the compiler.
108 dnl # NOTE: This is not fully implemented yet for any platform, but it is
109 dnl # partially usable on Windows.
110 AC_ARG_WITH(gcc,
111             [  --with-gcc              Force the use of GCC as the compiler],
112             _use_gcc="$withval")
113
114 dnl # Define the binary format.  Possible values are the following:
115 dnl #     N32_M3     - On IRIX, use N32 mips3 binaries
116 dnl #     N32_M4     - On IRIX, use N32 mips4 binaries
117 dnl #     64_M3      - On IRIX, use 64-bit mips3 binaries
118 dnl #     64_M4      - On IRIX, use 64-bit mips4 binaries
119 dnl #     HP         - On HP-UX, use HP PA-RISC binaries
120 dnl #     ALPHA      - On an Alpha running Digital UNIX, use COFF binaries
121 dnl #     ELF_i386   - On an i386 OS (e.g., Linux/i386), use ELF binaries
122 dnl #     WIN32_i386 - On an i386 Win32 OS, Linux), use Win32 binaries
123 AC_ARG_WITH(abi,
124             [  --with-abi=<N32_M3|N32_M4|64_M3|64_M4|HP|ALPHA|ELF_i386|WIN32_i386>
125                           Define the Application Binary Interface to use],
126             _abi_type="$withval")
127
128 dnl # Define which threading model to use.  Possible values are "IRIX_SPROC"
129 dnl # or "POSIX".
130 dnl # The default is "IRIX_SPROC".
131 AC_ARG_WITH(threads,
132             [  --with-threads=<IRIX_SPROC|POSIX|WIN32>
133                           Define threading implementation [default=IRIX_SPROC]],
134             _thread_pkg="$withval", _thread_pkg='IRIX_SPROC')
135
136 dnl # Define the root directory for the Java installation.
137 dnl # The default is /usr/java or what the user has defined in his or her
138 dnl # $JDK_HOME environment variable.  ${_JDK_HOME_ALT_LIST} must be a
139 dnl # colon-separated list of bin directories that could contain javac(1)
140 dnl # and the other JDK utilities.
141 if test "x$JAVA_HOME" = "x" ; then
142     _JDK_HOME_ALT_LIST="/usr/local/java/bin"
143 else
144     _JDK_HOME_ALT_LIST="${JAVA_HOME}/bin:/usr/local/java/bin"
145 fi
146
147 AC_ARG_WITH(jdkhome,
148             [  --with-jdkhome=<PATH>   JDK installation directory      [default=\$JDK_HOME
149                                                            then /usr/java]],
150             JDK_HOME="$withval", JDK_HOME="${JDK_HOME-/usr/java}")
151
152 dnl # Define the root directory for the Performer installation.
153 dnl # The default is /usr.
154 AC_ARG_WITH(pfroot,
155             [  --with-pfroot=<PATH>    Performer installation
156                           directory                       [default=/usr]],
157             PFROOT="$withval", PFROOT='/usr')
158
159 dnl # Define the version of Perfromer to use.
160 dnl # The default is 2.4.
161 AC_ARG_WITH(pfver,
162             [  --with-pfver=<VER>      Performer version to use        [default=2.4]],
163             PF_VER="$withval", PF_VER='2.4')
164
165 dnl # If no value has been set for $DEFAULT_OGLROOT, use /usr.
166 : ${DEFAULT_OGLROOT=/usr}
167
168 dnl # Define the root directory for the OpenGL installation.
169 dnl # The default is /usr.
170 AC_ARG_WITH(oglroot,
171             [  --with-oglroot=<PATH>   OpenGL installation directory   [default=/usr]],
172             OGLROOT="$withval", OGLROOT="$DEFAULT_OGLROOT")
173
174 dnl # Use the Mesa OpenGL implementation.  That is, link with libMesaGL and
175 dnl # libMesaGLU.
176 dnl # The default is no.
177 AC_ARG_WITH(mesa,
178             [  --with-mesa             Use Mesa OpenGL implementation  [default=no]],
179             _with_mesa="$withval", _with_mesa='no')
180
181 dnl # Use AudioWorks (which can be found at the given path) in the sound
182 dnl # wrapper.
183 dnl # The default is to use it with the path being /usr.
184 AC_ARG_WITH(audioworks,
185             [  --with-audioworks=<PATH>
186                           AudioWorks installation         [default=/usr]],
187             _with_aw="$withval", _with_aw='/usr')
188
189 dnl # Use SL (which can be found at the given path) in the sound wrapper.
190 dnl # The default is to use it with the path being /usr.
191 AC_ARG_WITH(sl,
192             [  --with-sl=<PATH>        SL installation                 [default=/usr]],
193             _with_sl="$withval", _with_sl='/usr')
194
195 dnl # Specify a directory containing a working Perl 5.004 (or newer) binary.
196 dnl # There is no default since standard locations are always available.
197 AC_ARG_WITH(perl,
198             [  --with-perl=<PATH>      Directory containing Perl 5.004
199                           or newer binary                 [No default]],
200             _user_perl_path="$withval")
201
202 dnl # Name the user who will own installed files.
203 AC_ARG_WITH(install-owner,
204             [  --with-install-owner=<USER NAME>
205                           Installed file owner name],
206             _install_owner="$withval")
207
208 dnl # Name the group used for setting ownership on installed files.
209 AC_ARG_WITH(install-group,
210             [  --with-install-group=<GROUP NAME>
211                           Installed file group name       [default=vrjuggler]],
212             _install_group="$withval", _install_group='vrjuggler')
213
214 dnl # Provide permissions for installed (normal) files.
215 AC_ARG_WITH(file-perms,
216             [  --with-file-perms=<FILE PERMISSIONS>
217                           Installed file permissions      [default=0644]],
218             FILE_PERMS="$withval", FILE_PERMS='0644')
219
220 dnl # Provide permissions for installed executable files.
221 AC_ARG_WITH(exec-perms,
222             [  --with-exec-perms=<EXEC PERMISSIONS>
223                           Installed executable permisions [default=0755]],
224             EXEC_PERMS="$withval", EXEC_PERMS='0755')
225
226 dnl # Provide permissions for directories in the installation tree.
227 AC_ARG_WITH(dir-perms,
228             [  --with-dir-perms=<DIRECTORY PERMISSIONS>
229                           Installed directory permisions  [default=0755]],
230             DIR_PERMS="$withval", DIR_PERMS='0755')
231
232 dnl # ------------------------------------------------------ #
233 dnl # --enable-feature[=arg] and --disable-feature arguments #
234 dnl # ------------------------------------------------------ #
235
236 dnl # Enable compilation of the OpenGL API.  Possible values are "yes" or
237 dnl # "no".  "yes" is set with --enable-gl-api and "no" is set with
238 dnl # --disable-gl-api.
239 dnl # The default is "yes".
240 AC_ARG_ENABLE(gl-api,
241               [  --enable-gl-api         use OpenGL API                  [default=yes]],
242               _enable_gl_api="$enableval", _enable_gl_api='yes')
243
244 dnl # Enable compilation of the Performer API.  Possible values are "yes" or
245 dnl # "no".  "yes" is set with --enable-pf-api and "no" is set with
246 dnl # --disable-pf-api.
247 dnl # The default is "yes".
248 AC_ARG_ENABLE(pf-api,
249               [  --enable-pf-api         use Perfromer API               [default=yes]],
250               _enable_pf_api="$enableval", _enable_pf_api='yes')
251
252 dnl # Enable performance testing.  Values that enable it are as follows:
253 dnl #
254 dnl #      SGI: Enable SGI IPC performance testing.  This defines
255 dnl #           VJ_PERFORMANCE to be VJ_PERF_SGI
256 dnl #    POSIX: Enable POSIX threads performance testing.  This defines
257 dnl #           VJ_PERFORMANCE to be VJ_PERF_POSIX
258 dnl #
259 dnl # Values that disable it are "no" or "NONE".  The default is "SGI".
260 AC_ARG_ENABLE(performance,
261               [  --enable-performance=<SGI|POSIX|NONE>
262                           enable performance testing      [default=SGI] ],
263               [ if test "x$enableval" = "xyes" ; then
264                     _enable_perf='SGI'
265                 elif test "x$enableval" = "xno" ; then
266                     _enable_perf='NONE'
267                 else
268                     _enable_perf="$enableval"
269                 fi
270               ], _enable_perf='SGI')
271
272 dnl # Define a macro VJ_ABI_CFG for setting up the configuration parameters
273 dnl # for a given ABI.  The usage is:
274 dnl #
275 dnl #   VJ_ABI_CFG([ ABI [, ISA [, library suffix [, extra compiler flags]]]])
276 dnl #
277 dnl # All arguments are optional and will default to the empty string if not
278 dnl # provided.
279 AC_DEFUN(VJ_ABI_CFG, [ ABI=$1 ISA=$2 LIBBITSUF=$3 _EXTRA_FLAGS=$4 ; ])
280
281 dnl # Set default values for these before checking ${_abi_type}.  Currently,
282 dnl # these are for non-IRIX platforms.
283 ABI=''
284 LIBBITSUF=''
285
286 dnl # Based on the value of $abi_type, set $ABI for later use and the Makefile
287 dnl # substitution variables $LIBBITSUF and $ISA.
288 case "x${_abi_type}" in
289     x64_M3)
290         VJ_ABI_CFG('64', 'mips3', '64', '-64 -mips3')
291         ;;
292     x64_M4)
293         VJ_ABI_CFG('64', 'mips4', '64', '-64 -mips4')
294         ;;
295     xN32_M3)
296         VJ_ABI_CFG('N32', 'mips3', '32', '-n32 -mips3')
297         ;;
298     xN32_M4)
299         VJ_ABI_CFG('N32', 'mips4', '32', '-n32 -mips4')
300         ;;
301     xHP)
302         VJ_ABI_CFG(HP, PA-RISC)
303         ;;
304     xALPHA)
305         VJ_ABI_CFG(ALPHA)
306         ;;
307     xELF_i386)
308         VJ_ABI_CFG('ELF', 'i386')
309         ;;
310     xWIN32_i386)
311         VJ_ABI_CFG('WIN32')
312         ;;
313 esac
314
315 dnl # -------------------------------------------------------------------------
316 dnl # System-dependent stuff.
317 dnl # -------------------------------------------------------------------------
318
319 dnl # We use AC_CANONICAL SYSTEM so that we can find out information about
320 dnl # the build, target and host platforms rather than only the host.
321 AC_CANONICAL_SYSTEM
322
323 dnl # Operating system release information.  This may contain anything and
324 dnl # should be treated as a string.
325 _OS_REL_STR=`uname -r`
326
327 dnl # Operating system version number only (any miscellaneous text is
328 dnl # stripped).  This will only contain a number and can be treated as a
329 dnl # float-point value.
330 dnl # NOTE: It is currently not used in config.h.
331 _OS_REL_NUM=`uname -r | sed -e 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\)[^0-9]*$/\1/'`
332
333 dnl # Major and minor version numbers from ${_OS_REL_NUM} separated for use
334 dnl # with the C preprocessor.  Using cut(1) is kind of a hack, but at least
335 dnl # it's a clean one.
336 _OS_REL_NUM_MAJOR=`echo "${_OS_REL_NUM}" | cut -f1 -d'.'`
337 _OS_REL_NUM_MINOR=`echo "${_OS_REL_NUM}" | cut -f1 -d' ' | cut -f2 -d'.'`
338
339 dnl # These are used on all platforms.
340 AC_DEFINE_UNQUOTED(VJ_OS_RELEASE, "${_OS_REL_STR}")
341 AC_DEFINE_UNQUOTED(VJ_OS_RELEASE_MAJOR, ${_OS_REL_NUM_MAJOR})
342 AC_DEFINE_UNQUOTED(VJ_OS_RELEASE_MINOR, ${_OS_REL_NUM_MINOR})
343
344 AR=''                   dnl # Archive library command (generally ar(1))
345 ARFLAGS=''              dnl # Flags for $AR
346 AR_NAME_FLAG=''         dnl # Extra flag used to allow $AR to name its output
347 DEP_GEN_FLAG='-M'       dnl # Flag for the compiler to generate dependencies
348 LD=''                   dnl # Shared library command (usually ld(1))
349 LDOPTS=''               dnl # More options for shared library generator
350 LDOPTS_DBG=''           dnl # Debugging options for shared library generator
351 LDOPTS_OPT=''           dnl # Optimization options for shared library generator
352 OBJ_FILE_SUFFIX='o'     dnl # Suffix for object file names
353 OBJ_NAME_FLAG='-o $@'   dnl # Flag used for naming a compiled object file
354
355 LIB_PREFIX='lib'        dnl # Prefix for library name
356 STATICLIB_EXT='a'       dnl # Extension for shared library names (usually 'a')
357 SHAREDLIB_EXT=''        dnl # Extension for shared library names (usually 'so')
358
359 DBG_FLAGS=''            dnl # Compiler debugging flags for object files
360 OPT_FLAGS=''            dnl # Compiler optimization flags for object files
361
362 DSOREGFILE=''
363 DSOVERSION=''
364 DSOVERSIONOPTS=''
365 ABI_LIST=''             dnl # List of supported ABIs on a given platform
366 OS_TYPE='UNIX'          dnl # General type of operating system (UNIX, Win32)
367 PLATFORM=''             dnl # Platform name
368
369 dnl # Depending on the target operating system, set various command options and
370 dnl # such.
371 case $target_os in
372     dnl # SGI running IRIX 6.*.
373     irix6*)
374         dnl # If no ABI has been set yet, default to N32_M3.
375         if test "$ABI" = "" ; then
376             VJ_ABI_CFG('N32', 'mips3', '32', '-n32 -mips3')
377         fi
378
379         dnl # Set compiler flags and the location of $DSOREGFILE depending on
380         dnl # $ABI.
381         if test "$ABI" = "64" ; then
382             DSOREGFILE='/usr/lib64/so_locations'
383             OPT_FLAGS='-O2 -OPT:Olimit=0'
384         elif test "$ABI" = "N32" ; then
385             DSOREGFILE='/usr/lib32/so_locations'
386             OPT_FLAGS='-O2 -OPT:Olimit=0'
387         fi
388
389         AR='${CXX}'
390         ARFLAGS='-LANG:std -J6 -ar -WR,-v -o'
391         CFLAGS="$CFLAGS -ansi"
392         CFLAGS_DYNLIB="$CFLAGS_DYNLIB -KPIC"
393         CXXFLAGS="$CXXFLAGS -ansi -LANG:std"
394         CXXFLAGS_DYNLIB="$CXXFLAGS_DYNLIB -KPIC"
395         DBG_FLAGS="-g -gslim"
396         LD='${CXX} -shared'
397         _LD_REGOPTS='-check_registry ${DSOREGFILE}'
398         LDOPTS="$LDOPTS -ansi -LANG:std -all ${_LD_REGOPTS} -elf -rdata_shared"
399         SHAREDLIB_EXT='so'
400
401         DSOVERSION='sgi4.0'
402         DSOVERSIONOPTS='-set_version ${DSOVERSION}'
403
404         ABI_LIST='64_M4 64_M3 N32_M4 N32_M3'
405         PLATFORM='IRIX'
406
407         AC_DEFINE(VJ_OS_IRIX,)
408         AC_DEFINE(_BSD_TYPES,)
409
410         if test ${_OS_REL_NUM_MAJOR} -lt 6 ; then
411             AC_DEFINE(IRIXREL, "IRIX5")
412         else
413             AC_DEFINE(IRIXREL, "IRIX6")
414         fi
415         ;;
416     dnl # HP PA-RISC machine running HP-UX 10.x.  These are not supported
417     dnl # because they lack a complete POSIX.4 real-time implementation.
418     hpux10*)
419         AC_MSG_ERROR(HP-UX 10.x is not supported.  Please upgrade to 11.00!)
420         ;;
421     dnl # HP PA-RISC machine running HP-UX 11.x.
422     hpux11*)
423         dnl # If no ABI has been set yet, default to HP PA-RISC.
424         if test "$ABI" = "" ; then
425             VJ_ABI_CFG('HP', 'PA-RISC')
426         fi
427
428         AR='ar'
429         ARFLAGS='ru'
430         CXXFLAGS="-AA -mt $CXXFLAGS"
431         DEP_GEN_FLAG='-E +m'
432         LD='aCC'
433         LDFLAGS="$LDFLAGS -mt -L/usr/lib/X11R6"
434         LDOPTS='-b'
435         DBG_FLAGS='-g'
436         OPT_FLAGS=''
437         SHAREDLIB_EXT='sl'
438
439         dnl # We have to use POSIX threads on HP-UX.
440         if test "x${_thread_pkg}" != "xPOSIX" ; then
441             AC_MSG_WARN(*** Forcing the use of POSIX threads ***)
442             _thread_pkg='POSIX'
443         fi
444
445         dnl # If nothing was given as an alternate OpenGL installation path,
446         dnl # use /opt/graphics/OpenGL.
447         if test "x$OGLROOT" = "x$DEFAULT_OGLROOT" ; then
448             OGLROOT='/opt/graphics/OpenGL'
449         fi
450
451         AC_DEFINE(VJ_OS_HPUX,)
452         ABI_LIST='HP'
453         PLATFORM='HP'
454         ;;
455     dnl # DEC Alpha running Digital UNIX 4.0.
456     osf4.0)
457         dnl # If no ABI has been set yet, default to ALPHA (whatever that
458         dnl # means).
459         if test "$ABI" = "" ; then
460             VJ_ABI_CFG('ALPHA')
461         fi
462
463         AR='ar'
464         ARFLAGS='-ruv'
465         LD='${CXX} -shared'
466         LDOPTS=''
467         OPT_FLAGS='-O2'
468         SHAREDLIB_EXT='so'
469
470         AC_DEFINE(VJ_OS_DUX,)
471         ABI_LIST='ALPHA'
472         PLATFORM='alpha-osf'
473         ;;
474     dnl # A machine running FreeBSD.  Currently only i386 is known to compile.
475     freebsd*)
476         dnl # If no ABI has been set yet, default to ELF with whatever the
477         dnl # target CPU architecture is.
478         if test "$ABI" = "" ; then
479             VJ_ABI_CFG('ELF', "$target_cpu")
480         fi
481
482         AR='ar'
483         ARFLAGS='-ruv'
484         CXXFLAGS="-Wall -Werror-implicit-function-declaration $CXXFLAGS"
485         LD='${CXX} -shared'
486         LDOPTS=''
487         DBG_FLAGS='-g'
488         OPT_FLAGS='-O2'
489         SHAREDLIB_EXT='so'
490
491         dnl # We have to use POSIX threads on FreeBSD.
492         if test "x${_thread_pkg}" != "xPOSIX" ; then
493             AC_MSG_WARN(*** Forcing the use of POSIX threads ***)
494             _thread_pkg='POSIX'
495         fi
496
497         AC_DEFINE(VJ_OS_FreeBSD,)
498         ABI_LIST='ELF'
499         PLATFORM='FreeBSD'
500         ;;
501     dnl # A machine running Linux.  Currently only i386 is known to work.
502     linux*)
503         dnl # If no ABI has been set yet, default to ELF with whatever the
504         dnl # target CPU architecture is.
505         if test "$ABI" = "" ; then
506             VJ_ABI_CFG('ELF', "$target_cpu")
507         fi
508
509         AR='ar'
510         ARFLAGS='-ruv'
511         CXXFLAGS="-Wall -Werror-implicit-function-declaration $CXXFLAGS"
512         LD='${CXX} -shared'
513         LDOPTS=''
514         OPT_FLAGS='-O1'
515         DBG_FLAGS='-g'
516         SHAREDLIB_EXT='so'
517
518         dnl # We have to use POSIX threads on Linux.
519         if test "x${_thread_pkg}" != "xPOSIX" ; then
520             AC_MSG_WARN(*** Forcing the use of POSIX threads ***)
521             _thread_pkg='POSIX'
522         fi
523
524         AC_DEFINE(VJ_OS_Linux,)
525         ABI_LIST='ELF'
526         PLATFORM='Linux'
527         ;;
528     dnl # A machine running Solaris (aka SunOS).  Currently only i386 is
529     dnl # known to work.
530     solaris*)
531         dnl # If no ABI has been set yet, default to ELF with whatever the
532         dnl # target CPU architecture is.
533         if test "$ABI" = "" ; then
534             VJ_ABI_CFG('ELF', "$target_cpu")
535         fi
536
537         AR='ar'
538         ARFLAGS='-ruv'
539         CXXFLAGS="-Wall -Werror-implicit-function-declaration $CXXFLAGS"
540         LD='${CXX} -G'
541         LDOPTS=''
542         DBG_FLAGS='-g'
543         OPT_FLAGS='-O2'
544         SHAREDLIB_EXT='so'
545
546         dnl # We have to use POSIX threads on Solaris.
547         if test "x${_thread_pkg}" != "xPOSIX" ; then
548             AC_MSG_WARN(*** Forcing the use of POSIX threads ***)
549             _thread_pkg='POSIX'
550         fi
551
552         AC_DEFINE(VJ_OS_Solaris,)
553         ABI_LIST='ELF'
554         PLATFORM='Solaris'
555         ;;
556     dnl # IBM RS/6000 running AIX.
557     aix*)
558         dnl # We have to use POSIX threads on AIX.
559         if test "x${_thread_pkg}" != "xPOSIX" ; then
560             AC_MSG_WARN(*** Forcing the use of POSIX threads ***)
561             _thread_pkg='POSIX'
562         fi
563
564         AC_DEFINE(VJ_OS_AIX)
565         PLATFORM='AIX'
566         ;;
567     dnl # i386-class machine running Windows {98,NT} with Cygnus GNU-Win32.
568     cygwin)
569         dnl # If no ABI has been set yet, default to WIN32 with whatever the
570         dnl # target CPU architecture is.
571         if test "$ABI" = "" ; then
572             VJ_ABI_CFG('WIN32')
573         fi
574
575         dnl # There is no performance testing/monitoring code for Win32 (yet).
576         if test "x${_enable_perf}" != "xNONE" ; then
577             AC_MSG_WARN(*** Disabling performance testing on $host ***)
578             _enable_perf='NONE'
579         fi
580
581         dnl # We have to use Win32 threads on Win32.
582         if test "x${_thread_pkg}" != "xWIN32" ; then
583             AC_MSG_WARN(*** WIN32 threads must be used on $host ***)
584             _thread_pkg='WIN32'
585         fi
586
587         if test "x${_use_gcc}" = "xyes" ; then
588             AR='ar'
589             ARFLAGS='-ruv'
590             CFLAGS="-mno-cygwin"
591             CXXFLAGS="-mno-cygwin"
592             DBG_FLAGS='-g'
593
594             LD='${CXX} -shared'
595         else
596             AR='link -lib'
597             ARFLAGS="$ARFLAGS -nologo"
598             AR_NAME_FLAG='-out:'
599             CFLAGS="-nologo"
600             CXXFLAGS="-nologo"
601             DBG_FLAGS='-Od -GZ -MTd -Z7'
602             DEP_GEN_FLAG='-FD'
603             OPT_FLAGS='-GB -MT'
604             LD='link -dll'
605             LDOPTS="$LDOPTS -nologo -out:\"${OBJDIR}/Juggler.lib\""
606             LDOPTS_DBG='-LDd -MDd -PDB:NONE'
607             LDOPTS_OPT='-LD -MD'
608             OBJ_FILE_SUFFIX='obj'
609             OBJ_NAME_FLAG='-Fo$@'
610         fi
611
612         LIB_PREFIX=''
613         STATICLIB_EXT='lib'
614         SHAREDLIB_EXT='dll'
615
616         AC_DEFINE(VJ_OS_Win32,)
617         ABI_LIST='WIN32'
618         OS_TYPE='Win32'
619
620         _sys_name=`uname -s`
621
622         dnl # Determine the value for $PLATFORM based on what uname(1) tells
623         dnl # us.  We define our own values because Cygnus' uname(1) returns
624         dnl # somewhat annoying names.
625         case ${_sys_name} in
626             dnl # Windows NT 4.0.
627             *NT-[[45]].0)
628                 PLATFORM='WinNT'
629                 ;;
630             dnl # Windows 95 and 98.
631             *WIN_9*-4.*)
632                 PLATFORM='Win9x'
633                 ;;
634             dnl # Unknown version of Windows that may not yet be supported.
635             *)
636                 AC_MSG_ERROR(Unknown Windows type ${_sys_name}!)
637                 ;;
638         esac
639
640         AC_DEFINE(WIN32,)
641         AC_DEFINE(_MBCS,)
642         ;;
643     dnl # Unkown operating system (to config.guess).
644     unknown)
645         dnl # If no ABI has been set yet, default to the target OS (which
646         dnl # will be 'unknown') with whatever the target CPU architecture is.
647         if test "$ABI" = "" ; then
648             VJ_ABI_CFG("$target_os", "$target_cpu")
649         fi
650
651         AC_DEFINE(VJ_OS_GENERIC,)
652         PLATFORM='UNKNOWN'
653         ;;
654 esac
655
656 dnl # --------------------------------------------------------------------
657 dnl # Depending on host type and the value in ${_enable_perf}, define the
658 dnl # settings for the performance code.
659 dnl # --------------------------------------------------------------------
660 if test "$PLATFORM" != "IRIX" -a "${_enable_perf}" != "NONE" ; then
661     _enable_perf='POSIX'
662 fi
663
664 dnl # Define unique values for each type of performance testing option.
665 dnl # Only one of these may be used for the value to which VJ_PERFORMANCE
666 dnl # is set.
667 AC_DEFINE(VJ_PERF_NONE, 0)
668 AC_DEFINE(VJ_PERF_SGI, 1)
669 AC_DEFINE(VJ_PERF_POSIX, 2)
670
671 dnl # Define VJ_PERFORMANCE based on ${_enable_perf}.  Default to
672 dnl # VJ_PERF_SGI if ${_enable_perf} has some unknown value.
673 if test "x${_enable_perf}" = "xSGI" ; then
674     AC_DEFINE(VJ_PERFORMANCE, VJ_PERF_SGI)
675 elif test "x${_enable_perf}" = "xPOSIX" ; then
676     AC_DEFINE(VJ_PERFORMANCE, VJ_PERF_POSIX)
677 elif test "x${_enable_perf}" = "xNONE" ; then
678     AC_DEFINE(VJ_PERFORMANCE, VJ_PERF_NONE)
679 else
680     AC_DEFINE(VJ_PERFORMANCE, VJ_PERF_SGI)
681 fi
682
683 dnl # -------------------------------------------------------------------------
684 dnl # Checks for programs.
685 dnl # -------------------------------------------------------------------------
686
687 _vjsave_CFLAGS="$CFLAGS"
688 _vjsave_CXXFLAGS="$CXXFLAGS"
689
690 dnl # If no alternate C compiler was specified, check to see if it is
691 dnl # necessary to force the use of a specific compiler on a given platform.
692 if test "x${_alt_cc}" = "xnone" ; then
693     dnl # On HP-UX, we have to use the aCC C++ compiler.
694     if test "$PLATFORM" = "HP" ; then
695         AC_CHECK_PROG(CC, cc, cc,
696             AC_MSG_ERROR(*** The library requires the HP-UX aCC C++ compiler ***))
697     dnl # On IRIX, we have to use cc (not gcc).
698     elif test "$PLATFORM" = "IRIX" ; then
699         AC_CHECK_PROG(CC, cc, cc,
700             AC_MSG_ERROR(*** The library requires the IRIX cc C compiler ***))
701     fi
702 dnl # Otherwise, force the use of the alternate C compiler.
703 else
704     CC="${_alt_cc}"
705 fi
706
707 dnl # If no alternate C++ compiler was specified, check to see if it is
708 dnl # necessary to force the use of a specific compiler on a given platform.
709 if test "x${_alt_cxx}" = "xnone" ; then
710     dnl # On HP-UX, we have to use the aCC C++ compiler.
711     if test "$PLATFORM" = "HP" ; then
712         AC_CHECK_PROG(CXX, aCC, aCC,
713             AC_MSG_ERROR(*** The library requires the HP-UX aCC C++ compiler ***))
714     dnl # On Windows, we have to use the Microsoft Visual C++ compiler CL.EXE.
715     elif test "$OS_TYPE" = "Win32" -a "x${_use_gcc}" != "xyes" ; then
716         AC_CHECK_PROG(CXX, cl, cl,
717             AC_MSG_ERROR(*** The library requires the MS Visual C++ compiler ***))
718         CC=$CXX
719     dnl # On IRIX, we have to use CC (not g++).
720     elif test "$PLATFORM" = "IRIX" ; then
721         AC_CHECK_PROG(CXX, CC, CC,
722             AC_MSG_ERROR(*** The library requires the IRIX CC C++ compiler ***))
723     fi
724 dnl # Otherwise, force the use of the alternate C++ compiler.
725 else
726     CXX="${_alt_cxx}"
727 fi
728
729 CFLAGS="$CFLAGS ${_EXTRA_FLAGS}"
730 CXXFLAGS="$CXXFLAGS ${_EXTRA_FLAGS}"
731
732 AC_PROG_CC
733 AC_PROG_CXX
734
735 dnl # If we are using GCC as the C compiler, the option for making
736 dnl # position-independent code is -fPIC.
737 if test "x$GCC" = "xyes" ; then
738     CFLAGS_DYNLIB="$CFLAGS_DYNLIB -fPIC"
739 fi
740
741 dnl # If we are using GCC as the C++ compiler, the option for making
742 dnl # position-independent code is -fPIC.
743 if test "x$GXX" = "xyes" ; then
744     CXXFLAGS_DYNLIB="$CXXFLAGS_DYNLIB -fPIC"
745 fi
746
747 dnl # If we are using GCC as the compiler, we need to be using at least egcs
748 dnl # 1.1.2.  A newer version (e.g., 2.95.2) is even better.
749 if test "x$GXX" = "xyes" ; then
750     AC_CACHE_CHECK(if $CXX is egcs 1.1.2 or newer,
751         ac_cv_CXX_is_egcs,
752         [ case `$CXX -dumpversion 2>&1` in
753               egcs-2.9*)
754                   ac_cv_CXX_is_egcs='yes'
755                   ;;
756               2.9*)
757                   ac_cv_CXX_is_egcs='yes'
758                   ;;
759               *)
760                   _val=`$CXX -v 2>&1 | grep -e '^gcc version' | cut -f4 -d' '`
761                   if test ${_val} -ge 19990314 ; then
762                       ac_cv_CXX_is_egcs='yes'
763                   else
764                       ac_cv_CXX_is_egcs='no'
765                   fi
766                   ;;
767           esac
768         ])
769
770     dnl # If the $CXX binary is not egcs 1.1.2 or newer, check for egcc and
771     dnl # eg++.  If it exists, we will assume that it is new enough.
772     if test "x$ac_cv_CXX_is_egcs" = "xno" ; then
773         AC_CHECK_PROG(CC, egcc, egcc,
774             AC_MSG_ERROR(*** The library requires the egcc C compiler ***))
775         AC_CHECK_PROG(CXX, eg++, eg++,
776             AC_MSG_ERROR(*** The library requires the eg++ C++ compiler ***))
777     fi
778 fi
779
780 dnl # At this point, we know what threading package we will be using and what
781 dnl # C compiler we have available.  Now check to see if the compiler accepts
782 dnl # the -pthread option.
783 if test "x${_thread_pkg}" = "xPOSIX" ; then
784     AC_CACHE_CHECK(whether $CC accepts -pthread,
785         ac_cv_CC_accepts_pthread,
786         [ echo 'void f(){}' > conftest.c
787           if test -z "`${CC} -pthread -c conftest.c 2>&1`" ; then
788               ac_cv_CC_accepts_pthread='yes'
789           else
790               ac_cv_CC_accepts_pthread='no'
791           fi
792           rm -f conftest*
793         ])
794 fi
795
796 AC_LANG_SAVE
797 AC_LANG_CPLUSPLUS
798 ac_ext='cpp'
799
800 AC_CACHE_CHECK(whether the C++ compiler handles templates properly,
801     ac_cv_CXX_is_current,
802     AC_TRY_COMPILE([#include <map> ],
803                    [ std::map<const char*, int> test_map; ],
804                    [ ac_cv_CXX_is_current='yes' ; rm -rf ./ii_files ],
805                    [ ac_cv_CXX_is_current='no' ;
806                      AC_MSG_ERROR(*** The library requires a current C++ compiler) ]))
807
808 AC_LANG_RESTORE
809
810 AC_PROG_CPP
811 AC_PROG_CXXCPP
812
813 CFLAGS="${_vjsave_CFLAGS}"
814 CXXFLAGS="${_vjsave_CXXFLAGS}"
815
816 JAVAC=''
817 JAR=''
818
819 dnl # Check for the JDK (specifically try to find javac(1) in $JDK_HOME or
820 dnl # in ${_JDK_HOME_ALT_LIST}).
821 AC_PATH_PROG(JAVAC, javac, no, ${JDK_HOME}/bin:$PATH:${_JDK_HOME_ALT_LIST})
822
823 dnl # If there is still no value in $JAVAC, then warn that the GUI will not be
824 dnl # built.
825 if test "$JAVAC" = "no" ; then
826     AC_MSG_WARN(*** The GUI requires javac -- it will not be built ***)
827     BUILD_GUI='N'
828 dnl # Otherwise, set $JAR to the path to jar(1) and continue.
829 else
830     if test "$OS_TYPE" = "Win32" ; then
831         JAVAC=`unix2dos "$JAVAC"`
832     fi
833
834     JAR=`echo $JAVAC | sed 's/javac$//'`jar
835     BUILD_GUI='Y'
836 fi
837
838 dnl # If we are on a Win32 system, use $ac_install_sh for the install
839 dnl # program.  This prevents problems with paths if an install program is
840 dnl # found elsewhere on the system.
841 dnl # XXX: This may not be a safe value to use since it is internal to the
842 dnl # generated configure script.  (patrick 1/10/2000)
843 if test "$OS_TYPE" = "Win32" ; then
844     INSTALL="$ac_install_sh"
845 dnl # Otherwise, use the safe AC_PROG_INSTALL macro.
846 else
847     AC_PROG_INSTALL
848 fi
849
850 dnl # Ensure that a version of Perl greater than or equal to 5.004 is
851 dnl # available.
852 chkPerl ( ) {
853     if test -x "$1" ; then
854         retval=`$1 -e "printf("%s\n", (($] >= 5.004) ? 0 : 1))"`
855     else
856         retval=1
857     fi
858
859     echo $retval
860 }
861
862 _PERL_PATH='/usr/local/bin /usr/bin C:/Perl/bin'
863
864 dnl # If ${_user_perl_path} has a value, prepend that on ${_PERL_PATH} so that
865 dnl # it will be checked before the standard places.
866 if test "x${_user_perl_path}" != "x" ; then
867     _PERL_PATH="${_user_perl_path} ${_PERL_PATH}"
868 fi
869
870 AC_CACHE_CHECK(for Perl version >= 5.004,
871                ac_cv_perl_version,
872                [ ac_cv_perl_version='no' ;
873                  for _dir in ${_PERL_PATH} ; do
874                      if eval "test \"`chkPerl ${_dir}/perl`\" -eq 0" ; then
875                          ac_cv_perl_version="${_dir}/perl"
876                          break
877                      elif eval "test \"`chkPerl ${_dir}/perl5`\" -eq 0" ; then
878                          ac_cv_perl_version="${_dir}/perl5"
879                          break
880                      fi
881                  done
882                ])
883
884 PERL="$ac_cv_perl_version"
885
886 AC_CHECK_PROG(MTREE_CMD, mtree, mtree, \${PERL} \${scriptdir}/mtree.pl)
887 AC_PROG_MAKE_SET
888
889 dnl # While ranlib(1) is not part of the base IRIX installation, the VRAC SGIs
890 dnl # have a ranlib(1) installed that does very bad things to ar archives.
891 dnl # We also do not want to use the Cygwin ranlib(1) with the Visual C++
892 dnl # LINK.EXE command.
893 if test "$PLATFORM" = "IRIX" -o "$OS_TYPE" = "Win32" ; then
894     RANLIB=':'
895 else
896     AC_PROG_RANLIB
897 fi
898
899 AC_PROG_LN_S
900
901 dnl # -------------------------------------------------------------------------
902 dnl # Checks for libraries.
903 dnl # -------------------------------------------------------------------------
904
905 THREADS=''
906
907 dnl # Test for libpthread or for libcma if libpthread is not present.
908 dnl # If the library is found, check for pthread_kill().  If it is present,
909 dnl # Draft 10 (the "final" draft) of the POSIX threads standard is in place.
910 dnl # If not, Draft 4 is available.
911 if test "x${_thread_pkg}" = "xPOSIX" ; then
912     _vjsave_LDFLAGS="$LDFLAGS"
913
914     if test "$ac_cv_CC_accepts_pthread" = "yes" ; then
915         LDFLAGS="$LDFLAGS -pthread"
916     fi
917
918     dnl # On HP-UX 11.00, HP hides the pthread library from configure.
919     dnl # This forces its use with the -mt flag.
920     if test "$PLATFORM" = "HP" ; then
921         THREADS='POSIX'
922     fi
923
924     AC_CHECK_LIB(pthread, pthread_create,
925         AC_CHECK_HEADER(pthread.h,
926             [ THREADS='POSIX' _pthread_lib='-lpthread'; ],
927             AC_MSG_WARN(*** POSIX threads will not be used (header file not found) ***)))
928
929     dnl # On FreeBSD, the pthreads stuff is in libc_r.
930     if test "x$THREADS" = "x" ; then
931         AC_CHECK_LIB(c_r, pthread_create,
932             AC_CHECK_HEADER(pthread.h,
933                 [ THREADS='POSIX' _pthread_lib='' ],
934                 AC_MSG_WARN(*** POSIX threads will not be used (header file not found) ***)))
935     fi
936
937     dnl # If $THREADS is equal to "POSIX" at this point, then the pthread
938     dnl # libraries needed are in $LIBS, so now we make a check for the draft
939     dnl # revision being used.  This is done by determining if pthread_kill()
940     dnl # is in the library.  If it is, Draft 10 is in use.  Otherwise, assume
941     dnl # it is Draft 4.
942     if test "$THREADS" = "POSIX" ; then
943         _vjsave_LIBS="$LIBS"
944         LIBS="$LIBS ${_pthread_lib}"
945
946         AC_CACHE_CHECK(POSIX threads draft revision,
947             ac_cv_pthread_version,
948             AC_TRY_LINK([#include <pthread.h> ],
949                 [ pthread_t t; pthread_kill(t, 1); ],
950                 ac_cv_pthread_version='Draft 10',
951                 ac_cv_pthread_version='Draft 4'))
952
953         AC_CHECK_FUNC(pthread_attr_setstack,
954             AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACK, 1))
955
956         LIBS="${_vjsave_LIBS}"
957
958         dnl # HP once again, not playing by the rules.  Forcing draft level 10.
959         if test "$PLATFORM" = "HP" ; then
960             AC_MSG_WARN(*** Forcing Pthreads Draft 10 on HP ***)
961             AC_DEFINE(_PTHREADS_DRAFT_10,)
962         else
963             if test "$ac_cv_pthread_version" = "Draft 10" ; then
964                 AC_DEFINE(_PTHREADS_DRAFT_10,)
965             else
966                 AC_DEFINE(_PTHREADS_DRAFT_4,)
967             fi
968         fi
969
970         dnl # Define the default thread scope depending on the platform.  On
971         dnl # IRIX, only process scope is avaiable without special
972         dnl # configuration options.  Other systems may support system scope.
973         if test "$PLATFORM" = "IRIX" ; then
974             AC_DEFINE(VJ_THREAD_SCOPE, PTHREAD_SCOPE_PROCESS)
975         else
976             AC_DEFINE(VJ_THREAD_SCOPE, PTHREAD_SCOPE_SYSTEM)
977         fi
978
979         dnl # Define the appropriate value for _POSIX_C_SOURCE on the current
980         dnl # platform.
981         if test "$PLATFORM" = "IRIX" -o "$PLATFORM" = "Linux" -o "$PLATFORM" = "Solaris" -o "$PLATFORM" = "HP"; then
982             AC_DEFINE(VJ_POSIX_C_SOURCE, 199506L)
983         else
984             AC_DEFINE(VJ_POSIX_C_SOURCE, 2)
985         fi
986     else
987         AC_MSG_WARN(*** POSIX threads will not be used (no library found) ***)
988     fi
989
990     dnl # Restore these in case any changes were made above.
991     LDFLAGS="${_vjsave_LDFLAGS}"
992 dnl # We are using WIN32 threads.
993 elif test "x${_thread_pkg}" = "xWIN32" ; then
994     THREADS='WIN32'
995
996 dnl # If we are not using POSIX threads, we must be using the IRIX sproc(2)
997 dnl # model, but we test ${_thread_pkg} just to be sure it is set right.
998 elif test "x${_thread_pkg}" = "xIRIX_SPROC" ; then
999     AC_CHECK_HEADERS(sys/prctl.h,
1000         THREADS='IRIX_SPROC',
1001         AC_MSG_WARN(*** IRIX sproc(2) threading will not be used (no headers found) ***))
1002 fi
1003
1004 dnl # Shared memory and synchronization primitives.
1005 SEMAPHORE_SYS=''                # POSIX, IRIX_SPROC, WIN32
1006 MUTEX_SYS=''                    # POSIX, IRIX_SPROC, WIN32
1007 SHMEM_SYS=''                    # POSIX, IRIX_SPROC, WIN32
1008 THREAD_SYS=''                   # POSIX, IRIX_SPROC, WIN32
1009
1010 dnl # Define various CPP macros depending on which threads implementation will
1011 dnl # be used.  If no implementation was defined above, exit configure.
1012 if test "$THREADS" = "POSIX" ; then
1013     dnl # Do not define _POSIX_C_SOURCE here because it will cause problems
1014     dnl # when compiling on IRIX.  Instead, define that in the source files
1015     dnl # where appropriate.
1016     AC_DEFINE(VJ_USE_PTHREADS,)
1017     AC_DEFINE(RWSTD_MULTI_THREAD,)
1018     AC_DEFINE(RW_MULTI_THREAD,)
1019
1020     dnl # On AIX, it is redundant to define _THREAD_SAFE.
1021     if test "x$PLATFORM" != "xAIX" ; then
1022         AC_DEFINE(_THREAD_SAFE,)
1023     fi
1024
1025     AC_DEFINE(_THREAD_SAFE,)
1026     dnl # On Linux, defining _THREAD_SAFE is the same as defining _REENTRANT,
1027     dnl # so we will not define both.
1028     if test "x$PLATFORM" != "xLinux" ; then
1029         AC_DEFINE(_REENTRANT,)
1030     else
1031         AC_DEFINE(_GNU_SOURCE,)
1032     fi
1033
1034     dnl # Use POSIX threading, mutexes and shared memory.
1035     MUTEX_SYS='POSIX'
1036     SHMEM_SYS='POSIX'
1037     THREAD_SYS='POSIX'
1038
1039     _vjsave_CFLAGS="$CFLAGS"
1040     _vjsave_LIBS="$LIBS"
1041
1042     dnl # This step and the following addition to $LIBS are necessary for
1043     dnl # properly testing for working POSIX semaphores.
1044     if test "x$ac_cv_CC_accepts_pthread" = "xyes" ; then
1045         CFLAGS="$CFLAGS -pthread"