/[ascend]/trunk/base/unixAC213/configure.in
ViewVC logotype

Annotation of /trunk/base/unixAC213/configure.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations) (download)
Thu Dec 16 15:21:59 2004 UTC (19 years, 10 months ago) by aw0a
File size: 70138 byte(s)
corrections to configure.in - not totally successful but here it is
1 aw0a 12 #--------------------------------------------------------------------
2     # A configure.in file for ASCEND.
3     #
4     # Process `configure.in' file with `autoconf' to produce
5     # a `configure' script. This `configure.in' was prepared
6     # for AutoConf v2.59.
7     #--------------------------------------------------------------------
8    
9     #--------------------------------------------------------------------
10     # Disable caching since it seems to get in the way
11     # more times than it helps us.
12     #--------------------------------------------------------------------
13     define([AC_CACHE_LOAD], )dnl
14     define([AC_CACHE_SAVE], )dnl
15    
16    
17     #--------------------------------------------------------------------
18     # This file must exist for configure to continue. It's
19     # how we know we're in the right place.
20     #--------------------------------------------------------------------
21     ##AWW20041113: AC_INIT(ascend4/compiler/ascParse.y)
22     AC_INIT(../generic/compiler/ascParse.y)
23    
24    
25     #--------------------------------------------------------------------
26     # CVS Most Recent Revision Data
27     # Put this data after AC_INIT since we want this information
28     # to also appear in configure and autoconf, when creating
29     # configure, strips all comments that appear in configure.in
30     # before AC_INIT
31     # $Revision: 1.38 $
32     # $Date: 2003/11/23 19:36:39 $
33     # $Author: ballan $
34     # $Source: /afs/cs.cmu.edu/project/ascend/Repository/configure.in,v $
35     #--------------------------------------------------------------------
36    
37    
38     #--------------------------------------------------------------------
39     # Where configure should look for files it needs.
40     #--------------------------------------------------------------------
41     AC_CONFIG_AUX_DIR(config)
42    
43     #--------------------------------------------------------------------
44     # Set the output variables prefix and exec_prefix that
45     # determine where things will be installed.
46     #--------------------------------------------------------------------
47     if test "${prefix}" = "NONE"; then
48     prefix=/usr/local
49     fi
50     if test "${exec_prefix}" = "NONE"; then
51     exec_prefix=$prefix
52     fi
53    
54    
55     #--------------------------------------------------------------------
56     # For the Fortran support libraries and the TCL/TK libraries
57     # and header files, we unfortunately need the full path to
58     # these files. The problem with having the full path is that
59     # if the user moves the source tree, things will break unless
60     # the user re-runs configure.
61     #--------------------------------------------------------------------
62    
63     #--------------------------------------------------------------------
64     ##AWW
65 aw0a 15 ##AWW We put the .o files when compiling into a tree structure
66     ##AWW relative to the directory in which we currently reside,
67     ##AWW while the .c and .h files are in a similar tree structure
68     ##AWW relative to the configure instruction we invoke. This
69     ##AWW allows one to have separate .o files in their own tree when
70     ##AWW compiling for different operating systems.
71     ##AWW
72     ##AWW Example 1 (same directories)
73     ##AWW Current directory one is in: /home/me/trunk/base/unixAC213
74 aw0a 31 ##AWW Directory containing configure: /home/me/trunk/base/unixAC213
75     ##AWW Command to invoke configure: ./configure
76 aw0a 15 ##AWW $ascpwd will be: /home/me/trunk/base/unixAC213
77 aw0a 31 ##AWW $srcdir will be: .
78 aw0a 18 ##AWW
79 aw0a 15 ##AWW Example 2 (different directories, abs path for command)
80     ##AWW Current directory one is in: /home/me/trunk/base/newTree
81 aw0a 31 ##AWW Directory containing configure: /home/me/trunk/base/unixAC213
82     ##AWW Command to invoke configure: /home/me/trunk/base/unixAC213/configure
83     ##AWW $ascpwd will be: /home/me/trunk/base/newTree
84     ##AWW $srcdir will be: /home/me/trunk/base/unixAC213
85     ##AWW
86 aw0a 15 ##AWW Example 3 (different directories, rel path for command)
87     ##AWW Same as Example 2
88     ##AWW Command to invoke configure: ../unixAC213/configure
89 aw0a 31 ##AWW $ascpwd will be: /home/me/trunk/base/newTree (same as in Example 2)
90     ##AWW $srcdir will be: ../unixAC213
91     ##AWW
92 aw0a 18 ##AWW Key elements of the source tree are:
93     ##AWW code/trunk/trunk/base/unixAC213/configure
94 aw0a 31 ##AWW code/trunk/trunk/base/generic
95     ##AWW code/trunk/tcltk98
96     ##AWW where $srcdir is pointing to /home/me/trunk/base/unixAC213, the folder
97     ##AWW containing "configure"
98 aw0a 18 ##AWW
99     ##AWW Configure is located at:
100     ##AWW $srcdir/configure
101     ##AWW while the .c/.h files one wants are in:
102     ##AWW $srcdir/../generic/compiler
103     ##AWW $srcdir/../generic/general
104     ##AWW $srcdir/../generic/packages
105     ##AWW $srcdir/../generic/solver
106     ##AWW $srcdir/../generic/utilities
107     ##AWW $srcdir/../../tcltk98/generic/interface
108     ##AWW
109     ##AWW Each of these directories contain Makefiles and possible
110     ##AWW need to find .h files in the other directories. For example
111     ##AWW the include statements are always of the form
112     ##AWW #include compiler/slv3.h or
113     ##AWW #include interface/SlvProc.h
114     ##AWW
115     ##AWW A safe include path should assume one is a directory with any
116     ##AWW of these .h and .c files and one needs to find a .h file in
117     ##AWW any other of them. The following paths should do it.
118     ##AWW
119     ##AWW If in compiler, general, packages, solver, utilities
120     ##AWW .. for general, packages, etc
121 aw0a 31 ##AWW ../../../tcltk98/generic for interface
122     ##AWW If in interface
123 aw0a 18 ##AWW .. for interface
124 aw0a 31 ##AWW ../../../base/generic for compiler, general, ..
125     ##AWW
126 aw0a 18 #--------------------------------------------------------------------
127 aw0a 12 # The asc_include variable is (directory) path to the ascend4
128 aw0a 31 # SOURCE directory relative to the immediate subdirectories of
129     # the ascend4 OBJECT directory. --rewrite - not clear.
130     #AWW To compile a new ASCEND executable, one should move into the
131     #AWW directory in which one wants the ASCEND object/executable
132     #AWW to reside (call this objTree) and from there run
133     #AWW ../base/unixAC213/configure.
134     #AWW In the following code asc_include is set to the path from
135    
136 aw0a 15 ascpwd=`pwd`
137     fullpathsrcdir=`cd $srcdir ; pwd`
138    
139     case "$srcdir" in
140 aw0a 12 .)
141     asc_include="../$srcdir"
142     ;;
143     /*)
144     #AWW20041113: asc_include="$srcdir/ascend4"
145     asc_include="$srcdir/../generic"
146     ;;
147     *)
148     #AWW20041113: asc_include="../../$srcdir/ascend4"
149     asc_include="$srcdir/../generic"
150 aw0a 31 ;;
151 aw0a 12 esac
152    
153    
154     #--------------------------------------------------------------------
155     # Do basic checks to determine
156     # * if we have `ranlib'
157     # * if we can create symbolic links
158     # * if `make' sets the MAKE macro
159     # * a bsd-compatible `install' program
160     # If we use the install-sh script that comes with configure,
161     # prefix it with the current directory so it'll work in
162     # subdirectories. Unfortunately, it won't work if the user
163     # moves the source tree.
164     #--------------------------------------------------------------------
165     AC_PROG_RANLIB
166     AC_PROG_LN_S
167     AC_PROG_MAKE_SET
168     AC_PROG_INSTALL
169     ##AWW20041113: No fixing seems necessary.
170 aw0a 15 case "X$INSTALL" in
171 aw0a 12 X/*)
172     ;;
173     *)
174     INSTALL="$ascpwd/$INSTALL"
175     ;;
176     esac
177    
178    
179     #--------------------------------------------------------------------
180     # Get the host type for various checks along the way
181     #--------------------------------------------------------------------
182     AC_CANONICAL_HOST
183    
184    
185     #--------------------------------------------------------------------
186     # Check for the C compiler: set CC and CFLAGS.
187     # If the user does NOT specify `--enable-gcc' on the configure
188     # command command line, set CC to either the envar CC or `cc'.
189     # Call AC_PROG_CC which will use the value of CC (perhaps set
190     # immediately above) or will check for `gcc' and then for `cc'
191     # if `gcc' is not found.
192     #
193     # If we are using GCC, then assume it groks ANSI. Otherwise,
194     # try to compile a small program using ANSI constructs with
195     # CC. If this fails, try to locate each of the following:
196     # c89 xlc acc
197     # and if successful, see if it compiles an ANSI C program.
198     # (Doing this in a loop would be ideal, but configure caches
199     # the result of AC_CHECK_PROG and uses the cached value for
200     # all but the first pass through the loop. This is also the
201     # reason we have to use a different variable asc_cc1, asc_cc2
202     # for each call to AC_CHECK_PROG.
203     #
204     # If we do not find an ANSI C compiler, print a warning and
205     # use the first value of CC we tried.
206     #--------------------------------------------------------------------
207    
208     AC_ARG_ENABLE(gcc,
209     [
210     ASCEND specific options
211    
212     Compiler options:
213     --enable-gcc allow use of gcc if avaiable],
214     [asc_gcc_ok=$enableval], [asc_gcc_ok=no])
215     if test ! "$asc_gcc_ok" = "yes"; then
216     CC=${CC-cc}
217     fi
218     asc_orig_cc=$CC
219    
220     if test "X$asc_gcc_ok" = "Xyes" ; then
221     asc_ansi_ok=yes
222     else
223     AC_MSG_CHECKING(
224     [whether $CC understands const, void*, and function prototypes])
225     AC_TRY_COMPILE( , [
226     int tstproto(int arg1, char * arg2);
227     int tstconst(const int arg1, const char *arg2);
228     int tstvoidp(const int arg1, const void *arg2); ],
229     [ asc_ansi_ok=yes ], [ asc_ansi_ok=no ])
230     AC_MSG_RESULT($asc_ansi_ok)
231     fi
232    
233     if test "$asc_ansi_ok" = no ; then
234     AC_CHECK_PROG(asc_cc1, c89, c89, NONE)
235     if test ! "$asc_cc1" = NONE ; then
236     CC=$asc_cc1
237     AC_MSG_CHECKING(
238     [whether $CC understands const, void*, and function prototypes])
239     AC_TRY_COMPILE( , [
240     int tstproto(int arg1, char * arg2);
241     int tstconst(const int arg1, const char *arg2);
242     int tstvoidp(const int arg1, const void *arg2); ],
243     [ asc_ansi_ok=yes ], [ asc_ansi_ok=no ])
244     AC_MSG_RESULT($asc_ansi_ok)
245     fi
246     fi
247    
248     if test "$asc_ansi_ok" = no ; then
249     AC_CHECK_PROG(asc_cc2, xlc, xlc, NONE)
250     if test ! "$asc_cc2" = NONE ; then
251     CC=$asc_cc2
252     AC_MSG_CHECKING(
253     [whether $CC understands const, void*, and function prototypes])
254     AC_TRY_COMPILE( , [
255     int tstproto(int arg1, char * arg2);
256     int tstconst(const int arg1, const char *arg2);
257     int tstvoidp(const int arg1, const void *arg2); ],
258     [ asc_ansi_ok=yes ], [ asc_ansi_ok=no ])
259     AC_MSG_RESULT($asc_ansi_ok)
260     fi
261     fi
262    
263     if test "$asc_ansi_ok" = no ; then
264     AC_CHECK_PROG(asc_cc3, acc, acc, NONE)
265     if test ! "$asc_cc3" = NONE ; then
266     CC=$asc_cc3
267     AC_MSG_CHECKING(
268     [whether $CC understands const, void*, and function prototypes])
269     AC_TRY_COMPILE( , [
270     int tstproto(int arg1, char * arg2);
271     int tstconst(const int arg1, const char *arg2);
272     int tstvoidp(const int arg1, const void *arg2); ],
273     [ asc_ansi_ok=yes ], [ asc_ansi_ok=no ])
274     AC_MSG_RESULT($asc_ansi_ok)
275     fi
276     fi
277    
278     AC_PROG_CC
279    
280     if test "$asc_ansi_ok" = no ; then
281     CC=$asc_orig_cc
282     AC_MSG_ERROR([Cannot find an ANSI C compiler. ASCEND will not build
283     without an ANSI compiler. If you have an ANSI compiler which
284     configure is not finding, set the CC environment variable to
285     the full path fo the compiler and rerun configure.])
286     fi
287    
288    
289     #--------------------------------------------------------------------
290     # Do other misc checks with CC and CFLAGS.
291     #
292     # Determine how to run the C preprocessor.
293     #
294     # If the user specifies --enable-optimization, remove `-g'
295     # from CFLAGS, add `-O' to CFLAGS, and define `NDEBUG'. If
296     # we are not building optimized, check for special libraries
297     # needed for building a debugging binary (currenly only
298     # /usr/lib/end.o under HPUX).
299     #
300     # Check if we're running on AIX; if so, add `-D_ALL_SOURCE'
301     # to CFLAGS.
302     #
303     # Check if we're running on HPUX; if so, add -D_HPUX_SOURCE'
304     # to CFLAGS unless the C preprocessor goes it for us.
305     #--------------------------------------------------------------------
306    
307     AC_PROG_CPP
308    
309     AC_ARG_ENABLE(optimization,
310     [ --enable-optimization optimize the C code while building ascend],
311     [asc_do_opt="$enableval"], [asc_do_opt=no])
312     if test "$asc_do_opt" = yes; then
313     CFLAGS=`echo "-O $CFLAGS " | sed 's/ -g / /g'`
314     AC_DEFINE(NDEBUG)
315     else
316     AC_PATH_PROG(DEBUG_LIBS, end.o, , /usr/lib)
317     fi
318    
319     AC_MSG_CHECKING([for AIX])
320     AC_EGREP_CPP(yes, [
321     #ifdef _AIX
322     yes
323     #endif
324     ], [ asc_aix=yes ; AC_DEFINE(_ALL_SOURCE) ], [asc_aix=no])
325     AC_MSG_RESULT($asc_aix)
326    
327     AC_MSG_CHECKING([whether -D_HPUX_SOURCE is needed])
328     AC_EGREP_CPP(yes, [
329     #ifdef __hpux
330     #ifndef _HPUX_SOURCE
331     yes
332     #endif
333     #endif
334     ], [ asc_hpux=yes ; AC_DEFINE(_HPUX_SOURCE) ], [asc_hpux=no])
335     AC_MSG_RESULT($asc_hpux)
336    
337     # Check the size of pointers; if cross compiling, assume 32 bit pointers
338     AC_CHECK_SIZEOF(void *, 4)
339    
340    
341     #--------------------------------------------------------------------
342     # Set YACC.
343     # See if we can find `yacc' ourselves; if not, call the
344     # autoconf macro which looks for `bison' and then for `yacc'
345     #--------------------------------------------------------------------
346     asc_found_yacc=0
347     AC_CHECK_PROG(YACC, yacc, yacc, [asc_found_yacc=no])
348     if test "$asc_found_yacc" = no ; then
349     AC_PROG_YACC
350     fi
351    
352    
353     #--------------------------------------------------------------------
354     # Set LEX.
355     # ASCEND requires a `flex' which understands -P (allows you to
356     # specify a prefix other than `yy'). The -P flag was added at
357     # the same time a -V (version) flag was added (version 2.4.1),
358     # so if `flex' understands -V, it'll understand -P (checking
359     # for -P directly requires a flex input file).
360     #
361     # 1. If `LEX' is not set, look for `flex' and set `LEX' to
362     # `flex' if found.
363     # 2. If `flex' was found, see if it understands -V. If so,
364     # set `scanner_src' and `typer_src' to have `flex' generate
365     # the C files from the flex input files
366     # base/generic/compiler/scanner.l & tcltk98/interface/typelex.l
367 aw0a 18 # We don't need to look for libfl.a since we define
368 aw0a 12 # yywrap() ourselves.
369     # 3. If `flex' wasn't found or was found but isn't new enough:
370     # a. Print a warning message
371     # b. Set `scanner_src' and `typer_src' to use pre-generated
372     # C files for the flex files mentioned in (2).
373     # c. Set `LEX' to `lex'
374     # d. Search for the lex library `libl.a' and set LEXLIB to
375     # its location.
376     #--------------------------------------------------------------------
377     AC_CHECK_PROG(LEX, flex, flex)
378    
379     if test -n "$LEX" ; then
380     AC_MSG_CHECKING([whether $LEX is at least version 2.4.1])
381     echo "$LEX -V" 1>&5
382     if $LEX -V 1>&5 2>&5 ; then
383     AC_MSG_RESULT(yes)
384     scanner_src="scanner.c.from.flex"
385     typer_src="typelex.c.from.flex"
386     else
387     AC_MSG_RESULT(no)
388     LEX=''
389     fi
390     fi
391    
392     if test -z "$LEX" ; then
393     AC_MSG_WARN([Cannot find a flex lexer version 2.4.1 or greater.
394     Using pregenerated C files for base/generic/compiler/scanner.l
395 aw0a 18 and tcltk98/interface/typelex.l. If you have flex 2.4.1
396     or newer, set the LEX environment variable to its location
397 aw0a 12 and run configure again.])
398     scanner_src="scanner.c.from.c"
399     typer_src="typelex.c.from.c"
400    
401     # let configure set LEX and LEXLIB even though we won't be using them
402     AC_PROG_LEX
403     fi
404    
405    
406     #--------------------------------------------------------------------
407     # Math libraries.
408     # On a few very rare systems, all of the libm.a stuff is
409     # already in libc.a. Set compiler flags accordingly.
410     # Also, Linux requires the "ieee" library for math to work
411     # right (and it must appear before "-lm").
412     #
413     # When building on HPUX with GCC, GCC cannot find `copysign'
414     # because it lives in an odd place; see if we need to add
415     # this odd place to MATH_LIBS.
416     #
417     # See if erf(), the error function, exists; if so, define
418     # HAVE_ERF.
419     #--------------------------------------------------------------------
420     AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
421    
422     AC_CHECK_LIB(ieee, printf, [MATH_LIBS="-lieee $MATH_LIBS"])
423    
424     if test -n "$MATH_LIBS" ; then
425     AC_CHECK_LIB(m, copysign, ,
426     AC_CHECK_LIB(m, drem, [MATH_LIBS="$MATH_LIBS /lib/pa1.1/libM.a"]
427     , , /lib/pa1.1/libM.a
428     ),
429     $MATH_LIBS)
430     fi
431    
432     # store the current list of libraries, add the math libraries to LIBS,
433     # check for erf(), then reset the value of LIBS.
434     asc_keep_LIBS="$LIBS"
435     LIBS="$LIBS $MATH_LIBS"
436     AC_CHECK_FUNCS(erf)
437     LIBS="$asc_keep_LIBS"
438    
439    
440     #--------------------------------------------------------------------
441     # Check for X11.
442     # We'll use the simple autoconf builtin macro for finding
443     # X11 until we find a reason not to.
444     #
445     # On Solaris and IRIX, add the path to the X library to the
446     # run-time shared-library-search-path so the ASCEND binary
447     # can find the X library without the user having to set
448     # LD_LIBRARY_PATH
449     #--------------------------------------------------------------------
450     AC_PATH_X
451     if test -n "$x_includes"; then
452     X11_INCLUDES="-I$x_includes"
453     fi
454     if test -n "$x_libraries"; then
455     X11_LIBRARIES="-L$x_libraries"
456     case "$host" in
457     sparc-sun-solaris*)
458     X11_RUN_PATH="-R$x_libraries"
459     ;;
460     mips-sgi-irix*)
461     X11_RUN_PATH="-rpath $x_libraries"
462     ;;
463     *)
464     X11_RUN_PATH=""
465     ;;
466     esac
467     fi
468    
469    
470     #--------------------------------------------------------------------
471     # Check for the existence of various libraries. The order here
472     # is important, so that then end up in the right order in the
473     # command line generated by make. The -lsocket and -lnsl
474     # libraries require a couple of special tricks:
475     # 1. Use "connect" and "accept" to check for -lsocket, and
476     # "gethostbyname" to check for -lnsl.
477     # 2. Use each function name only once: can't redo a check
478     # because autoconf caches the results of the last check
479     # and won't redo it.
480     # 3. Use -lnsl and -lsocket only if they supply procedures that
481     # aren't already present in the normal libraries. This is
482     # because IRIX 5.2 has libraries, but they aren't needed and
483     # they're bogus: they goof up name resolution if used.
484     # 4. On some SVR4 systems, can't use -lsocket without -lnsl
485     # too. To get around this problem, check for both libraries
486     # together if -lsocket doesn't work by itself.
487     #--------------------------------------------------------------------
488     dnl AC_CHECK_LIB(Xbsd, printf, [LIBS="$LIBS -lXbsd"])
489    
490     asc_checkBoth=0
491     AC_CHECK_FUNC(connect, [asc_checkSocket=0], [asc_checkSocket=1])
492     if test "$asc_checkSocket" = 1; then
493     AC_CHECK_LIB(socket, printf, [X11_EXTRA_LIBS="-lsocket"],[asc_checkBoth=1])
494     fi
495     if test "$asc_checkBoth" = 1; then
496     asc_oldLibs=$LIBS
497     X11_EXTRA_LIBS="-lsocket -lnsl"
498     LIBS="$LIBS $X11_EXTRA_LIBS"
499     AC_CHECK_FUNC(accept, asc_checkNsl=0, [X11_EXTRA_LIBS=""])
500     LIBS=$asc_oldLibs
501     fi
502     asc_oldLibs=$LIBS
503     LIBS="$LIBS $X11_EXTRA_LIBS"
504     AC_CHECK_FUNC(gethostbyname, ,
505     AC_CHECK_LIB(nsl, printf, [X11_EXTRA_LIBS="$X11_EXTRA_LIBS -lnsl"]))
506     LIBS=$asc_oldLibs
507    
508    
509     #--------------------------------------------------------------------
510     # The following comes directly from the configure.in file for
511     # Tcl8.0.
512     #
513     # The statements below define a collection of symbols related to
514     # dynamic loading and shared libraries:
515     #
516     # DL_OBJS - Name of the object file that implements dynamic
517     # loading for ASCEND on this system.
518     # DL_LIBS - Library file(s) to include in tclsh and other base
519     # applications in order for the "load" command to work.
520     # LD_FLAGS - Flags to pass to the compiler when linking object
521     # files into an executable application binary such
522     # as tclsh.
523     # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
524     # that tell the run-time dynamic linker where to look
525     # for shared libraries such as libtcl.so. Depends on
526     # the variable LIB_RUNTIME_DIR in the Makefile.
527     # MAKE_LIB - Command to execute to build the ASCEND library;
528     # differs depending on whether or not ASCEND is being
529     # compiled as a shared library.
530     # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
531     # of a shared library (may request position-independent
532     # code, among other things).
533     # SHLIB_LD - Base command to use for combining object files
534     # into a shared library.
535     # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
536     # creating shared libraries. This symbol typically
537     # goes at the end of the "ld" commands that build
538     # shared libraries. The value of the symbol is
539     # "${LIBS}" if all of the dependent libraries should
540     # be specified when creating a shared library. If
541     # dependent libraries should not be specified (as on
542     # SunOS 4.x, where they cause the link to fail, or in
543     # general if ASCEND and Tk aren't themselves shared
544     # libraries), then this symbol has an empty string
545     # as its value.
546     # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
547     # extensions. An empty string means we don't know how
548     # to use shared libraries on this platform.
549     # ASC_LIB_FILE - Name of the file that contains the ASCEND library, such
550     # as libtcl7.8.so or libtcl7.8.a.
551     # ASC_LIB_SUFFIX -Specifies everything that comes after the "libtcl"
552     # in the shared library name, using the $VERSION variable
553     # to put the version in the right place. This is used
554     # by platforms that need non-standard library names.
555     # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
556     # to have a version after the .so, and ${VERSION}.a
557     # on AIX, since the ASCEND shared library needs to have
558     # a .a extension whereas shared objects for loadable
559     # extensions have a .so extension. Defaults to
560     # ${VERSION}${SHLIB_SUFFIX}.
561     #--------------------------------------------------------------------
562    
563     # Step 1: set the variable "system" to hold the name and version number
564     # for the system. This can usually be done via the "uname" command, but
565     # there are a few systems, like Next, where this doesn't work.
566    
567     # Changed this to use the "$host" variable from AC_CANONICAL_HOST
568    
569     # Step 2: check for existence of -ldl library. This is needed because
570     # Linux can use either -ldl or -ldld for dynamic loading.
571    
572     AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
573    
574     # Step 3: set configuration options based on system name and version.
575    
576     ASC_SHARED_LIB_SUFFIX=""
577     ASC_UNSHARED_LIB_SUFFIX=""
578     ASC_LIB_VERSIONS_OK=ok
579     case $host in
580     *-aix*)
581     SHLIB_CFLAGS=""
582     SHLIB_LD="$fullpathsrcdir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512"
583     SHLIB_LD_LIBS='${LIBS}'
584     SHLIB_SUFFIX=".so"
585     DL_OBJS=""
586     DL_LIBS="-lld"
587     LD_FLAGS=""
588     LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
589     ASC_SHARED_LIB_SUFFIX='${VERSION}.a'
590     ;;
591     *-bsdi*)
592     SHLIB_CFLAGS=""
593     SHLIB_LD="shlicc -r"
594     SHLIB_LD_LIBS='${LIBS}'
595     SHLIB_SUFFIX=".so"
596     DL_OBJS=""
597     DL_LIBS="-ldl"
598     LD_FLAGS=""
599     LD_SEARCH_FLAGS=""
600     ;;
601     *-dgux*)
602     SHLIB_CFLAGS="-K PIC"
603     SHLIB_LD="cc -G"
604     SHLIB_LD_LIBS=""
605     SHLIB_SUFFIX=".so"
606     DL_OBJS=""
607     DL_LIBS="-ldl"
608     LD_FLAGS=""
609     LD_SEARCH_FLAGS=""
610     ;;
611     *-hpux8*|*-hpux9*|*-hpux10*)
612     AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
613     if test "$tcl_ok" = yes; then
614     SHLIB_CFLAGS="+z"
615     SHLIB_LD="ld -b"
616     SHLIB_LD_LIBS=""
617     SHLIB_SUFFIX=".sl"
618     DL_OBJS=""
619     DL_LIBS="-ldld"
620     LD_FLAGS="-Wl,-E"
621     LD_SEARCH_FLAGS='-Wl,+b,${LIB_RUNTIME_DIR}:.'
622     fi
623     ;;
624     *-irix4*)
625     SHLIB_CFLAGS="-G 0"
626     SHLIB_SUFFIX=".a"
627     SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
628     SHLIB_LD_LIBS='${LIBS}'
629     DL_OBJS=""
630     DL_LIBS=""
631     LD_FLAGS="-Wl,-D,08000000"
632     LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
633     ASC_SHARED_LIB_SUFFIX='${VERSION}.a'
634     ;;
635     *-irix5*|*-irix6.*)
636     SHLIB_CFLAGS=""
637     SHLIB_LD="ld -shared -rdata_shared"
638     SHLIB_LD_LIBS=""
639     SHLIB_SUFFIX=".so"
640     DL_OBJS=""
641     DL_LIBS=""
642     LD_FLAGS=""
643     LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
644     ;;
645     *-linux*)
646     SHLIB_CFLAGS="-fPIC"
647     SHLIB_LD_LIBS=""
648     SHLIB_SUFFIX=".so"
649     if test "$have_dl" = yes; then
650     SHLIB_LD="${CC} -shared"
651     DL_OBJS=""
652     DL_LIBS="-ldl"
653     LD_FLAGS="-rdynamic"
654     LD_SEARCH_FLAGS=""
655     else
656     AC_CHECK_HEADER(dld.h, [
657     SHLIB_LD="ld -shared"
658     DL_OBJS=""
659     DL_LIBS="-ldld"
660     LD_FLAGS=""
661     LD_SEARCH_FLAGS=""])
662     fi
663     ;;
664     MP-RAS-02*)
665     SHLIB_CFLAGS="-K PIC"
666     SHLIB_LD="cc -G"
667     SHLIB_LD_LIBS=""
668     SHLIB_SUFFIX=".so"
669     DL_OBJS=""
670     DL_LIBS="-ldl"
671     LD_FLAGS=""
672     LD_SEARCH_FLAGS=""
673     ;;
674     MP-RAS-*)
675     SHLIB_CFLAGS="-K PIC"
676     SHLIB_LD="cc -G"
677     SHLIB_LD_LIBS=""
678     SHLIB_SUFFIX=".so"
679     DL_OBJS=""
680     DL_LIBS="-ldl"
681     LD_FLAGS="-Wl,-Bexport"
682     LD_SEARCH_FLAGS=""
683     ;;
684     *-netbsd*|*-freebsd*|*-openbsd*)
685     # Not available on all versions: check for include file.
686     AC_CHECK_HEADER(dlfcn.h, [
687     SHLIB_CFLAGS="-fpic"
688     SHLIB_LD="ld -Bshareable -x"
689     SHLIB_LD_LIBS=""
690     SHLIB_SUFFIX=".so"
691     DL_OBJS=""
692     DL_LIBS=""
693     LD_FLAGS=""
694     LD_SEARCH_FLAGS=""
695     ASC_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.so.1.0'
696     ], [
697     SHLIB_CFLAGS=""
698     SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
699     SHLIB_LD_LIBS='${LIBS}'
700     SHLIB_SUFFIX=".a"
701     DL_OBJS=""
702     DL_LIBS=""
703     LD_FLAGS=""
704     LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
705     ASC_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
706     ])
707    
708     # FreeBSD doesn't handle version numbers with dots.
709    
710     ASC_UNSHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
711     ASC_LIB_VERSIONS_OK=nodots
712     ;;
713     *-nextstep*)
714     SHLIB_CFLAGS=""
715     SHLIB_LD="cc -nostdlib -r"
716     SHLIB_LD_LIBS=""
717     SHLIB_SUFFIX=".so"
718     DL_OBJS=""
719     DL_LIBS=""
720     LD_FLAGS=""
721     LD_SEARCH_FLAGS=""
722     ;;
723     alpha-dec-osf*)
724     # Digital OSF/1
725     SHLIB_CFLAGS=""
726     SHLIB_LD='ld -shared -expect_unresolved "*"'
727     SHLIB_LD_LIBS=""
728     SHLIB_SUFFIX=".so"
729     DL_OBJS=""
730     DL_LIBS=""
731     LD_FLAGS=""
732     LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
733     ;;
734     *-riscos*)
735     SHLIB_CFLAGS="-G 0"
736     SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
737     SHLIB_LD_LIBS='${LIBS}'
738     SHLIB_SUFFIX=".a"
739     DL_OBJS=""
740     DL_LIBS=""
741     LD_FLAGS="-Wl,-D,08000000"
742     LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
743     ;;
744     SCO_SV-3.2*)
745     # Note, dlopen is available only on SCO 3.2.5 and greater. However,
746     # this test works, since "uname -s" was non-standard in 3.2.4 and
747     # below.
748     SHLIB_CFLAGS="-Kpic -belf"
749     SHLIB_LD="ld -G"
750     SHLIB_LD_LIBS=""
751     SHLIB_SUFFIX=".so"
752     DL_OBJS=""
753     DL_LIBS=""
754     LD_FLAGS="-belf -Wl,-Bexport"
755     LD_SEARCH_FLAGS=""
756     ;;
757     *-sni-sysv*)
758     SHLIB_CFLAGS="-K PIC"
759     SHLIB_LD="cc -G"
760     SHLIB_LD_LIBS=""
761     SHLIB_SUFFIX=".so"
762     DL_OBJS=""
763     DL_LIBS="-ldl"
764     LD_FLAGS=""
765     LD_SEARCH_FLAGS=""
766     ;;
767     *-sunos4*)
768     SHLIB_CFLAGS="-PIC"
769     SHLIB_LD="ld"
770     SHLIB_LD_LIBS=""
771     SHLIB_SUFFIX=".so"
772     DL_OBJS=""
773     DL_LIBS="-ldl"
774     LD_FLAGS=""
775     LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
776    
777     # SunOS can't handle version numbers with dots in them in library
778     # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
779     # requires an extra version number at the end of .so file names.
780     # So, the library has to have a name like libtcl75.so.1.0
781    
782     ASC_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.so.1.0'
783     ASC_UNSHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
784     ASC_LIB_VERSIONS_OK=nodots
785     ;;
786     *-solaris*)
787     SHLIB_CFLAGS="-KPIC"
788     SHLIB_LD="/usr/ccs/bin/ld -G -z text"
789    
790     # Note: need the LIBS below, otherwise Tk won't find ASCEND's
791     # symbols when dynamically loaded into tclsh.
792    
793     SHLIB_LD_LIBS='${LIBS}'
794     SHLIB_SUFFIX=".so"
795     DL_OBJS=""
796     DL_LIBS="-ldl"
797     LD_FLAGS=""
798     LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
799     ;;
800     *-ultrix4*)
801     SHLIB_CFLAGS="-G 0"
802     SHLIB_SUFFIX=".a"
803     SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
804     SHLIB_LD_LIBS='${LIBS}'
805     DL_OBJS=""
806     DL_LIBS=""
807     LD_FLAGS="-Wl,-D,08000000"
808     LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
809     ;;
810     mips-dde-sysv*)
811     SHLIB_CFLAGS="-KPIC"
812     SHLIB_LD="cc -G"
813     SHLIB_LD_LIBS=""
814     SHLIB_SUFFIX=".so"
815     DL_OBJS=""
816     DL_LIBS="-ldl"
817     # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
818     # that don't grok the -Bexport option. Test that it does.
819     hold_ldflags=$LDFLAGS
820     AC_MSG_CHECKING([for ld accepts -Bexport flag])
821     LDFLAGS="${LDFLAGS} -Wl,-Bexport"
822     AC_TRY_LINK(, [int i;], found=yes, found=no)
823     LDFLAGS=$hold_ldflags
824     AC_MSG_RESULT($found)
825     if test "$found" = yes; then
826     LD_FLAGS="-Wl,-Bexport"
827     else
828     LD_FLAGS=""
829     fi
830     LD_SEARCH_FLAGS=""
831     ;;
832     esac
833    
834     #--------------------------------------------------------------------
835     # TCL / TK / TK-TABLE
836     #
837     # The user can specify the location of the Tcl and/or Tk
838     # libraries using the --with-tcl and --with-tk configure
839     # options. Print a warning if the user tries to say
840     # --without-tcl since ASCEND requires Tcl/Tk.
841     #
842     # If the user does not specify the location, we need to search
843     # for either shared or static versions of the Tcl and Tk
844     # libraries, and they must be for version 8.x of Tcl/Tk.
845     #
846     # Check for the static Tcl library in a list of reasonable
847     # locations. If we find it, verify that it is from Tcl 8.0 by
848     # looking for the symbol `TclCompileCatchCmd'. Remember, we
849     # need the math library and the dynamic loader library (-ldl or
850     # -ldld) to avoid undefined symbols when we test the version of
851     # the Tcl library.
852     #
853     # If we can't find a static Tcl8.0 library, try to find a
854     # dynamic one by calling AC_CHECK_LIB and looking for the
855     # function `TclCompileCatchCmd'. If we fail, print an error
856     # message and exit configure.
857     #
858     # Search for a version of tcl.h that contains `8.' in the
859     # TCL_MAJOR_VERSION macro; we look in a list of reasonable
860     # locations, then call AC_EGREP_HEADER to look for us.
861     #
862     # Repeat the process for the Tk library; the symbol we want is
863     # `Tk_NameOfFont'; remember we need the X library---and all the
864     # libraries it needs---as well as the Tcl library to avoid
865     # undefined symbols when we test the version of the Tk library.
866     #
867     # The user can use --with-tktable to specify a location for a
868     # static version of the Tk-Table library. If a value is
869     # specified, assume it is good and define the cpp macro
870     # STATIC_TABLE.
871     #
872     # If a value is not specified, look for libTktable.a; if we
873     # find it, assume it works and define the cpp macro
874     # STATIC_TABLE. If we don't find it, assume ASCEND will be
875     # able to dynamically load it at run time and tell the user
876     # about our assumption.
877     #--------------------------------------------------------------------
878     #
879     # a list of directories to search for the Tcl/Tk libraries
880     asc_tcl_library_dirs="
881     /usr/local/lib/ascend/lib
882     $prefix/lib:$exec_prefix/lib
883     $ascpwd/tcl8.0
884     $ascpwd/tcl8.0/unix
885     $ascpwd/tk8.0
886     $ascpwd/tk8.0/unix
887     $ascpwd/ascend4/lib
888     /lib
889     /usr/lib
890     /usr/local/lib
891     /usr/contributed/lib
892     /afs/cs/project/ascend/depot/@sys/lib
893     "
894     # a list of directories to search for the Tcl/Tk include files
895     asc_tcl_include_dirs="
896     /usr/local/lib/ascend/include
897     $prefix/include
898     $fullpathsrcdir/tcl8.0
899     $fullpathsrcdir/tcl8.0/generic
900     $fullpathsrcdir/tk8.0
901     $fullpathsrcdir/tk8.0/generic
902     $fullpathsrcdir/ascend4/include
903     $ascpwd/ascend4/include
904     /usr/include
905     /usr/local/include
906     /usr/contributed/include
907     /afs/cs/project/ascend/depot/common/include
908     "
909     # a list of directories to search for the TkTable library
910     asc_tk_table_dirs="
911     /usr/local/lib/ascend/lib/Tktable
912     $prefix/lib/Tktable
913     $exec_prefix/lib/Tktable
914     $ascpwd/tkTable1.80
915     $ascpwd/ascend4/lib
916     $ascpwd/ascend4/lib/Tktable
917     /afs/cs/project/ascend/depot/@sys/lib/Tktable
918     "
919     # see if the user gave us the location of the Tcl8.0
920     # library and/or header file
921     #
922     AC_ARG_WITH(tcl,
923     [Location of Tcl, Tk, and tkTable:
924     --with-tcl=LIBRARY,HEADER
925     The location of the Tcl8.0 library and/or header
926     For a static Tcl8.0 library, give the full path:
927     --with-tcl='/usr/local/lib/libtcl8.0.a'
928     For a dynamic library, give any -L options required:
929     --with-tcl='-L/usr/local/lib -ltcl8.0'
930     To specify only the header, leave off the library:
931     --with-tcl=',/usr/local/include/tcl.h'] ,
932     , [with_tcl=yes])
933    
934     case "$with_tcl" in
935     no)
936     # User specified --without-tcl; this makes no sense,
937     # print a warning and search for it ourselves
938     AC_MSG_WARN([Bad option '--without-tcl'
939     ASCEND must be compiled with Tcl8.0.])
940     with_tcllib=_searching
941     with_tclhdr=_searching
942     ;;
943     yes|,|"")
944     # User didn't give the option or didn't give useful
945     # information, search for it ourselves
946     with_tcllib=_searching
947     with_tclhdr=_searching
948     ;;
949     ,*)
950     # Only the header was specified.
951     with_tcllib=_searching
952     TCL_HDR=`echo $with_tcl | sed 's/^,//'`
953     ;;
954     *,?*)
955     # Both the library and the header were specified
956     TCL_LIB=`echo $with_tcl | sed 's/,.*$//'`
957     TCL_HDR=`echo $with_tcl | sed 's/^.*,//'`
958     ;;
959     *)
960     # Only the library was specified
961     TCL_LIB=`echo $with_tcl | sed 's/,$//'`
962     with_tclhdr=_searching
963     ;;
964     esac
965    
966     # try to find a static version of the Tcl8.0 library
967     #
968     if test "X$with_tcllib" = X_searching ; then
969     AC_PATH_PROGS(TCL_LIB, libtcl8.0.a libtcl80.a libtcl8.3.a, , $asc_tcl_library_dirs)
970     if test -z "$TCL_LIB" ; then
971     TCL_LIB=_searching
972     fi
973     else
974     AC_MSG_RESULT([checking for tcl library... $TCL_LIB])
975     fi
976    
977     # verify the TCL_LIB
978     if test ! "X$TCL_LIB" = X_searching ; then
979     AC_MSG_CHECKING([whether $TCL_LIB is for Tcl8.3])
980     asc_libs_orig=$LIBS
981     LIBS="$TCL_LIB $X11_LIBRARIES $X11_EXTRA_LIBS $DL_LIBS $MATH_LIBS $LIBS"
982     AC_TRY_LINK( , [TclCompileCatchCmd()], , [TCL_LIB=_searching]);
983     if test "X$TCL_LIB" = X_searching ; then
984     AC_MSG_RESULT(no)
985     else
986     AC_MSG_RESULT(yes)
987     fi
988     LIBS=$asc_libs_orig
989     fi
990    
991     # see if the default LPATH can find the Tcl8.0 library
992     #
993     if test "X$TCL_LIB" = X_searching ; then
994     AC_CHECK_LIB(tcl83, TclCompileCatchCmd, [TCL_LIB="-ltcl83"] , ,
995     [$X11_LIBRARIES $X11_EXTRA_LIBS $DL_LIBS $MATH_LIBS])
996     fi
997     if test "X$TCL_LIB" = X_searching ; then
998     AC_CHECK_LIB(tcl8.3, TclCompileCatchCmd, [TCL_LIB="-ltcl8.3"] , ,
999     [$X11_LIBRARIES $X11_EXTRA_LIBS $DL_LIBS $MATH_LIBS])
1000     fi
1001     if test "X$TCL_LIB" = X_searching ; then
1002     AC_CHECK_LIB(tcl8.0, TclCompileCatchCmd, [TCL_LIB="-ltcl8.0"] , ,
1003     [$X11_LIBRARIES $X11_EXTRA_LIBS $DL_LIBS $MATH_LIBS])
1004     fi
1005     if test "X$TCL_LIB" = X_searching ; then
1006     AC_CHECK_LIB(tcl80, TclCompileCatchCmd, [TCL_LIB="-ltcl80"] , ,
1007     [$X11_LIBRARIES $X11_EXTRA_LIBS $DL_LIBS $MATH_LIBS])
1008     fi
1009     if test "X$TCL_LIB" = X_searching ; then
1010     AC_CHECK_LIB(tcl, TclCompileCatchCmd, [TCL_LIB="-ltcl"] , ,
1011     [$X11_LIBRARIES $X11_EXTRA_LIBS $DL_LIBS $MATH_LIBS])
1012     fi
1013    
1014     # give up searching for the Tcl8.0 library
1015     #
1016     if test "X$TCL_LIB" = X_searching ; then
1017     AC_MSG_ERROR([Cannot find a compatiable Tcl library.
1018     You must build and install Tcl version 8.3 before you
1019     can build ASCEND. If you have installed the correct version
1020     of Tcl, run configure again with the argument:
1021     --with-tcl=LIBRARY,HEADER
1022     where LIBRARY and HEADER are the full paths to the Tcl8.3
1023     library file and header file, respectively.])
1024     fi
1025    
1026     # see if the user gave us the location of the Tcl8.0 header file
1027     #
1028     if test ! "X$with_tclhdr" = X_searching ; then
1029     if test ! -f "$TCL_HDR" ; then
1030     AC_MSG_WARN([user specified Tcl header file, $TCL_HDR, does not exist])
1031     with_tclhdr=_searching
1032     TCL_HDR=''
1033     fi
1034     fi
1035     if test "X$with_tclhdr" = X_searching ; then
1036     AC_PATH_PROG(TCL_HDR, tcl.h, , $asc_tcl_include_dirs)
1037     if test -z "$TCL_HDR" ; then
1038     AC_EGREP_HEADER([TCL_MAJOR_VERSION.*8], tcl.h, [TCL_HDR='tcl.h'], )
1039     fi
1040     else
1041     AC_MSG_RESULT([checking for tcl header... $TCL_HDR])
1042     fi
1043     if test -f "$TCL_HDR" ; then
1044     AC_MSG_CHECKING([whether $TCL_HDR is for version 8])
1045     echo 'grep TCL_MAJOR_VERSION "$TCL_HDR" 2>&5' 1>&5
1046     grep_tcl_h=`grep TCL_MAJOR_VERSION "$TCL_HDR" 2>&5`
1047     echo $grep_tcl_h 1>&5
1048     case "$grep_tcl_h" in
1049     *8)
1050     AC_MSG_RESULT(yes)
1051     ;;
1052     *)
1053     AC_MSG_RESULT(no)
1054     TCL_HDR=
1055     ;;
1056     esac
1057     fi
1058     if test -z "$TCL_HDR" ; then
1059     AC_MSG_ERROR([Cannot find a compatiable Tcl header file.
1060     You must build and install Tcl version 8.3 (but not yet 8.4) before you
1061     can build ASCEND. If you have installed the correct version
1062     of Tcl, run configure again with the argument:
1063     --with-tcl=LIBRARY,HEADER
1064     where LIBRARY and HEADER are the full paths to the Tcl8.3
1065     library file and header file, respectively.])
1066     fi
1067     TCL_HDR=`echo $TCL_HDR | sed 's,tcl\.h$,,'`
1068     if test -n "$TCL_HDR" ; then
1069     TCL_HDR="-I$TCL_HDR"
1070     fi
1071    
1072    
1073     ###### REPEAT FOR TK
1074     #
1075     # see if the user gave us the location of the Tk8.3
1076     # library and/or header file
1077     #
1078     AC_ARG_WITH(tk,
1079     [ --with-tk=LIBRARY,HEADER
1080     The location of the Tk8.0 library and/or header
1081     For a static Tk8.0 library, give the full path:
1082     --with-tk='/usr/local/lib/libtk8.3.a'
1083     For a dynamic library, give any -L options required:
1084     --with-tk='-L/usr/local/lib -ltk8.3'
1085     To specify only the header, leave off the library:
1086     --with-tk=',/usr/local/include/tk.h'] ,
1087     , [with_tk=yes])
1088    
1089     case "$with_tk" in
1090     no)
1091     # User specified --without-tk; this makes no sense,
1092     # print a warning and search for it ourselves
1093     AC_MSG_WARN([Bad option '--without-tk'
1094     ASCEND must be compiled with Tk8.0.])
1095     with_tklib=_searching
1096     with_tkhdr=_searching
1097     ;;
1098     yes|,|"")
1099     # User didn't give the option or didn't give useful
1100     # information, search for it ourselves
1101     with_tklib=_searching
1102     with_tkhdr=_searching
1103     ;;
1104     ,*)
1105     # Only the header was specified.
1106     with_tklib=_searching
1107     TK_HDR=`echo $with_tk | sed 's/^,//'`
1108     ;;
1109     *,?*)
1110     # Both the library and the header were specified
1111     TK_LIB=`echo $with_tk | sed 's/,.*$//'`
1112     TK_HDR=`echo $with_tk | sed 's/^.*,//'`
1113     ;;
1114     *)
1115     # Only the library was specified
1116     TK_LIB=`echo $with_tk | sed 's/,$//'`
1117     with_tkhdr=_searching
1118     ;;
1119     esac
1120    
1121     # try to find a static version of the Tk8.0 library
1122     #
1123     if test "X$with_tklib" = X_searching ; then
1124     AC_PATH_PROGS(TK_LIB, libtk8.0.a libtk80.a libtk.a libtk8.3.a, , $asc_tcl_library_dirs)
1125     if test -z "TK_LIB" ; then
1126     TK_LIB=_searching
1127     fi
1128     else
1129     AC_MSG_RESULT([checking for tk library... $TK_LIB])
1130     fi
1131    
1132     # verify the TK_LIB
1133     #
1134     if test ! "X$TK_LIB" = X_searching ; then
1135     AC_MSG_CHECKING([whether $TK_LIB is for Tk8.0])
1136     asc_libs_orig=$LIBS
1137     LIBS="$TK_LIB $TCL_LIB $X11_LIBRARIES -lX11 $X11_EXTRA_LIBS $DL_LIBS $MATH_LIBS $LIBS"
1138     AC_TRY_LINK( , [Tk_NameOfFont()], , [TK_LIB=_searching]);
1139     if test "X$TK_LIB" = X_searching ; then
1140     AC_MSG_RESULT(no)
1141     else
1142     AC_MSG_RESULT(yes)
1143     fi
1144     LIBS=$asc_libs_orig
1145     fi
1146    
1147     # see if the default LPATH can find the Tk8.0 library
1148     #
1149     if test "X$TK_LIB" = X_searching ; then
1150     AC_MSG_RESULT([checking for a dynamically loaded Tk8.0 library])
1151     AC_CHECK_LIB(tk8.0, Tk_NameOfFont, [TK_LIB="-ltk8.0"] , ,
1152     [$TCL_LIB $X11_LIBRARIES -lX11 $X11_EXTRA_LIBS $DL_LIBS $MATH_LIBS])
1153     fi
1154     if test "X$TK_LIB" = X_searching ; then
1155     AC_CHECK_LIB(tk80, Tk_NameOfFont, [TK_LIB="-ltk80"] , ,
1156     [$TCL_LIB $X11_LIBRARIES -lX11 $X11_EXTRA_LIBS $DL_LIBS $MATH_LIBS])
1157     fi
1158     if test "X$TK_LIB" = X_searching ; then
1159     AC_CHECK_LIB(tk, Tk_NameOfFont, [TK_LIB="-ltk"] , ,
1160     [$TCL_LIB $X11_LIBRARIES -lX11 $X11_EXTRA_LIBS $DL_LIBS $MATH_LIBS])
1161     fi
1162    
1163     # give up searching for the Tk8.0 library
1164     #
1165     if test "X$TK_LIB" = X_searching ; then
1166     AC_MSG_ERROR([Cannot find a compatiable Tk library.
1167     You must build and install Tk version 8.0 or newer before you
1168     can build ASCEND. If you have installed the correct version
1169     of Tk, run configure again with the argument:
1170     --with-tk=LIBRARY,HEADER
1171     where LIBRARY and HEADER are the full paths to the Tk8.0
1172     library file and header file, respectively.])
1173     fi
1174    
1175     # see if the user gave us the location of the Tk8.0 header file
1176     #
1177     if test ! "X$with_tkhdr" = X_searching ; then
1178     if test ! -f "$TK_HDR" ; then
1179     AC_MSG_WARN([user specified Tk header file, $TK_HDR, does not exist])
1180     with_tkhdr=_searching
1181     TK_HDR=''
1182     fi
1183     fi
1184     if test "X$with_tkhdr" = X_searching ; then
1185     AC_PATH_PROG(TK_HDR, tk.h, , $asc_tcl_include_dirs)
1186     if test -z "$TK_HDR" ; then
1187     AC_EGREP_HEADER([TK_MAJOR_VERSION.*8], tk.h, [TK_HDR='tk.h'], )
1188     fi
1189     else
1190     AC_MSG_RESULT([checking for tk header... $TK_HDR])
1191     fi
1192     if test -f "$TK_HDR" ; then
1193     AC_MSG_CHECKING([whether $TK_HDR is for version 8])
1194     echo 'grep TK_MAJOR_VERSION "$TK_HDR" 2>&5' 1>&5
1195     grep_tk_h=`grep TK_MAJOR_VERSION "$TK_HDR" 2>&5`
1196     echo $grep_tk_h 1>&5
1197     case "$grep_tk_h" in
1198     *8)
1199     AC_MSG_RESULT(yes)
1200     ;;
1201     *)
1202     AC_MSG_RESULT(no)
1203     TK_HDR=
1204     ;;
1205     esac
1206     fi
1207     if test -z "$TK_HDR" ; then
1208     AC_MSG_ERROR([Cannot find a compatiable Tk header file.
1209     You must build and install Tk version 8.0 or newer before you
1210     can build ASCEND. If you have installed the correct version
1211     of Tk, run configure again with the argument:
1212     --with-tk=LIBRARY,HEADER
1213     where LIBRARY and HEADER are the full paths to the Tk8.0
1214     library file and header file, respectively.])
1215     fi
1216     TK_HDR=`echo $TK_HDR | sed 's,tk\.h$,,'`
1217     if test -n "$TK_HDR" ; then
1218     TK_HDR="-I$TK_HDR"
1219     if test "X$TCL_HDR" = "X$TK_HDR" ; then
1220     TK_HDR=
1221     fi
1222     fi
1223    
1224    
1225     AC_ARG_WITH(tktable,
1226     [ --with-tktable=TKTABLE full path to a TkTable1.3 static library], , )
1227     case "$with_tktable" in
1228     yes|no|"")
1229     # search for the table
1230     AC_PATH_PROG(TKTABLE_LIB, libTktable.a, , $asc_tk_table_dirs)
1231     ;;
1232     *)
1233     # use the user's value
1234     TKTABLE_LIB="$with_tktable"
1235     ;;
1236     esac
1237     if test -n "$TKTABLE_LIB" ; then
1238     HAVE_TKTABLE='-DSTATIC_TKTABLE'
1239     else
1240     AC_MSG_RESULT(Assuming Tktable will be dynamically linked into ASCEND)
1241     fi
1242    
1243     AC_ARG_WITH(wish,
1244     [ --with-wish=/path/to/bin/wish
1245     The location of the wish shell executable matching
1246     the tcl/tk given by --with-tk and --with-tcl.
1247     X11 must be running during configure. ] ,
1248     , [with_wish=no])
1249     case "$with_wish" in
1250     yes|no|"")
1251     AC_MSG_RESULT([--with-wish not specified.
1252     Setting env vars TCL_LIBRARY, TK_LIBRARY may be needed to run.])
1253     ;;
1254     *)
1255     AC_MSG_CHECKING([wish for tcl_library,tklibrary])
1256     ASC_TK_LIBRARY=`config/wishvar tk_library $with_wish`
1257     ASC_TCL_LIBRARY=`config/wishvar tcl_library $with_wish`
1258     AC_MSG_RESULT([ $ASC_TCL_LIBRARY , $ASC_TK_LIBRARY])
1259     ;;
1260     esac
1261    
1262    
1263     #--------------------------------------------------------------------
1264     # FORTRAN
1265     #
1266     # ASCEND uses the LSOD integrator and is capable of working
1267     # with CONOPT and with MINOS. These libraries are written in
1268     # Fortran; to use them, configure needs to find a Fortran
1269     # compiler and the necessary Fortran libraries (e.g.,
1270     # libF77.a). LSOD, CONOPT, and MINOS also require the BLAS and
1271     # LINPACK libraries to avoid undefined symbols at link time.
1272     #
1273     # The builder can specify the location of
1274     # * the Fortran compiler and libraries using
1275     # --with-fortran=<compiler>,<libraries>
1276     # * the BLAS library using
1277     # --with-blas=<blas-library>
1278     # * the LINPACK library using
1279     # --with-linpack=<linpack-library>
1280     # * the LSOD library using
1281     # --with-blas=<lsod-library>
1282     # * the CONOPT library using
1283     # --with-conopt=<conopt-library>
1284     # * the MINOS library using
1285     # --with-minos=<minos-library> <===currently disabled
1286     # The builder can disable some parts of the fortran build using
1287     # the --without-<package> configure option.
1288     #
1289     # If the user does not specify the locations of the compiler
1290     # and the libraries and does not disable them, configure
1291     # attempts to find them.
1292     #
1293     # Building with LSOD, CONOPT, and/or MINOS is further
1294     # complicated by the dependencies between these libraries and
1295     # the BLAS and LINPACK libraries.
1296     #
1297     # If we cannot find a Fortran compiler, we disable all Fortran
1298     # code (LSOD, CONOPT, and MINOS). Otherwise, look for the
1299     # Fortran libraries (e.g., libF77.a) based on the type of
1300     # machine we are compiling on.
1301     #
1302     # If Fortran is enabled, we need to find a compiled BLAS
1303     # library or source code. Check for the machine's libblas.a
1304     # and ASCEND's libascblas.a; if those fail, check for the
1305     # libascblas.a source code; if that fails, we disable all
1306     # Fortran (LSOD, CONOPT, MINOS).
1307     #
1308     # If Fortran is enabled, we need to find a compiled LINPACK
1309     # library or source code. Check for the machine's liblpak.a
1310     # and ASCEND's libasclpak.a; if those fail, check for the
1311     # libasclpak.a source code; if that fails, we disable all
1312     # Fortran (LSOD, CONOPT, MINOS).
1313     #
1314     # If Fortran is enabled, we try to find a compiled LSOD library
1315     # or source code. Check for a libinteg.a; if that fails, check
1316     # for the libinteg.a source code; if that fails, we disable
1317     # LSOD. If we find LSOD, define STATIC_LSOD.
1318     #
1319     # If Fortran is enabled, we try to find a compiled OPTSQP
1320     # library or source code. Check for a librsqp.a; if that fails,
1321     # check for the librsqp.a source code; if that fails, we disable
1322     # OPTSQP. If we find RSQP, define STATIC_OPTSQP.
1323     #
1324     # If Fortran is enabled, we try to find a compiled CONOPT
1325     # library. Check for a libconsub.a; if that fails, we disable
1326     # CONOPT. If we find CONOPT, define STATIC_CONOPT; if not,
1327     # tell the user where to find CONOPT using the contact
1328     # information from the nonlinear programming FAQ:
1329     # http://www.mcs.anl.gov/home/otc/Guide/faq/nonlinear-programming-faq.html
1330     #
1331     # If Fortran is enabled, we try to find a compiled MINOS
1332     # library or source code. Check for a libminos54.a; if that
1333     # fails, check for the libminos54.a source code; if that fails,
1334     # we disable MINOS. If we find MINOS, define STATIC_MINOS; if
1335     # not, tell the user where to find MINOS using the contact
1336     # information from the nonlinear programming FAQ:
1337     # http://www.mcs.anl.gov/home/otc/Guide/faq/nonlinear-programming-faq.html
1338     #--------------------------------------------------------------------
1339     #
1340     # the list of directories to search for the fortran compiler
1341     asc_f77_prog_dirs="$PATH:/usr/lang:/opt/SUNWspro/bin"
1342     #
1343     # the list of directories to search for the required fortran libraries
1344     asc_f77_support_dirs="
1345     /lib
1346     /usr/lib
1347     /usr/local/lib
1348     /usr/contributed/lib
1349     /usr/local/lib/ascend/lib
1350     $ascpwd/blas
1351     $ascpwd/linpack
1352     $ascpwd/lsod
1353    
1354 aw0a 15 ##AWW There are folders two levels up from configure for these packages
1355     $fullpathsrcdir/../../blas
1356     $fullpathsrcdir/../../linpack
1357     $fullpathsrcdir/../../lsod
1358    
1359     #AWW20041113: $ascpwd/conopt
1360 aw0a 12 #AWW20041113: $ascpwd/rsqp
1361     #AWW20041113: $ascpwd/minos
1362     #AWW20041113: $ascpwd/ascend4/archive
1363     $ascpwd/generic/archive
1364 aw0a 15 /afs/cs/project/ascend/depot/@sys/lib
1365 aw0a 12 /afs/cs/project/ascend/depot/build/obj/conopt
1366     "
1367     #
1368     AC_ARG_WITH(fortran,
1369     [Fortran compiler and libraries:
1370     --with-fortran=F77,F77LIBS
1371     The location of your Fortran compiler and its
1372     library files. For example, under SunOS:
1373     --with-fortran='f77,-L/usr/lang/lib -lF77 -lM77'
1374     To specify only the compiler or libraries, leave off
1375     whatever is not needed:
1376     --with-fortran=',-L/usr/lang/lib -lF77 -lM77'
1377     Use '--without-fortran' to not link against
1378     any Fortran libraries],
1379     , [with_fortran=yes])
1380     case "$with_fortran" in
1381     no)
1382     # The user disabled all fortran using
1383     # the --without-fortran option.
1384     F77=
1385     F77LIBS=
1386     with_f77=no
1387     with_f77libs=no
1388     ;;
1389     yes|,|"")
1390     # The user didn't pass in the --with-fortran option
1391     # or didn't give us any useful information. We do
1392     # the search ourselves.
1393     with_f77=_searching
1394     with_f77libs=_searching
1395     ;;
1396     ,*)
1397     # The user passed in the libraries, search for the
1398     # compiler ourselves.
1399     with_f77=_searching
1400     F77LIBS=`echo $with_fortran | sed 's/^,//'`
1401     echo "user gave F77LIBS=$F77LIBS"
1402     ;;
1403     *,?*)
1404     # The user passed in both the compiler and the
1405     # libraries.
1406     F77=`echo $with_fortran | sed s'/,.*$//'`
1407     F77LIBS=`echo $with_fortran | sed 's/^.*,//'`
1408     echo "user gave F77=$F77"
1409     echo "user gave F77LIBS=$F77LIBS"
1410     ;;
1411     *)
1412     # The user passed in the compiler; search for the
1413     # libraries ourselves.
1414     F77=`echo $with_fortran | sed s'/,$//'`
1415     with_f77libs=_searching
1416     echo "user gave F77=$F77"
1417     ;;
1418     esac
1419    
1420     if test "X$with_f77" = X_searching ; then
1421     # Search for the fortran compiler; print a warning if we can't
1422     # find it and disable all fortran.
1423     AC_PATH_PROGS(F77, f77 xlf g77, , $asc_f77_prog_dirs)
1424     if test -z "$F77" ; then
1425     with_fortran=no
1426     with_f77libs=no
1427     AC_MSG_WARN([Cannot find your Fortran compiler. Building ASCEND
1428     without integration, MINOS, and CONOPT support. To bulid ASCEND with
1429     Fortran support, run configure with the option
1430     --with-fortran=F77,F77LIBS
1431     where F77 is the full path to your Fortran compiler and F77LIBS are
1432     its related libraries])
1433     fi
1434     fi
1435    
1436     if test "X$with_f77libs" = X_searching ; then
1437     # We found a compiler, now search for the fortran libraries
1438     # based on the system type.
1439     AC_MSG_RESULT([checking for fortran libraries based on system type])
1440     case "$host" in
1441     alpha-dec-osf*)
1442     AC_CHECK_LIB(for, for_lle, [F77LIBS="$F77LIBS -lfor"], , $F77LIBS)
1443     AC_CHECK_LIB(ots, _OtsFill, [F77LIBS="$F77LIBS -lots"], , $F77LIBS)
1444     AC_CHECK_LIB(Ufor, etime_, [F77LIBS="$F77LIBS -lUfor"], , $F77LIBS)
1445     ;;
1446     mips-dec-ultrix*)
1447     AC_CHECK_LIB(for, for_lle, [F77LIBS="$F77LIBS -lfor"], , $F77LIBS)
1448     ;;
1449     hppa1.1-hp-hpux*)
1450     AC_CHECK_LIB(cl, FTN_QATAN, [F77LIBS="$F77LIBS -lcl"], , $F77LIBS)
1451     ;;
1452     *-ibm-aix*)
1453     # need to add -lc before -lxlf on AIX to
1454     # avoid getting the wrong getenv
1455     F77LIBS="-lc $F77LIBS"
1456     AC_CHECK_LIB(xlf, _xldabs, [F77LIBS="$F77LIBS -lxlf"], , $F77LIBS)
1457     AC_CHECK_LIB(xlfutil, srand_, [F77LIBS="$F77LIBS -lxlfutil"], ,
1458     $F77LIBS)
1459     AC_CHECK_LIB(xlf90, printf,
1460     [F77LIBS="$F77LIBS -lxlf90"], , $F77LIBS)
1461     ;;
1462     *-linux-*)
1463     AC_CHECK_LIB(f2c, pow_dd, [F77LIBS="$F77LIBS -lf2c"], , $F77LIBS)
1464     AC_CHECK_LIB(g2c, pow_dd, [F77LIBS="$F77LIBS -lg2c"], , $F77LIBS)
1465     ;;
1466     sparc-sun-solaris*)
1467     if test -n "$GCC" ; then
1468     F77LIBS="-L/opt/SUNWspro/lib -R/opt/SUNWspro/lib"
1469     fi
1470     AC_CHECK_LIB(sunmath, d_sqrt_, [MATH_LIBS="-lsunmath $MATH_LIBS"])
1471     AC_CHECK_LIB(F77, f77_init,
1472     [F77LIBS="$F77LIBS -lF77"], , $F77LIBS $MATH_LIBS)
1473     AC_CHECK_LIB(M77, inmax_,
1474     [F77LIBS="$F77LIBS -lM77"], , $F77LIBS $MATH_LIBS)
1475     ;;
1476     sparc-sun-sunos4*)
1477     if test -n "$GCC" ; then
1478     F77LIBS="-L/usr/lang/lib"
1479     fi
1480     AC_CHECK_LIB(F77, f77_init, [F77LIBS="$F77LIBS -lF77"], , $F77LIBS)
1481     AC_CHECK_LIB(M77, inmax_, [F77LIBS="$F77LIBS -lM77"], , $F77LIBS)
1482     ;;
1483     mips-sgi-irix*)
1484     AC_CHECK_LIB(F77, s_copy, [F77LIBS="$F77LIBS -lF77"], , $F77LIBS)
1485     AC_CHECK_LIB(I77, f_exit, [F77LIBS="$F77LIBS -lI77"], , $F77LIBS)
1486     AC_CHECK_LIB(isam, mkidxname,
1487     [F77LIBS="$F77LIBS -lisam"], , $F77LIBS)
1488     ;;
1489     *)
1490     AC_CHECK_LIB(F77, printf, [F77LIBS="$F77LIBS -lF77"], , $F77LIBS)
1491     AC_CHECK_LIB(M77, printf, [F77LIBS="$F77LIBS -lM77"], , $F77LIBS)
1492     AC_CHECK_LIB(f2c, pow_dd, [F77LIBS="$F77LIBS -lf2c"], , $F77LIBS)
1493     AC_CHECK_LIB(f77, printf, [F77LIBS="$F77LIBS -lf77"], , $F77LIBS)
1494     AC_CHECK_LIB(for, printf, [F77LIBS="$F77LIBS -lfor"], , $F77LIBS)
1495     AC_CHECK_LIB(ots, printf, [F77LIBS="$F77LIBS -lots"], , $F77LIBS)
1496     AC_CHECK_LIB(Ufor, printf, [F77LIBS="$F77LIBS -lUfor"], , $F77LIBS)
1497     ;;
1498     esac
1499     fi
1500    
1501     # asc_subdirs are the extra fortran subdirectories we have to visit
1502     # to build the fortran libraries. Initialize it to empty here.
1503     asc_subdirs=''
1504    
1505     # Initialize the blas variables
1506     make_blaslib=''
1507    
1508     AC_ARG_WITH(blas,
1509     [ --with-blas=BLASLIB The full path to the blas library.
1510     Use '--with-blas=build' to build the blas library
1511     from the sources that come with the distribution.],
1512     , [with_blas=yes] )
1513     case "$with_fortran$with_blas" in
1514     no*)
1515     # Fortran is disabled; ignore this option (if present)
1516     BLASLIB=
1517     ;;
1518     *no)
1519     # It is an error if the user chooses to build without
1520     # the BLAS library if Fortran is enabled.
1521     AC_MSG_ERROR([Bad option '--without-blas'
1522     To support Fortran calls, ASCEND must be compiled with a blas library])
1523     ;;
1524     *build)
1525     # Fortran is enabled and the user specified --with-blas=build
1526     # For a search for BLAS source code and tell the Makefile
1527     # to build it; useful for testing configure.
1528     #AWW20041206: blas_src_file="$srcdir/blas/dcopy.f"
1529 aw0a 18 blas_src_file="$srcdir/../../blas/dcopy.f"
1530     AC_MSG_CHECKING([for blas source file $blas_src_file ])
1531 aw0a 12 if test -f $blas_src_file ; then
1532     AC_MSG_RESULT(yes)
1533     #AWW20041119: BLASLIB="$ascpwd/ascend4/archive/libascblas.a"
1534 aw0a 15 BLASLIB="$ascpwd/../generic/archive/libascblas.a"
1535     make_blaslib='make-blaslib'
1536 aw0a 12 #AWW20041206: blaslib_makefile="blas/Makefile"
1537 aw0a 18 blaslib_makefile="../../blas/Makefile"
1538     #AWW20041206: asc_subdirs="$asc_subdirs ../blas"
1539     asc_subdirs="$asc_subdirs ../../blas"
1540     else
1541 aw0a 12 AC_MSG_RESULT(no)
1542     AC_MSG_ERROR([User specified '--with-blas=build' but
1543     configure cannot find the blas source file $blas_src_file])
1544     fi
1545     ;;
1546     *yes)
1547     # Fortran in enabled and the user didn't give the --with-blas
1548     # option or didn't give the library's location.
1549     # Search for a compiled libblas.a or libascblas.a; if that
1550     # fails, look for BLAS source code; if that also fails,
1551     # disable all Fortran and print a warning.
1552     AC_PATH_PROGS(BLASLIB, libblas.a libascblas.a, , $asc_f77_support_dirs)
1553     blas_src_file="$srcdir/../../blas/dcopy.f"
1554 aw0a 18 if test -z "$BLASLIB" -a -n "$blas_src_file" ; then
1555 aw0a 12 AC_MSG_CHECKING([for blas source file $blas_src_file ])
1556     if test -f $blas_src_file ; then
1557     AC_MSG_RESULT(yes)
1558     #AWW20041119: BLASLIB="$ascpwd/ascend4/archive/libascblas.a"
1559 aw0a 18 BLASLIB="$ascpwd/../generic/archive/libascblas.a"
1560 aw0a 15 make_blaslib='make-blaslib'
1561 aw0a 12 #AWW20041206: blaslib_makefile="blas/Makefile"
1562 aw0a 18 blaslib_makefile="../../blas/Makefile"
1563     #AWW20041206: asc_subdirs="$asc_subdirs ../blas"
1564     asc_subdirs="$asc_subdirs ../../blas"
1565     else
1566 aw0a 12 AC_MSG_RESULT(no)
1567     fi
1568     fi
1569     if test -z "$BLASLIB" ; then
1570     with_fortran=no
1571     AC_MSG_WARN([Cannot find libblas.a, libascblas.a, nor blas
1572     source code. Building ASCEND without integration, MINOS, and CONOPT
1573     support. To specify a specific location for the blas library, run
1574     configure again with the argument:
1575     --with-blas=BLASLIB
1576     where BLASLIB is the full path to the blas library file.])
1577     fi
1578     ;;
1579     *)
1580     # The user gave us --with-blas=BLASLIB, use that as the
1581     # location of the BLAS library.
1582     BLASLIB="$with_blas"
1583     ;;
1584     esac
1585    
1586    
1587     # Initialize the linpack variables
1588     make_lpaklib=''
1589    
1590     AC_ARG_WITH(linpack,
1591     [ --with-linpack=LPAKLIB The full path to the linpack library.
1592     Use '--with-linpack=build' to build the library
1593     from the sources that come with the distribution.],
1594     , [with_linpack=yes] )
1595     case "$with_fortran$with_linpack" in
1596     no*)
1597     # Fortran is disabled; ignore this option (if present)
1598     LPAKLIB=
1599     ;;
1600     *no)
1601     # It is an error if the user chooses to build without
1602     # the LINPACK library if Fortran is enabled.
1603     AC_MSG_ERROR([Bad option '--without-linpack'
1604     To support Fortran calls, ASCEND must be compiled with a
1605     linpack library.])
1606     ;;
1607     *build)
1608     # Fortran is enabled and the user specified --with-linpack=build
1609     # For a search for LINPACK source code and tell the Makefile
1610     # to build it; useful for testing configure.
1611     lpak_src_file="$srcdir/../../linpack/d1mach.f"
1612 aw0a 18 AC_MSG_CHECKING([for linpack source file $lpak_src_file ])
1613 aw0a 12 if test -f $lpak_src_file ; then
1614     AC_MSG_RESULT(yes)
1615     #AWW20041119: LPAKLIB="$ascpwd/ascend4/archive/libasclpak.a"
1616 aw0a 15 LPAKLIB="$ascpwd/../generic/archive/libasclpak.a"
1617     make_lpaklib='make-lpaklib'
1618 aw0a 12 #AWW20041206: lpaklib_makefile="linpack/Makefile"
1619 aw0a 18 lpaklib_makefile="../../linpack/Makefile"
1620     #AWW20041206: asc_subdirs="$asc_subdirs ../linpack"
1621     asc_subdirs="$asc_subdirs ../../linpack"
1622     else
1623 aw0a 12 AC_MSG_RESULT(no)
1624     AC_MSG_ERROR([User specified '--with-linpack=build' but
1625     configure cannot find the linpack source file $lpak_src_file])
1626     fi
1627     ;;
1628     *yes)
1629     # Fortran in enabled and the user didn't give the --with-linpack
1630     # option or didn't give the library's location.
1631     # Search for a compiled liblpak.a or libasclpak.a; if that
1632     # fails, look for LINPACK source code; if that also fails,
1633     # disable all Fortran and print a warning.
1634     AC_PATH_PROGS(LPAKLIB, liblpak.a libasclpak.a, , $asc_f77_support_dirs)
1635     lpak_src_file="$srcdir/../../linpack/d1mach.f"
1636 aw0a 18 if test -z "$LPAKLIB" -a -n "$lpak_src_file" ; then
1637 aw0a 12 AC_MSG_CHECKING([for linpack source file $lpak_src_file ])
1638     if test -f $lpak_src_file ; then
1639     AC_MSG_RESULT(yes)
1640     #AWW20041119: LPAKLIB="$ascpwd/ascend4/archive/libasclpak.a"
1641 aw0a 15 LPAKLIB="$ascpwd/../generic/archive/libasclpak.a"
1642     make_lpaklib='make-lpaklib'
1643 aw0a 12 #AWW20041206: lpaklib_makefile="linpack/Makefile"
1644 aw0a 18 lpaklib_makefile="../../linpack/Makefile"
1645     #AWW20041206: asc_subdirs="$asc_subdirs ../linpack"
1646     asc_subdirs="$asc_subdirs ../../linpack"
1647     else
1648 aw0a 12 AC_MSG_RESULT(no)
1649     fi
1650     fi
1651     if test -z "$LPAKLIB" ; then
1652     with_fortran=no
1653     AC_MSG_WARN([Cannot find liblpak.a, libasclpak.a, nor linpack
1654     source code. Building ASCEND without integration, MINOS, and CONOPT
1655     support. To specify a specific location for the linpack library, run
1656     configure again with the argument:
1657     --with-linpack=LPAKLIB
1658     where LPAKLIB is the full path to the linpack library file.])
1659     fi
1660     ;;
1661     *)
1662     # The user gave us --with-linkpack=LINKPACKLIB, use that
1663     # as the location of the LINKPACK library.
1664     LPAKLIB="$with_linpack"
1665     ;;
1666     esac
1667    
1668    
1669     # Initialize the lsod variables
1670     make_lsodlib=''
1671     HAVE_LSOD=''
1672    
1673     AC_ARG_WITH(lsod,
1674     [ --with-lsod=LSODLIB The full path to the lsod library.
1675     Use '--with-lsod=build' to build the lsod library
1676     from the sources that come with the distribution.],
1677     , [with_lsod=yes] )
1678     case "$with_fortran$with_lsod" in
1679     no*)
1680     # Fortran is disabled; ignore this option (if present)
1681     LSODLIB=
1682     with_lsod=no
1683     ;;
1684     *no)
1685     # Fortran is enabled but the user specified --without-lsod
1686     LSODLIB=
1687     ;;
1688     *build)
1689     # Fortran is enabled and the user specified --with-lsod=build
1690     # For a search for LSOD source code and tell the Makefile
1691     # to build it; useful for testing configure.
1692     lsod_src_file="$srcdir/../../lsod/lsode.f"
1693 aw0a 18 AC_MSG_CHECKING([for lsod source file $lsod_src_file ])
1694 aw0a 12 if test -f $lsod_src_file ; then
1695     AC_MSG_RESULT(yes)
1696     #AWW20041119: LSODLIB="$ascpwd/ascend4/archive/libinteg.a"
1697 aw0a 15 LSODLIB="$ascpwd/../generic/archive/libinteg.a"
1698     make_lsodlib='make-lsodlib'
1699 aw0a 12 #AWW20041206: lsodlib_makefile="lsod/Makefile"
1700 aw0a 18 lsodlib_makefile="../../lsod/Makefile"
1701     #AWW20041206: asc_subdirs="$asc_subdirs ../lsod"
1702     asc_subdirs="$asc_subdirs ../../lsod"
1703     HAVE_LSOD='-DSTATIC_LSOD'
1704 aw0a 12 else
1705     AC_MSG_RESULT(no)
1706     AC_MSG_ERROR([User specified '--with-lsod=build' but
1707     configure cannot find the lsod source file $lsod_src_file])
1708     fi
1709     ;;
1710     *yes)
1711     # Fortran in enabled and the user didn't give the --with-lsod
1712     # option or didn't give the library's location.
1713     # Search for a compiled libinteg.a; if that fails, look
1714     # for LSOD source code; if that also fails, disable LSOD
1715     # and print a warning.
1716     AC_PATH_PROGS(LSODLIB, libinteg.a libasclsod.a, , $asc_f77_support_dirs)
1717     lsod_src_file="$srcdir/../../lsod/lsode.f"
1718 aw0a 18 if test -z "$LSODLIB" -a -n "$lsod_src_file" ; then
1719 aw0a 12 AC_MSG_CHECKING([for lsod source file $lsod_src_file ])
1720     if test -f $lsod_src_file ; then
1721     AC_MSG_RESULT(yes)
1722     #AWW20041119: LSODLIB="$ascpwd/ascend4/archive/libinteg.a"
1723 aw0a 15 LSODLIB="$ascpwd/../generic/archive/libinteg.a"
1724     make_lsodlib='make-lsodlib'
1725 aw0a 12 #AWW20041206: lsodlib_makefile="lsod/Makefile"
1726 aw0a 18 lsodlib_makefile="../../lsod/Makefile"
1727     #AWW20041206: asc_subdirs="$asc_subdirs ../lsod"
1728     asc_subdirs="$asc_subdirs ../../lsod"
1729     else
1730 aw0a 12 AC_MSG_RESULT(no)
1731     fi
1732     fi
1733     if test -z "$LSODLIB" ; then
1734     with_lsod=no
1735     AC_MSG_WARN([Cannot find libinteg.a nor the lsod
1736     source code. Building ASCEND without integration
1737     support. To specify a specific location for the lsod library, run
1738     configure again with the argument:
1739     --with-lsod=LSODLIB
1740     where LSODLIB is the full path to the lsod integration library file.])
1741     else
1742     HAVE_LSOD='-DSTATIC_LSOD'
1743     fi
1744     ;;
1745     *)
1746     # The user gave us --with-lsod=LSODLIB, use that as the
1747     # location of the LSOD library and define -DSTATIC_LSOD.
1748     LSODLIB="$with_lsod"
1749     HAVE_LSOD='-DSTATIC_LSOD'
1750     ;;
1751     esac
1752    
1753    
1754     #--------------------------------------------------------------------
1755     # Other trees which may or may not be present. If present,
1756     # generate the Makefiles in the tree unless the user passes in
1757     # a --without-<package> argument.
1758     #
1759     # Valid <package> values are: TK, models, help
1760     #
1761     # We could have `configure' do this for us via
1762     # AC_CONFIG_SUBDIRS, but `configure' scripts in the trees can
1763     # only be one directory removed from this configure script.
1764     # For example, it would be nice to have `models' under
1765     # `ascend4', but `configure' doesn't like `ascend4/models' as
1766     # an argument to AC_CONFIG_SUBDIRS.
1767     #
1768     # To get around this problem, we do things by hand. :-)
1769     #
1770     # If the user gives a --without-<package> argument, we have
1771     # nothing to do for that package.
1772     #
1773     # Otherwise,
1774     # * Set `subdir_file_exists' to a file that should exist in the
1775     # subtree---this is how we know that the subtree is really
1776     # there.
1777     # * Set `subdir_locations' to the list of locations, relative
1778     # to this configure script, where the subtree may live.
1779     # * Set `subdir_output' to the list of makefiles to generate;
1780     # the variable `subdir_root' in this list will be replaced
1781     # with the correct value from `subdir_locations'.
1782     #
1783     # To see which (if any) of the values in `subdir_locations' is
1784     # the correct one, we set `subdir_root' to each value in
1785     # `subdir_locations' and check for the existence of
1786     # $fullpathsrcdir/$subdir_root/$subdir_file_exists, where
1787     # $fullpathsrcdir is the full path to the source directory. If
1788     # that file exists, we
1789     # * Set <package>_dir_root to ../$subdir_root. The "../" is
1790     #AWW20041208:# needed since this value is used in the `ascend4' directory
1791 aw0a 21 # needed since this value is used in the `generic' directory
1792     #AWW20041208:# and $subdir_root is relative to the parent of `ascend4'.
1793     # and $subdir_root is relative to the parent of `generic'.
1794     # * Substitute the value of $subdir_root into `subdir_output'
1795 aw0a 12 # and set the result to <package>_makefiles: the list of
1796     # Makefiles for configure to generate.
1797     # * Each package needs to be able to find its way back to
1798     # ascend4/ConfigAscend; it needs to go back up the tree
1799     # however many levels deep it is---i.e., `foo/bar/baz' should
1800     # become `../../..' and this does it: sed 's,[^/][^/]*,..,g'
1801     # but we need to quote the [] from m4, so we get this bizarre
1802     # thing: sed 's,[[^/][^/]]*,..,g' Set <package>_topbuilddir
1803     # to this result.
1804     # * Exit the loop.
1805     #--------------------------------------------------------------------
1806    
1807     # Initialize variables
1808     tkdir_root=''
1809     tkdir_topbuilddir=''
1810    
1811     AC_ARG_WITH(tkdir,
1812     [Generation of Makefiles:
1813     --without-tkdir do not generate Makefiles in the TK subdir],
1814     , [with_tkdir=yes])
1815     if test ! "X$with_tkdir" = "Xno" ; then
1816     subdir_file_exists='AscendRC'
1817     #AWW20041117: FIXME next line
1818 aw0a 15 #AWW20041206: subdir_locations='ascend4/TK'
1819 aw0a 18 subdir_locations='../../tcltk98/TK'
1820 aw0a 21 subdir_output='
1821 aw0a 12 $subdir_root/Makefile
1822     $subdir_root/Makefile.Rules:$subdir_root/Makefile.Rules.in
1823     $subdir_root/bitmaps/Makefile
1824     $subdir_root/templates/Makefile
1825     '
1826     for subdir_root in $subdir_locations ; do
1827     if test -f $fullpathsrcdir/$subdir_root/$subdir_file_exists ; then
1828     #AWW20041208: tkdir_root="../$subdir_root"
1829 aw0a 21 tkdir_root="$subdir_root"
1830     tkdir_makefiles=`eval echo $subdir_output`
1831 aw0a 12 tkdir_topbuilddir=`echo "$subdir_root" | sed 's,[[^/][^/]]*,..,g'`
1832     break
1833     fi
1834     done
1835     fi
1836    
1837     # Initialize variables
1838     models_dir_root=''
1839     models_topbuilddir=''
1840    
1841     AC_ARG_WITH(models,
1842     [ --without-models do not generate Makefiles in the models subdir],
1843     , [with_models=yes])
1844     if test ! "X$with_models" = "Xno" ; then
1845     subdir_file_exists='system.a4l'
1846     #AWW20041117: FIXME next line
1847 aw0a 15 #AWW20041206: subdir_locations='models ascend4/models'
1848 aw0a 18 subdir_locations='models ../../base/generic/models'
1849     subdir_output='
1850 aw0a 12 $subdir_root/Makefile
1851     $subdir_root/Makefile.Rules:$subdir_root/Makefile.Rules.in
1852     $subdir_root/ben/Makefile
1853     '
1854     ## $subdir_root/examples/Makefile
1855     ## $subdir_root/examples/abbott/Makefile
1856     ## $subdir_root/examples/flexible_design/Makefile
1857     ## $subdir_root/libraries/Makefile
1858     ## $subdir_root/libraries/abbott/Makefile
1859     ## $subdir_root/pending/Makefile
1860     ## $subdir_root/pending/examples/Makefile
1861     ## $subdir_root/pending/libraries/Makefile
1862     for subdir_root in $subdir_locations ; do
1863     if test -f $fullpathsrcdir/$subdir_root/$subdir_file_exists ; then
1864     #AWW20041208: models_dir_root="../$subdir_root"
1865 aw0a 21 models_dir_root="$subdir_root"
1866     models_makefiles=`eval echo $subdir_output`
1867 aw0a 12 models_topbuilddir=`echo "$subdir_root" | sed 's,[[^/][^/]]*,..,g'`
1868     break
1869     fi
1870     done
1871     fi
1872    
1873    
1874     # Initialize variables
1875     help_dir_root=''
1876     help_topbuilddir=''
1877    
1878     dnl >>>>AC_ARG_WITH(help,
1879     dnl >>>> [ --without-help do not generate Makefiles in the help subdir],
1880     dnl >>>> , [with_help=yes])
1881     dnl >>>>if test ! "X$with_help" = "Xno" ; then
1882     dnl >>>> subdir_file_exists='ascend-helpTOC.htm'
1883     dnl >>>> subdir_locations='help ascend4/help'
1884     dnl >>>> subdir_output='
1885     dnl >>>> $subdir_root/Makefile
1886     dnl >>>> $subdir_root/Makefile.Rules:$subdir_root/Makefile.Rules.in
1887     dnl >>>> $subdir_root/Screenshots/Makefile
1888     dnl >>>> '
1889     dnl >>>> for subdir_root in $subdir_locations ; do
1890     dnl >>>> if test -f $fullpathsrcdir/$subdir_root/$subdir_file_exists ; then
1891     dnl >>>> help_dir_root="../$subdir_root"
1892     dnl >>>> help_makefiles=`eval echo $subdir_output`
1893     dnl >>>> help_topbuilddir=`echo "$subdir_root" | sed 's,[[^/][^/]]*,..,g'`
1894     dnl >>>> break
1895     dnl >>>> fi
1896     dnl >>>> done
1897     dnl >>>>fi
1898    
1899    
1900     #--------------------------------------------------------------------
1901     # The variables we substitute into the Makefile.in files
1902     # and the command to actually generate the Makefiles
1903     #--------------------------------------------------------------------
1904     AC_SUBST(ascpwd)
1905     AC_SUBST(fullpathsrcdir)
1906     AC_SUBST(asc_include)
1907     AC_SUBST(CC)
1908     AC_SUBST(CFLAGS)
1909     AC_SUBST(LEX)
1910     AC_SUBST(LEXLIB)
1911     AC_SUBST(scanner_src)
1912     AC_SUBST(typer_src)
1913     AC_SUBST(MATH_LIBS)
1914     AC_SUBST(DEBUG_LIBS)
1915     AC_SUBST(X11_INCLUDES)
1916     AC_SUBST(X11_LIBRARIES)
1917     AC_SUBST(X11_RUN_PATH)
1918     AC_SUBST(X11_EXTRA_LIBS)
1919     AC_SUBST(DL_LIBS)
1920     AC_SUBST(LD_FLAGS)
1921     AC_SUBST(LD_SEARCH_FLAGS)
1922     AC_SUBST(SHLIB_CFLAGS)
1923     AC_SUBST(SHLIB_LD)
1924     AC_SUBST(SHLIB_LD_LIBS)
1925     AC_SUBST(SHLIB_SUFFIX)
1926     AC_SUBST(ASC_LIB_SUFFIX)
1927     AC_SUBST(TCL_LIB)
1928     AC_SUBST(TCL_HDR)
1929     AC_SUBST(TK_LIB)
1930     AC_SUBST(TK_HDR)
1931     AC_SUBST(TKTABLE_LIB)
1932     AC_SUBST(ASC_TK_LIBRARY)
1933     AC_SUBST(ASC_TCL_LIBRARY)
1934     AC_SUBST(HAVE_TKTABLE)
1935     AC_SUBST(asc_subdirs)
1936     AC_SUBST(F77)
1937     AC_SUBST(F77LIBS)
1938     AC_SUBST(BLASLIB)
1939     AC_SUBST(make_blaslib)
1940     AC_SUBST(LPAKLIB)
1941     AC_SUBST(make_lpaklib)
1942     AC_SUBST(LSODLIB)
1943     AC_SUBST(make_lsodlib)
1944     AC_SUBST(HAVE_LSOD)
1945     #AWW20041113: AC_SUBST(OPTSQPLIB)
1946 aw0a 15 #AWW20041113: AC_SUBST(make_rsqplib)
1947     #AWW20041113: AC_SUBST(HAVE_OPTSQP)
1948     #AWW20041113: dnl AC_SUBST(HARWELLLIB)
1949     #AWW20041113: dnl AC_SUBST(make_harwelllib)
1950     #AWW20041113: dnl AC_SUBST(HAVE_HARWELL)
1951     #AWW20041113: AC_SUBST(MINOSLIB)
1952     #AWW20041113: AC_SUBST(make_minoslib)
1953     #AWW20041113: AC_SUBST(HAVE_MINOS)
1954     #AWW20041113: AC_SUBST(CONOPTLIB)
1955     #AWW20041113: AC_SUBST(make_conoptlib)
1956     #AWW20041113: AC_SUBST(HAVE_CONOPT)
1957     AC_SUBST(tkdir_root)
1958 aw0a 12 AC_SUBST(tkdir_topbuilddir)
1959     AC_SUBST(models_dir_root)
1960     AC_SUBST(models_topbuilddir)
1961     AC_SUBST(help_dir_root)
1962     AC_SUBST(help_topbuilddir)
1963    
1964     #AWW20041129: In the following macro, replace the following
1965 aw0a 18 #AWW20041129: in the call.
1966     #AWW20041129:
1967     #AWW20041113: ascend4/ConfigAscend:ascend4/ConfigAscend.in
1968 aw0a 15 #AWW20041113: ascend4/Makefile
1969     #AWW20041113: ascend4/bin/ascend4.sh
1970     #AWW20041113: ascend4/Makefile.Rules:ascend4/Makefile.Rules.in
1971     #AWW20041113: ascend4/archive/Makefile
1972     #AWW20041113: ascend4/bin/Makefile
1973     #AWW20041113: ascend4/compiler/Makefile
1974     #AWW20041113: ascend4/general/Makefile
1975     #AWW20041113: ascend4/interface/Makefile
1976     #AWW20041113: ascend4/lib/Makefile
1977     #AWW20041113: ascend4/packages/Makefile
1978     #AWW20041113: ascend4/solver/Makefile
1979     #AWW20041113: ascend4/utilities/Makefile
1980     #AWW20041129:
1981 aw0a 18 #AWW20041129: and remove the following
1982     #AWW20041129:
1983     #AWW20041117: $rsqplib_makefile
1984     #AWW20041117: $conoptlib_makefile
1985     #AWW20041117: $minoslib_makefile
1986    
1987    
1988     AC_OUTPUT(
1989     ../../base/generic/ConfigAscend:../../base/generic/ConfigAscend.in
1990     ../../base/generic/Makefile
1991     ../../base/generic/bin/ascend4.sh
1992     ../../base/generic/Makefile.Rules:../../base/generic/Makefile.Rules.in
1993     ../../base/generic/archive/Makefile
1994     ../../base/generic/bin/Makefile
1995     ../../base/generic/compiler/Makefile
1996     ../../base/generic/general/Makefile
1997     ../../tcltk98/generic/interface/Makefile
1998     ../../base/generic/lib/Makefile
1999     ../../base/generic/packages/Makefile
2000     ../../base/generic/solver/Makefile
2001     ../../base/generic/utilities/Makefile
2002     $tkdir_makefiles
2003 aw0a 12 $models_makefiles
2004     $help_makefiles
2005     $blaslib_makefile
2006     $lpaklib_makefile
2007     $lsodlib_makefile
2008     )
2009    

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22