1 | # Copyright (C) 2006 International Business Machines.. |
---|
2 | # All Rights Reserved. |
---|
3 | # This file is distributed under the Common Public License. |
---|
4 | # |
---|
5 | ## $Id: coin.m4 117 2006-10-18 04:16:16Z andreasw $ |
---|
6 | # |
---|
7 | # Author: Andreas Wachter IBM 2006-04-14 |
---|
8 | |
---|
9 | # This file defines the common autoconf macros for COIN |
---|
10 | # |
---|
11 | |
---|
12 | # Check requirements |
---|
13 | AC_PREREQ(2.59) |
---|
14 | |
---|
15 | ########################################################################### |
---|
16 | # COIN_MAIN_SUBDIRS # |
---|
17 | ########################################################################### |
---|
18 | |
---|
19 | # This macro sets up the recursion into configure scripts into |
---|
20 | # subdirectories. Each possible subdirectory should be provided as a |
---|
21 | # new argument to this macro. The current limit is 10 subdirectories. |
---|
22 | # This automatically also checks for the Data subdirectory. |
---|
23 | |
---|
24 | AC_DEFUN([AC_COIN_MAIN_SUBDIRS], |
---|
25 | [AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration]) |
---|
26 | |
---|
27 | m4_ifvaln([$1],[AC_MSG_CHECKING(whether directory $1 is available) |
---|
28 | coin_skip=no |
---|
29 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
30 | for dir in $COIN_SKIP_PROJECTS; do |
---|
31 | if test $dir = $1; then |
---|
32 | coin_skip=yes |
---|
33 | fi |
---|
34 | done |
---|
35 | fi |
---|
36 | if test $coin_skip = yes; then |
---|
37 | AC_MSG_RESULT(skipping) |
---|
38 | elif test -r $srcdir/$1/configure; then |
---|
39 | coin_subdirs="$coin_subdirs $1" |
---|
40 | AC_MSG_RESULT(yes) |
---|
41 | AC_CONFIG_SUBDIRS($1) |
---|
42 | else |
---|
43 | AC_MSG_RESULT(no) |
---|
44 | fi]) |
---|
45 | m4_ifvaln([$2],[AC_MSG_CHECKING(whether directory $2 is available) |
---|
46 | coin_skip=no |
---|
47 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
48 | for dir in $COIN_SKIP_PROJECTS; do |
---|
49 | if test $dir = $2; then |
---|
50 | coin_skip=yes |
---|
51 | fi |
---|
52 | done |
---|
53 | fi |
---|
54 | if test $coin_skip = yes; then |
---|
55 | AC_MSG_RESULT(skipping) |
---|
56 | elif test -r $srcdir/$2/configure; then |
---|
57 | coin_subdirs="$coin_subdirs $2" |
---|
58 | AC_MSG_RESULT(yes) |
---|
59 | AC_CONFIG_SUBDIRS($2) |
---|
60 | else |
---|
61 | AC_MSG_RESULT(no) |
---|
62 | fi]) |
---|
63 | m4_ifvaln([$3],[AC_MSG_CHECKING(whether directory $3 is available) |
---|
64 | coin_skip=no |
---|
65 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
66 | for dir in $COIN_SKIP_PROJECTS; do |
---|
67 | if test $dir = $3; then |
---|
68 | coin_skip=yes |
---|
69 | fi |
---|
70 | done |
---|
71 | fi |
---|
72 | if test $coin_skip = yes; then |
---|
73 | AC_MSG_RESULT(skipping) |
---|
74 | elif test -r $srcdir/$3/configure; then |
---|
75 | coin_subdirs="$coin_subdirs $3" |
---|
76 | AC_MSG_RESULT(yes) |
---|
77 | AC_CONFIG_SUBDIRS($3) |
---|
78 | else |
---|
79 | AC_MSG_RESULT(no) |
---|
80 | fi]) |
---|
81 | m4_ifvaln([$4],[AC_MSG_CHECKING(whether directory $4 is available) |
---|
82 | coin_skip=no |
---|
83 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
84 | for dir in $COIN_SKIP_PROJECTS; do |
---|
85 | if test $dir = $4; then |
---|
86 | coin_skip=yes |
---|
87 | fi |
---|
88 | done |
---|
89 | fi |
---|
90 | if test $coin_skip = yes; then |
---|
91 | AC_MSG_RESULT(skipping) |
---|
92 | elif test -r $srcdir/$4/configure; then |
---|
93 | coin_subdirs="$coin_subdirs $4" |
---|
94 | AC_MSG_RESULT(yes) |
---|
95 | AC_CONFIG_SUBDIRS($4) |
---|
96 | else |
---|
97 | AC_MSG_RESULT(no) |
---|
98 | fi]) |
---|
99 | m4_ifvaln([$5],[AC_MSG_CHECKING(whether directory $5 is available) |
---|
100 | coin_skip=no |
---|
101 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
102 | for dir in $COIN_SKIP_PROJECTS; do |
---|
103 | if test $dir = $5; then |
---|
104 | coin_skip=yes |
---|
105 | fi |
---|
106 | done |
---|
107 | fi |
---|
108 | if test $coin_skip = yes; then |
---|
109 | AC_MSG_RESULT(skipping) |
---|
110 | elif test -r $srcdir/$5/configure; then |
---|
111 | coin_subdirs="$coin_subdirs $5" |
---|
112 | AC_MSG_RESULT(yes) |
---|
113 | AC_CONFIG_SUBDIRS($5) |
---|
114 | else |
---|
115 | AC_MSG_RESULT(no) |
---|
116 | fi]) |
---|
117 | m4_ifvaln([$6],[AC_MSG_CHECKING(whether directory $6 is available) |
---|
118 | coin_skip=no |
---|
119 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
120 | for dir in $COIN_SKIP_PROJECTS; do |
---|
121 | if test $dir = $6; then |
---|
122 | coin_skip=yes |
---|
123 | fi |
---|
124 | done |
---|
125 | fi |
---|
126 | if test $coin_skip = yes; then |
---|
127 | AC_MSG_RESULT(skipping) |
---|
128 | elif test -r $srcdir/$6/configure; then |
---|
129 | coin_subdirs="$coin_subdirs $6" |
---|
130 | AC_MSG_RESULT(yes) |
---|
131 | AC_CONFIG_SUBDIRS($6) |
---|
132 | else |
---|
133 | AC_MSG_RESULT(no) |
---|
134 | fi]) |
---|
135 | m4_ifvaln([$7],[AC_MSG_CHECKING(whether directory $7 is available) |
---|
136 | coin_skip=no |
---|
137 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
138 | for dir in $COIN_SKIP_PROJECTS; do |
---|
139 | if test $dir = $7; then |
---|
140 | coin_skip=yes |
---|
141 | fi |
---|
142 | done |
---|
143 | fi |
---|
144 | if test $coin_skip = yes; then |
---|
145 | AC_MSG_RESULT(skipping) |
---|
146 | elif test -r $srcdir/$7/configure; then |
---|
147 | coin_subdirs="$coin_subdirs $7" |
---|
148 | AC_MSG_RESULT(yes) |
---|
149 | AC_CONFIG_SUBDIRS($7) |
---|
150 | else |
---|
151 | AC_MSG_RESULT(no) |
---|
152 | fi]) |
---|
153 | m4_ifvaln([$8],[AC_MSG_CHECKING(whether directory $8 is available) |
---|
154 | coin_skip=no |
---|
155 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
156 | for dir in $COIN_SKIP_PROJECTS; do |
---|
157 | if test $dir = $8; then |
---|
158 | coin_skip=yes |
---|
159 | fi |
---|
160 | done |
---|
161 | fi |
---|
162 | if test $coin_skip = yes; then |
---|
163 | AC_MSG_RESULT(skipping) |
---|
164 | elif test -r $srcdir/$8/configure; then |
---|
165 | coin_subdirs="$coin_subdirs $8" |
---|
166 | AC_MSG_RESULT(yes) |
---|
167 | AC_CONFIG_SUBDIRS($8) |
---|
168 | else |
---|
169 | AC_MSG_RESULT(no) |
---|
170 | fi]) |
---|
171 | m4_ifvaln([$9],[AC_MSG_CHECKING(whether directory $9 is available) |
---|
172 | coin_skip=no |
---|
173 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
174 | for dir in $COIN_SKIP_PROJECTS; do |
---|
175 | if test $dir = $9; then |
---|
176 | coin_skip=yes |
---|
177 | fi |
---|
178 | done |
---|
179 | fi |
---|
180 | if test $coin_skip = yes; then |
---|
181 | AC_MSG_RESULT(skipping) |
---|
182 | elif test -r $srcdir/$9/configure; then |
---|
183 | coin_subdirs="$coin_subdirs $9" |
---|
184 | AC_MSG_RESULT(yes) |
---|
185 | AC_CONFIG_SUBDIRS($9) |
---|
186 | else |
---|
187 | AC_MSG_RESULT(no) |
---|
188 | fi]) |
---|
189 | m4_ifvaln([$10],[AC_MSG_CHECKING(whether directory $10 is available) |
---|
190 | coin_skip=no |
---|
191 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
192 | for dir in $COIN_SKIP_PROJECTS; do |
---|
193 | if test $dir = $10; then |
---|
194 | coin_skip=yes |
---|
195 | fi |
---|
196 | done |
---|
197 | fi |
---|
198 | if test $coin_skip = yes; then |
---|
199 | AC_MSG_RESULT(skipping) |
---|
200 | elif test -r $srcdir/$10/configure; then |
---|
201 | coin_subdirs="$coin_subdirs $10" |
---|
202 | AC_MSG_RESULT(yes) |
---|
203 | AC_CONFIG_SUBDIRS($10) |
---|
204 | else |
---|
205 | AC_MSG_RESULT(no) |
---|
206 | fi]) |
---|
207 | ]) # AC_COIN_MAIN_SUBDIRS |
---|
208 | |
---|
209 | ########################################################################### |
---|
210 | # COIN_THIRDPARTY_SUBDIRS # |
---|
211 | ########################################################################### |
---|
212 | |
---|
213 | # This macro sets up the recursion into the configure script in a |
---|
214 | # subdirectory for compilation of third party code. The first |
---|
215 | # argument is just the string that appears in the configure output. |
---|
216 | # The second argument is the directory with the configure script, and |
---|
217 | # the third one is a file that should exists in that directory. If |
---|
218 | # this file does not exist, we assume that the user has not downloaded |
---|
219 | # the code, and we are not going to compile it |
---|
220 | |
---|
221 | AC_DEFUN([AC_COIN_THIRDPARTY_SUBDIRS], |
---|
222 | [AC_MSG_CHECKING(whether code for third party package $1 is available) |
---|
223 | coin_skip=no |
---|
224 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
225 | for dir in $COIN_SKIP_PROJECTS; do |
---|
226 | if test $dir = $2; then |
---|
227 | coin_skip=yes |
---|
228 | fi |
---|
229 | done |
---|
230 | fi |
---|
231 | if test $coin_skip = yes; then |
---|
232 | AC_MSG_RESULT(skipping) |
---|
233 | elif test -r $srcdir/$2/$3; then |
---|
234 | coin_subdirs="$coin_subdirs $2" |
---|
235 | AC_MSG_RESULT(yes) |
---|
236 | AC_CONFIG_SUBDIRS($2) |
---|
237 | else |
---|
238 | AC_MSG_RESULT(no) |
---|
239 | fi |
---|
240 | ]) # AC_COIN_THIRDPARTY_SUBDIRS |
---|
241 | |
---|
242 | ########################################################################### |
---|
243 | # COIN_CHECK_VPATH # |
---|
244 | ########################################################################### |
---|
245 | |
---|
246 | # This macro sets the variable coin_vpath_config to true if this is a |
---|
247 | # VPATH configuration, otherwise it sets it to false. |
---|
248 | AC_DEFUN([AC_COIN_CHECK_VPATH], |
---|
249 | [AC_MSG_CHECKING(whether this is a VPATH configuration) |
---|
250 | if test `cd $srcdir; pwd` != `pwd`; then |
---|
251 | coin_vpath_config=yes; |
---|
252 | else |
---|
253 | coin_vpath_config=no; |
---|
254 | fi |
---|
255 | AC_MSG_RESULT($coin_vpath_config) |
---|
256 | ]) # AC_COIN_CHECK_VPATH |
---|
257 | |
---|
258 | ########################################################################### |
---|
259 | # COIN_PROJECTDIR_INIT # |
---|
260 | ########################################################################### |
---|
261 | |
---|
262 | # This macro does everything that is required in the early part in the |
---|
263 | # configure script, such as defining a few variables. This should only |
---|
264 | # be used in the main directory of a project directory (the one under |
---|
265 | # which src is) |
---|
266 | |
---|
267 | AC_DEFUN([AC_COIN_PROJECTDIR_INIT], |
---|
268 | [# Initialize the ADDLIBS variable |
---|
269 | ADDLIBS='-lm' |
---|
270 | AC_SUBST(ADDLIBS) |
---|
271 | |
---|
272 | # Initialize the FADDLIBS variable (which is to be used with a fortran |
---|
273 | # compiler and will not include FLIBS) |
---|
274 | FADDLIBS= |
---|
275 | AC_SUBST(FADDLIBS) |
---|
276 | |
---|
277 | # A useful makefile conditional that is always false |
---|
278 | AM_CONDITIONAL(ALWAYS_FALSE, false) |
---|
279 | |
---|
280 | # We set the following variable so that we know later in AC_COIN_FINALIZE |
---|
281 | # that we are in a project main directory |
---|
282 | coin_projectdir=yes |
---|
283 | ]) # AC_COIN_PROJECTDIR_INIT |
---|
284 | |
---|
285 | ########################################################################### |
---|
286 | # COIN_DEBUG_COMPILE # |
---|
287 | ########################################################################### |
---|
288 | |
---|
289 | # enable the configure flags --enable-debug and --enable-debug-prjct |
---|
290 | # (where prcjt is the name of the project in lower case) and set the |
---|
291 | # variable coin_debug_compile to true or false This is used by |
---|
292 | # COIN_PROG_CXX, COIN_PROG_CC and COIN_PROG_F77 to determine the |
---|
293 | # compilation flags. This macro also makes the switches |
---|
294 | # --with-prjct-verbosity and --with-prjct-checklevel available, which |
---|
295 | # define the preprocessor macros COIN_PRJCT_VERBOSITY and |
---|
296 | # COIN_PRJCT_CHECKLEVEL to the specified value (default is 0). |
---|
297 | # |
---|
298 | # The project specific flags are only made available, if one gives the |
---|
299 | # name of the project as first argument to this macro. |
---|
300 | |
---|
301 | AC_DEFUN([AC_COIN_DEBUG_COMPILE], |
---|
302 | [AC_BEFORE([$0],[AC_COIN_PROG_CXX])dnl |
---|
303 | AC_BEFORE([$0],[AC_COIN_PROG_CC])dnl |
---|
304 | AC_BEFORE([$0],[AC_COIN_PROG_F77])dnl |
---|
305 | |
---|
306 | AC_MSG_CHECKING([whether we want to compile in debug mode]) |
---|
307 | |
---|
308 | AC_ARG_ENABLE([debug], |
---|
309 | [AC_HELP_STRING([--enable-debug], |
---|
310 | [compile all projects with debug options tests])], |
---|
311 | [case "${enableval}" in |
---|
312 | yes) coin_debug_compile=true |
---|
313 | enable_shared=no |
---|
314 | ;; |
---|
315 | no) coin_debug_compile=false |
---|
316 | ;; |
---|
317 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) |
---|
318 | ;; |
---|
319 | esac], |
---|
320 | [coin_debug_compile=false]) |
---|
321 | |
---|
322 | m4_ifvaln([$1], |
---|
323 | [AC_ARG_ENABLE(debug-m4_tolower($1), |
---|
324 | [AC_HELP_STRING([--enable-debug-m4_tolower($1)], |
---|
325 | [compile this project ($1) with debug options])], |
---|
326 | [case "${enableval}" in |
---|
327 | yes) coin_debug_compile=true |
---|
328 | enable_shared=no |
---|
329 | ;; |
---|
330 | no) coin_debug_compile=false |
---|
331 | ;; |
---|
332 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug-m4_tolower($1)) |
---|
333 | ;; |
---|
334 | esac],[:]) |
---|
335 | ]) # m4_ifvaln([$1], |
---|
336 | |
---|
337 | if test $coin_debug_compile = true; then |
---|
338 | AC_MSG_RESULT([yes]) |
---|
339 | else |
---|
340 | AC_MSG_RESULT([no]) |
---|
341 | fi |
---|
342 | |
---|
343 | m4_ifvaln([$1], |
---|
344 | [AC_ARG_WITH(m4_tolower($1)-verbosity, |
---|
345 | AC_HELP_STRING([--with-m4_tolower($1)-verbosity], |
---|
346 | [specify the debug verbosity level for project $1]), |
---|
347 | [m4_tolower(coin_$1_verbosity)=$withval], |
---|
348 | [m4_tolower(coin_$1_verbosity)=0]) |
---|
349 | AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_VERBOSITY), |
---|
350 | m4_tolower($coin_$1_verbosity), |
---|
351 | [Define to the debug verbosity level (0 is no output)]) |
---|
352 | |
---|
353 | AC_ARG_WITH(m4_tolower($1)-checklevel, |
---|
354 | AC_HELP_STRING([--with-m4_tolower($1)-checklevel], |
---|
355 | [specify the sanity check level for project $1]), |
---|
356 | [m4_tolower(coin_$1_checklevel)=$withval], |
---|
357 | [m4_tolower(coin_$1_checklevel)=0]) |
---|
358 | AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_CHECKLEVEL), |
---|
359 | m4_tolower($coin_$1_checklevel), |
---|
360 | [Define to the debug sanity check level (0 is no test)]) |
---|
361 | |
---|
362 | # We use the following variable to have a string with the upper case |
---|
363 | # version of the project name |
---|
364 | COIN_PRJCT=m4_toupper($1) |
---|
365 | |
---|
366 | ]) # m4_ifvaln([$1], |
---|
367 | |
---|
368 | ]) # AC_COIN_DEBUG_COMPILE |
---|
369 | |
---|
370 | ########################################################################### |
---|
371 | # COIN_MINGW_LD_FIX # |
---|
372 | ########################################################################### |
---|
373 | |
---|
374 | # This macro is included by any PROG_compiler macro, to set the LD |
---|
375 | # environment variable on MinWG to the correct value (link) |
---|
376 | |
---|
377 | AC_DEFUN([AC_COIN_MINGW_LD_FIX], |
---|
378 | [case $build in |
---|
379 | *-mingw*) |
---|
380 | if test "${LD+set}" = set; then :; else |
---|
381 | LD=link |
---|
382 | fi |
---|
383 | ;; |
---|
384 | esac |
---|
385 | ]) |
---|
386 | |
---|
387 | ########################################################################### |
---|
388 | # COIN_ENABLE_DOSCOMPILE # |
---|
389 | ########################################################################### |
---|
390 | |
---|
391 | # This macro is included by any PROG_compiler macro, to enable the |
---|
392 | # --enable-doscompile options which is to be used when one wants to |
---|
393 | # compile an executable under Cygwin which also runs directly under |
---|
394 | # does (without requiring Cygwin1.dll). Essentially, if enabled and |
---|
395 | # the GNU compilers are used, it switches the --mno-cygwin flag on. |
---|
396 | |
---|
397 | AC_DEFUN([AC_COIN_ENABLE_DOSCOMPILE], |
---|
398 | [AC_ARG_ENABLE([doscompile], |
---|
399 | [AC_HELP_STRING([--enable-doscompile], |
---|
400 | [Under Cygwin, compile so that executables run under DOS (default: disabled)])], |
---|
401 | [if test "$enable_doscompile = yes"; then |
---|
402 | case $build in |
---|
403 | *-cygwin*) ;; |
---|
404 | *) AC_MSG_ERROR([--enable-doscompile option makes only sense under Cygwin]) ;; |
---|
405 | esac |
---|
406 | fi], |
---|
407 | [enable_doscompile=no]) |
---|
408 | ]) |
---|
409 | |
---|
410 | ########################################################################### |
---|
411 | # COIN_PROG_CXX # |
---|
412 | ########################################################################### |
---|
413 | |
---|
414 | # Find the compile command by running AC_PROG_CXX (with compiler names |
---|
415 | # for different operating systems) and put it into CXX (unless it was |
---|
416 | # given my the user), and find an appropriate value for CXXFLAGS. It is |
---|
417 | # possible to provide additional -D flags in the variable CXXDEFS. |
---|
418 | |
---|
419 | AC_DEFUN([AC_COIN_PROG_CXX], |
---|
420 | [AC_REQUIRE([AC_COIN_PROG_CC]) #Let's try if that overcomes configuration problem with VC++ 6.0 |
---|
421 | AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) |
---|
422 | AC_LANG_PUSH(C++) |
---|
423 | |
---|
424 | AC_ARG_VAR(CXXDEFS,[Additional -D flags to be used when compiling C++ code.]) |
---|
425 | AC_ARG_VAR(ADD_CXXFLAGS,[Additional C++ compiler options]) |
---|
426 | AC_ARG_VAR(DBG_CXXFLAGS,[Debug C++ compiler options]) |
---|
427 | AC_ARG_VAR(OPT_CXXFLAGS,[Optimize C++ compiler options]) |
---|
428 | |
---|
429 | coin_has_cxx=yes |
---|
430 | |
---|
431 | save_cxxflags="$CXXFLAGS" |
---|
432 | case $build in |
---|
433 | *-cygwin* | *-mingw*) |
---|
434 | comps="g++ cl" ;; |
---|
435 | *-darwin*) comps="g++ c++ CC" ;; |
---|
436 | *) comps="xlC aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; |
---|
437 | esac |
---|
438 | |
---|
439 | # We delete the cached value, since the test might not have been |
---|
440 | # performed with out choise of compilers earlier |
---|
441 | $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; } |
---|
442 | AC_PROG_CXX([$comps]) |
---|
443 | CXXFLAGS="$save_cxxflags" |
---|
444 | |
---|
445 | # Check if a project specific CXXFLAGS variable has been set |
---|
446 | if test x$COIN_PRJCT != x; then |
---|
447 | eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set} |
---|
448 | if test x$coin_tmp = xset; then |
---|
449 | eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS} |
---|
450 | fi |
---|
451 | fi |
---|
452 | |
---|
453 | if test x"$CXXFLAGS" = x; then |
---|
454 | |
---|
455 | # ToDo decide whether we want -DNDEBUG for optimization |
---|
456 | coin_add_cxxflags= |
---|
457 | coin_opt_cxxflags= |
---|
458 | coin_dbg_cxxflags= |
---|
459 | coin_warn_cxxflags= |
---|
460 | |
---|
461 | if test "$GXX" = "yes"; then |
---|
462 | case "$CXX" in |
---|
463 | icpc* | */icpc*) |
---|
464 | ;; |
---|
465 | *) |
---|
466 | # ToDo decide about unroll-loops |
---|
467 | coin_opt_cxxflags="-O3 -fomit-frame-pointer" |
---|
468 | coin_add_cxxflags="-pipe" |
---|
469 | coin_dbg_cxxflags="-g" |
---|
470 | coin_warn_cxxflags="-pedantic-errors -Wimplicit -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion" |
---|
471 | if test "$enable_doscompile" = yes; then |
---|
472 | case $build in |
---|
473 | *-cygwin*) |
---|
474 | CXXFLAGS="-mno-cygwin" |
---|
475 | AC_TRY_LINK([],[int i=0; i++;], |
---|
476 | [coin_add_cxxflags="-mno-cygwin $coin_add_cxxflags"]) |
---|
477 | CXXFLAGS= |
---|
478 | ;; |
---|
479 | esac |
---|
480 | fi |
---|
481 | esac |
---|
482 | fi |
---|
483 | if test -z "$coin_opt_cxxflags"; then |
---|
484 | case $build in |
---|
485 | *-cygwin* | *-mingw*) |
---|
486 | case "$CXX" in |
---|
487 | cl* | */cl*) |
---|
488 | coin_opt_cxxflags='-O2' |
---|
489 | coin_add_cxxflags='-nologo -EHsc -GR -MT' |
---|
490 | coin_dbg_cxxflags='-Yd' |
---|
491 | ;; |
---|
492 | esac |
---|
493 | ;; |
---|
494 | *-linux-*) |
---|
495 | case "$CXX" in |
---|
496 | icpc* | */icpc*) |
---|
497 | coin_opt_cxxflags="-O3 -ip" |
---|
498 | coin_add_cxxflags="" |
---|
499 | coin_dbg_cxxflags="-g" |
---|
500 | # Check if -i_dynamic is necessary (for new glibc library) |
---|
501 | CXXFLAGS= |
---|
502 | AC_TRY_LINK([],[int i=0; i++;],[], |
---|
503 | [coin_add_cxxflags="-i_dynamic $coin_add_cxxflags"]) |
---|
504 | ;; |
---|
505 | pgCC* | */pgCC*) |
---|
506 | coin_opt_cxxflags="-fast" |
---|
507 | coin_add_cxxflags="-Kieee -pc 64" |
---|
508 | coin_dbg_cxxflags="-g" |
---|
509 | ;; |
---|
510 | esac |
---|
511 | ;; |
---|
512 | *-ibm-*) |
---|
513 | case "$CXX" in |
---|
514 | xlC* | */xlC* | mpxlC* | */mpxlC*) |
---|
515 | coin_opt_cxxflags="-O3 -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" |
---|
516 | coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna" |
---|
517 | coin_dbg_cxxflags="-g" |
---|
518 | ;; |
---|
519 | esac |
---|
520 | ;; |
---|
521 | *-hp-*) |
---|
522 | case "$CXX" in |
---|
523 | aCC* | */aCC* ) |
---|
524 | coin_opt_cxxflags="-O" |
---|
525 | coin_add_cxxflags="-AA" |
---|
526 | coin_dbg_cxxflags="-g" |
---|
527 | ;; |
---|
528 | esac |
---|
529 | ;; |
---|
530 | *-sun-*) |
---|
531 | coin_opt_cxxflags="-O4" |
---|
532 | coin_dbg_cxxflags="-g" |
---|
533 | ;; |
---|
534 | esac |
---|
535 | fi |
---|
536 | |
---|
537 | if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then |
---|
538 | coin_dbg_cxxflags="-g" |
---|
539 | fi |
---|
540 | |
---|
541 | if test -z "$coin_opt_cxxflags"; then |
---|
542 | # Try if -O option works if nothing else is set |
---|
543 | CXXFLAGS=-O |
---|
544 | AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cxxflags="-O"]) |
---|
545 | fi |
---|
546 | |
---|
547 | if test x${DBG_CXXFLAGS+set} != xset; then |
---|
548 | DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags" |
---|
549 | fi |
---|
550 | if test x${OPT_CXXFLAGS+set} != xset; then |
---|
551 | OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags" |
---|
552 | fi |
---|
553 | |
---|
554 | DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" |
---|
555 | OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" |
---|
556 | |
---|
557 | if test "$coin_debug_compile" = "true"; then |
---|
558 | CXXFLAGS="$DBG_CXXFLAGS" |
---|
559 | else |
---|
560 | CXXFLAGS="$OPT_CXXFLAGS" |
---|
561 | fi |
---|
562 | else |
---|
563 | CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" |
---|
564 | if test x${DBG_CXXFLAGS+set} != xset; then |
---|
565 | DBG_CXXFLAGS="$CXXFLAGS" |
---|
566 | fi |
---|
567 | if test x${OPT_CXXFLAGS+set} != xset; then |
---|
568 | OPT_CXXFLAGS="$CXXFLAGS" |
---|
569 | fi |
---|
570 | fi |
---|
571 | |
---|
572 | # Try if CXXFLAGS works |
---|
573 | save_CXXFLAGS="$CXXFLAGS" |
---|
574 | AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=]) |
---|
575 | if test -z "$CXXFLAGS"; then |
---|
576 | AC_MSG_WARN([The flags CXXFLAGS="$save_CXXFLAGS" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually.]) |
---|
577 | CXXFLAGS='-O' |
---|
578 | AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=]) |
---|
579 | if test -z "$CXXFLAGS"; then |
---|
580 | AC_MSG_WARN([This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually.]) |
---|
581 | fi |
---|
582 | fi |
---|
583 | |
---|
584 | AC_MSG_NOTICE([C++ compiler options are: $CXXFLAGS]) |
---|
585 | |
---|
586 | AC_ARG_VAR(MPICXX,[C++ MPI Compiler]) |
---|
587 | if test x"$MPICXX" = x; then :; else |
---|
588 | AC_MSG_NOTICE([Will use MPI C++ compiler $MPICXX]) |
---|
589 | CXX="$MPICXX" |
---|
590 | fi |
---|
591 | |
---|
592 | case "$CXX" in |
---|
593 | cl*) |
---|
594 | AC_COIN_MINGW_LD_FIX |
---|
595 | ;; |
---|
596 | esac |
---|
597 | |
---|
598 | AC_LANG_POP(C++) |
---|
599 | ]) # AC_COIN_PROG_CXX |
---|
600 | |
---|
601 | |
---|
602 | ########################################################################### |
---|
603 | # COIN_CXXLIBS # |
---|
604 | ########################################################################### |
---|
605 | |
---|
606 | # Determine the C++ runtime libraries required for linking a C++ library |
---|
607 | # with a Fortran or C compiler. The result is available in CXXLIBS. |
---|
608 | |
---|
609 | AC_DEFUN([AC_COIN_CXXLIBS], |
---|
610 | [AC_REQUIRE([AC_PROG_CXX])dnl |
---|
611 | AC_LANG_PUSH(C++) |
---|
612 | AC_ARG_VAR(CXXLIBS,[Libraries necessary for linking C++ code with Fortran compiler]) |
---|
613 | if test -z "$CXXLIBS"; then |
---|
614 | if test "$GXX" = "yes"; then |
---|
615 | case "$CXX" in |
---|
616 | icpc* | */icpc*) |
---|
617 | CXXLIBS="" |
---|
618 | ;; |
---|
619 | *) |
---|
620 | CXXLIBS="-lstdc++ -lm" # -lgcc" |
---|
621 | ;; |
---|
622 | esac |
---|
623 | else |
---|
624 | case $build in |
---|
625 | *-mingw32 | *-cygwin-* ) |
---|
626 | case "$CXX" in |
---|
627 | cl*) |
---|
628 | CXXLIBS=nothing;; |
---|
629 | esac;; |
---|
630 | *-linux-*) |
---|
631 | case "$CXX" in |
---|
632 | icpc* | */icpc*) |
---|
633 | CXXLIBS="" |
---|
634 | ;; |
---|
635 | pgCC* | */pgCC*) |
---|
636 | CXXLIBS="-lstd -lC -lc" |
---|
637 | ;; |
---|
638 | esac;; |
---|
639 | *-ibm-*) |
---|
640 | CXXLIBS="-lC -lc" |
---|
641 | ;; |
---|
642 | *-hp-*) |
---|
643 | CXXLIBS="-L/opt/aCC/lib -l++ -lstd_v2 -lCsup_v2 -lm -lcl -lc" |
---|
644 | ;; |
---|
645 | *-sun-*) |
---|
646 | CXXLIBS="-lCstd -lCrun" |
---|
647 | esac |
---|
648 | fi |
---|
649 | fi |
---|
650 | if test -z "$CXXLIBS"; then |
---|
651 | AC_MSG_WARN([Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran of C).]) |
---|
652 | else |
---|
653 | AC_MSG_NOTICE([Assuming that CXXLIBS is \"$CXXLIBS\".]) |
---|
654 | fi |
---|
655 | if test x"$CXXLIBS" = xnothing; then |
---|
656 | CXXLIBS= |
---|
657 | fi |
---|
658 | AC_LANG_POP(C++) |
---|
659 | ]) # AC_COIN_CXXLIBS |
---|
660 | |
---|
661 | ########################################################################### |
---|
662 | # COIN_CHECK_HEADER # |
---|
663 | ########################################################################### |
---|
664 | |
---|
665 | # This macro checks for a header file, but it does so without the |
---|
666 | # standard header. This avoids warning messages like: |
---|
667 | # |
---|
668 | # configure: WARNING: dlfcn.h: present but cannot be compiled |
---|
669 | # configure: WARNING: dlfcn.h: check for missing prerequisite headers? |
---|
670 | # configure: WARNING: dlfcn.h: see the Autoconf documentation |
---|
671 | # configure: WARNING: dlfcn.h: section "Present But Cannot Be Compiled" |
---|
672 | # configure: WARNING: dlfcn.h: proceeding with the preprocessor's result |
---|
673 | # configure: WARNING: dlfcn.h: in the future, the compiler will take precedence |
---|
674 | |
---|
675 | AC_DEFUN([AC_COIN_CHECK_HEADER], |
---|
676 | [if test x"$4" = x; then |
---|
677 | hdr="#include <$1>" |
---|
678 | else |
---|
679 | hdr="$4" |
---|
680 | fi |
---|
681 | AC_CHECK_HEADERS([$1],[$2],[$3],[$hdr]) |
---|
682 | ]) # AC_COIN_CHECK_HEADER |
---|
683 | |
---|
684 | ########################################################################### |
---|
685 | # COIN_CHECK_CXX_CHEADER # |
---|
686 | ########################################################################### |
---|
687 | |
---|
688 | # This macro checks for C header files that are used from C++. For a give |
---|
689 | # stub (e.g., math), it first checks if the C++ library (cmath) is available. |
---|
690 | # If it is, it defines HAVE_CMATH (or whatever the stub is). If it is not |
---|
691 | # available, it checks for the old C head (math.h) and defines HAVE_MATH_H |
---|
692 | # if that one exists. |
---|
693 | |
---|
694 | AC_DEFUN([AC_COIN_CHECK_CXX_CHEADER], |
---|
695 | [AC_LANG_PUSH(C++) |
---|
696 | AC_COIN_CHECK_HEADER([c$1],[$2],[$3],[$4]) |
---|
697 | if test "$ac_cv_header_c$1" != "yes"; then |
---|
698 | AC_COIN_CHECK_HEADER([$1.h],[$2],[$3],[$4]) |
---|
699 | fi |
---|
700 | AC_LANG_POP(C++) |
---|
701 | ]) # AC_COIN_CHECK_CXX_CHEADER |
---|
702 | |
---|
703 | ########################################################################### |
---|
704 | # COIN_PROG_CC # |
---|
705 | ########################################################################### |
---|
706 | |
---|
707 | # Find the compile command by running AC_PROG_CC (with compiler names |
---|
708 | # for different operating systems) and put it into CC (unless it was |
---|
709 | # given my the user), and find an appropriate value for CFLAGS. It is |
---|
710 | # possible to provide additional -D flags in the variable CDEFS. |
---|
711 | |
---|
712 | AC_DEFUN([AC_COIN_PROG_CC], |
---|
713 | [AC_REQUIRE([AC_COIN_MINGW_LD_FIX]) |
---|
714 | AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) |
---|
715 | AC_LANG_PUSH(C) |
---|
716 | |
---|
717 | # For consistency, we set the C compiler to the same value of the C++ |
---|
718 | # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) |
---|
719 | if test x"$CXX" != x; then |
---|
720 | case "$CXX" in |
---|
721 | cl*) |
---|
722 | if test x"$CC" = x; then |
---|
723 | CC="$CXX" |
---|
724 | AC_MSG_WARN([C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX]) |
---|
725 | fi |
---|
726 | ;; |
---|
727 | esac |
---|
728 | fi |
---|
729 | |
---|
730 | AC_ARG_VAR(CDEFS,[Additional -D flags to be used when compiling C code.]) |
---|
731 | AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options]) |
---|
732 | AC_ARG_VAR(DBG_CFLAGS,[Debug C compiler options]) |
---|
733 | AC_ARG_VAR(OPT_CFLAGS,[Optimize C compiler options]) |
---|
734 | |
---|
735 | coin_has_cc=yes |
---|
736 | |
---|
737 | save_cflags="$CFLAGS" |
---|
738 | case $build in |
---|
739 | *-cygwin* | *-mingw*) |
---|
740 | comps="gcc cl" ;; |
---|
741 | *-linux-*) comps="xlc gcc cc pgcc icc" ;; |
---|
742 | *) comps="xlc_r xlc cc gcc pgcc icc" ;; |
---|
743 | esac |
---|
744 | |
---|
745 | # We delete the cached value, since the test might not have been |
---|
746 | # performed with out choise of compilers earlier |
---|
747 | $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; } |
---|
748 | AC_PROG_CC([$comps]) |
---|
749 | CFLAGS="$save_cflags" |
---|
750 | |
---|
751 | # Check if a project specific CFLAGS variable has been set |
---|
752 | if test x$COIN_PRJCT != x; then |
---|
753 | eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set} |
---|
754 | if test x$coin_tmp = xset; then |
---|
755 | eval CFLAGS=\${${COIN_PRJCT}_CFLAGS} |
---|
756 | fi |
---|
757 | fi |
---|
758 | |
---|
759 | if test x"$CFLAGS" = x; then |
---|
760 | |
---|
761 | coin_add_cflags= |
---|
762 | coin_opt_cflags= |
---|
763 | coin_dbg_cflags= |
---|
764 | coin_warn_cflags= |
---|
765 | |
---|
766 | if test "$GCC" = "yes"; then |
---|
767 | case "$CC" in |
---|
768 | icc* | */icc*) |
---|
769 | ;; |
---|
770 | *) |
---|
771 | coin_opt_cflags="-O3 -fomit-frame-pointer" |
---|
772 | coin_add_cflags="-pipe" |
---|
773 | coin_dbg_cflags="-g" |
---|
774 | coin_warn_cflags="-pedantic-errors -Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall" |
---|
775 | if test "$enable_doscompile" = yes; then |
---|
776 | case $build in |
---|
777 | *-cygwin*) |
---|
778 | CFLAGS="-mno-cygwin" |
---|
779 | AC_TRY_LINK([],[int i=0; i++;], |
---|
780 | [coin_add_cflags="-mno-cygwin $coin_add_cflags"]) |
---|
781 | CFLAGS= |
---|
782 | ;; |
---|
783 | esac |
---|
784 | fi |
---|
785 | esac |
---|
786 | fi |
---|
787 | if test -z "$coin_opt_cflags"; then |
---|
788 | case $build in |
---|
789 | *-cygwin* | *-mingw*) |
---|
790 | case "$CC" in |
---|
791 | cl* | */cl*) |
---|
792 | coin_opt_cflags='-O2' |
---|
793 | coin_add_cflags='-nologo' |
---|
794 | coin_dbg_cflags='-Yd' |
---|
795 | ;; |
---|
796 | esac |
---|
797 | ;; |
---|
798 | *-linux-*) |
---|
799 | case "$CC" in |
---|
800 | icc* | */icc*) |
---|
801 | coin_opt_cflags="-O3 -ip" |
---|
802 | coin_add_cflags="" |
---|
803 | coin_dbg_cflags="-g" |
---|
804 | # Check if -i_dynamic is necessary (for new glibc library) |
---|
805 | CFLAGS= |
---|
806 | AC_TRY_LINK([],[int i=0; i++;],[], |
---|
807 | [coin_add_cflags="-i_dynamic $coin_add_cflags"]) |
---|
808 | ;; |
---|
809 | pgcc* | */pgcc*) |
---|
810 | coin_opt_cflags="-fast" |
---|
811 | coin_add_cflags="-Kieee -pc 64" |
---|
812 | coin_dbg_cflags="-g" |
---|
813 | ;; |
---|
814 | esac |
---|
815 | ;; |
---|
816 | *-ibm-*) |
---|
817 | case "$CC" in |
---|
818 | xlc* | */xlc* | mpxlc* | */mpxlc*) |
---|
819 | coin_opt_cflags="-O3 -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" |
---|
820 | coin_add_cflags="-bmaxdata:0x80000000" |
---|
821 | coin_dbg_cflags="-g" |
---|
822 | ;; |
---|
823 | esac |
---|
824 | ;; |
---|
825 | *-hp-*) |
---|
826 | coin_opt_cflags="-O" |
---|
827 | coin_add_cflags="-Ae" |
---|
828 | coin_dbg_cflags="-g" |
---|
829 | ;; |
---|
830 | *-sun-*) |
---|
831 | coin_opt_cflags="-xO4" |
---|
832 | coin_dbg_cflags="-g" |
---|
833 | ;; |
---|
834 | *-sgi-*) |
---|
835 | coin_opt_cflags="-O -OPT:Olimit=0" |
---|
836 | coin_dbg_cflags="-g" |
---|
837 | ;; |
---|
838 | esac |
---|
839 | fi |
---|
840 | |
---|
841 | if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then |
---|
842 | coin_dbg_cflags="-g" |
---|
843 | fi |
---|
844 | |
---|
845 | if test -z "$coin_opt_cflags"; then |
---|
846 | # Try if -O option works if nothing else is set |
---|
847 | CFLAGS="-O" |
---|
848 | AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cflags="-O"]) |
---|
849 | fi |
---|
850 | |
---|
851 | if test x${DBG_CFLAGS+set} != xset; then |
---|
852 | DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags" |
---|
853 | fi |
---|
854 | if test x${OPT_CFLAGS+set} != xset; then |
---|
855 | OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags" |
---|
856 | fi |
---|
857 | |
---|
858 | DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS" |
---|
859 | OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS" |
---|
860 | |
---|
861 | if test "$coin_debug_compile" = "true"; then |
---|
862 | CFLAGS="$DBG_CFLAGS" |
---|
863 | else |
---|
864 | CFLAGS="$OPT_CFLAGS" |
---|
865 | fi |
---|
866 | else |
---|
867 | CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS" |
---|
868 | if test x${DBG_CFLAGS+set} != xset; then |
---|
869 | DBG_CFLAGS="$CFLAGS" |
---|
870 | fi |
---|
871 | if test x${OPT_CFLAGS+set} != xset; then |
---|
872 | OPT_CFLAGS="$CFLAGS" |
---|
873 | fi |
---|
874 | fi |
---|
875 | |
---|
876 | # Check if user wants to have additional CFLAGS options |
---|
877 | AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options]) |
---|
878 | if test x"$ADD_CFLAGS" != x; then |
---|
879 | CFLAGS="$CFLAGS $ADD_CFLAGS" |
---|
880 | fi |
---|
881 | |
---|
882 | # Try if CFLAGS works |
---|
883 | save_CFLAGS="$CFLAGS" |
---|
884 | AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=]) |
---|
885 | if test -z "$CFLAGS"; then |
---|
886 | AC_MSG_WARN([The value CFLAGS="$save_CFLAGS" do not work. I will now just try '-O', but you might want to set CFLAGS manually.]) |
---|
887 | CFLAGS='-O' |
---|
888 | AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=]) |
---|
889 | if test -z "$CFLAGS"; then |
---|
890 | AC_MSG_WARN([This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually.]) |
---|
891 | fi |
---|
892 | fi |
---|
893 | |
---|
894 | AC_MSG_NOTICE([C compiler options are: $CFLAGS]) |
---|
895 | |
---|
896 | AC_ARG_VAR(MPICC,[C MPI Compiler]) |
---|
897 | if test x"$MPICC" = x; then :; else |
---|
898 | AC_MSG_NOTICE([Will use MPI C compiler $MPICC]) |
---|
899 | CC="$MPICC" |
---|
900 | fi |
---|
901 | |
---|
902 | # Correct ADDLIBS initialization if we are using the MS compiler |
---|
903 | case "$CC" in |
---|
904 | cl*) |
---|
905 | ADDLIBS= |
---|
906 | AC_COIN_MINGW_LD_FIX |
---|
907 | ;; |
---|
908 | esac |
---|
909 | |
---|
910 | AC_LANG_POP(C) |
---|
911 | ]) # AC_COIN_PROG_CC |
---|
912 | |
---|
913 | ########################################################################### |
---|
914 | # COIN_PROG_F77 # |
---|
915 | ########################################################################### |
---|
916 | |
---|
917 | # Find the compile command by running AC_PROG_F77 (with compiler names |
---|
918 | # for different operating systems) and put it into F77 (unless it was |
---|
919 | # given my the user), and find an appropriate value for FFLAGS |
---|
920 | |
---|
921 | AC_DEFUN([AC_COIN_PROG_F77], |
---|
922 | [AC_REQUIRE([AC_COIN_MINGW_LD_FIX]) |
---|
923 | AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) |
---|
924 | AC_LANG_PUSH([Fortran 77]) |
---|
925 | |
---|
926 | AC_ARG_VAR(ADD_FFLAGS,[Additional Fortran compiler options]) |
---|
927 | AC_ARG_VAR(DBG_FFLAGS,[Debug Fortran compiler options]) |
---|
928 | AC_ARG_VAR(OPT_FFLAGS,[Optimize Fortran compiler options]) |
---|
929 | |
---|
930 | coin_has_f77=yes |
---|
931 | |
---|
932 | save_fflags="$FFLAGS" |
---|
933 | case $build in |
---|
934 | *-cygwin* | *-mingw*) |
---|
935 | comps="gfortran g77 ifort fl32" ;; |
---|
936 | *) comps="xlf fort77 gfortran f77 g77 pgf90 pgf77 ifort ifc frt af77" ;; |
---|
937 | esac |
---|
938 | |
---|
939 | # We delete the cached value, since the test might not have been |
---|
940 | # performed with out choise of compilers earlier |
---|
941 | $as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; } |
---|
942 | AC_PROG_F77($comps) |
---|
943 | FFLAGS="$save_fflags" |
---|
944 | |
---|
945 | # Check if a project specific FFLAGS variable has been set |
---|
946 | if test x$COIN_PRJCT != x; then |
---|
947 | eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set} |
---|
948 | if test x$coin_tmp = xset; then |
---|
949 | eval FFLAGS=\${${COIN_PRJCT}_FFLAGS} |
---|
950 | fi |
---|
951 | fi |
---|
952 | |
---|
953 | if test x"$FFLAGS" = x; then |
---|
954 | |
---|
955 | coin_add_fflags= |
---|
956 | coin_opt_fflags= |
---|
957 | coin_dbg_fflags= |
---|
958 | coin_warn_fflags= |
---|
959 | |
---|
960 | if test "$G77" = "yes"; then |
---|
961 | coin_opt_fflags="-O3 -fomit-frame-pointer" |
---|
962 | coin_add_fflags="-pipe" |
---|
963 | coin_dbg_fflags="-g" |
---|
964 | if test "$enable_doscompile" = yes; then |
---|
965 | case $build in |
---|
966 | *-cygwin*) |
---|
967 | FFLAGS="-mno-cygwin" |
---|
968 | AC_TRY_LINK([],[ write(*,*) 'Hello world'], |
---|
969 | [coin_add_fflags="-mno-cygwin $coin_add_fflags"]) |
---|
970 | FFLAGS= |
---|
971 | ;; |
---|
972 | esac |
---|
973 | fi |
---|
974 | else |
---|
975 | case $build in |
---|
976 | *-cygwin* | *-mingw*) |
---|
977 | case $F77 in |
---|
978 | ifort* | */ifort*) |
---|
979 | coin_opt_fflags='-O3' |
---|
980 | coin_add_fflags='-nologo -MT' |
---|
981 | coin_dbg_fflags='-debug' |
---|
982 | ;; |
---|
983 | esac |
---|
984 | ;; |
---|
985 | *-linux-*) |
---|
986 | case $F77 in |
---|
987 | ifc* | */ifc* | ifort* | */ifort*) |
---|
988 | coin_opt_fflags="-O3 -ip" |
---|
989 | coin_add_fflags="-cm -w90 -w95" |
---|
990 | coin_dbg_fflags="-g -CA -CB -CS" |
---|
991 | # Check if -i_dynamic is necessary (for new glibc library) |
---|
992 | FFLAGS= |
---|
993 | AC_TRY_LINK([],[ write(*,*) 'Hello world'],[], |
---|
994 | [coin_add_fflags="-i_dynamic $coin_add_fflags"]) |
---|
995 | ;; |
---|
996 | pgf77* | */pgf77* | pgf90* | */pgf90*) |
---|
997 | coin_opt_fflags="-fast" |
---|
998 | coin_add_fflags="-Kieee -pc 64" |
---|
999 | coin_dbg_fflags="-g" |
---|
1000 | ;; |
---|
1001 | esac |
---|
1002 | ;; |
---|
1003 | *-ibm-*) |
---|
1004 | case "$F77" in |
---|
1005 | xlf* | */xlf* | mpxlf* | */mpxlf* ) |
---|
1006 | coin_opt_fflags="-O3 -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" |
---|
1007 | coin_add_fflags="-bmaxdata:0x80000000" |
---|
1008 | coin_dbg_fflags="-g -C" |
---|
1009 | ;; |
---|
1010 | esac |
---|
1011 | ;; |
---|
1012 | *-hp-*) |
---|
1013 | coin_opt_fflags="+O3" |
---|
1014 | coin_add_fflags="+U77" |
---|
1015 | coin_dbg_fflags="-C -g" |
---|
1016 | ;; |
---|
1017 | *-sun-*) |
---|
1018 | coin_opt_fflags="-O4" |
---|
1019 | coin_dbg_fflags="-g" |
---|
1020 | ;; |
---|
1021 | *-sgi-*) |
---|
1022 | coin_opt_fflags="-O5 -OPT:Olimit=0" |
---|
1023 | coin_dbg_fflags="-g" |
---|
1024 | ;; |
---|
1025 | esac |
---|
1026 | fi |
---|
1027 | |
---|
1028 | if test "$ac_cv_prog_f77_g" = yes && test -z "$coin_dbg_fflags" ; then |
---|
1029 | coin_dbg_fflags="-g" |
---|
1030 | fi |
---|
1031 | |
---|
1032 | if test -z "$coin_opt_fflags"; then |
---|
1033 | # Try if -O option works if nothing else is set |
---|
1034 | FFLAGS=-O |
---|
1035 | AC_TRY_LINK([],[ integer i], [coin_opt_fflags="-O"]) |
---|
1036 | fi |
---|
1037 | |
---|
1038 | if test x${DBG_FFLAGS+set} != xset; then |
---|
1039 | DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags" |
---|
1040 | fi |
---|
1041 | if test x${OPT_FFLAGS+set} != xset; then |
---|
1042 | OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags" |
---|
1043 | fi |
---|
1044 | |
---|
1045 | DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS" |
---|
1046 | OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS" |
---|
1047 | |
---|
1048 | if test "$coin_debug_compile" = "true"; then |
---|
1049 | FFLAGS="$DBG_FFLAGS" |
---|
1050 | else |
---|
1051 | FFLAGS="$OPT_FFLAGS" |
---|
1052 | fi |
---|
1053 | else |
---|
1054 | FFLAGS="$FFLAGS $ADD_FFLAGS" |
---|
1055 | if test x${DBG_FFLAGS+set} != xset; then |
---|
1056 | DBG_FFLAGS="$FFLAGS" |
---|
1057 | fi |
---|
1058 | if test x${OPT_FFLAGS+set} != xset; then |
---|
1059 | OPT_FFLAGS="$FFLAGS" |
---|
1060 | fi |
---|
1061 | fi |
---|
1062 | |
---|
1063 | # Try if FFLAGS works |
---|
1064 | AC_TRY_LINK([],[ integer i],[],[FFLAGS=]) |
---|
1065 | if test -z "$FFLAGS"; then |
---|
1066 | AC_MSG_WARN([The flags FFLAGS="$FFLAGS" do not work. I will now just try '-O', but you might want to set FFLAGS manually.]) |
---|
1067 | FFLAGS='-O' |
---|
1068 | AC_TRY_LINK([],[ integer i],[],[FFLAGS=]) |
---|
1069 | if test -z "$FFLAGS"; then |
---|
1070 | AC_MSG_WARN([This value for FFLAGS does not work. I will continue with empty FFLAGS, but you might want to set FFLAGS manually.]) |
---|
1071 | fi |
---|
1072 | fi |
---|
1073 | |
---|
1074 | AC_MSG_NOTICE([Fortran compiler options are: $FFLAGS]) |
---|
1075 | |
---|
1076 | AC_ARG_VAR(MPIF77,[Fortran MPI Compiler]) |
---|
1077 | if test x"$MPIF77" = x; then :; else |
---|
1078 | AC_MSG_NOTICE([Will use MPI Fortran compiler $MPIF77]) |
---|
1079 | F77="$MPIF77" |
---|
1080 | fi |
---|
1081 | |
---|
1082 | case "$F77" in |
---|
1083 | ifort*) |
---|
1084 | AC_COIN_MINGW_LD_FIX |
---|
1085 | ;; |
---|
1086 | esac |
---|
1087 | |
---|
1088 | AC_LANG_POP([Fortran 77]) |
---|
1089 | ]) # AC_COIN_PROG_F77 |
---|
1090 | |
---|
1091 | ########################################################################### |
---|
1092 | # COIN_F77_WRAPPERS # |
---|
1093 | ########################################################################### |
---|
1094 | |
---|
1095 | # Calls autoconfs AC_F77_WRAPPERS and does additional corrections to FLIBS |
---|
1096 | |
---|
1097 | AC_DEFUN([AC_COIN_F77_WRAPPERS], |
---|
1098 | [AC_BEFORE([AC_COIN_PROG_F77],[$0])dnl |
---|
1099 | AC_BEFORE([AC_PROG_F77],[$0])dnl |
---|
1100 | |
---|
1101 | AC_LANG_PUSH([Fortran 77]) |
---|
1102 | |
---|
1103 | AC_F77_WRAPPERS |
---|
1104 | |
---|
1105 | # This is to correct a missing exclusion in autoconf 2.59 |
---|
1106 | if test x"$FLIBS" != x; then |
---|
1107 | my_flibs= |
---|
1108 | for flag in $FLIBS; do |
---|
1109 | case flag in |
---|
1110 | -lcrt*.o) ;; |
---|
1111 | *) my_flibs="$my_flibs $flag" ;; |
---|
1112 | esac |
---|
1113 | done |
---|
1114 | FLIBS="$my_flibs" |
---|
1115 | fi |
---|
1116 | |
---|
1117 | case $build in |
---|
1118 | # The following is a fix to define FLIBS for ifort on Windows |
---|
1119 | *-cygwin* | *-mingw*) |
---|
1120 | case "$F77" in |
---|
1121 | ifort* | */ifort*) |
---|
1122 | FLIBS="-link libifcorert.lib $LIBS /NODEFAULTLIB:libc.lib";; |
---|
1123 | esac;; |
---|
1124 | *-hp-*) |
---|
1125 | FLIBS="$FLIBS -lm";; |
---|
1126 | *-ibm-*) |
---|
1127 | FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;; |
---|
1128 | *-linux-*) |
---|
1129 | case "$F77" in |
---|
1130 | pgf77* | */pgf77* | pgf90* | */pgf90*) |
---|
1131 | # ask linker to go through the archives multiple times |
---|
1132 | # (the Fortran compiler seems to do that automatically... |
---|
1133 | FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;; |
---|
1134 | esac |
---|
1135 | esac |
---|
1136 | |
---|
1137 | ]) # AC_COIN_F77_WRAPPERS |
---|
1138 | |
---|
1139 | |
---|
1140 | ########################################################################### |
---|
1141 | # COIN_INIT_AUTOMAKE # |
---|
1142 | ########################################################################### |
---|
1143 | |
---|
1144 | # This macro calls the regular INIT_AUTOMAKE and MAINTAINER_MODE |
---|
1145 | # macros, and defines additional variables and makefile conditionals, |
---|
1146 | # that are used in the maintainer parts of the makfile. It also |
---|
1147 | # checks if the correct versions of the autotools are used. |
---|
1148 | # |
---|
1149 | # This also defines the AC_SUBST variables: |
---|
1150 | # abs_source_dir absolute path to source code for this package |
---|
1151 | # abs_bin_dir absolute path to the directory where binaries are |
---|
1152 | # going to be installed (prefix/bin) |
---|
1153 | # abs_lib_dir absolute path to the directory where libraries are |
---|
1154 | # going to be installed (prefix/lib) |
---|
1155 | # abs_include_dir absolute path to the directory where the header files |
---|
1156 | # are installed (prefix/include) |
---|
1157 | |
---|
1158 | AC_DEFUN([AC_COIN_INIT_AUTOMAKE], |
---|
1159 | [AC_REQUIRE([AC_PROG_EGREP]) |
---|
1160 | # Stuff for automake |
---|
1161 | AM_INIT_AUTOMAKE |
---|
1162 | AM_MAINTAINER_MODE |
---|
1163 | |
---|
1164 | coin_have_externals=no |
---|
1165 | if test "$enable_maintainer_mode" = yes; then |
---|
1166 | |
---|
1167 | # If maintainer mode is chosen, we make sure that the correct versions |
---|
1168 | # of the tools are used, and that we know where libtoo.m4 is (to |
---|
1169 | # recreate acinclude.m4) |
---|
1170 | |
---|
1171 | AC_SUBST(LIBTOOLM4) |
---|
1172 | LIBTOOLM4= |
---|
1173 | |
---|
1174 | # Check if we have autoconf |
---|
1175 | AC_CHECK_PROG([have_autoconf],[autoconf],[yes],[no]) |
---|
1176 | if test $have_autoconf = no; then |
---|
1177 | AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find autoconf in your path.]) |
---|
1178 | fi |
---|
1179 | |
---|
1180 | # Check whether autoconf is the correct version |
---|
1181 | correct_version='2.59' |
---|
1182 | grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` |
---|
1183 | AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of autoconf]) |
---|
1184 | autoconf --version > confauto.out 2>&1 |
---|
1185 | if $EGREP $grep_version confauto.out >/dev/null 2>&1; then |
---|
1186 | AC_MSG_RESULT([yes]) |
---|
1187 | else |
---|
1188 | rm -f confauto.out |
---|
1189 | AC_MSG_RESULT([no]) |
---|
1190 | AC_MSG_ERROR([You don't have the correct version of autoconf as the first one in your path.]) |
---|
1191 | fi |
---|
1192 | rm -f confauto.out |
---|
1193 | |
---|
1194 | # Check if the executable autoconf is picked up from the correct location |
---|
1195 | AC_MSG_CHECKING([whether autoconf is coming from the correct location]) |
---|
1196 | autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` |
---|
1197 | autoconf_dir=`cd $autoconf_dir; pwd` |
---|
1198 | if test x$AUTOTOOLS_DIR = x; then |
---|
1199 | want_dir=$HOME/bin |
---|
1200 | else |
---|
1201 | want_dir=$AUTOTOOLS_DIR/bin |
---|
1202 | fi |
---|
1203 | if test $autoconf_dir = `cd $want_dir; pwd`; then |
---|
1204 | AC_MSG_RESULT([yes]) |
---|
1205 | else |
---|
1206 | rm -f confauto.out |
---|
1207 | AC_MSG_RESULT([no]) |
---|
1208 | AC_MSG_ERROR([The autoconf executable should be picked up from \$HOME/bin or \$AUTOTOOLS_DIR/bin.]) |
---|
1209 | fi |
---|
1210 | |
---|
1211 | # Check if we have automake |
---|
1212 | AC_CHECK_PROG([have_automake],[automake],[yes],[no]) |
---|
1213 | if test $have_automake = no; then |
---|
1214 | AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find automake in your path.]) |
---|
1215 | fi |
---|
1216 | |
---|
1217 | # Check whether automake is the correct version |
---|
1218 | correct_version='1.9.6' |
---|
1219 | grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` |
---|
1220 | AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of automake]) |
---|
1221 | automake --version > confauto.out 2>&1 |
---|
1222 | if $EGREP $grep_version confauto.out >/dev/null 2>&1; then |
---|
1223 | AC_MSG_RESULT([yes]) |
---|
1224 | else |
---|
1225 | rm -f confauto.out |
---|
1226 | AC_MSG_RESULT([no]) |
---|
1227 | AC_MSG_ERROR([You don't have the correct version of automake as the first one in your path.]) |
---|
1228 | fi |
---|
1229 | rm -f confauto.out |
---|
1230 | |
---|
1231 | # Check if the executable automake is picked up from the correct location |
---|
1232 | AC_MSG_CHECKING([whether automake is coming from the correct location]) |
---|
1233 | automake_dir=`which automake | sed -e 's=/automake=='` |
---|
1234 | automake_dir=`cd $automake_dir; pwd` |
---|
1235 | if test x$AUTOTOOLS_DIR = x; then |
---|
1236 | want_dir=$HOME/bin |
---|
1237 | else |
---|
1238 | want_dir=$AUTOTOOLS_DIR/bin |
---|
1239 | fi |
---|
1240 | if test $automake_dir = `cd $want_dir; pwd`; then |
---|
1241 | AC_MSG_RESULT([yes]) |
---|
1242 | else |
---|
1243 | rm -f confauto.out |
---|
1244 | AC_MSG_RESULT([no]) |
---|
1245 | AC_MSG_ERROR([The automake executable should be picked up from \$HOME/bin or \$AUTOTOOLS_DIR/bin.]) |
---|
1246 | fi |
---|
1247 | |
---|
1248 | # Check if we can find the libtool file |
---|
1249 | if test x$AUTOTOOLS_DIR = x; then |
---|
1250 | want_dir=$HOME/share |
---|
1251 | else |
---|
1252 | want_dir=$AUTOTOOLS_DIR/share |
---|
1253 | fi |
---|
1254 | AC_CHECK_FILE([$want_dir/aclocal/libtool.m4], |
---|
1255 | [LIBTOOLM4="$want_dir/aclocal/libtool.m4"], |
---|
1256 | [AC_MSG_ERROR([I cannot find the libtool.m4 file.])]) |
---|
1257 | |
---|
1258 | # Check if this is the correct version of libtool (with escaped dots) |
---|
1259 | correct_version='1.5.22' |
---|
1260 | grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` |
---|
1261 | AC_CHECK_FILE([$want_dir/libtool/ltmain.sh], |
---|
1262 | [have_ltmain=yes], |
---|
1263 | [have_ltmain=no]) |
---|
1264 | AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of libtool.]) |
---|
1265 | if test $have_ltmain = yes; then |
---|
1266 | if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then |
---|
1267 | AC_MSG_RESULT([yes]) |
---|
1268 | else |
---|
1269 | AC_MSG_RESULT([no]) |
---|
1270 | AC_MSG_ERROR([You don't have the correct version of libtool.]) |
---|
1271 | fi |
---|
1272 | else |
---|
1273 | AC_MSG_RESULT([no]) |
---|
1274 | AC_MSG_ERROR([I cannot find the ltmain.sh file.]) |
---|
1275 | fi |
---|
1276 | |
---|
1277 | # Check if we have an Externals file |
---|
1278 | if test -r $srcdir/Externals; then |
---|
1279 | coin_have_externals=yes |
---|
1280 | fi |
---|
1281 | # Check if subversion is installed and understands https |
---|
1282 | AC_CHECK_PROG([have_svn],[svn],[yes],[no]) |
---|
1283 | if test x$have_svn = xyes; then |
---|
1284 | AC_MSG_CHECKING([svn understands https]) |
---|
1285 | svn --version > confauto.out 2>&1 |
---|
1286 | if $EGREP https confauto.out >/dev/null 2>&1; then |
---|
1287 | AC_MSG_RESULT(yes) |
---|
1288 | else |
---|
1289 | AC_MSG_RESULT(no) |
---|
1290 | have_svn=no |
---|
1291 | fi |
---|
1292 | rm -f confauto.out |
---|
1293 | fi |
---|
1294 | |
---|
1295 | # Find the location of the BuildTools directory |
---|
1296 | BUILDTOOLSDIR= |
---|
1297 | if test -r $srcdir/BuildTools/coin.m4; then |
---|
1298 | BUILDTOOLSDIR=$srcdir/BuildTools |
---|
1299 | else |
---|
1300 | if test -r $srcdir/../BuildTools/coin.m4; then |
---|
1301 | BUILDTOOLSDIR=$srcdir/../BuildTools |
---|
1302 | else |
---|
1303 | if test -r $srcdir/../../BuildTools/coin.m4; then |
---|
1304 | BUILDTOOLSDIR=$srcdir/../../BuildTools |
---|
1305 | else |
---|
1306 | AC_MSG_ERROR(Cannot find the BuildTools directory) |
---|
1307 | fi |
---|
1308 | fi |
---|
1309 | fi |
---|
1310 | AC_SUBST(BUILDTOOLSDIR) |
---|
1311 | |
---|
1312 | # The following variable is set to the name of the directory where |
---|
1313 | # the autotool scripts are located |
---|
1314 | AC_SUBST(AUX_DIR) |
---|
1315 | AUX_DIR=$ac_aux_dir |
---|
1316 | fi |
---|
1317 | |
---|
1318 | # helpful variable for the base directory of this package |
---|
1319 | abs_source_dir=`cd $srcdir; pwd` |
---|
1320 | AC_SUBST(abs_source_dir) |
---|
1321 | |
---|
1322 | # Stuff for example Makefiles |
---|
1323 | if test x$prefix = xNONE; then |
---|
1324 | full_prefix=$ac_default_prefix |
---|
1325 | else |
---|
1326 | full_prefix=$prefix |
---|
1327 | fi |
---|
1328 | full_prefix=`cd $full_prefix ; pwd` |
---|
1329 | AC_SUBST(abs_lib_dir) |
---|
1330 | abs_lib_dir=$full_prefix/lib |
---|
1331 | AC_SUBST(abs_include_dir) |
---|
1332 | abs_include_dir=$full_prefix/include |
---|
1333 | AC_SUBST(abs_bin_dir) |
---|
1334 | abs_bin_dir=$full_prefix/bin |
---|
1335 | |
---|
1336 | AM_CONDITIONAL(HAVE_EXTERNALS, |
---|
1337 | test $coin_have_externals = yes && test x$have_svn = xyes) |
---|
1338 | ]) # AC_COIN_INIT_AUTOMAKE |
---|
1339 | |
---|
1340 | ########################################################################### |
---|
1341 | # COIN_INIT_AUTO_TOOLS # |
---|
1342 | ########################################################################### |
---|
1343 | |
---|
1344 | # Initialize the auto tools automake and libtool, with all |
---|
1345 | # modifications we want for COIN packages. |
---|
1346 | # |
---|
1347 | # RPATH_FLAGS link flags for hardcoding path to shared objects |
---|
1348 | |
---|
1349 | # This is a trick to have this code before AC_COIN_PROG_LIBTOOL |
---|
1350 | AC_DEFUN([AC_COIN_DISABLE_STATIC], |
---|
1351 | [ |
---|
1352 | # On Cygwin, building DLLs doesn't work |
---|
1353 | case $build in |
---|
1354 | *-cygwin*) |
---|
1355 | coin_disable_shared=yes |
---|
1356 | platform=Cygwin |
---|
1357 | ;; |
---|
1358 | *-mingw*) |
---|
1359 | coin_disable_shared=yes |
---|
1360 | platform="Msys" |
---|
1361 | # case "$CXX" in |
---|
1362 | # cl*) |
---|
1363 | # coin_disable_shared=yes |
---|
1364 | # platform="Msys with cl" |
---|
1365 | # ;; |
---|
1366 | # esac |
---|
1367 | ;; |
---|
1368 | esac |
---|
1369 | if test x"$coin_disable_shared" = xyes; then |
---|
1370 | if test x"$enable_shared" = xyes; then |
---|
1371 | AC_MSG_WARN([On $platform, shared objects are not supported. I'm disabling your choice.]) |
---|
1372 | fi |
---|
1373 | enable_shared=no |
---|
1374 | fi |
---|
1375 | # By default, we only want the shared objects to be compiled |
---|
1376 | AC_DISABLE_STATIC |
---|
1377 | ]) |
---|
1378 | |
---|
1379 | AC_DEFUN([AC_COIN_INIT_AUTO_TOOLS], |
---|
1380 | [AC_BEFORE([AC_COIN_PROG_CXX],[$0]) |
---|
1381 | AC_BEFORE([AC_COIN_PROG_CC],[$0]) |
---|
1382 | AC_BEFORE([AC_COIN_PROG_F77],[$0]) |
---|
1383 | AC_REQUIRE([AC_COIN_DISABLE_STATIC]) |
---|
1384 | |
---|
1385 | # Initialize automake |
---|
1386 | AC_COIN_INIT_AUTOMAKE |
---|
1387 | |
---|
1388 | # Stuff for libtool |
---|
1389 | AC_COIN_PROG_LIBTOOL |
---|
1390 | |
---|
1391 | # set RPATH_FLAGS to the compiler link flags required to hardcode location |
---|
1392 | # of the shared objects |
---|
1393 | AC_COIN_RPATH_FLAGS($abs_lib_dir) |
---|
1394 | ]) # AC_COIN_INIT_AUTO_TOOLS |
---|
1395 | |
---|
1396 | ########################################################################### |
---|
1397 | # COIN_PROG_LIBTOOL # |
---|
1398 | ########################################################################### |
---|
1399 | |
---|
1400 | # Setup the libtool stuff together with any modifications to make it |
---|
1401 | # work on additional platforms |
---|
1402 | |
---|
1403 | AC_DEFUN([AC_COIN_PROG_LIBTOOL], |
---|
1404 | [AC_REQUIRE([AC_COIN_DLFCN_H]) |
---|
1405 | |
---|
1406 | # We check for this header here in a non-standard way to avoid warning |
---|
1407 | # messages |
---|
1408 | AC_PROG_LIBTOOL |
---|
1409 | |
---|
1410 | # Fix bugs in libtool script for Windows native compilation: |
---|
1411 | # - cygpath is not correctly quoted in fix_srcfile_path |
---|
1412 | # - paths generated for .lib files is not run through cygpath -w |
---|
1413 | |
---|
1414 | |
---|
1415 | # - lib includes subdirectory information; we want to replace |
---|
1416 | # |
---|
1417 | # old_archive_cmds="lib /OUT:\$oldlib\$oldobjs\$old_deplibs" |
---|
1418 | # |
---|
1419 | # by |
---|
1420 | # |
---|
1421 | # old_archive_cmds="echo \$oldlib | grep .libs >/dev/null; if test \$? = 0; then cd .libs; lib /OUT:\`echo \$oldlib\$oldobjs\$old_deplibs | sed -e s@\.libs/@@g\`; cd .. ; else lib /OUT:\$oldlib\$oldobjs\$old_deplibs ; fi" |
---|
1422 | # |
---|
1423 | # -e 's%old_archive_cmds="lib /OUT:\\\$oldlib\\\$oldobjs\\\$old_deplibs"%old_archive_cmds="echo \\\$oldlib \| grep .libs >/dev/null; if test \\\$? = 0; then cd .libs; lib /OUT:\\\`echo \\\$oldlib\\\$oldobjs\\\$old_deplibs \| sed -e s@\\.libs/@@g\\\`; cd .. ; else lib /OUT:\\\$oldlib\\\$oldobjs\\\$old_deplibs; fi"%' \ |
---|
1424 | |
---|
1425 | # The following was a hack for chaniing @BACKSLASH to \ |
---|
1426 | # -e 'sYcompile_command=`\$echo "X\$compile_command" | \$Xsed -e '"'"'s%@OUTPUT@%'"'"'"\$output"'"'"'%g'"'"'`Ycompile_command=`\$echo "X\$compile_command" | \$Xsed -e '"'"'s%@OUTPUT@%'"'"'"\$output"'"'"'%g'"'"' | \$Xsed -e '"'"'s%@BACKSLASH@%\\\\\\\\\\\\\\\\%g'"'"'`Y' \ |
---|
1427 | |
---|
1428 | # Correct cygpath for minGW (ToDo!) |
---|
1429 | case $build in |
---|
1430 | *-mingw*) |
---|
1431 | CYGPATH_W=echo |
---|
1432 | ;; |
---|
1433 | esac |
---|
1434 | |
---|
1435 | case $build in |
---|
1436 | *-cygwin* | *-mingw*) |
---|
1437 | case "$CXX" in |
---|
1438 | cl* | */cl*) |
---|
1439 | AC_MSG_NOTICE(Applying patches to libtool for cl compiler) |
---|
1440 | sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ |
---|
1441 | -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ |
---|
1442 | -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ |
---|
1443 | -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ |
---|
1444 | -e 's%lib /OUT:%lib -OUT:%' \ |
---|
1445 | -e "s%cygpath -w%$CYGPATH_W%" \ |
---|
1446 | -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\`lib -nologo -list \\$f_ex_an_ar_oldlib | xargs echo\\`; echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$f_ex_an_ar_oldlib; done%' \ |
---|
1447 | -e 's/$AR t/lib -nologo -list/' \ |
---|
1448 | -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \ |
---|
1449 | -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \ |
---|
1450 | libtool > conftest.bla |
---|
1451 | |
---|
1452 | mv conftest.bla libtool |
---|
1453 | chmod 755 libtool |
---|
1454 | ;; |
---|
1455 | *) |
---|
1456 | AC_MSG_NOTICE(Applying patches to libtool for GNU compiler) |
---|
1457 | sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ |
---|
1458 | -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ |
---|
1459 | -e 's|libext="lib"|libext="a"|' \ |
---|
1460 | libtool > conftest.bla |
---|
1461 | |
---|
1462 | mv conftest.bla libtool |
---|
1463 | chmod 755 libtool |
---|
1464 | ;; |
---|
1465 | esac |
---|
1466 | esac |
---|
1467 | |
---|
1468 | # ToDo |
---|
1469 | # For now, don't use the -no-undefined flag, since the Makefiles are |
---|
1470 | # not yet set up that way. But we need to fix this, when we want |
---|
1471 | # to comile DLLs under Windows. |
---|
1472 | LT_LDFLAGS= |
---|
1473 | AC_SUBST(LT_LDFLAGS) |
---|
1474 | ]) # AC_COIN_PROG_LIBTOOL |
---|
1475 | |
---|
1476 | # This is a trick to force the check for the dlfcn header to be done before |
---|
1477 | # the checks for libtool |
---|
1478 | AC_DEFUN([AC_COIN_DLFCN_H], |
---|
1479 | [AC_LANG_PUSH(C) |
---|
1480 | AC_COIN_CHECK_HEADER([dlfcn.h]) |
---|
1481 | AC_LANG_POP(C) |
---|
1482 | ]) # AC_COIN_DLFCN_H |
---|
1483 | |
---|
1484 | ########################################################################### |
---|
1485 | # COIN_RPATH_FLAGS # |
---|
1486 | ########################################################################### |
---|
1487 | |
---|
1488 | # This macro, in case shared objects are used, defines a variable |
---|
1489 | # RPATH_FLAGS that can be used by the linker to hardwire the library |
---|
1490 | # search path for the given directories. This is useful for example |
---|
1491 | # Makefiles |
---|
1492 | |
---|
1493 | AC_DEFUN([AC_COIN_RPATH_FLAGS], |
---|
1494 | [RPATH_FLAGS= |
---|
1495 | |
---|
1496 | if test $enable_shared = yes; then |
---|
1497 | case $build in |
---|
1498 | *-linux-*) |
---|
1499 | if test "$GXX" = "yes"; then |
---|
1500 | RPATH_FLAGS= |
---|
1501 | for dir in $1; do |
---|
1502 | RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir" |
---|
1503 | done |
---|
1504 | fi ;; |
---|
1505 | *-darwin*) |
---|
1506 | RPATH_FLAGS=nothing ;; |
---|
1507 | *-ibm-*) |
---|
1508 | case "$CXX" in |
---|
1509 | xlC* | */xlC* | mpxlC* | */mpxlC*) |
---|
1510 | RPATH_FLAGS=nothing ;; |
---|
1511 | esac ;; |
---|
1512 | *-hp-*) |
---|
1513 | RPATH_FLAGS=nothing ;; |
---|
1514 | *-mingw32) |
---|
1515 | RPATH_FLAGS=nothing ;; |
---|
1516 | *-sun-*) |
---|
1517 | RPATH_FLAGS= |
---|
1518 | for dir in $1; do |
---|
1519 | RPATH_FLAGS="$RPATH_FLAGS -R$dir" |
---|
1520 | done |
---|
1521 | esac |
---|
1522 | |
---|
1523 | if test "$RPATH_FLAGS" = ""; then |
---|
1524 | AC_MSG_WARN([Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually.]) |
---|
1525 | fi |
---|
1526 | if test "$RPATH_FLAGS" = "nothing"; then |
---|
1527 | RPATH_FLAGS= |
---|
1528 | fi |
---|
1529 | fi |
---|
1530 | |
---|
1531 | AC_SUBST(RPATH_FLAGS) |
---|
1532 | ]) # AC_COIN_RPATH_FLAGS |
---|
1533 | |
---|
1534 | ########################################################################### |
---|
1535 | # COIN_FINALIZE # |
---|
1536 | ########################################################################### |
---|
1537 | |
---|
1538 | # This macro should be called at the very end of the configure.ac file. |
---|
1539 | # It creates the output files (by using AC_OUTPUT), and might do some other |
---|
1540 | # things (such as generating links to data files in a VPATH configuration). |
---|
1541 | # It also prints the "success" message. |
---|
1542 | |
---|
1543 | AC_DEFUN([AC_COIN_FINALIZE], |
---|
1544 | [ |
---|
1545 | FADDLIBS="$ADDLIBS" |
---|
1546 | if test x"$coin_need_flibs" = xyes; then |
---|
1547 | ADDLIBS="$ADDLIBS $FLIBS" |
---|
1548 | fi |
---|
1549 | |
---|
1550 | # library extension |
---|
1551 | AC_SUBST(LIBEXT) |
---|
1552 | case "$CC" in |
---|
1553 | cl*) LIBEXT=lib ;; |
---|
1554 | *) LIBEXT=a ;; |
---|
1555 | esac |
---|
1556 | |
---|
1557 | # Define VPATH_DISTCLEANFILES to be everything that needs to be |
---|
1558 | # cleaned for distclean in a vpath configuration |
---|
1559 | AC_SUBST(VPATH_DISTCLEANFILES) |
---|
1560 | VPATH_DISTCLEANFILES="$coin_vpath_link_files" |
---|
1561 | |
---|
1562 | AC_OUTPUT |
---|
1563 | |
---|
1564 | if test x"$coin_vpath_link_files" = x; then : ; else |
---|
1565 | AC_MSG_NOTICE(Creating VPATH links for data files) |
---|
1566 | for file in $coin_vpath_link_files; do |
---|
1567 | rm -f $file |
---|
1568 | $LN_S $abs_source_dir/$file $file |
---|
1569 | done |
---|
1570 | fi |
---|
1571 | |
---|
1572 | if test x$coin_projectdir = xyes; then |
---|
1573 | AC_MSG_NOTICE([Configuration of $PACKAGE_NAME successful]) |
---|
1574 | else |
---|
1575 | AC_MSG_NOTICE([Main configuration of $PACKAGE_NAME successful]) |
---|
1576 | fi |
---|
1577 | ]) #AC_COIN_FINALIZE |
---|
1578 | |
---|
1579 | ########################################################################### |
---|
1580 | # COIN_VPATH_LINK # |
---|
1581 | ########################################################################### |
---|
1582 | |
---|
1583 | # This macro makes sure that a symbolic link is created to a file in |
---|
1584 | # the source code directory tree if we are in a VPATH compilation, and |
---|
1585 | # if this package is the main package to be installed |
---|
1586 | |
---|
1587 | AC_DEFUN([AC_COIN_VPATH_LINK], |
---|
1588 | [AC_REQUIRE([AC_COIN_CHECK_VPATH]) |
---|
1589 | if test $coin_vpath_config = yes; then |
---|
1590 | coin_vpath_link_files="$coin_vpath_link_files $1" |
---|
1591 | fi |
---|
1592 | ]) #AC_COIN_VPATH_LINK |
---|
1593 | |
---|
1594 | ########################################################################### |
---|
1595 | # COIN_ENABLE_GNU_PACKAGES # |
---|
1596 | ########################################################################### |
---|
1597 | |
---|
1598 | # This macro defined the --enable-gnu-packages flag. This can be used |
---|
1599 | # to check if a user wants to compile GNU packges (such as readline or |
---|
1600 | # zlib) into the executable. By default, GNU packages are disabled. |
---|
1601 | # This also defines the automake conditional COIN_ENABLE_GNU_PACKAGES |
---|
1602 | |
---|
1603 | AC_DEFUN([AC_COIN_ENABLE_GNU_PACKAGES], |
---|
1604 | [AC_ARG_ENABLE([gnu-packages], |
---|
1605 | [AC_HELP_STRING([--enable-gnu-packages], |
---|
1606 | [compile with GNU packages (disabled by default)])], |
---|
1607 | [coin_enable_gnu=$enableval], |
---|
1608 | [coin_enable_gnu=no]) |
---|
1609 | ]) # AC_COIN_ENABLE_GNU_PACKAGES |
---|
1610 | |
---|
1611 | ########################################################################### |
---|
1612 | # COIN_CHECK_GNU_ZLIB # |
---|
1613 | ########################################################################### |
---|
1614 | |
---|
1615 | # This macro checks for the libz library. |
---|
1616 | |
---|
1617 | AC_DEFUN([AC_COIN_CHECK_GNU_ZLIB], |
---|
1618 | [AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES]) |
---|
1619 | AC_BEFORE([AC_COIN_PROG_CXX],[$0]) |
---|
1620 | AC_BEFORE([AC_COIN_PROG_CC],[$0]) |
---|
1621 | AC_BEFORE([AC_COIN_PROG_F77],[$0]) |
---|
1622 | AC_BEFORE([$0],[AC_COIN_FINISH]) |
---|
1623 | |
---|
1624 | coin_has_zlib=no |
---|
1625 | if test $coin_enable_gnu = yes; then |
---|
1626 | AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes]) |
---|
1627 | |
---|
1628 | if test $coin_has_zlib = yes; then |
---|
1629 | AC_CHECK_LIB([z],[gzopen], |
---|
1630 | [ADDLIBS="-lz $ADDLIBS"], |
---|
1631 | [coin_has_zlib=no]) |
---|
1632 | fi |
---|
1633 | |
---|
1634 | if test $coin_has_zlib = yes; then |
---|
1635 | AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available]) |
---|
1636 | fi |
---|
1637 | fi |
---|
1638 | |
---|
1639 | AM_CONDITIONAL(COIN_HAS_ZLIB,test x$coin_has_zlib = xyes) |
---|
1640 | ]) # AC_COIN_CHECK_GNU_ZLIB |
---|
1641 | |
---|
1642 | |
---|
1643 | ########################################################################### |
---|
1644 | # COIN_CHECK_GNU_BZLIB # |
---|
1645 | ########################################################################### |
---|
1646 | |
---|
1647 | # This macro checks for the libbz2 library. |
---|
1648 | |
---|
1649 | AC_DEFUN([AC_COIN_CHECK_GNU_BZLIB], |
---|
1650 | [AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES]) |
---|
1651 | AC_BEFORE([AC_COIN_PROG_CXX],[$0]) |
---|
1652 | AC_BEFORE([AC_COIN_PROG_CC],[$0]) |
---|
1653 | AC_BEFORE([AC_COIN_PROG_F77],[$0]) |
---|
1654 | AC_BEFORE([$0],[AC_COIN_FINISH]) |
---|
1655 | |
---|
1656 | coin_has_bzlib=no |
---|
1657 | if test $coin_enable_gnu = yes; then |
---|
1658 | AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes]) |
---|
1659 | |
---|
1660 | if test $coin_has_bzlib = yes; then |
---|
1661 | AC_CHECK_LIB([bz2],[BZ2_bzReadOpen], |
---|
1662 | [ADDLIBS="-lbz2 $ADDLIBS"], |
---|
1663 | [coin_has_bzlib=no]) |
---|
1664 | fi |
---|
1665 | |
---|
1666 | if test $coin_has_bzlib = yes; then |
---|
1667 | AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available]) |
---|
1668 | fi |
---|
1669 | fi |
---|
1670 | ]) # AC_COIN_CHECK_GNU_BZLIB |
---|
1671 | |
---|
1672 | |
---|
1673 | ########################################################################### |
---|
1674 | # COIN_CHECK_GNU_READLINE # |
---|
1675 | ########################################################################### |
---|
1676 | |
---|
1677 | # This macro checks for GNU's readline. It verifies that the header |
---|
1678 | # readline/readline.h is available, and that the -lreadline library |
---|
1679 | # contains "readline". It is assumed that #include <stdio.h> is included |
---|
1680 | # in the source file before the #include<readline/readline.h> |
---|
1681 | |
---|
1682 | AC_DEFUN([AC_COIN_CHECK_GNU_READLINE], |
---|
1683 | [AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES]) |
---|
1684 | AC_BEFORE([AC_COIN_PROG_CXX],[$0]) |
---|
1685 | AC_BEFORE([AC_COIN_PROG_CC],[$0]) |
---|
1686 | AC_BEFORE([AC_COIN_PROG_F77],[$0]) |
---|
1687 | AC_BEFORE([$0],[AC_COIN_FINISH]) |
---|
1688 | |
---|
1689 | coin_has_readline=no |
---|
1690 | if test $coin_enable_gnu = yes; then |
---|
1691 | AC_COIN_CHECK_HEADER([readline/readline.h], |
---|
1692 | [coin_has_readline=yes],[], |
---|
1693 | [#include <stdio.h>]) |
---|
1694 | |
---|
1695 | coin_save_LIBS="$LIBS" |
---|
1696 | LIBS= |
---|
1697 | # First we check if tputs and friends are available |
---|
1698 | if test $coin_has_readline = yes; then |
---|
1699 | AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[], |
---|
1700 | [coin_has_readline=no]) |
---|
1701 | fi |
---|
1702 | |
---|
1703 | # Now we check for readline |
---|
1704 | if test $coin_has_readline = yes; then |
---|
1705 | AC_CHECK_LIB([readline],[readline], |
---|
1706 | [ADDLIBS="-lreadline $LIBS $ADDLIBS"], |
---|
1707 | [coin_has_readline=no]) |
---|
1708 | fi |
---|
1709 | |
---|
1710 | if test $coin_has_readline = yes; then |
---|
1711 | AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available]) |
---|
1712 | fi |
---|
1713 | |
---|
1714 | LIBS="$coin_save_LIBS" |
---|
1715 | fi |
---|
1716 | ]) # AC_COIN_CHECK_GNU_READLINE |
---|
1717 | |
---|
1718 | ########################################################################### |
---|
1719 | # COIN_DATA_PATH # |
---|
1720 | ########################################################################### |
---|
1721 | |
---|
1722 | # This macro defines a preprocessor macro with the absolute path to a |
---|
1723 | # subdirectory of Data. The argument of this macro is the name of the |
---|
1724 | # subdirectory (in correct case), and the name of the macro is |
---|
1725 | # COIN_DATA_DIR_PATH, where dir is replaced by the capitalized name of |
---|
1726 | # the directory. The path ends with a separator ("/" for linux and |
---|
1727 | # '\\' for Windows). The default value for this path can be |
---|
1728 | # overwritten with the input variable with the same name |
---|
1729 | # (COIN_DATA_DIR_PATH). At this point we chech only for the |
---|
1730 | # $srcdir/../Data subdirectory. |
---|
1731 | |
---|
1732 | AC_DEFUN([AC_COIN_DATA_PATH], |
---|
1733 | [AC_MSG_CHECKING([absolute path to data directory $1]) |
---|
1734 | |
---|
1735 | AC_ARG_VAR(m4_toupper(COIN_DATA_$1_PATH),[Set to absolute path to Data/$1 subdirectory]) |
---|
1736 | |
---|
1737 | if test x"$m4_toupper(COIN_DATA_$1_PATH)" = x; then |
---|
1738 | m4_toupper(COIN_DATA_$1_PATH)=`cd $srcdir/../Data/$1; pwd` |
---|
1739 | fi |
---|
1740 | |
---|
1741 | # Under Cygwin, use Windows path. Add separator |
---|
1742 | case $build in |
---|
1743 | *-cygwin*) |
---|
1744 | m4_toupper(COIN_DATA_$1_PATH)=`cygwin -w $m4_toupper(COIN_DATA_$1_PATH)`\\ |
---|
1745 | ;; |
---|
1746 | *) |
---|
1747 | m4_toupper(COIN_DATA_$1_PATH)="$m4_toupper(COIN_DATA_$1_PATH)/" |
---|
1748 | ;; |
---|
1749 | esac |
---|
1750 | |
---|
1751 | if test -r $m4_toupper(COIN_DATA_$1_PATH); then |
---|
1752 | AC_DEFINE_UNQUOTED(m4_toupper(COIN_DATA_$1_PATH),["$m4_toupper(COIN_DATA_$1_PATH)"], |
---|
1753 | [Define to absolute path for Data subdirectory $1]) |
---|
1754 | AC_MSG_RESULT($m4_toupper(COIN_DATA_$1_PATH)) |
---|
1755 | else |
---|
1756 | AC_MSG_ERROR(Directory $m4_toupper(COIN_DATA_$1_PATH) does not exist) |
---|
1757 | fi |
---|
1758 | ]) # AC_COIN_HAS_DATA |
---|
1759 | |
---|
1760 | ########################################################################### |
---|
1761 | # COIN_EXAMPLE_FILES # |
---|
1762 | ########################################################################### |
---|
1763 | |
---|
1764 | # This macro determines the names of the example files (using the |
---|
1765 | # argument in an "ls" command) and sets up the variables EXAMPLE_FILES |
---|
1766 | # and EXAMPLE_CLEAN_FILES. If this is a VPATH configuration, it also |
---|
1767 | # creates soft links to the example files. |
---|
1768 | |
---|
1769 | AC_DEFUN([AC_COIN_EXAMPLE_FILES], |
---|
1770 | [AC_REQUIRE([AC_COIN_CHECK_GNU_ZLIB]) |
---|
1771 | AC_REQUIRE([AC_COIN_CHECK_VPATH]) |
---|
1772 | files=`cd $srcdir; ls $1` |
---|
1773 | # We need to do the following loop to make sure that are no newlines |
---|
1774 | # in the variable |
---|
1775 | for file in $files; do |
---|
1776 | EXAMPLE_FILES="$EXAMPLE_FILES $file" |
---|
1777 | done |
---|
1778 | if test $coin_vpath_config = yes; then |
---|
1779 | if test "$enable_doscompile" = yes; then |
---|
1780 | lnkcmd=cp |
---|
1781 | AC_MSG_NOTICE([Copying example files ($1)]) |
---|
1782 | else |
---|
1783 | AC_PROG_LN_S |
---|
1784 | AC_MSG_NOTICE([Creating links to the example files ($1)]) |
---|
1785 | lnkcmd="$LN_S" |
---|
1786 | fi |
---|
1787 | for file in $EXAMPLE_FILES; do |
---|
1788 | rm -f $file |
---|
1789 | $lnkcmd $srcdir/$file $file |
---|
1790 | done |
---|
1791 | EXAMPLE_CLEAN_FILES='$1' |
---|
1792 | else |
---|
1793 | EXAMPLE_CLEAN_FILES= |
---|
1794 | fi |
---|
1795 | |
---|
1796 | # In case there are compressed files, we create a variable with the |
---|
1797 | # uncompressed names |
---|
1798 | EXAMPLE_UNCOMPRESSED_FILES= |
---|
1799 | for file in $EXAMPLE_FILES; do |
---|
1800 | case $file in |
---|
1801 | *.gz) |
---|
1802 | EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`" |
---|
1803 | ;; |
---|
1804 | esac |
---|
1805 | done |
---|
1806 | |
---|
1807 | AC_SUBST(EXAMPLE_UNCOMPRESSED_FILES) |
---|
1808 | AC_SUBST(EXAMPLE_FILES) |
---|
1809 | AC_SUBST(EXAMPLE_CLEAN_FILES) |
---|
1810 | ]) #AC_COIN_EXAMPLE_FILES |
---|
1811 | |
---|
1812 | ########################################################################### |
---|
1813 | # COIN_HAS_PROJECT # |
---|
1814 | ########################################################################### |
---|
1815 | |
---|
1816 | # This macro sets up usage of a Coin package. It defines the |
---|
1817 | # PKGSRCDIR and PKGOBJDIR variables, refering to the main source and |
---|
1818 | # object directory of the package, respectively. It also defines |
---|
1819 | # a COIN_HAS_PKG preprocessor macro and makefile conditional. The |
---|
1820 | # argument should be the name (Pkg) of the project (in correct lower |
---|
1821 | # and upper case) |
---|
1822 | |
---|
1823 | AC_DEFUN([AC_COIN_HAS_PROJECT], |
---|
1824 | [AC_MSG_CHECKING([for COIN project $1]) |
---|
1825 | |
---|
1826 | # First check, if the sub-project is actually available (ToDo: allow |
---|
1827 | # other locations) |
---|
1828 | |
---|
1829 | m4_tolower(coin_has_$1)=unavailable |
---|
1830 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
1831 | for dir in $COIN_SKIP_PROJECTS; do |
---|
1832 | if test $dir = $1; then |
---|
1833 | m4_tolower(coin_has_$1)=skipping |
---|
1834 | fi |
---|
1835 | done |
---|
1836 | fi |
---|
1837 | |
---|
1838 | if test $m4_tolower(coin_has_$1) != skipping; then |
---|
1839 | if test $PACKAGE_TARNAME = m4_tolower($1); then |
---|
1840 | m4_tolower(coin_has_$1)=. |
---|
1841 | else |
---|
1842 | if test -d $srcdir/../$1; then |
---|
1843 | m4_tolower(coin_has_$1)=../$1 |
---|
1844 | fi |
---|
1845 | fi |
---|
1846 | fi |
---|
1847 | |
---|
1848 | if test $m4_tolower(coin_has_$1) != unavailable && |
---|
1849 | test $m4_tolower(coin_has_$1) != skipping; then |
---|
1850 | # Set the #define if the component is available |
---|
1851 | AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is used]) |
---|
1852 | |
---|
1853 | # Set the variables for source and object code location |
---|
1854 | AC_SUBST(m4_toupper($1SRCDIR)) |
---|
1855 | m4_toupper($1SRCDIR)=`cd $srcdir/$m4_tolower(coin_has_$1); pwd` |
---|
1856 | AC_SUBST(m4_toupper($1OBJDIR)) |
---|
1857 | m4_toupper($1OBJDIR)=`pwd`/$m4_tolower(coin_has_$1) |
---|
1858 | fi |
---|
1859 | |
---|
1860 | # Define the Makefile conditional |
---|
1861 | AM_CONDITIONAL(m4_toupper(COIN_HAS_$1), |
---|
1862 | [test $m4_tolower(coin_has_$1) != unavailable && |
---|
1863 | test $m4_tolower(coin_has_$1) != skipping]) |
---|
1864 | AC_MSG_RESULT([$m4_tolower(coin_has_$1)]) |
---|
1865 | ]) # AC_COIN_HAS |
---|
1866 | |
---|
1867 | ########################################################################### |
---|
1868 | # COIN_HAS_USER_LIBRARY # |
---|
1869 | ########################################################################### |
---|
1870 | |
---|
1871 | # This macro sets up usage of a library with header files. It defines |
---|
1872 | # the LBRYINCDIR variable, and it defines COIN_HAS_LBRY preprocessor |
---|
1873 | # macro and makefile conditional. The first argument should be the |
---|
1874 | # full name (LibraryName) of the library, and the second argument (in |
---|
1875 | # upper case letters) the abbreviation (LBRY). This macro also |
---|
1876 | # introduces the configure arguments --with-libraryname-incdir and |
---|
1877 | # --with-libraryname-lib which have to be both given by a user to use |
---|
1878 | # this solver to tell the configure script where the include files and |
---|
1879 | # the library are located. Those arguments can also be given as |
---|
1880 | # environement variables LBRYINCDIR and LBRYLIB, but a --with-* |
---|
1881 | # argument overwrites an environment variable. If a third argument is |
---|
1882 | # given, it is assumed that this is the name of a header file that can |
---|
1883 | # be checked for in the given include directory, and if a fourth |
---|
1884 | # argument is given, it is assumed to be the name of a C function |
---|
1885 | # which is given and defined in the library, and a test is done to |
---|
1886 | # check if that symbol is defined in the library. |
---|
1887 | # If it possible to disable the check, by specifying |
---|
1888 | # --disable-libraryname-libcheck - this is a workaround for platforms |
---|
1889 | # where checks don't work (yet) properly. |
---|
1890 | |
---|
1891 | AC_DEFUN([AC_COIN_HAS_USER_LIBRARY], |
---|
1892 | [AC_REQUIRE([AC_COIN_PROJECTDIR_INIT]) |
---|
1893 | AC_MSG_CHECKING(if user provides library for $1) |
---|
1894 | |
---|
1895 | # Check for header file directory |
---|
1896 | AC_ARG_WITH(m4_tolower($1)-incdir, |
---|
1897 | AC_HELP_STRING([--with-m4_tolower($1)-incdir], |
---|
1898 | [specify the directory with the header files for library $1]), |
---|
1899 | [$2INCDIR=`cd $withval; pwd`]) |
---|
1900 | # Check for library directory |
---|
1901 | AC_ARG_WITH(m4_tolower($1)-lib, |
---|
1902 | AC_HELP_STRING([--with-m4_tolower($1)-lib], |
---|
1903 | [specify the flags to link with the library $1]), |
---|
1904 | [$2LIB=$withval]) |
---|
1905 | # Switch to disable library check if requested |
---|
1906 | AC_ARG_ENABLE(m4_tolower($1)-libcheck, |
---|
1907 | AC_HELP_STRING([--enable-m4_tolower($1)-libcheck], |
---|
1908 | [use disable-m4_tolower($1)-libcheck to skip the link check at configuration time]), |
---|
1909 | [m4_tolower($1)_libcheck=$enableval], |
---|
1910 | [m4_tolower($1)_libcheck=yes]) |
---|
1911 | |
---|
1912 | if test x"$$2INCDIR" != x || test x"$$2LIB" != x; then |
---|
1913 | m4_tolower(coin_has_$2)=true |
---|
1914 | else |
---|
1915 | m4_tolower(coin_has_$2)=false |
---|
1916 | fi |
---|
1917 | |
---|
1918 | if test $m4_tolower(coin_has_$2) = true; then |
---|
1919 | # Check either both arguments or none are given |
---|
1920 | if test x"$$2INCDIR" = x || test x"$$2LIB" = x; then |
---|
1921 | AC_MSG_ERROR([You need to specify both --with-m4_tolower($1)-incdir and --with-m4_tolower($1)-lib if you want to use library $1]) |
---|
1922 | fi |
---|
1923 | AC_MSG_RESULT(yes) |
---|
1924 | # Check if the given header file is there |
---|
1925 | m4_ifvaln([$3],[AC_CHECK_FILE([$$2INCDIR/$3],[], |
---|
1926 | [AC_MSG_ERROR([Cannot find file $3 in $$2INCDIR])])]) |
---|
1927 | # Check if the symbol is provided in the library |
---|
1928 | # ToDo: FOR NOW WE ASSUME THAT WE ARE USING THE C++ COMPILER |
---|
1929 | m4_ifvaln([$4],[if test x"$m4_tolower($1)_libcheck" != xno; then |
---|
1930 | coin_save_LIBS="$LIBS" |
---|
1931 | LIBS="$$2LIB $ADDLIBS" |
---|
1932 | AC_MSG_CHECKING([whether symbol $4 is available with $2]) |
---|
1933 | # ToDo find out what to do about extern "C" |
---|
1934 | # AC_TRY_LINK([extern "C" {void $4();}],[$4()], |
---|
1935 | AC_TRY_LINK([void $4();],[$4()], |
---|
1936 | [AC_MSG_RESULT(yes)], |
---|
1937 | [AC_MSG_RESULT(no) |
---|
1938 | AC_MSG_ERROR([Cannot find symbol $4 with $2])]) |
---|
1939 | LIBS="$coin_save_LIBS" |
---|
1940 | fi]) |
---|
1941 | ADDLIBS="$$2LIB $ADDLIBS" |
---|
1942 | AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is used]) |
---|
1943 | else |
---|
1944 | AC_MSG_RESULT(no) |
---|
1945 | fi |
---|
1946 | |
---|
1947 | AC_SUBST($2INCDIR) |
---|
1948 | AC_SUBST($2LIB) |
---|
1949 | AM_CONDITIONAL(COIN_HAS_$2, |
---|
1950 | test $m4_tolower(coin_has_$2) = true) |
---|
1951 | ]) #AC_COIN_HAS_SOLVER |
---|
1952 | |
---|
1953 | ########################################################################### |
---|
1954 | # COIN_HAS_ASL # |
---|
1955 | ########################################################################### |
---|
1956 | |
---|
1957 | # This macro checks if the user has provide arguments that say where |
---|
1958 | # the precompiled ASL files should be found (with the --with-asldir |
---|
1959 | # flag). If this is not the case, we check if the ThirdParty/ASL |
---|
1960 | # directory has been configured, which indicates that the files will |
---|
1961 | # be in that directory and can be used. |
---|
1962 | |
---|
1963 | AC_DEFUN([AC_COIN_HAS_ASL], |
---|
1964 | [coin_aslobjdir=../ThirdParty/ASL |
---|
1965 | coin_aslsrcdir=$srcdir/$coin_aslobjdir |
---|
1966 | |
---|
1967 | # Determine the name of the ASL library |
---|
1968 | case "$CXX" in |
---|
1969 | cl* | */cl*) |
---|
1970 | ampllib=amplsolv.lib ;; |
---|
1971 | *) |
---|
1972 | ampllib=amplsolver.a ;; |
---|
1973 | esac |
---|
1974 | |
---|
1975 | AC_ARG_WITH([asldir], |
---|
1976 | AC_HELP_STRING([--with-asldir], |
---|
1977 | [specify path to AMPL solver directory (or BUILD for compilation, or "no" for disabling AMPL)]), |
---|
1978 | [use_asldir=$withval], [use_asldir=]) |
---|
1979 | |
---|
1980 | if test "$use_asldir" = BUILD; then |
---|
1981 | AC_CHECK_FILE([$coin_aslobjdir/Makefile],[], |
---|
1982 | [AC_MSG_ERROR([option \"BUILD\" specified for asldir, but directory is not configure (sources missing?)])]) |
---|
1983 | elif test -z "$use_asldir"; then |
---|
1984 | # try to find sources - if not given don't compile |
---|
1985 | AC_CHECK_FILE([$coin_aslobjdir/Makefile],[use_asldir=BUILD],[use_asldir=no]) |
---|
1986 | elif test "$use_asldir" != "no"; then |
---|
1987 | AC_CHECK_FILE([$use_asldir/$ampllib],[], |
---|
1988 | [AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but library missing])]) |
---|
1989 | AC_CHECK_FILE([$use_asldir/asl.h],[], |
---|
1990 | [AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but header files are missing])]) |
---|
1991 | use_asldir=`cd $use_asldir; pwd` |
---|
1992 | case $build in |
---|
1993 | *-cygwin*) use_asldir=`cygpath -w $use_asldir | sed -e sX\\\\\\\\X/Xg` ;; |
---|
1994 | esac |
---|
1995 | fi |
---|
1996 | |
---|
1997 | # Variable containing ASL library (including full path) |
---|
1998 | AC_SUBST(ASLLIB) |
---|
1999 | # Variable containing flags for including ASL header files |
---|
2000 | AC_SUBST(ASL_CPPFLAGS) |
---|
2001 | |
---|
2002 | if test "$use_asldir" = BUILD; then |
---|
2003 | coin_aslobjdir=`cd $coin_aslobjdir; pwd` |
---|
2004 | ASLLIB=`$CYGPATH_W $coin_aslobjdir/$ampllib | sed -e sX\\\\\\\\X/Xg` |
---|
2005 | coin_aslsrcdir=`cd $coin_aslsrcdir; pwd` |
---|
2006 | ASL_CPPFLAGS="-I"`$CYGPATH_W $coin_aslobjdir | sed -e sX\\\\\\\\X/Xg`" -I"`$CYGPATH_W $coin_aslsrcdir/solvers | sed -e sX\\\\\\\\X/Xg` |
---|
2007 | elif test "$use_asldir" != no; then |
---|
2008 | ASLLIB=`$CYGPATH_W $use_asldir/$ampllib | sed -e sX\\\\\\\\X/Xg` |
---|
2009 | ASL_CPPFLAGS="-I"`$CYGPATH_W $use_asldir | sed -e sX\\\\\\\\X/Xg` |
---|
2010 | fi |
---|
2011 | |
---|
2012 | if test "$use_asldir" != no; then |
---|
2013 | AC_CHECK_LIB(dl,[dlopen],[ASLLIB="$ASLLIB -ldl"],[]) |
---|
2014 | coin_has_asl=yes |
---|
2015 | AC_DEFINE([COIN_HAS_ASL],[1], |
---|
2016 | [If defined, the Ampl Solver Library is available.]) |
---|
2017 | else |
---|
2018 | coin_has_asl=no |
---|
2019 | fi |
---|
2020 | AM_CONDITIONAL(COIN_HAS_ASL, test $coin_has_asl = yes) |
---|
2021 | ]) # AC_COIN_HAS_ASL |
---|
2022 | |
---|
2023 | ########################################################################### |
---|
2024 | # COIN_TRY_FLINK # |
---|
2025 | ########################################################################### |
---|
2026 | |
---|
2027 | # Auxilliary macro to test if a Fortran function name can be linked, |
---|
2028 | # given the current settings of LIBS. We determine from the context, what |
---|
2029 | # the currently active programming language is, and cast the name accordingly. |
---|
2030 | # The first argument is the name of the function/subroutine, in small letters, |
---|
2031 | # the second argument are the actions taken when the test works, and the |
---|
2032 | # third argument are the actions taken if the test fails. |
---|
2033 | |
---|
2034 | AC_DEFUN([AC_COIN_TRY_FLINK], |
---|
2035 | [case $ac_ext in |
---|
2036 | f) |
---|
2037 | AC_TRY_LINK([],[ call $1],[$2],[$3]) |
---|
2038 | ;; |
---|
2039 | c) |
---|
2040 | AC_F77_FUNC($1,cfunc$1) |
---|
2041 | if test x"$coin_need_flibs" = xyes; then |
---|
2042 | flink_try=no; |
---|
2043 | else |
---|
2044 | AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()], |
---|
2045 | [flink_try=yes],[flink_try=no]) |
---|
2046 | fi |
---|
2047 | if test $flink_try = yes; then |
---|
2048 | $2 |
---|
2049 | else |
---|
2050 | if test x"$FLIBS" != x; then |
---|
2051 | flink_save_libs="$LIBS" |
---|
2052 | LIBS="$LIBS $FLIBS" |
---|
2053 | AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()], |
---|
2054 | [LIBS="$flink_save_libs" |
---|
2055 | $2 |
---|
2056 | coin_need_flibs=yes], |
---|
2057 | [LIBS="$flink_save_libs" |
---|
2058 | $3]) |
---|
2059 | else |
---|
2060 | $3 |
---|
2061 | fi |
---|
2062 | fi |
---|
2063 | ;; |
---|
2064 | cc) |
---|
2065 | AC_F77_FUNC($1,cfunc$1) |
---|
2066 | if test x"$coin_need_flibs" = xyes; then |
---|
2067 | flink_try=no; |
---|
2068 | else |
---|
2069 | AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()], |
---|
2070 | [flink_try=yes],[flink_try=no]) |
---|
2071 | fi |
---|
2072 | if test $flink_try = yes; then |
---|
2073 | $2 |
---|
2074 | else |
---|
2075 | if test x"$FLIBS" != x; then |
---|
2076 | flink_save_libs="$LIBS" |
---|
2077 | LIBS="$LIBS $FLIBS" |
---|
2078 | AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()], |
---|
2079 | [LIBS="$flink_save_libs" |
---|
2080 | $2 |
---|
2081 | coin_need_flibs=yes], |
---|
2082 | [LIBS="$flink_save_libs" |
---|
2083 | $3]) |
---|
2084 | else |
---|
2085 | $3 |
---|
2086 | fi |
---|
2087 | fi |
---|
2088 | ;; |
---|
2089 | esac |
---|
2090 | ]) # AC_COIN_TRY_FLINK |
---|
2091 | |
---|
2092 | ########################################################################### |
---|
2093 | # COIN_HAS_BLAS # |
---|
2094 | ########################################################################### |
---|
2095 | |
---|
2096 | # This macro checks for a library containing the BLAS library. It |
---|
2097 | # tried standard libraries, and if none is found to be working, it |
---|
2098 | # checks whether the BLAS ThirdParty/Blas directory has been configured. |
---|
2099 | # It adds to ADDLIBS any flags required to link with an externally provided |
---|
2100 | # BLAS. It defines the makefile conditional and preprocessor macro |
---|
2101 | # COIN_HAS_BLAS, if blas is available, and it defines the makefile conditional |
---|
2102 | # COIN_BUILD_BLAS, if blas is compiled within COIN. |
---|
2103 | |
---|
2104 | AC_DEFUN([AC_COIN_HAS_BLAS], |
---|
2105 | [coin_blasobjdir=../ThirdParty/Blas |
---|
2106 | coin_blassrcdir=$srcdir/$coin_blasobjdir |
---|
2107 | |
---|
2108 | AC_ARG_WITH([blas], |
---|
2109 | AC_HELP_STRING([--with-blas], |
---|
2110 | [specify BLAS library (or BUILD for compilation)]), |
---|
2111 | [use_blas=$withval], [use_blas=]) |
---|
2112 | |
---|
2113 | # Check if user supplied option makes sense |
---|
2114 | if test x"$use_blas" != x; then |
---|
2115 | if test "$use_blas" = "BUILD"; then |
---|
2116 | AC_CHECK_FILE([$coin_blasobjdir/Makefile],[], |
---|
2117 | [AC_MSG_ERROR([option \"BUILD\" specified for Blas, but $coin_blasobjdir directory is not configured])]) |
---|
2118 | else |
---|
2119 | AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works]) |
---|
2120 | LIBS="$use_blas $LIBS" |
---|
2121 | ADDLIBS="$use_blas $ADDLIBS" |
---|
2122 | AC_COIN_TRY_FLINK([daxpy], |
---|
2123 | [AC_MSG_RESULT([yes])], |
---|
2124 | [AC_MSG_RESULT([no]) |
---|
2125 | AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])]) |
---|
2126 | fi |
---|
2127 | else |
---|
2128 | # Try to autodetect the library for blas based on build system |
---|
2129 | case $build in |
---|
2130 | *-sgi-*) |
---|
2131 | SAVE_LIBS="$LIBS" |
---|
2132 | AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS]) |
---|
2133 | LIBS="-lcomplib.sgimath $LIBS" |
---|
2134 | AC_COIN_TRY_FLINK([daxpy], |
---|
2135 | [AC_MSG_RESULT([yes]) |
---|
2136 | use_blas=-lcomplib.sgimath; |
---|
2137 | ADDLIBS="-lcomplib.sgimath $ADDLIBS"], |
---|
2138 | [AC_MSG_RESULT([no]) |
---|
2139 | SAVE_LIBS="$LIBS"]) |
---|
2140 | ;; |
---|
2141 | *-sun-*) |
---|
2142 | SAVE_LIBS="$LIBS" |
---|
2143 | AC_MSG_CHECKING([whether -xlic_lib=sunperf has BLAS]) |
---|
2144 | LIBS="-xlic_lib=sunperf $LIBS" |
---|
2145 | AC_COIN_TRY_FLINK([daxpy], |
---|
2146 | [AC_MSG_RESULT([yes]) |
---|
2147 | use_blas='-xlic_lib=sunperf'], |
---|
2148 | ADDLIBS="-xlic_lib=sunperf $ADDLIBS" |
---|
2149 | [AC_MSG_RESULT([no]) |
---|
2150 | LIBS="$SAVE_LIBS"]) |
---|
2151 | ;; |
---|
2152 | esac |
---|
2153 | # On cygwin, if enable_doscompile is used, recompile blas because it |
---|
2154 | # otherwise links with the cygwin blas which doesn't run under DOS |
---|
2155 | if test "$enable_doscompile" != yes; then |
---|
2156 | if test -z "$use_blas"; then |
---|
2157 | SAVE_LIBS="$LIBS" |
---|
2158 | AC_MSG_CHECKING([whether -lblas has BLAS]) |
---|
2159 | LIBS="-lblas $LIBS" |
---|
2160 | AC_COIN_TRY_FLINK([daxpy], |
---|
2161 | [AC_MSG_RESULT([yes]) |
---|
2162 | ADDLIBS="-lblas $ADDLIBS" |
---|
2163 | use_blas='-lblas'], |
---|
2164 | [AC_MSG_RESULT([no]) |
---|
2165 | LIBS="$SAVE_LIBS"]) |
---|
2166 | fi |
---|
2167 | fi |
---|
2168 | if test -z "$use_blas"; then |
---|
2169 | AC_CHECK_FILE([$coin_blasobjdir/Makefile],[use_blas=BUILD]) |
---|
2170 | fi |
---|
2171 | fi |
---|
2172 | |
---|
2173 | AM_CONDITIONAL([COIN_HAS_BLAS],[test x"$use_blas" != x]) |
---|
2174 | AM_CONDITIONAL([COIN_BUILD_BLAS],[test "$use_blas" = BUILD]) |
---|
2175 | |
---|
2176 | if test x"$use_blas" = x; then |
---|
2177 | coin_has_blas=no |
---|
2178 | else |
---|
2179 | coin_has_blas=yes |
---|
2180 | AC_DEFINE([COIN_HAS_BLAS],[1], |
---|
2181 | [If defined, the BLAS Library is available.]) |
---|
2182 | fi |
---|
2183 | ]) # AC_COIN_HAS_BLAS |
---|
2184 | |
---|
2185 | ########################################################################### |
---|
2186 | # COIN_HAS_LAPACK # |
---|
2187 | ########################################################################### |
---|
2188 | |
---|
2189 | # This macro checks for a library containing the LAPACK library. It |
---|
2190 | # tried standard libraries, and if none is found to be working, it |
---|
2191 | # checks whether the LAPACK ThirdParty/Lapack directory has been |
---|
2192 | # configured. It adds to ADDLIBS any flags required to link with an |
---|
2193 | # externally provided LAPACK. It defines the makefile conditional and |
---|
2194 | # preprocessor macro COIN_HAS_LAPACK, if lapack is available, and it |
---|
2195 | # defines the makefile conditional COIN_BUILD_LAPACK, if lapack is |
---|
2196 | # compiled within COIN. |
---|
2197 | |
---|
2198 | AC_DEFUN([AC_COIN_HAS_LAPACK], |
---|
2199 | [coin_lapackobjdir=../ThirdParty/Lapack |
---|
2200 | coin_lapacksrcdir=$srcdir/$coin_lapackobjdir |
---|
2201 | |
---|
2202 | AC_ARG_WITH([lapack], |
---|
2203 | AC_HELP_STRING([--with-lapack], |
---|
2204 | [specify LAPACK library (or BUILD for compilation)]), |
---|
2205 | [use_lapack=$withval], [use_lapack=]) |
---|
2206 | |
---|
2207 | # Check if user supplied option makes sense |
---|
2208 | if test x"$use_lapack" != x; then |
---|
2209 | if test "$use_lapack" = "BUILD"; then |
---|
2210 | AC_CHECK_FILE([$coin_lapackobjdir/Makefile],[], |
---|
2211 | [AC_MSG_ERROR([option \"BUILD\" specified for Lapack, but $coin_lapackobjdir directory is not configured])]) |
---|
2212 | else |
---|
2213 | AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works]) |
---|
2214 | LIBS="$use_lapack $LIBS" |
---|
2215 | ADDLIBS="$use_lapack $ADDLIBS" |
---|
2216 | AC_COIN_TRY_FLINK([dsyev], |
---|
2217 | [AC_MSG_RESULT([yes])], |
---|
2218 | [AC_MSG_RESULT([no]) |
---|
2219 | AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])]) |
---|
2220 | fi |
---|
2221 | else |
---|
2222 | if test x$coin_has_blas = xyes; then |
---|
2223 | # First try to see if LAPACK is already available with BLAS library |
---|
2224 | AC_MSG_CHECKING([whether LAPACK is already available with BLAS library]) |
---|
2225 | AC_COIN_TRY_FLINK([dsyev], |
---|
2226 | [AC_MSG_RESULT([yes]); use_lapack=ok], |
---|
2227 | [AC_MSG_RESULT([no])]) |
---|
2228 | fi |
---|
2229 | if test -z "$use_lapack"; then |
---|
2230 | # Try to autodetect the library for lapack based on build system |
---|
2231 | case $build in |
---|
2232 | *-sgi-*) |
---|
2233 | SAVE_LIBS="$LIBS" |
---|
2234 | AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK]) |
---|
2235 | LIBS="-lcomplib.sgimath $LIBS" |
---|
2236 | AC_COIN_TRY_FLINK([dsyev], |
---|
2237 | [AC_MSG_RESULT([yes]) |
---|
2238 | use_lapack=-lcomplib.sgimath; |
---|
2239 | ADDLIBS="-lcomplib.sgimath $ADDLIBS"], |
---|
2240 | [AC_MSG_RESULT([no]) |
---|
2241 | SAVE_LIBS="$LIBS"]) |
---|
2242 | ;; |
---|
2243 | *-sun-*) |
---|
2244 | SAVE_LIBS="$LIBS" |
---|
2245 | AC_MSG_CHECKING([whether -xlic_lib=sunperf has LAPACK]) |
---|
2246 | LIBS="-xlic_lib=sunperf $LIBS" |
---|
2247 | AC_COIN_TRY_FLINK([dsyev], |
---|
2248 | [AC_MSG_RESULT([yes]) |
---|
2249 | use_lapack='-xlic_lib=sunperf'], |
---|
2250 | ADDLIBS="-xlic_lib=sunperf $ADDLIBS" |
---|
2251 | [AC_MSG_RESULT([no]) |
---|
2252 | LIBS="$SAVE_LIBS"]) |
---|
2253 | ;; |
---|
2254 | esac |
---|
2255 | fi |
---|
2256 | # On cygwin, if enable_doscompile is used, recompile lapack because it |
---|
2257 | # otherwise links with the cygwin lapack which doesn't run under DOS |
---|
2258 | if test "$enable_doscompile" != yes; then |
---|
2259 | if test -z "$use_lapack"; then |
---|
2260 | SAVE_LIBS="$LIBS" |
---|
2261 | AC_MSG_CHECKING([whether -llapack has LAPACK]) |
---|
2262 | LIBS="-llapack $LIBS" |
---|
2263 | AC_COIN_TRY_FLINK([dsyev], |
---|
2264 | [AC_MSG_RESULT([yes]) |
---|
2265 | ADDLIBS="-llapack $ADDLIBS" |
---|
2266 | use_lapack='-llapack'], |
---|
2267 | [AC_MSG_RESULT([no]) |
---|
2268 | LIBS="$SAVE_LIBS"]) |
---|
2269 | fi |
---|
2270 | fi |
---|
2271 | if test -z "$use_lapack"; then |
---|
2272 | AC_CHECK_FILE([$coin_lapackobjdir/Makefile],[use_lapack=BUILD]) |
---|
2273 | fi |
---|
2274 | fi |
---|
2275 | |
---|
2276 | AM_CONDITIONAL([COIN_HAS_LAPACK],[test x"$use_lapack" != x]) |
---|
2277 | AM_CONDITIONAL([COIN_BUILD_LAPACK],[test "$use_lapack" = BUILD]) |
---|
2278 | |
---|
2279 | if test x"$use_lapack" = x; then |
---|
2280 | coin_has_lapack=no |
---|
2281 | else |
---|
2282 | coin_has_lapack=yes |
---|
2283 | AC_DEFINE([COIN_HAS_LAPACK],[1], |
---|
2284 | [If defined, the LAPACK Library is available.]) |
---|
2285 | fi |
---|
2286 | ]) # AC_COIN_HAS_LAPACK |
---|