root/juggler/tags/1.0.5/configure.in

Revision 7539, 73.8 kB (checked in by anonymous, 7 years ago)

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