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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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