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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 472 - (show annotations) (download)
Mon Apr 17 04:51:34 2006 UTC (14 years, 3 months ago) by ben.allan
File size: 56373 byte(s)
fixed configure to allow user to bypass missing yacc.
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 #JP I think that the current recommendation is to install from
135 #JP run ./configure (ie from this directory)
136
137 ascpwd=`pwd`
138 fullpathsrcdir=`cd $srcdir ; pwd`
139
140 case "$srcdir" in
141 .)
142 asc_include="../$srcdir"
143 ;;
144 /*)
145 asc_include="$srcdir/../generic"
146 ;;
147 *)
148 asc_include="$srcdir/../generic"
149 ;;
150 esac
151
152
153 #--------------------------------------------------------------------
154 # Do basic checks to determine
155 # * if we have `ranlib'
156 # * if we can create symbolic links
157 # * if `make' sets the MAKE macro
158 # * a bsd-compatible `install' program
159 # If we use the install-sh script that comes with configure,
160 # prefix it with the current directory so it'll work in
161 # subdirectories. Unfortunately, it won't work if the user
162 # moves the source tree.
163 #--------------------------------------------------------------------
164 AC_PROG_RANLIB
165 AC_PROG_LN_S
166 AC_PROG_MAKE_SET
167 AC_PROG_INSTALL
168
169 case "X$INSTALL" in
170 X/*)
171 ;;
172 *)
173 INSTALL="$ascpwd/$INSTALL"
174 ;;
175 esac
176
177
178 #--------------------------------------------------------------------
179 # Get the host type for various checks along the way
180 #--------------------------------------------------------------------
181 AC_CANONICAL_HOST
182
183 #--------------------------------------------------------------------
184 # Check for the C compiler: set CC and CFLAGS.
185 # If the user does NOT specify `--enable-gcc' on the configure
186 # command command line, set CC to either the envar CC or `cc'.
187 # Call AC_PROG_CC which will use the value of CC (perhaps set
188 # immediately above) or will check for `gcc' and then for `cc'
189 # if `gcc' is not found.
190 #
191 # If we are using GCC, then assume it groks ANSI. Otherwise,
192 # try to compile a small program using ANSI constructs with
193 # CC. If this fails, try to locate each of the following:
194 # c89 xlc acc
195 # and if successful, see if it compiles an ANSI C program.
196 # (Doing this in a loop would be ideal, but configure caches
197 # the result of AC_CHECK_PROG and uses the cached value for
198 # all but the first pass through the loop. This is also the
199 # reason we have to use a different variable asc_cc1, asc_cc2
200 # for each call to AC_CHECK_PROG.
201 #
202 # If we do not find an ANSI C compiler, print a warning and
203 # use the first value of CC we tried.
204 #--------------------------------------------------------------------
205 #JP removed the lengthy CC tests, since ANSI C is pretty universal
206 #JP these days, and GCC can pretty much be assumed if we're using
207 #JP Autotools.
208
209 AC_PROG_CC(gcc)
210
211 #--------------------------------------------------------------------
212 # Do other misc checks with CC and CFLAGS.
213 #
214 # Determine how to run the C preprocessor.
215 #
216 # If the user specifies --enable-optimization, remove `-g'
217 # from CFLAGS, add `-O' to CFLAGS, and define `NDEBUG'. If
218 # we are not building optimized, check for special libraries
219 # needed for building a debugging binary (currenly only
220 # /usr/lib/end.o under HPUX).
221 #
222 # Check if we're running on AIX; if so, add `-D_ALL_SOURCE'
223 # to CFLAGS.
224 #
225 # Check if we're running on HPUX; if so, add -D_HPUX_SOURCE'
226 # to CFLAGS unless the C preprocessor goes it for us.
227 #--------------------------------------------------------------------
228
229 AC_PROG_CPP
230
231 AC_ARG_ENABLE(optimization,
232 [ --enable-optimization optimize the C code while building ascend],
233 [asc_do_opt="$enableval"], [asc_do_opt=no])
234
235 if test "$asc_do_opt" = yes; then
236 CFLAGS=`echo "-O $CFLAGS " | sed 's/ -g / /g'`
237 AC_DEFINE(NDEBUG)
238 else
239 AC_PATH_PROG(DEBUG_LIBS, end.o, , /usr/lib)
240 fi
241
242 AC_MSG_CHECKING([for AIX])
243 AC_EGREP_CPP(yes, [
244 #ifdef _AIX
245 yes
246 #endif
247 ], [ asc_aix=yes ; AC_DEFINE(_ALL_SOURCE) ], [asc_aix=no])
248 AC_MSG_RESULT($asc_aix)
249
250 AC_MSG_CHECKING([whether -D_HPUX_SOURCE is needed])
251 AC_EGREP_CPP(yes, [
252 #ifdef __hpux
253 #ifndef _HPUX_SOURCE
254 yes
255 #endif
256 #endif
257 ], [ asc_hpux=yes ; AC_DEFINE(_HPUX_SOURCE) ], [asc_hpux=no])
258 AC_MSG_RESULT($asc_hpux)
259
260 # Check the size of pointers; if cross compiling, assume 32 bit pointers
261 AC_CHECK_SIZEOF(void *, 4)
262
263
264 #--------------------------------------------------------------------
265 # Set YACC.
266 # call the
267 # autoconf macro which looks for `bison' and then for `yacc'.
268 # note it isn't bright enough to check that yacc really exists,
269 # so we allow the user to disable it.
270 #--------------------------------------------------------------------
271
272 YACCSAVE="$YACC"
273 AC_PROG_YACC
274
275 AC_ARG_WITH(yacc,
276 [ --without-yacc do not generate parser from yacc file],
277 , [with_yacc=yes])
278 if test ! "X$with_yacc" = "Xyes" ; then
279 YACC=": configured without yacc"
280 parser_src="ascParse.c.from.c"
281 else
282 parser_src="ascParse.c.from.yacc"
283 fi
284 AC_SUBST(parser_src)
285
286 #--------------------------------------------------------------------
287 # Set LEX.
288 # ASCEND requires a `flex' which understands -P (allows you to
289 # specify a prefix other than `yy'). The -P flag was added at
290 # the same time a -V (version) flag was added (version 2.4.1),
291 # so if `flex' understands -V, it'll understand -P (checking
292 # for -P directly requires a flex input file).
293 #
294 # 1. If `LEX' is not set, look for `flex' and set `LEX' to
295 # `flex' if found.
296 # 2. If `flex' was found, see if it understands -V. If so,
297 # set `scanner_src' and `typer_src' to have `flex' generate
298 # the C files from the flex input files
299 # base/generic/compiler/scanner.l & tcltk98/interface/typelex.l
300 # We don't need to look for libfl.a since we define
301 # yywrap() ourselves.
302 # 3. If `flex' wasn't found or was found but isn't new enough:
303 # a. Print a warning message
304 # b. Set `scanner_src' and `typer_src' to use pre-generated
305 # C files for the flex files mentioned in (2).
306 # c. Set `LEX' to `lex'
307 # d. Search for the lex library `libl.a' and set LEXLIB to
308 # its location.
309 #--------------------------------------------------------------------
310
311 AC_CHECK_PROG(LEX, flex, flex)
312
313 if test -n "$LEX" ; then
314 AC_MSG_CHECKING([whether $LEX is at least version 2.4.1])
315 echo "$LEX -V" 1>&5
316 if $LEX -V 1>&5 2>&5 ; then
317 AC_MSG_RESULT(yes)
318 scanner_src="scanner.c.from.flex"
319 typer_src="typelex.c.from.flex"
320 else
321 AC_MSG_RESULT(no)
322 LEX=''
323 fi
324 fi
325
326 if test -z "$LEX" ; then
327 AC_MSG_WARN([Cannot find a flex lexer version 2.4.1 or greater.
328 Using pregenerated C files for base/generic/compiler/scanner.l
329 and tcltk98/interface/typelex.l. If you have flex 2.4.1
330 or newer, set the LEX environment variable to its location
331 and run configure again.])
332 scanner_src="scanner.c.from.c"
333 typer_src="typelex.c.from.c"
334
335 # let configure set LEX and LEXLIB even though we won't be using them
336 AC_PROG_LEX
337 fi
338
339
340 #--------------------------------------------------------------------
341 # Math libraries.
342 # On a few very rare systems, all of the libm.a stuff is
343 # already in libc.a. Set compiler flags accordingly.
344 # Also, Linux requires the "ieee" library for math to work
345 # right (and it must appear before "-lm").
346 #
347 # When building on HPUX with GCC, GCC cannot find `copysign'
348 # because it lives in an odd place; see if we need to add
349 # this odd place to MATH_LIBS.
350 #
351 # See if erf(), the error function, exists; if so, define
352 # HAVE_ERF.
353 #--------------------------------------------------------------------
354 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
355
356 AC_CHECK_LIB(ieee, printf, [MATH_LIBS="-lieee $MATH_LIBS"])
357
358 if test -n "$MATH_LIBS" ; then
359 AC_CHECK_LIB(m, copysign, ,
360 AC_CHECK_LIB(m, drem, [MATH_LIBS="$MATH_LIBS /lib/pa1.1/libM.a"]
361 , , /lib/pa1.1/libM.a
362 ),
363 $MATH_LIBS)
364 fi
365
366 # store the current list of libraries, add the math libraries to LIBS,
367 # check for erf(), then reset the value of LIBS.
368 asc_keep_LIBS="$LIBS"
369 LIBS="$LIBS $MATH_LIBS"
370 AC_CHECK_FUNCS(erf)
371 LIBS="$asc_keep_LIBS"
372
373 #----------------------------------------------
374 # Check for 'vsnprintf' -- there seems to be a problem with it in
375 # on cygwin.
376
377 dnl -------------------------------------
378 dnl Macro to sniff for the 'vsnprintf' function
379 dnl
380 dnl This function appears to be problematic under cygwin, hence the addition
381 dnl of this macro.
382 dnl -------------------------------------
383
384 AC_DEFUN([AC_FUNC_SNPRINTF],
385 [AC_CHECK_FUNCS(snprintf vsnprintf)
386 AC_MSG_CHECKING(for working snprintf)
387 AC_CACHE_VAL(ac_cv_have_working_snprintf,
388 [AC_TRY_RUN(
389 [#include <stdio.h>
390
391 int main(void)
392 {
393 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
394 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
395 int i;
396 i = snprintf (bufs, 2, "%s", "111");
397 if (strcmp (bufs, "1")) exit (1);
398 if (i != 3) exit (1);
399 i = snprintf (bufd, 2, "%d", 111);
400 if (strcmp (bufd, "1")) exit (1);
401 if (i != 3) exit (1);
402 exit(0);
403 }], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
404 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
405 AC_MSG_CHECKING(for working vsnprintf)
406 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
407 [AC_TRY_RUN(
408 [#include <stdio.h>
409 #include <stdarg.h>
410
411 int my_vsnprintf (char *buf, const char *tmpl, ...)
412 {
413 int i;
414 va_list args;
415 va_start (args, tmpl);
416 i = vsnprintf (buf, 2, tmpl, args);
417 va_end (args);
418 return i;
419 }
420
421 int main(void)
422 {
423 char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
424 char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
425 int i;
426 i = my_vsnprintf (bufs, "%s", "111");
427 if (strcmp (bufs, "1")) exit (1);
428 if (i != 3) exit (1);
429 i = my_vsnprintf (bufd, "%d", 111);
430 if (strcmp (bufd, "1")) exit (1);
431 if (i != 3) exit (1);
432 exit(0);
433 }], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
434 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
435 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
436 AC_LIBOBJ(snprintf)
437 AC_MSG_WARN([Replacing missing/broken (v)snprintf() with version from http://www.ijs.si/software/snprintf/.])
438 AC_DEFINE(PREFER_PORTABLE_SNPRINTF, 1, "enable replacement (v)snprintf if system (v)snprintf is broken")
439 fi])
440
441 AC_FUNC_SNPRINTF
442
443 #--------------------------------------------------------------------
444 # Check for X11.
445 # We'll use the simple autoconf builtin macro for finding
446 # X11 until we find a reason not to.
447 #
448 # On Solaris and IRIX, add the path to the X library to the
449 # run-time shared-library-search-path so the ASCEND binary
450 # can find the X library without the user having to set
451 # LD_LIBRARY_PATH
452 #--------------------------------------------------------------------
453 AC_PATH_X
454 if test -n "$x_includes"; then
455 X11_INCLUDES="-I$x_includes"
456 fi
457 if test -n "$x_libraries"; then
458 X11_LIBRARIES="-L$x_libraries"
459 case "$host" in
460 sparc-sun-solaris*)
461 X11_RUN_PATH="-R$x_libraries"
462 ;;
463 mips-sgi-irix*)
464 X11_RUN_PATH="-rpath $x_libraries"
465 ;;
466 *)
467 X11_RUN_PATH=""
468 ;;
469 esac
470 fi
471
472
473 #--------------------------------------------------------------------
474 # Check for the existence of various libraries. The order here
475 # is important, so that then end up in the right order in the
476 # command line generated by make. The -lsocket and -lnsl
477 # libraries require a couple of special tricks:
478 # 1. Use "connect" and "accept" to check for -lsocket, and
479 # "gethostbyname" to check for -lnsl.
480 # 2. Use each function name only once: can't redo a check
481 # because autoconf caches the results of the last check
482 # and won't redo it.
483 # 3. Use -lnsl and -lsocket only if they supply procedures that
484 # aren't already present in the normal libraries. This is
485 # because IRIX 5.2 has libraries, but they aren't needed and
486 # they're bogus: they goof up name resolution if used.
487 # 4. On some SVR4 systems, can't use -lsocket without -lnsl
488 # too. To get around this problem, check for both libraries
489 # together if -lsocket doesn't work by itself.
490 #--------------------------------------------------------------------
491 dnl AC_CHECK_LIB(Xbsd, printf, [LIBS="$LIBS -lXbsd"])
492
493 asc_checkBoth=0
494 AC_CHECK_FUNC(connect, [asc_checkSocket=0], [asc_checkSocket=1])
495 if test "$asc_checkSocket" = 1; then
496 AC_CHECK_LIB(socket, printf, [X11_EXTRA_LIBS="-lsocket"],[asc_checkBoth=1])
497 fi
498 if test "$asc_checkBoth" = 1; then
499 asc_oldLibs=$LIBS
500 X11_EXTRA_LIBS="-lsocket -lnsl"
501 LIBS="$LIBS $X11_EXTRA_LIBS"
502 AC_CHECK_FUNC(accept, asc_checkNsl=0, [X11_EXTRA_LIBS=""])
503 LIBS=$asc_oldLibs
504 fi
505 asc_oldLibs=$LIBS
506 LIBS="$LIBS $X11_EXTRA_LIBS"
507 AC_CHECK_FUNC(gethostbyname, ,
508 AC_CHECK_LIB(nsl, printf, [X11_EXTRA_LIBS="$X11_EXTRA_LIBS -lnsl"]))
509 LIBS=$asc_oldLibs
510
511
512 #--------------------------------------------------------------------
513 # The following comes directly from the configure.in file for
514 # Tcl8.0.
515 #
516 # The statements below define a collection of symbols related to
517 # dynamic loading and shared libraries:
518 #
519 # DL_OBJS - Name of the object file that implements dynamic
520 # loading for ASCEND on this system.
521 # DL_LIBS - Library file(s) to include in tclsh and other base
522 # applications in order for the "load" command to work.
523 # LD_FLAGS - Flags to pass to the compiler when linking object
524 # files into an executable application binary such
525 # as tclsh.
526 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
527 # that tell the run-time dynamic linker where to look
528 # for shared libraries such as libtcl.so. Depends on
529 # the variable LIB_RUNTIME_DIR in the Makefile.
530 # MAKE_LIB - Command to execute to build the ASCEND library;
531 # differs depending on whether or not ASCEND is being
532 # compiled as a shared library.
533 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
534 # of a shared library (may request position-independent
535 # code, among other things).
536 # SHLIB_LD - Base command to use for combining object files
537 # into a shared library.
538 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
539 # creating shared libraries. This symbol typically
540 # goes at the end of the "ld" commands that build
541 # shared libraries. The value of the symbol is
542 # "${LIBS}" if all of the dependent libraries should
543 # be specified when creating a shared library. If
544 # dependent libraries should not be specified (as on
545 # SunOS 4.x, where they cause the link to fail, or in
546 # general if ASCEND and Tk aren't themselves shared
547 # libraries), then this symbol has an empty string
548 # as its value.
549 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
550 # extensions. An empty string means we don't know how
551 # to use shared libraries on this platform.
552 # ASC_LIB_FILE - Name of the file that contains the ASCEND library, such
553 # as libtcl7.8.so or libtcl7.8.a.
554 # ASC_LIB_SUFFIX -Specifies everything that comes after the "libtcl"
555 # in the shared library name, using the $VERSION variable
556 # to put the version in the right place. This is used
557 # by platforms that need non-standard library names.
558 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
559 # to have a version after the .so, and ${VERSION}.a
560 # on AIX, since the ASCEND shared library needs to have
561 # a .a extension whereas shared objects for loadable
562 # extensions have a .so extension. Defaults to
563 # ${VERSION}${SHLIB_SUFFIX}.
564 #--------------------------------------------------------------------
565
566 # Step 1: set the variable "system" to hold the name and version number
567 # for the system. This can usually be done via the "uname" command, but
568 # there are a few systems, like Next, where this doesn't work.
569
570 # Changed this to use the "$host" variable from AC_CANONICAL_HOST
571
572 # Step 2: check for existence of -ldl library. This is needed because
573 # Linux can use either -ldl or -ldld for dynamic loading.
574
575 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
576
577 # Step 3: set configuration options based on system name and version.
578
579 ASC_SHARED_LIB_SUFFIX=""
580 ASC_UNSHARED_LIB_SUFFIX=""
581 ASC_LIB_VERSIONS_OK=ok
582 case $host in
583 *-aix*)
584 SHLIB_CFLAGS=""
585 SHLIB_LD="$fullpathsrcdir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512"
586 SHLIB_LD_LIBS='${LIBS}'
587 SHLIB_SUFFIX=".so"
588 DL_OBJS=""
589 DL_LIBS="-lld"
590 LD_FLAGS=""
591 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
592 ASC_SHARED_LIB_SUFFIX='${VERSION}.a'
593 ;;
594 *-bsdi*)
595 SHLIB_CFLAGS=""
596 SHLIB_LD="shlicc -r"
597 SHLIB_LD_LIBS='${LIBS}'
598 SHLIB_SUFFIX=".so"
599 DL_OBJS=""
600 DL_LIBS="-ldl"
601 LD_FLAGS=""
602 LD_SEARCH_FLAGS=""
603 ;;
604 *-dgux*)
605 SHLIB_CFLAGS="-K PIC"
606 SHLIB_LD="cc -G"
607 SHLIB_LD_LIBS=""
608 SHLIB_SUFFIX=".so"
609 DL_OBJS=""
610 DL_LIBS="-ldl"
611 LD_FLAGS=""
612 LD_SEARCH_FLAGS=""
613 ;;
614 *-hpux8*|*-hpux9*|*-hpux10*)
615 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
616 if test "$tcl_ok" = yes; then
617 SHLIB_CFLAGS="+z"
618 SHLIB_LD="ld -b"
619 SHLIB_LD_LIBS=""
620 SHLIB_SUFFIX=".sl"
621 DL_OBJS=""
622 DL_LIBS="-ldld"
623 LD_FLAGS="-Wl,-E"
624 LD_SEARCH_FLAGS='-Wl,+b,${LIB_RUNTIME_DIR}:.'
625 fi
626 ;;
627 *-irix4*)
628 SHLIB_CFLAGS="-G 0"
629 SHLIB_SUFFIX=".a"
630 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
631 SHLIB_LD_LIBS='${LIBS}'
632 DL_OBJS=""
633 DL_LIBS=""
634 LD_FLAGS="-Wl,-D,08000000"
635 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
636 ASC_SHARED_LIB_SUFFIX='${VERSION}.a'
637 ;;
638 *-irix5*|*-irix6.*)
639 SHLIB_CFLAGS=""
640 SHLIB_LD="ld -shared -rdata_shared"
641 SHLIB_LD_LIBS=""
642 SHLIB_SUFFIX=".so"
643 DL_OBJS=""
644 DL_LIBS=""
645 LD_FLAGS=""
646 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
647 ;;
648 *-linux*)
649 SHLIB_CFLAGS="-fPIC"
650 SHLIB_LD_LIBS=""
651 SHLIB_SUFFIX=".so"
652 if test "$have_dl" = yes; then
653 SHLIB_LD="${CC} -shared"
654 DL_OBJS=""
655 DL_LIBS="-ldl"
656 LD_FLAGS="-rdynamic"
657 LD_SEARCH_FLAGS=""
658 else
659 AC_CHECK_HEADER(dld.h, [
660 SHLIB_LD="ld -shared"
661 DL_OBJS=""
662 DL_LIBS="-ldld"
663 LD_FLAGS=""
664 LD_SEARCH_FLAGS=""])
665 fi
666 ;;
667 MP-RAS-02*)
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 MP-RAS-*)
678 SHLIB_CFLAGS="-K PIC"
679 SHLIB_LD="cc -G"
680 SHLIB_LD_LIBS=""
681 SHLIB_SUFFIX=".so"
682 DL_OBJS=""
683 DL_LIBS="-ldl"
684 LD_FLAGS="-Wl,-Bexport"
685 LD_SEARCH_FLAGS=""
686 ;;
687 *-netbsd*|*-freebsd*|*-openbsd*)
688 # Not available on all versions: check for include file.
689 AC_CHECK_HEADER(dlfcn.h, [
690 SHLIB_CFLAGS="-fpic"
691 SHLIB_LD="ld -Bshareable -x"
692 SHLIB_LD_LIBS=""
693 SHLIB_SUFFIX=".so"
694 DL_OBJS=""
695 DL_LIBS=""
696 LD_FLAGS=""
697 LD_SEARCH_FLAGS=""
698 ASC_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.so.1.0'
699 ], [
700 SHLIB_CFLAGS=""
701 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
702 SHLIB_LD_LIBS='${LIBS}'
703 SHLIB_SUFFIX=".a"
704 DL_OBJS=""
705 DL_LIBS=""
706 LD_FLAGS=""
707 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
708 ASC_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
709 ])
710
711 # FreeBSD doesn't handle version numbers with dots.
712
713 ASC_UNSHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
714 ASC_LIB_VERSIONS_OK=nodots
715 ;;
716 *-riscos*)
717 SHLIB_CFLAGS="-G 0"
718 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
719 SHLIB_LD_LIBS='${LIBS}'
720 SHLIB_SUFFIX=".a"
721 DL_OBJS=""
722 DL_LIBS=""
723 LD_FLAGS="-Wl,-D,08000000"
724 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
725 ;;
726 SCO_SV-3.2*)
727 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
728 # this test works, since "uname -s" was non-standard in 3.2.4 and
729 # below.
730 SHLIB_CFLAGS="-Kpic -belf"
731 SHLIB_LD="ld -G"
732 SHLIB_LD_LIBS=""
733 SHLIB_SUFFIX=".so"
734 DL_OBJS=""
735 DL_LIBS=""
736 LD_FLAGS="-belf -Wl,-Bexport"
737 LD_SEARCH_FLAGS=""
738 ;;
739 *-sni-sysv*)
740 SHLIB_CFLAGS="-K PIC"
741 SHLIB_LD="cc -G"
742 SHLIB_LD_LIBS=""
743 SHLIB_SUFFIX=".so"
744 DL_OBJS=""
745 DL_LIBS="-ldl"
746 LD_FLAGS=""
747 LD_SEARCH_FLAGS=""
748 ;;
749 *-sunos4*)
750 SHLIB_CFLAGS="-PIC"
751 SHLIB_LD="ld"
752 SHLIB_LD_LIBS=""
753 SHLIB_SUFFIX=".so"
754 DL_OBJS=""
755 DL_LIBS="-ldl"
756 LD_FLAGS=""
757 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
758
759 # SunOS can't handle version numbers with dots in them in library
760 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
761 # requires an extra version number at the end of .so file names.
762 # So, the library has to have a name like libtcl75.so.1.0
763
764 ASC_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.so.1.0'
765 ASC_UNSHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a'
766 ASC_LIB_VERSIONS_OK=nodots
767 ;;
768 *-solaris*)
769 SHLIB_CFLAGS="-KPIC"
770 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
771
772 # Note: need the LIBS below, otherwise Tk won't find ASCEND's
773 # symbols when dynamically loaded into tclsh.
774
775 SHLIB_LD_LIBS='${LIBS}'
776 SHLIB_SUFFIX=".so"
777 DL_OBJS=""
778 DL_LIBS="-ldl"
779 LD_FLAGS=""
780 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
781 ;;
782 mips-dde-sysv*)
783 SHLIB_CFLAGS="-KPIC"
784 SHLIB_LD="cc -G"
785 SHLIB_LD_LIBS=""
786 SHLIB_SUFFIX=".so"
787 DL_OBJS=""
788 DL_LIBS="-ldl"
789 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
790 # that don't grok the -Bexport option. Test that it does.
791 hold_ldflags=$LDFLAGS
792 AC_MSG_CHECKING([for ld accepts -Bexport flag])
793 LDFLAGS="${LDFLAGS} -Wl,-Bexport"
794 AC_TRY_LINK(, [int i;], found=yes, found=no)
795 LDFLAGS=$hold_ldflags
796 AC_MSG_RESULT($found)
797 if test "$found" = yes; then
798 LD_FLAGS="-Wl,-Bexport"
799 else
800 LD_FLAGS=""
801 fi
802 LD_SEARCH_FLAGS=""
803 ;;
804 esac
805
806 #--------------------------------------------------------------------
807 # Look for Tcl/Tk
808 #--------------------------------------------------------------------
809
810 # moved to config, acsite setup
811 # find tcl
812 TCLINCLUDE=
813 TCLLIB=
814 TCLPACKAGE=
815 ASC_TCL
816 # find tk
817 TKINCLUDE=
818 TKLIB=
819 TKPACKAGE=
820 ASC_TK
821
822
823 #--------------------------------------------------------------------
824 # FORTRAN
825 #
826 # ASCEND uses the LSOD integrator and is capable of working
827 # with CONOPT and with MINOS. These libraries are written in
828 # Fortran; to use them, configure needs to find a Fortran
829 # compiler and the necessary Fortran libraries (e.g.,
830 # libF77.a). LSOD, CONOPT, and MINOS also require the BLAS and
831 # LINPACK libraries to avoid undefined symbols at link time.
832 #
833 # The builder can specify the location of
834 # * the Fortran compiler and libraries using
835 # --with-fortran=<compiler>,<libraries>
836 # * the BLAS library using
837 # --with-blas=<blas-library>
838 # * the LINPACK library using
839 # --with-linpack=<linpack-library>
840 # * the LSOD library using
841 # --with-blas=<lsod-library>
842 # * the CONOPT library using
843 # --with-conopt=<conopt-library>
844 # * the MINOS library using
845 # --with-minos=<minos-library> <===currently disabled
846 # The builder can disable some parts of the fortran build using
847 # the --without-<package> configure option.
848 #
849 # If the user does not specify the locations of the compiler
850 # and the libraries and does not disable them, configure
851 # attempts to find them.
852 #
853 # Building with LSOD, CONOPT, and/or MINOS is further
854 # complicated by the dependencies between these libraries and
855 # the BLAS and LINPACK libraries.
856 #
857 # If we cannot find a Fortran compiler, we disable all Fortran
858 # code (LSOD, CONOPT, and MINOS). Otherwise, look for the
859 # Fortran libraries (e.g., libF77.a) based on the type of
860 # machine we are compiling on.
861 #
862 # If Fortran is enabled, we need to find a compiled BLAS
863 # library or source code. Check for the machine's libblas.a
864 # and ASCEND's libascblas.a; if those fail, check for the
865 # libascblas.a source code; if that fails, we disable all
866 # Fortran (LSOD, CONOPT, MINOS).
867 #
868 # If Fortran is enabled, we need to find a compiled LINPACK
869 # library or source code. Check for the machine's liblpak.a
870 # and ASCEND's libasclpak.a; if those fail, check for the
871 # libasclpak.a source code; if that fails, we disable all
872 # Fortran (LSOD, CONOPT, MINOS).
873 #
874 # If Fortran is enabled, we try to find a compiled LSOD library
875 # or source code. Check for a libinteg.a; if that fails, check
876 # for the libinteg.a source code; if that fails, we disable
877 # LSOD. If we find LSOD, define STATIC_LSOD.
878 #
879 # If Fortran is enabled, we try to find a compiled OPTSQP
880 # library or source code. Check for a librsqp.a; if that fails,
881 # check for the librsqp.a source code; if that fails, we disable
882 # OPTSQP. If we find RSQP, define STATIC_OPTSQP.
883 #
884 # If Fortran is enabled, we try to find a compiled CONOPT
885 # library. Check for a libconsub.a; if that fails, we disable
886 # CONOPT. If we find CONOPT, define STATIC_CONOPT; if not,
887 # tell the user where to find CONOPT using the contact
888 # information from the nonlinear programming FAQ:
889 # http://www.mcs.anl.gov/home/otc/Guide/faq/nonlinear-programming-faq.html
890 #
891 # If Fortran is enabled, we try to find a compiled MINOS
892 # library or source code. Check for a libminos54.a; if that
893 # fails, check for the libminos54.a source code; if that fails,
894 # we disable MINOS. If we find MINOS, define STATIC_MINOS; if
895 # not, tell the user where to find MINOS using the contact
896 # information from the nonlinear programming FAQ:
897 # http://www.mcs.anl.gov/home/otc/Guide/faq/nonlinear-programming-faq.html
898 #--------------------------------------------------------------------
899 #
900 # the list of directories to search for the fortran compiler
901 asc_f77_prog_dirs="$PATH:/usr/lang:/opt/SUNWspro/bin"
902 #
903 # the list of directories to search for the required fortran libraries
904 asc_f77_support_dirs="
905 /lib
906 /usr/lib
907 /usr/local/lib
908 /usr/contributed/lib
909 /usr/local/lib/ascend/lib
910 $ascpwd/blas
911 $ascpwd/linpack
912 $ascpwd/lsod
913
914 ##AWW There are folders two levels up from configure for these packages
915 $fullpathsrcdir/../../blas
916 $fullpathsrcdir/../../linpack
917 $fullpathsrcdir/../../lsod
918
919 #AWW20041113: $ascpwd/conopt
920 #AWW20041113: $ascpwd/rsqp
921 #AWW20041113: $ascpwd/minos
922 #AWW20041113: $ascpwd/ascend4/archive
923 $ascpwd/archive
924 /afs/cs/project/ascend/depot/@sys/lib
925 /afs/cs/project/ascend/depot/build/obj/conopt
926 "
927 #
928 AC_ARG_WITH(fortran,
929 [Fortran compiler and libraries:
930 --with-fortran=F77,F77LIBS
931 The location of your Fortran compiler and its
932 library files. For example, under SunOS:
933 --with-fortran='f77,-L/usr/lang/lib -lF77 -lM77'
934 To specify only the compiler or libraries, leave off
935 whatever is not needed:
936 --with-fortran=',-L/usr/lang/lib -lF77 -lM77'
937 Use '--without-fortran' to not link against
938 any Fortran libraries],
939 , [with_fortran=yes])
940 case "$with_fortran" in
941 no)
942 # The user disabled all fortran using
943 # the --without-fortran option.
944 F77=
945 F77LIBS=
946 with_f77=no
947 with_f77libs=no
948 ;;
949 yes|,|"")
950 # The user didn't pass in the --with-fortran option
951 # or didn't give us any useful information. We do
952 # the search ourselves.
953 with_f77=_searching
954 with_f77libs=_searching
955 ;;
956 ,*)
957 # The user passed in the libraries, search for the
958 # compiler ourselves.
959 with_f77=_searching
960 F77LIBS=`echo $with_fortran | sed 's/^,//'`
961 echo "user gave F77LIBS=$F77LIBS"
962 ;;
963 *,?*)
964 # The user passed in both the compiler and the
965 # libraries.
966 F77=`echo $with_fortran | sed s'/,.*$//'`
967 F77LIBS=`echo $with_fortran | sed 's/^.*,//'`
968 echo "user gave F77=$F77"
969 echo "user gave F77LIBS=$F77LIBS"
970 ;;
971 *)
972 # The user passed in the compiler; search for the
973 # libraries ourselves.
974 F77=`echo $with_fortran | sed s'/,$//'`
975 with_f77libs=_searching
976 echo "user gave F77=$F77"
977 ;;
978 esac
979
980 if test "X$with_f77" = X_searching ; then
981 # Search for the fortran compiler; print a warning if we can't
982 # find it and disable all fortran.
983 AC_PATH_PROGS(F77, f77 xlf g77, , $asc_f77_prog_dirs)
984 if test -z "$F77" ; then
985 with_fortran=no
986 with_f77libs=no
987 AC_MSG_WARN([Cannot find your Fortran compiler. Building ASCEND
988 without integration, MINOS, and CONOPT support. To bulid ASCEND with
989 Fortran support, run configure with the option
990 --with-fortran=F77,F77LIBS
991 where F77 is the full path to your Fortran compiler and F77LIBS are
992 its related libraries])
993 fi
994 fi
995
996 if test "X$with_f77libs" = X_searching ; then
997 # We found a compiler, now search for the fortran libraries
998 # based on the system type.
999 AC_MSG_RESULT([checking for fortran libraries based on system type])
1000 case "$host" in
1001 hppa1.1-hp-hpux*)
1002 AC_CHECK_LIB(cl, FTN_QATAN, [F77LIBS="$F77LIBS -lcl"], , $F77LIBS)
1003 ;;
1004 *-ibm-aix*)
1005 # need to add -lc before -lxlf on AIX to
1006 # avoid getting the wrong getenv
1007 F77LIBS="-lc $F77LIBS"
1008 AC_CHECK_LIB(xlf, _xldabs, [F77LIBS="$F77LIBS -lxlf"], , $F77LIBS)
1009 AC_CHECK_LIB(xlfutil, srand_, [F77LIBS="$F77LIBS -lxlfutil"], ,
1010 $F77LIBS)
1011 AC_CHECK_LIB(xlf90, printf,
1012 [F77LIBS="$F77LIBS -lxlf90"], , $F77LIBS)
1013 ;;
1014 *-linux-*)
1015 AC_CHECK_LIB(f2c, pow_dd, [F77LIBS="$F77LIBS -lf2c"], , $F77LIBS)
1016 AC_CHECK_LIB(g2c, pow_dd, [F77LIBS="$F77LIBS -lg2c"], , $F77LIBS)
1017 ;;
1018 sparc-sun-solaris*)
1019 if test -n "$GCC" ; then
1020 F77LIBS="-L/opt/SUNWspro/lib -R/opt/SUNWspro/lib"
1021 fi
1022 AC_CHECK_LIB(sunmath, d_sqrt_, [MATH_LIBS="-lsunmath $MATH_LIBS"])
1023 AC_CHECK_LIB(F77, f77_init,
1024 [F77LIBS="$F77LIBS -lF77"], , $F77LIBS $MATH_LIBS)
1025 AC_CHECK_LIB(M77, inmax_,
1026 [F77LIBS="$F77LIBS -lM77"], , $F77LIBS $MATH_LIBS)
1027 ;;
1028 sparc-sun-sunos4*)
1029 if test -n "$GCC" ; then
1030 F77LIBS="-L/usr/lang/lib"
1031 fi
1032 AC_CHECK_LIB(F77, f77_init, [F77LIBS="$F77LIBS -lF77"], , $F77LIBS)
1033 AC_CHECK_LIB(M77, inmax_, [F77LIBS="$F77LIBS -lM77"], , $F77LIBS)
1034 ;;
1035 mips-sgi-irix*)
1036 AC_CHECK_LIB(F77, s_copy, [F77LIBS="$F77LIBS -lF77"], , $F77LIBS)
1037 AC_CHECK_LIB(I77, f_exit, [F77LIBS="$F77LIBS -lI77"], , $F77LIBS)
1038 AC_CHECK_LIB(isam, mkidxname,
1039 [F77LIBS="$F77LIBS -lisam"], , $F77LIBS)
1040 ;;
1041 *)
1042 AC_CHECK_LIB(F77, printf, [F77LIBS="$F77LIBS -lF77"], , $F77LIBS)
1043 AC_CHECK_LIB(M77, printf, [F77LIBS="$F77LIBS -lM77"], , $F77LIBS)
1044 AC_CHECK_LIB(f2c, pow_dd, [F77LIBS="$F77LIBS -lf2c"], , $F77LIBS)
1045 AC_CHECK_LIB(f77, printf, [F77LIBS="$F77LIBS -lf77"], , $F77LIBS)
1046 AC_CHECK_LIB(for, printf, [F77LIBS="$F77LIBS -lfor"], , $F77LIBS)
1047 AC_CHECK_LIB(ots, printf, [F77LIBS="$F77LIBS -lots"], , $F77LIBS)
1048 AC_CHECK_LIB(Ufor, printf, [F77LIBS="$F77LIBS -lUfor"], , $F77LIBS)
1049 ;;
1050 esac
1051 fi
1052
1053 # asc_subdirs are the extra fortran subdirectories we have to visit
1054 # to build the fortran libraries. Initialize it to empty here.
1055 asc_subdirs=''
1056
1057 # Initialize the blas variables
1058 make_blaslib=''
1059
1060 AC_ARG_WITH(blas,
1061 [ --with-blas=BLASLIB The full path to the blas library.
1062 Use '--with-blas=build' to build the blas library
1063 from the sources that come with the distribution.],
1064 , [with_blas=yes] )
1065 case "$with_fortran$with_blas" in
1066 no*)
1067 # Fortran is disabled; ignore this option (if present)
1068 BLASLIB=
1069 ;;
1070 *no)
1071 # It is an error if the user chooses to build without
1072 # the BLAS library if Fortran is enabled.
1073 AC_MSG_ERROR([Bad option '--without-blas'
1074 To support Fortran calls, ASCEND must be compiled with a blas library])
1075 ;;
1076 *build)
1077 # Fortran is enabled and the user specified --with-blas=build
1078 # For a search for BLAS source code and tell the Makefile
1079 # to build it; useful for testing configure.
1080 #AWW20041206: blas_src_file="$srcdir/blas/dcopy.f"
1081 blas_src_file="$srcdir/../../blas/dcopy.f"
1082 AC_MSG_CHECKING([for blas source file $blas_src_file ])
1083 if test -f $blas_src_file ; then
1084 AC_MSG_RESULT(yes)
1085 #AWW20041119: BLASLIB="$ascpwd/ascend4/archive/libascblas.a"
1086 BLASLIB="$ascpwd/archive/libascblas.a"
1087 make_blaslib='make-blaslib'
1088 #AWW20041206: blaslib_makefile="blas/Makefile"
1089 blaslib_makefile="blas/Makefile:../../blas/Makefile.in"
1090 #AWW20041206: asc_subdirs="$asc_subdirs ../blas"
1091 asc_subdirs="$asc_subdirs blas"
1092 else
1093 AC_MSG_RESULT(no)
1094 AC_MSG_ERROR([User specified '--with-blas=build' but
1095 configure cannot find the blas source file $blas_src_file])
1096 fi
1097 ;;
1098 *yes)
1099 # Fortran in enabled and the user didn't give the --with-blas
1100 # option or didn't give the library's location.
1101 # Search for a compiled libblas.a or libascblas.a; if that
1102 # fails, look for BLAS source code; if that also fails,
1103 # disable all Fortran and print a warning.
1104 AC_PATH_PROGS(BLASLIB, libblas.a libascblas.a, , $asc_f77_support_dirs)
1105 blas_src_file="$srcdir/../../blas/dcopy.f"
1106 if test -z "$BLASLIB" -a -n "$blas_src_file" ; then
1107 AC_MSG_CHECKING([for blas source file $blas_src_file ])
1108 if test -f $blas_src_file ; then
1109 AC_MSG_RESULT(yes)
1110 #AWW20041119: BLASLIB="$ascpwd/ascend4/archive/libascblas.a"
1111 BLASLIB="$ascpwd/archive/libascblas.a"
1112 make_blaslib='make-blaslib'
1113 #AWW20041206: blaslib_makefile="blas/Makefile"
1114 blaslib_makefile="blas/Makefile:../../blas/Makefile.in"
1115 #AWW20041206: asc_subdirs="$asc_subdirs ../blas"
1116 asc_subdirs="$asc_subdirs blas"
1117 else
1118 AC_MSG_RESULT(no)
1119 fi
1120 fi
1121 if test -z "$BLASLIB" ; then
1122 with_fortran=no
1123 AC_MSG_WARN([Cannot find libblas.a, libascblas.a, nor blas
1124 source code. Building ASCEND without integration, MINOS, and CONOPT
1125 support. To specify a specific location for the blas library, run
1126 configure again with the argument:
1127 --with-blas=BLASLIB
1128 where BLASLIB is the full path to the blas library file.])
1129 fi
1130 ;;
1131 *)
1132 # The user gave us --with-blas=BLASLIB, use that as the
1133 # location of the BLAS library.
1134 BLASLIB="$with_blas"
1135 ;;
1136 esac
1137
1138
1139 # Initialize the linpack variables
1140 make_lpaklib=''
1141
1142 AC_ARG_WITH(linpack,
1143 [ --with-linpack=LPAKLIB The full path to the linpack library.
1144 Use '--with-linpack=build' to build the library
1145 from the sources that come with the distribution.],
1146 , [with_linpack=yes] )
1147 case "$with_fortran$with_linpack" in
1148 no*)
1149 # Fortran is disabled; ignore this option (if present)
1150 LPAKLIB=
1151 ;;
1152 *no)
1153 # It is an error if the user chooses to build without
1154 # the LINPACK library if Fortran is enabled.
1155 AC_MSG_ERROR([Bad option '--without-linpack'
1156 To support Fortran calls, ASCEND must be compiled with a
1157 linpack library.])
1158 ;;
1159 *build)
1160 # Fortran is enabled and the user specified --with-linpack=build
1161 # For a search for LINPACK source code and tell the Makefile
1162 # to build it; useful for testing configure.
1163 lpak_src_file="$srcdir/../../linpack/d1mach.f"
1164 AC_MSG_CHECKING([for linpack source file $lpak_src_file ])
1165 if test -f $lpak_src_file ; then
1166 AC_MSG_RESULT(yes)
1167 #AWW20041119: LPAKLIB="$ascpwd/ascend4/archive/libasclpak.a"
1168 LPAKLIB="$ascpwd/archive/libasclpak.a"
1169 make_lpaklib='make-lpaklib'
1170 #AWW20041206: lpaklib_makefile="linpack/Makefile"
1171 lpaklib_makefile="linpack/Makefile:../../linpack/Makefile.in"
1172 #AWW20041206: asc_subdirs="$asc_subdirs ../linpack"
1173 asc_subdirs="$asc_subdirs linpack"
1174 else
1175 AC_MSG_RESULT(no)
1176 AC_MSG_ERROR([User specified '--with-linpack=build' but
1177 configure cannot find the linpack source file $lpak_src_file])
1178 fi
1179 ;;
1180 *yes)
1181 # Fortran in enabled and the user didn't give the --with-linpack
1182 # option or didn't give the library's location.
1183 # Search for a compiled liblpak.a or libasclpak.a; if that
1184 # fails, look for LINPACK source code; if that also fails,
1185 # disable all Fortran and print a warning.
1186 AC_PATH_PROGS(LPAKLIB, liblpak.a libasclpak.a, , $asc_f77_support_dirs)
1187 lpak_src_file="$srcdir/../../linpack/d1mach.f"
1188 if test -z "$LPAKLIB" -a -n "$lpak_src_file" ; then
1189 AC_MSG_CHECKING([for linpack source file $lpak_src_file ])
1190 if test -f $lpak_src_file ; then
1191 AC_MSG_RESULT(yes)
1192 #AWW20041119: LPAKLIB="$ascpwd/ascend4/archive/libasclpak.a"
1193 LPAKLIB="$ascpwd/archive/libasclpak.a"
1194 make_lpaklib='make-lpaklib'
1195 #AWW20041206: lpaklib_makefile="linpack/Makefile"
1196 lpaklib_makefile="linpack/Makefile:../../linpack/Makefile.in"
1197 #AWW20041206: asc_subdirs="$asc_subdirs ../linpack"
1198 asc_subdirs="$asc_subdirs linpack"
1199 else
1200 AC_MSG_RESULT(no)
1201 fi
1202 fi
1203 if test -z "$LPAKLIB" ; then
1204 with_fortran=no
1205 AC_MSG_WARN([Cannot find liblpak.a, libasclpak.a, nor linpack
1206 source code. Building ASCEND without integration, MINOS, and CONOPT
1207 support. To specify a specific location for the linpack library, run
1208 configure again with the argument:
1209 --with-linpack=LPAKLIB
1210 where LPAKLIB is the full path to the linpack library file.])
1211 fi
1212 ;;
1213 *)
1214 # The user gave us --with-linkpack=LINKPACKLIB, use that
1215 # as the location of the LINKPACK library.
1216 LPAKLIB="$with_linpack"
1217 ;;
1218 esac
1219
1220
1221 # Initialize the lsod variables
1222 make_lsodlib=''
1223 HAVE_LSOD=''
1224
1225 AC_ARG_WITH(lsod,
1226 [ --with-lsod=LSODLIB The full path to the lsod library.
1227 Use '--with-lsod=build' to build the lsod library
1228 from the sources that come with the distribution.],
1229 , [with_lsod=yes] )
1230 case "$with_fortran$with_lsod" in
1231 no*)
1232 # Fortran is disabled; ignore this option (if present)
1233 LSODLIB=
1234 with_lsod=no
1235 ;;
1236 *no)
1237 # Fortran is enabled but the user specified --without-lsod
1238 LSODLIB=
1239 ;;
1240 *build)
1241 # Fortran is enabled and the user specified --with-lsod=build
1242 # For a search for LSOD source code and tell the Makefile
1243 # to build it; useful for testing configure.
1244 lsod_src_file="$srcdir/../../lsod/lsode.f"
1245 AC_MSG_CHECKING([for lsod source file $lsod_src_file ])
1246 if test -f $lsod_src_file ; then
1247 AC_MSG_RESULT(yes)
1248 #AWW20041119: LSODLIB="$ascpwd/ascend4/archive/libinteg.a"
1249 LSODLIB="$ascpwd/archive/libinteg.a"
1250 make_lsodlib='make-lsodlib'
1251 #AWW20041206: lsodlib_makefile="lsod/Makefile"
1252 lsodlib_makefile="lsod/Makefile:../../lsod/Makefile.in"
1253 #AWW20041206: asc_subdirs="$asc_subdirs ../lsod"
1254 asc_subdirs="$asc_subdirs lsod"
1255 HAVE_LSOD='-DSTATIC_LSOD'
1256 else
1257 AC_MSG_RESULT(no)
1258 AC_MSG_ERROR([User specified '--with-lsod=build' but
1259 configure cannot find the lsod source file $lsod_src_file])
1260 fi
1261 ;;
1262 *yes)
1263 # Fortran in enabled and the user didn't give the --with-lsod
1264 # option or didn't give the library's location.
1265 # Search for a compiled libinteg.a; if that fails, look
1266 # for LSOD source code; if that also fails, disable LSOD
1267 # and print a warning.
1268 AC_PATH_PROGS(LSODLIB, libinteg.a libasclsod.a, , $asc_f77_support_dirs)
1269 lsod_src_file="$srcdir/../../lsod/lsode.f"
1270 if test -z "$LSODLIB" -a -n "$lsod_src_file" ; then
1271 AC_MSG_CHECKING([for lsod source file $lsod_src_file ])
1272 if test -f $lsod_src_file ; then
1273 AC_MSG_RESULT(yes)
1274 #AWW20041119: LSODLIB="$ascpwd/ascend4/archive/libinteg.a"
1275 LSODLIB="$ascpwd/archive/libinteg.a"
1276 make_lsodlib='make-lsodlib'
1277 #AWW20041206: lsodlib_makefile="lsod/Makefile"
1278 lsodlib_makefile="lsod/Makefile:../../lsod/Makefile.in"
1279 #AWW20041206: asc_subdirs="$asc_subdirs ../lsod"
1280 asc_subdirs="$asc_subdirs lsod"
1281 else
1282 AC_MSG_RESULT(no)
1283 fi
1284 fi
1285 if test -z "$LSODLIB" ; then
1286 with_lsod=no
1287 AC_MSG_WARN([Cannot find libinteg.a nor the lsod
1288 source code. Building ASCEND without integration
1289 support. To specify a specific location for the lsod library, run
1290 configure again with the argument:
1291 --with-lsod=LSODLIB
1292 where LSODLIB is the full path to the lsod integration library file.])
1293 else
1294 HAVE_LSOD='-DSTATIC_LSOD'
1295 fi
1296 ;;
1297 *)
1298 # The user gave us --with-lsod=LSODLIB, use that as the
1299 # location of the LSOD library and define -DSTATIC_LSOD.
1300 LSODLIB="$with_lsod"
1301 HAVE_LSOD='-DSTATIC_LSOD'
1302 ;;
1303 esac
1304
1305
1306 #--------------------------------------------------------------------
1307 # Other trees which may or may not be present. If present,
1308 # generate the Makefiles in the tree unless the user passes in
1309 # a --without-<package> argument.
1310 #
1311 # Valid <package> values are: TK, models, help
1312 #
1313 # We could have `configure' do this for us via
1314 # AC_CONFIG_SUBDIRS, but `configure' scripts in the trees can
1315 # only be one directory removed from this configure script.
1316 # For example, it would be nice to have `models' under
1317 # `ascend4', but `configure' doesn't like `ascend4/models' as
1318 # an argument to AC_CONFIG_SUBDIRS.
1319 #
1320 # To get around this problem, we do things by hand. :-)
1321 #
1322 # If the user gives a --without-<package> argument, we have
1323 # nothing to do for that package.
1324 #
1325 # Otherwise,
1326 # * Set `subdir_file_exists' to a file that should exist in the
1327 # subtree---this is how we know that the subtree is really
1328 # there.
1329 # * Set `subdir_locations' to the list of locations, relative
1330 # to this configure script, where the subtree may live.
1331 # * Set `subdir_output' to the list of makefiles to generate;
1332 # the variable `subdir_root' in this list will be replaced
1333 # with the correct value from `subdir_locations'.
1334 #
1335 # To see which (if any) of the values in `subdir_locations' is
1336 # the correct one, we set `subdir_root' to each value in
1337 # `subdir_locations' and check for the existence of
1338 # $fullpathsrcdir/$subdir_root/$subdir_file_exists, where
1339 # $fullpathsrcdir is the full path to the source directory. If
1340 # that file exists, we
1341 # * Set <package>_dir_root to ../$subdir_root. The "../" is
1342 #AWW20041208:# needed since this value is used in the `ascend4' directory
1343 # needed since this value is used in the `generic' directory
1344 #AWW20041208:# and $subdir_root is relative to the parent of `ascend4'.
1345 # and $subdir_root is relative to the parent of `generic'.
1346 # * Substitute the value of $subdir_root into `subdir_output'
1347 # and set the result to <package>_makefiles: the list of
1348 # Makefiles for configure to generate.
1349 # * Each package needs to be able to find its way back to
1350 # ascend4/ConfigAscend; it needs to go back up the tree
1351 # however many levels deep it is---i.e., `foo/bar/baz' should
1352 # become `../../..' and this does it: sed 's,[^/][^/]*,..,g'
1353 # but we need to quote the [] from m4, so we get this bizarre
1354 # thing: sed 's,[[^/][^/]]*,..,g' Set <package>_topbuilddir
1355 # to this result.
1356 # * Exit the loop.
1357 #--------------------------------------------------------------------
1358
1359 # Initialize variables
1360 tkdir_root=''
1361 tkdir_topbuilddir=''
1362
1363 AC_ARG_WITH(tkdir,
1364 [Generation of Makefiles:
1365 --without-tkdir do not generate Makefiles in the TK subdir],
1366 , [with_tkdir=yes])
1367 if test ! "X$with_tkdir" = "Xno" ; then
1368 subdir_file_exists='AscendRC'
1369 #AWW20041117: FIXME next line
1370 #AWW20041206: subdir_locations='ascend4/TK'
1371 subdir_target="TK"
1372 subdir_locations='../../tcltk98/TK'
1373 subdir_output='
1374 $subdir_target/Makefile:$subdir_root/Makefile.in
1375 $subdir_target/Makefile.Rules:$subdir_root/Makefile.Rules.in
1376 $subdir_target/bitmaps/Makefile:$subdir_root/bitmaps/Makefile.in
1377 $subdir_target/templates/Makefile:$subdir_root/templates/Makefile.in
1378 '
1379 for subdir_root in $subdir_locations ; do
1380 if test -f $fullpathsrcdir/$subdir_root/$subdir_file_exists ; then
1381 #AWW20041208: tkdir_root="../$subdir_root"
1382 tkdir_root=$subdir_target
1383 tkdir_makefiles=`eval echo $subdir_output`
1384 tkdir_topbuilddir="$fullpathsrcdir/../../tcltk98/TK"
1385 break
1386 fi
1387 done
1388 fi
1389
1390 # Initialize variables
1391 models_dir_root=''
1392 models_topbuilddir=''
1393
1394 AC_ARG_WITH(models,
1395 [ --without-models do not generate Makefiles in the models subdir],
1396 , [with_models=yes])
1397 if test ! "X$with_models" = "Xno" ; then
1398 subdir_file_exists='system.a4l'
1399 #AWW20041117: FIXME next line
1400 #AWW20041206: subdir_locations='models ascend4/models'
1401 subdir_target="models"
1402 subdir_locations='models ../../models'
1403 subdir_output='
1404 $subdir_target/Makefile:$subdir_root/Makefile.in
1405 $subdir_target/Makefile.Rules:$subdir_root/Makefile.Rules.in
1406 $subdir_target/ben/Makefile:$subdir_root/ben/Makefile.in
1407 $subdir_target/johnpye/Makefile:$subdir_root/johnpye/Makefile.in
1408 '
1409 ## $subdir_root/examples/Makefile
1410 ## $subdir_root/examples/abbott/Makefile
1411 ## $subdir_root/examples/flexible_design/Makefile
1412 ## $subdir_root/libraries/Makefile
1413 ## $subdir_root/libraries/abbott/Makefile
1414 ## $subdir_root/pending/Makefile
1415 ## $subdir_root/pending/examples/Makefile
1416 ## $subdir_root/pending/libraries/Makefile
1417 for subdir_root in $subdir_locations ; do
1418 if test -f $fullpathsrcdir/$subdir_root/$subdir_file_exists ; then
1419 #AWW20041208: models_dir_root="../$subdir_root"
1420 models_dir_root="$subdir_target"
1421 models_makefiles=`eval echo $subdir_output`
1422 models_topbuilddir="$fullpathsrcdir/../../models"
1423 break
1424 fi
1425 done
1426 fi
1427
1428
1429 # Initialize variables
1430 help_dir_root=''
1431 help_topbuilddir=''
1432
1433 dnl >>>>AC_ARG_WITH(help,
1434 dnl >>>> [ --without-help do not generate Makefiles in the help subdir],
1435 dnl >>>> , [with_help=yes])
1436 dnl >>>>if test ! "X$with_help" = "Xno" ; then
1437 dnl >>>> subdir_file_exists='ascend-helpTOC.htm'
1438 dnl >>>> subdir_locations='help ascend4/help'
1439 dnl >>>> subdir_output='
1440 dnl >>>> $subdir_root/Makefile
1441 dnl >>>> $subdir_root/Makefile.Rules:$subdir_root/Makefile.Rules.in
1442 dnl >>>> $subdir_root/Screenshots/Makefile
1443 dnl >>>> '
1444 dnl >>>> for subdir_root in $subdir_locations ; do
1445 dnl >>>> if test -f $fullpathsrcdir/$subdir_root/$subdir_file_exists ; then
1446 dnl >>>> help_dir_root="../$subdir_root"
1447 dnl >>>> help_makefiles=`eval echo $subdir_output`
1448 dnl >>>> help_topbuilddir=`echo "$subdir_root" | sed 's,[[^/][^/]]*,..,g'`
1449 dnl >>>> break
1450 dnl >>>> fi
1451 dnl >>>> done
1452 dnl >>>>fi
1453
1454 #-----------------------------------------------
1455 # DYNAMIC_LINKING or STATIC_LINKING ?
1456
1457 AC_MSG_CHECKING([for package linking])
1458
1459 AC_ARG_ENABLE(dynamic-linking, AC_HELP_STRING([--enable-dynamic-packages],
1460 [Enable dynamic linking of ASCEND external packages (default is YES for Linux, Cygwin and MinGW; NO for any other platform)])
1461 ,
1462 if test $enableval; then
1463 dynlinking=1
1464 else
1465 dynlinking=0
1466 fi
1467 ,
1468 dynlinking="_def"
1469 )
1470
1471 if test "X$dynlinking" = "X_def"; then
1472 case $host in
1473 *-*-cygwin* | *-*-mingw* | *linux* ) dynlinking=1;;
1474 *) dynlinking=0;;
1475 esac
1476 fi
1477
1478 if test "X$dynlinking" = "X1"; then
1479 AC_MSG_RESULT([DYNAMIC])
1480 AC_DEFINE(DYNAMIC_PACKAGES)
1481 else
1482 AC_MSG_RESULT([STATIC])
1483 AC_DEFINE(STATIC_PACKAGES)
1484 fi
1485
1486 #-----------------------------------------------
1487 # DEBUG_RELS or not?
1488
1489 AC_MSG_CHECKING([for relation debugging])
1490
1491 AC_ARG_ENABLE(relation-debugging, AC_HELP_STRING([--enable-relation-debugging],
1492 [Enable debug output for relation compilation (default is NO)])
1493 ,
1494 if test $enableval; then
1495 debugrels=1
1496 else
1497 debugrels=0
1498 fi
1499 ,
1500 debugrels=0
1501 )
1502
1503 if test "X$debugrels" = "X1"; then
1504 AC_MSG_RESULT([YES])
1505 AC_DEFINE(DEBUG_RELS)
1506 else
1507 AC_MSG_RESULT([no])
1508 fi
1509
1510 #-----------------------------------------------
1511 # TIME the compiler?
1512
1513 AC_MSG_CHECKING([whether to time the compiler])
1514
1515 AC_ARG_ENABLE(compiler-timing, AC_HELP_STRING([--enable-compiler-timing],
1516 [Enable timing of the compiler (default is NO)])
1517 ,
1518 if test $enableval; then
1519 timecompiler=1
1520 else
1521 timecompiler=0
1522 fi
1523 ,
1524 timecompiler=0
1525 )
1526
1527 if test "X$timecompiler" = "X1"; then
1528 AC_MSG_RESULT([YES])
1529 AC_DEFINE(TIMECOMPILER)
1530 else
1531 AC_MSG_RESULT([no])
1532 fi
1533
1534
1535 #--------------------------------------------------------------------
1536 # The variables we substitute into the Makefile.in files
1537 # and the command to actually generate the Makefiles
1538 #--------------------------------------------------------------------
1539 AC_SUBST(ascpwd)
1540 AC_SUBST(fullpathsrcdir)
1541 AC_SUBST(asc_include)
1542 AC_SUBST(CC)
1543 AC_SUBST(DEFS)
1544 AC_SUBST(CFLAGS)
1545 AC_SUBST(LEX)
1546 AC_SUBST(LEXLIB)
1547 AC_SUBST(scanner_src)
1548 AC_SUBST(typer_src)
1549 AC_SUBST(MATH_LIBS)
1550 AC_SUBST(DEBUG_LIBS)
1551 AC_SUBST(X11_INCLUDES)
1552 AC_SUBST(X11_LIBRARIES)
1553 AC_SUBST(X11_RUN_PATH)
1554 AC_SUBST(X11_EXTRA_LIBS)
1555 AC_SUBST(DL_LIBS)
1556 AC_SUBST(LD_FLAGS)
1557 AC_SUBST(LD_SEARCH_FLAGS)
1558 AC_SUBST(SHLIB_CFLAGS)
1559 AC_SUBST(SHLIB_LD)
1560 AC_SUBST(SHLIB_LD_LIBS)
1561 AC_SUBST(SHLIB_SUFFIX)
1562 AC_SUBST(ASC_LIB_SUFFIX)
1563 AC_SUBST(TK_LIB)
1564 AC_SUBST(TK_HDR)
1565 AC_SUBST(TKTABLE_LIB)
1566 AC_SUBST(ASC_TK_LIBRARY)
1567 AC_SUBST(ASC_TCL_LIBRARY)
1568 AC_SUBST(HAVE_TKTABLE)
1569 AC_SUBST(asc_subdirs)
1570 AC_SUBST(F77)
1571 AC_SUBST(F77LIBS)
1572 AC_SUBST(BLASLIB)
1573 AC_SUBST(make_blaslib)
1574 AC_SUBST(LPAKLIB)
1575 AC_SUBST(make_lpaklib)
1576 AC_SUBST(LSODLIB)
1577 AC_SUBST(make_lsodlib)
1578 AC_SUBST(HAVE_LSOD)
1579 #AWW20041113: AC_SUBST(OPTSQPLIB)
1580 #AWW20041113: AC_SUBST(make_rsqplib)
1581 #AWW20041113: AC_SUBST(HAVE_OPTSQP)
1582 #AWW20041113: dnl AC_SUBST(HARWELLLIB)
1583 #AWW20041113: dnl AC_SUBST(make_harwelllib)
1584 #AWW20041113: dnl AC_SUBST(HAVE_HARWELL)
1585 #AWW20041113: AC_SUBST(MINOSLIB)
1586 #AWW20041113: AC_SUBST(make_minoslib)
1587 #AWW20041113: AC_SUBST(HAVE_MINOS)
1588 #AWW20041113: AC_SUBST(CONOPTLIB)
1589 #AWW20041113: AC_SUBST(make_conoptlib)
1590 #AWW20041113: AC_SUBST(HAVE_CONOPT)
1591 AC_SUBST(tkdir_root)
1592 AC_SUBST(tkdir_topbuilddir)
1593 AC_SUBST(models_dir_root)
1594 AC_SUBST(models_topbuilddir)
1595 AC_SUBST(help_dir_root)
1596 AC_SUBST(help_topbuilddir)
1597
1598 AC_OUTPUT(
1599 ConfigAscend:../../base/generic/ConfigAscend.in
1600 Makefile:../../base/generic/Makefile.in
1601 bin/ascend4.sh:../../base/generic/bin/ascend4.sh.in
1602 Makefile.Rules:../../base/generic/Makefile.Rules.in
1603 archive/Makefile:../../base/generic/archive/Makefile.in
1604 bin/Makefile:../../base/generic/bin/Makefile.in
1605 compiler/Makefile:../../base/generic/compiler/Makefile.in
1606 general/Makefile:../../base/generic/general/Makefile.in
1607 interface/Makefile:../../tcltk98/generic/interface/Makefile.in
1608 lib/Makefile:../../base/generic/lib/Makefile.in
1609 packages/Makefile:../../base/generic/packages/Makefile.in
1610 solver/Makefile:../../base/generic/solver/Makefile.in
1611 utilities/Makefile:../../base/generic/utilities/Makefile.in
1612 ../../jam/Jamrules
1613 ../../tcltk98/generic/Jamrules_tcltk98
1614 $tkdir_makefiles
1615 $models_makefiles
1616 $help_makefiles
1617 $blaslib_makefile
1618 $lpaklib_makefile
1619 $lsodlib_makefile
1620 )

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