root/juggler/tags/1.0.0/configure.in

Revision 17862, 70.2 kB (checked in by anonymous, 4 years ago)

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