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

Contents of /trunk/base/autotools/configure.in

Parent Directory Parent Directory | Revision Log Revision Log


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

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