1 | # Copyright (C) 2006, 2009 International Business Machines. |
---|
2 | # All Rights Reserved. |
---|
3 | # This file is distributed under the Common Public License. |
---|
4 | # |
---|
5 | ## $Id: coin.m4 1331 2009-07-16 16:00:50Z stefan $ |
---|
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_CHECK_FILE # |
---|
211 | ########################################################################### |
---|
212 | |
---|
213 | # A simple replacement for AC_CHECK_FILE that works for cross compilation |
---|
214 | |
---|
215 | AC_DEFUN([AC_COIN_CHECK_FILE], |
---|
216 | [if test -r $1; then |
---|
217 | $2 |
---|
218 | : |
---|
219 | else |
---|
220 | $3 |
---|
221 | : |
---|
222 | fi |
---|
223 | ]) |
---|
224 | |
---|
225 | ########################################################################### |
---|
226 | # COIN_THIRDPARTY_SUBDIRS # |
---|
227 | ########################################################################### |
---|
228 | |
---|
229 | # This macro sets up the recursion into the configure script in a |
---|
230 | # subdirectory for compilation of third party code. The first |
---|
231 | # argument is just the string that appears in the configure output. |
---|
232 | # The second argument is the directory with the configure script, and |
---|
233 | # the third one is a file that should exists in that directory. If |
---|
234 | # this file does not exist, we assume that the user has not downloaded |
---|
235 | # the code, and we are not going to compile it |
---|
236 | |
---|
237 | AC_DEFUN([AC_COIN_THIRDPARTY_SUBDIRS], |
---|
238 | [AC_MSG_CHECKING(whether code for third party package $1 is available) |
---|
239 | coin_skip=no |
---|
240 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
241 | for dir in $COIN_SKIP_PROJECTS; do |
---|
242 | if test $dir = $2; then |
---|
243 | coin_skip=yes |
---|
244 | fi |
---|
245 | done |
---|
246 | fi |
---|
247 | if test $coin_skip = yes; then |
---|
248 | AC_MSG_RESULT(skipping) |
---|
249 | else |
---|
250 | coin_tmp=`echo $srcdir/$2/$3` |
---|
251 | # There is probably a more elegant way to get the first thing out here... |
---|
252 | for i in $coin_tmp; do |
---|
253 | coin_tmp2=$i |
---|
254 | #break 1 |
---|
255 | done |
---|
256 | if test -r $coin_tmp2; then |
---|
257 | coin_subdirs="$coin_subdirs $2" |
---|
258 | AC_MSG_RESULT(yes) |
---|
259 | AC_CONFIG_SUBDIRS($2) |
---|
260 | else |
---|
261 | AC_MSG_RESULT(no) |
---|
262 | fi |
---|
263 | fi |
---|
264 | ]) # AC_COIN_THIRDPARTY_SUBDIRS |
---|
265 | |
---|
266 | ########################################################################### |
---|
267 | # COIN_CHECK_VPATH # |
---|
268 | ########################################################################### |
---|
269 | |
---|
270 | # This macro sets the variable coin_vpath_config to true if this is a |
---|
271 | # VPATH configuration, otherwise it sets it to false. |
---|
272 | AC_DEFUN([AC_COIN_CHECK_VPATH], |
---|
273 | [AC_MSG_CHECKING(whether this is a VPATH configuration) |
---|
274 | if test `cd $srcdir; pwd` != `pwd`; then |
---|
275 | coin_vpath_config=yes; |
---|
276 | else |
---|
277 | coin_vpath_config=no; |
---|
278 | fi |
---|
279 | AC_MSG_RESULT($coin_vpath_config) |
---|
280 | ]) # AC_COIN_CHECK_VPATH |
---|
281 | |
---|
282 | ########################################################################### |
---|
283 | # COIN_PROJECTDIR_INIT # |
---|
284 | ########################################################################### |
---|
285 | |
---|
286 | # This macro does everything that is required in the early part in the |
---|
287 | # configure script, such as defining a few variables. This should only |
---|
288 | # be used in the main directory of a project directory (the one under |
---|
289 | # which src is) |
---|
290 | |
---|
291 | AC_DEFUN([AC_COIN_PROJECTDIR_INIT], |
---|
292 | [# Initialize the ADDLIBS variable |
---|
293 | ADDLIBS="-lm $LIBS" |
---|
294 | AC_SUBST(ADDLIBS) |
---|
295 | |
---|
296 | # As backup, we make sure we don't loose an FLIBS if it has been set |
---|
297 | # by the user |
---|
298 | save_FLIBS="$FLIBS" |
---|
299 | |
---|
300 | # Initialize the FADDLIBS variable (which is to be used with a fortran |
---|
301 | # compiler and will not include FLIBS) |
---|
302 | FADDLIBS="$LIBS" |
---|
303 | AC_SUBST(FADDLIBS) |
---|
304 | |
---|
305 | # A useful makefile conditional that is always false |
---|
306 | AM_CONDITIONAL(ALWAYS_FALSE, false) |
---|
307 | |
---|
308 | # We set the following variable so that we know later in AC_COIN_FINALIZE |
---|
309 | # that we are in a project main directory |
---|
310 | coin_projectdir=yes |
---|
311 | ]) # AC_COIN_PROJECTDIR_INIT |
---|
312 | |
---|
313 | ########################################################################### |
---|
314 | # COIN_DEBUG_COMPILE # |
---|
315 | ########################################################################### |
---|
316 | |
---|
317 | # enable the configure flags --enable-debug and --enable-debug-prjct |
---|
318 | # (where prcjt is the name of the project in lower case) and set the |
---|
319 | # variable coin_debug_compile to true or false This is used by |
---|
320 | # COIN_PROG_CXX, COIN_PROG_CC and COIN_PROG_F77 to determine the |
---|
321 | # compilation flags. This macro also makes the switches |
---|
322 | # --with-prjct-verbosity and --with-prjct-checklevel available, which |
---|
323 | # define the preprocessor macros COIN_PRJCT_VERBOSITY and |
---|
324 | # COIN_PRJCT_CHECKLEVEL to the specified value (default is 0). |
---|
325 | # |
---|
326 | # The project specific flags are only made available, if one gives the |
---|
327 | # name of the project as first argument to this macro. |
---|
328 | |
---|
329 | AC_DEFUN([AC_COIN_DEBUG_COMPILE], |
---|
330 | [AC_BEFORE([$0],[AC_COIN_PROG_CXX])dnl |
---|
331 | AC_BEFORE([$0],[AC_COIN_PROG_CC])dnl |
---|
332 | AC_BEFORE([$0],[AC_COIN_PROG_F77])dnl |
---|
333 | |
---|
334 | AC_MSG_CHECKING([whether we want to compile in debug mode]) |
---|
335 | |
---|
336 | AC_ARG_ENABLE([debug], |
---|
337 | [AC_HELP_STRING([--enable-debug], |
---|
338 | [compile all projects with debug options tests])], |
---|
339 | [case "${enableval}" in |
---|
340 | yes) coin_debug_compile=true |
---|
341 | if test "${enable_shared+set}" = set; then :; else |
---|
342 | enable_shared=no |
---|
343 | fi |
---|
344 | ;; |
---|
345 | no) coin_debug_compile=false |
---|
346 | ;; |
---|
347 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) |
---|
348 | ;; |
---|
349 | esac], |
---|
350 | [coin_debug_compile=false]) |
---|
351 | |
---|
352 | m4_ifvaln([$1], |
---|
353 | [AC_ARG_ENABLE(debug-m4_tolower($1), |
---|
354 | [AC_HELP_STRING([--enable-debug-m4_tolower($1)], |
---|
355 | [compile this project ($1) with debug options])], |
---|
356 | [case "${enableval}" in |
---|
357 | yes) coin_debug_compile=true |
---|
358 | enable_shared=no |
---|
359 | ;; |
---|
360 | no) coin_debug_compile=false |
---|
361 | ;; |
---|
362 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug-m4_tolower($1)) |
---|
363 | ;; |
---|
364 | esac],[:]) |
---|
365 | ]) # m4_ifvaln([$1], |
---|
366 | |
---|
367 | if test $coin_debug_compile = true; then |
---|
368 | AC_MSG_RESULT([yes]) |
---|
369 | else |
---|
370 | AC_MSG_RESULT([no]) |
---|
371 | fi |
---|
372 | |
---|
373 | m4_ifvaln([$1], |
---|
374 | [AC_ARG_WITH(m4_tolower($1)-verbosity, |
---|
375 | AC_HELP_STRING([--with-m4_tolower($1)-verbosity], |
---|
376 | [specify the debug verbosity level for project $1]), |
---|
377 | [if test "$withval" = yes; then |
---|
378 | withval=1 |
---|
379 | fi |
---|
380 | m4_tolower(coin_$1_verbosity)=$withval], |
---|
381 | [m4_tolower(coin_$1_verbosity)=0]) |
---|
382 | AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_VERBOSITY), |
---|
383 | m4_tolower($coin_$1_verbosity), |
---|
384 | [Define to the debug verbosity level (0 is no output)]) |
---|
385 | |
---|
386 | AC_ARG_WITH(m4_tolower($1)-checklevel, |
---|
387 | AC_HELP_STRING([--with-m4_tolower($1)-checklevel], |
---|
388 | [specify the sanity check level for project $1]), |
---|
389 | [if test "$withval" = yes; then |
---|
390 | withval=1 |
---|
391 | fi |
---|
392 | m4_tolower(coin_$1_checklevel)=$withval], |
---|
393 | [m4_tolower(coin_$1_checklevel)=0]) |
---|
394 | AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_CHECKLEVEL), |
---|
395 | m4_tolower($coin_$1_checklevel), |
---|
396 | [Define to the debug sanity check level (0 is no test)]) |
---|
397 | |
---|
398 | # We use the following variable to have a string with the upper case |
---|
399 | # version of the project name |
---|
400 | COIN_PRJCT=m4_toupper($1) |
---|
401 | |
---|
402 | ]) # m4_ifvaln([$1], |
---|
403 | |
---|
404 | ]) # AC_COIN_DEBUG_COMPILE |
---|
405 | |
---|
406 | ########################################################################### |
---|
407 | # COIN_MINGW_LD_FIX # |
---|
408 | ########################################################################### |
---|
409 | |
---|
410 | # This macro is included by any PROG_compiler macro, to set the LD |
---|
411 | # environment variable on MinGW to the correct value (link). But note that |
---|
412 | # if we're building in cygwin with -mno-cygwin, we still want ld! If we're |
---|
413 | # building from cygwin with MSVC tools (cl/link), then we do want link and |
---|
414 | # you'd better have your PATH variable straight, else you'll be doing file |
---|
415 | # links instead of code links! Arguably, LDFLAGS should include -mno-cygwin |
---|
416 | # but in practice all linking seems to be handled through the compilers, so |
---|
417 | # CFLAGS and CXXFLAGS suffice. |
---|
418 | |
---|
419 | AC_DEFUN([AC_COIN_MINGW_LD_FIX], |
---|
420 | [case $build in |
---|
421 | *-mingw*) |
---|
422 | if test "${LD+set}" = set; then :; else |
---|
423 | LD=link |
---|
424 | fi |
---|
425 | ;; |
---|
426 | esac |
---|
427 | case $enable_doscompile in |
---|
428 | msvc) |
---|
429 | if test "x${LD+set}" = xset; then :; else |
---|
430 | LD=link |
---|
431 | fi |
---|
432 | ;; |
---|
433 | esac |
---|
434 | ]) |
---|
435 | |
---|
436 | ########################################################################### |
---|
437 | # COIN_ENABLE_DOSCOMPILE # |
---|
438 | ########################################################################### |
---|
439 | |
---|
440 | # This macro is invoked by any PROG_compiler macro to establish the |
---|
441 | # --enable-doscompile option, used when one wants to compile an executable |
---|
442 | # under Cygwin which also runs directly under DOS (without requiring |
---|
443 | # Cygwin1.dll). The job of this macro is to make sure the option is correct and |
---|
444 | # to set enable_doscompile. Legal values are mingw, msvc, and no (disabled). |
---|
445 | # mingw: Fake mingw under cygwin, using GCC tools and -mno-cygwin. The most |
---|
446 | # important thing here is that preprocess, compile, and link steps |
---|
447 | # *all* see -mno-cygwin. |
---|
448 | # msvc: Assume the presence of cl/link. It's the user's responsibility to |
---|
449 | # make sure their PATH is correct. In particular, that MSVC link is |
---|
450 | # found and not cygwin link (we want to do code linking, not file |
---|
451 | # linking). |
---|
452 | # It's the responsibility of individual PROG_compiler macros to ensure that |
---|
453 | # they correctly set the compiler search list and preprocess, compile, and |
---|
454 | # link flags. This is tied to compiler setup because in practice invocations |
---|
455 | # of the preprocessor and linker are made through the compiler. |
---|
456 | |
---|
457 | AC_DEFUN([AC_COIN_ENABLE_DOSCOMPILE], |
---|
458 | [AC_REQUIRE([AC_CANONICAL_BUILD]) |
---|
459 | AC_ARG_ENABLE([doscompile], |
---|
460 | [AC_HELP_STRING([--enable-doscompile], |
---|
461 | [Under Cygwin, compile so that executables run under DOS. |
---|
462 | Set to mingw to use gcc/g++/ld with -mno-cygwin. |
---|
463 | Set to msvc to use cl/link (or icl/link). |
---|
464 | Default when mentioned: mingw. |
---|
465 | Default when not mentioned: disabled.])], |
---|
466 | [if test "$enable_doscompile" != no; then |
---|
467 | case $build in |
---|
468 | *-cygwin* | *-mingw*) ;; |
---|
469 | *) AC_MSG_ERROR([--enable-doscompile option makes sense only under Cygwin or MinGW]) ;; |
---|
470 | esac |
---|
471 | fi], |
---|
472 | [enable_doscompile=no]) |
---|
473 | case "$enable_doscompile" in |
---|
474 | mingw) |
---|
475 | case $build in |
---|
476 | *-mingw*) enable_doscompile=no ;; |
---|
477 | esac |
---|
478 | ;; |
---|
479 | msvc|no) ;; |
---|
480 | yes) enable_doscompile=mingw ;; |
---|
481 | *) AC_MSG_ERROR([Invalid value $enable_doscompile for --enable-doscompile. |
---|
482 | Try configure --help=recursive.]) |
---|
483 | ;; |
---|
484 | esac |
---|
485 | if test "$enable_doscompile" != no ; then |
---|
486 | AC_MSG_NOTICE([DOS compile style is: $enable_doscompile]) |
---|
487 | fi |
---|
488 | ]) |
---|
489 | |
---|
490 | ########################################################################### |
---|
491 | # COIN_PROG_CXX # |
---|
492 | ########################################################################### |
---|
493 | |
---|
494 | # Find the compile command by running AC_PROG_CXX (with compiler names for |
---|
495 | # different operating systems) and put it into CXX (unless it was given by the |
---|
496 | # user). Then find an appropriate value for CXXFLAGS. If either of CXXFLAGS or |
---|
497 | # PRJCT_CXXFLAGS is defined, that value is used (replace PRJCT with the upper |
---|
498 | # case name of this project). It is possible to provide additional -D flags |
---|
499 | # in the variable CXXDEFS, and additional compilation flags with ADD_CXXFLAGS. |
---|
500 | |
---|
501 | AC_DEFUN([AC_COIN_PROG_CXX], |
---|
502 | [AC_REQUIRE([AC_COIN_PROG_CC]) #Let's try if that overcomes configuration problem with VC++ 6.0 |
---|
503 | AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) |
---|
504 | AC_LANG_PUSH(C++) |
---|
505 | |
---|
506 | AC_ARG_VAR(CXXDEFS,[Additional -D flags to be used when compiling C++ code.]) |
---|
507 | AC_ARG_VAR(ADD_CXXFLAGS,[Additional C++ compiler options]) |
---|
508 | AC_ARG_VAR(DBG_CXXFLAGS,[Debug C++ compiler options]) |
---|
509 | AC_ARG_VAR(OPT_CXXFLAGS,[Optimize C++ compiler options]) |
---|
510 | |
---|
511 | coin_has_cxx=yes |
---|
512 | |
---|
513 | save_cxxflags="$CXXFLAGS" |
---|
514 | # For *-*-solaris*, promote Studio/Workshop compiler to front of list. |
---|
515 | case $build in |
---|
516 | *-cygwin* | *-mingw*) |
---|
517 | if test "$enable_doscompile" = msvc ; then |
---|
518 | comps="icl cl" |
---|
519 | else |
---|
520 | comps="g++ cl" |
---|
521 | fi ;; |
---|
522 | *-*-solaris*) |
---|
523 | comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; |
---|
524 | *-darwin*) comps="g++ c++ CC" ;; |
---|
525 | *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; |
---|
526 | esac |
---|
527 | |
---|
528 | # We delete the cached value, since the test might not have been |
---|
529 | # performed with our choice of compilers earlier |
---|
530 | $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; } |
---|
531 | # AC_MSG_NOTICE([C++ compiler candidates: $comps]) |
---|
532 | AC_PROG_CXX([$comps]) |
---|
533 | |
---|
534 | #AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler |
---|
535 | #thus, we test here whether $CXX is actually working |
---|
536 | AC_LANG_PUSH(C++) |
---|
537 | AC_MSG_CHECKING([whether C++ compiler $CXX works]); |
---|
538 | AC_COMPILE_IFELSE( |
---|
539 | [AC_LANG_PROGRAM(, [int i=0;])], |
---|
540 | [AC_MSG_RESULT(yes)], |
---|
541 | [AC_MSG_RESULT(no) |
---|
542 | AC_MSG_ERROR(failed to find a C++ compiler or C++ compiler $CXX does not work)] |
---|
543 | ) |
---|
544 | AC_LANG_POP(C++) |
---|
545 | |
---|
546 | # It seems that we need to cleanup something here for the Windows |
---|
547 | case "$CXX" in |
---|
548 | cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) |
---|
549 | sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh |
---|
550 | mv confdefs.hh confdefs.h |
---|
551 | ;; |
---|
552 | esac |
---|
553 | |
---|
554 | # Autoconf incorrectly concludes that cl recognises -g. It doesn't. |
---|
555 | case "$CXX" in |
---|
556 | cl* | */cl* | CL* | */CL* ) |
---|
557 | if test "$ac_cv_prog_cxx_g" = yes ; then |
---|
558 | ac_cv_prog_cxx_g=no |
---|
559 | AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.]) |
---|
560 | fi ;; |
---|
561 | esac |
---|
562 | CXXFLAGS="$save_cxxflags" |
---|
563 | |
---|
564 | # Check if a project specific CXXFLAGS variable has been set |
---|
565 | if test x$COIN_PRJCT != x; then |
---|
566 | eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set} |
---|
567 | if test x$coin_tmp = xset; then |
---|
568 | eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS} |
---|
569 | fi |
---|
570 | fi |
---|
571 | |
---|
572 | if test x"$CXXFLAGS" = x; then |
---|
573 | |
---|
574 | # ToDo decide whether we want -DNDEBUG for optimization |
---|
575 | coin_add_cxxflags= |
---|
576 | coin_opt_cxxflags= |
---|
577 | coin_dbg_cxxflags= |
---|
578 | coin_warn_cxxflags= |
---|
579 | |
---|
580 | if test "$GXX" = "yes"; then |
---|
581 | case "$CXX" in |
---|
582 | icpc* | */icpc*) |
---|
583 | ;; |
---|
584 | *) |
---|
585 | # ToDo decide about unroll-loops |
---|
586 | coin_opt_cxxflags="-O3 -fomit-frame-pointer" |
---|
587 | coin_add_cxxflags="-pipe" |
---|
588 | coin_dbg_cxxflags="-g" |
---|
589 | coin_warn_cxxflags="-Wimplicit -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas" |
---|
590 | case $build in |
---|
591 | *-darwin*) |
---|
592 | ;; |
---|
593 | *) |
---|
594 | coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags" |
---|
595 | ;; |
---|
596 | esac |
---|
597 | |
---|
598 | case $enable_doscompile in |
---|
599 | mingw) |
---|
600 | CXXFLAGS="-mno-cygwin" |
---|
601 | AC_TRY_LINK(,[int i=0; i++;],[coin_add_cxxflags="-mno-cygwin $coin_add_cxxflags"]) |
---|
602 | CXXFLAGS= |
---|
603 | ;; |
---|
604 | esac |
---|
605 | esac |
---|
606 | fi |
---|
607 | |
---|
608 | # Note that we do not need to cover GCC in the following tests. |
---|
609 | |
---|
610 | if test -z "$coin_opt_cxxflags"; then |
---|
611 | case $build in |
---|
612 | *-cygwin* | *-mingw*) |
---|
613 | case "$CXX" in |
---|
614 | cl* | */cl* | CL* | */CL*) |
---|
615 | # The MT and MTd options are mutually exclusive |
---|
616 | coin_opt_cxxflags='-MT -O2' |
---|
617 | coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE' |
---|
618 | coin_dbg_cxxflags='-MTd' |
---|
619 | ;; |
---|
620 | icl* | */icl* | ICL* | */ICL*) |
---|
621 | # The MT and MTd options are mutually exclusive |
---|
622 | coin_opt_cxxflags='-MT -Ox' |
---|
623 | coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE' |
---|
624 | coin_dbg_cxxflags='-MTd -debug' |
---|
625 | ;; |
---|
626 | esac |
---|
627 | ;; |
---|
628 | *-linux-*) |
---|
629 | case "$CXX" in |
---|
630 | icpc* | */icpc*) |
---|
631 | coin_opt_cxxflags="-O3 -ip -mp1" |
---|
632 | coin_add_cxxflags="" |
---|
633 | coin_dbg_cxxflags="-g" |
---|
634 | # Check if -i_dynamic is necessary (for new glibc library) |
---|
635 | CXXFLAGS= |
---|
636 | AC_TRY_LINK(,[int i=0; i++;],[], |
---|
637 | [coin_add_cxxflags="-i_dynamic $coin_add_cxxflags"]) |
---|
638 | ;; |
---|
639 | pgCC* | */pgCC*) |
---|
640 | coin_opt_cxxflags="-fast" |
---|
641 | coin_add_cxxflags="-Kieee -pc 64" |
---|
642 | coin_dbg_cxxflags="-g" |
---|
643 | ;; |
---|
644 | esac |
---|
645 | ;; |
---|
646 | *-ibm-*) |
---|
647 | case "$CXX" in |
---|
648 | xlC* | */xlC* | mpxlC* | */mpxlC*) |
---|
649 | coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" |
---|
650 | coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++" |
---|
651 | coin_dbg_cxxflags="-g" |
---|
652 | ;; |
---|
653 | esac |
---|
654 | ;; |
---|
655 | *-hp-*) |
---|
656 | case "$CXX" in |
---|
657 | aCC* | */aCC* ) |
---|
658 | coin_opt_cxxflags="-O" |
---|
659 | coin_add_cxxflags="-AA" |
---|
660 | coin_dbg_cxxflags="-g" |
---|
661 | ;; |
---|
662 | esac |
---|
663 | ;; |
---|
664 | *-*-solaris*) |
---|
665 | coin_opt_cxxflags="-O4" |
---|
666 | coin_dbg_cxxflags="-g" |
---|
667 | ;; |
---|
668 | esac |
---|
669 | fi |
---|
670 | |
---|
671 | # Generic flag settings. If these don't work, add a case above. |
---|
672 | |
---|
673 | if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then |
---|
674 | coin_dbg_cxxflags="-g" |
---|
675 | fi |
---|
676 | |
---|
677 | if test -z "$coin_opt_cxxflags"; then |
---|
678 | # Try if -O option works if nothing else is set |
---|
679 | CXXFLAGS=-O |
---|
680 | AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cxxflags="-O"]) |
---|
681 | fi |
---|
682 | |
---|
683 | # if PM doesn't want the warning messages, take them out |
---|
684 | if test x"$coin_skip_warn_cxxflags" = xyes; then |
---|
685 | coin_warn_cxxflags= |
---|
686 | fi |
---|
687 | |
---|
688 | # Do final setup of flags based on values determined above. |
---|
689 | |
---|
690 | if test x${DBG_CXXFLAGS+set} != xset; then |
---|
691 | DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags" |
---|
692 | fi |
---|
693 | if test x${OPT_CXXFLAGS+set} != xset; then |
---|
694 | OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags" |
---|
695 | fi |
---|
696 | |
---|
697 | DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" |
---|
698 | OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" |
---|
699 | |
---|
700 | if test "$coin_debug_compile" = "true"; then |
---|
701 | CXXFLAGS="$DBG_CXXFLAGS" |
---|
702 | else |
---|
703 | CXXFLAGS="$OPT_CXXFLAGS" |
---|
704 | fi |
---|
705 | |
---|
706 | # Handle the case where CXXFLAGS was set externally. |
---|
707 | else |
---|
708 | CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" |
---|
709 | if test x${DBG_CXXFLAGS+set} != xset; then |
---|
710 | DBG_CXXFLAGS="$CXXFLAGS" |
---|
711 | fi |
---|
712 | if test x${OPT_CXXFLAGS+set} != xset; then |
---|
713 | OPT_CXXFLAGS="$CXXFLAGS" |
---|
714 | fi |
---|
715 | fi |
---|
716 | |
---|
717 | # If CXXFLAGS contains -mno-cygwin, CPPFLAGS must also have it. |
---|
718 | |
---|
719 | case "$CXXFLAGS" in |
---|
720 | *-mno-cygwin*) |
---|
721 | if test x${CPPFLAGS+set} != xset ; then |
---|
722 | CPPFLAGS="-mno-cygwin" |
---|
723 | else |
---|
724 | case "$CPPFLAGS" in |
---|
725 | *-mno-cygwin*) |
---|
726 | ;; |
---|
727 | *) |
---|
728 | CPPFLAGS="$CPPFLAGS -mno-cygwin" |
---|
729 | ;; |
---|
730 | esac |
---|
731 | fi ;; |
---|
732 | esac |
---|
733 | |
---|
734 | # Try if CXXFLAGS works |
---|
735 | save_CXXFLAGS="$CXXFLAGS" |
---|
736 | AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=]) |
---|
737 | if test -z "$CXXFLAGS"; then |
---|
738 | 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.]) |
---|
739 | CXXFLAGS='-O' |
---|
740 | AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=]) |
---|
741 | if test -z "$CXXFLAGS"; then |
---|
742 | AC_MSG_WARN([This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually.]) |
---|
743 | fi |
---|
744 | fi |
---|
745 | |
---|
746 | AC_MSG_NOTICE([C++ compiler options are: $CXXFLAGS]) |
---|
747 | |
---|
748 | AC_ARG_VAR(MPICXX,[C++ MPI Compiler]) |
---|
749 | if test x"$MPICXX" = x; then :; else |
---|
750 | AC_MSG_NOTICE([Will use MPI C++ compiler $MPICXX]) |
---|
751 | CXX="$MPICXX" |
---|
752 | fi |
---|
753 | |
---|
754 | case "$CXX" in |
---|
755 | cl* | */cl* | CL* | */CL* ) |
---|
756 | AC_COIN_MINGW_LD_FIX |
---|
757 | ;; |
---|
758 | esac |
---|
759 | |
---|
760 | AC_LANG_POP(C++) |
---|
761 | ]) # AC_COIN_PROG_CXX |
---|
762 | |
---|
763 | |
---|
764 | ########################################################################### |
---|
765 | # COIN_CXXLIBS # |
---|
766 | ########################################################################### |
---|
767 | |
---|
768 | # Determine the C++ runtime libraries required for linking a C++ library |
---|
769 | # with a Fortran or C compiler. The result is available in CXXLIBS. |
---|
770 | |
---|
771 | AC_DEFUN([AC_COIN_CXXLIBS], |
---|
772 | [AC_REQUIRE([AC_PROG_CXX])dnl |
---|
773 | AC_LANG_PUSH(C++) |
---|
774 | AC_ARG_VAR(CXXLIBS,[Libraries necessary for linking C++ code with Fortran compiler]) |
---|
775 | if test -z "$CXXLIBS"; then |
---|
776 | if test "$GXX" = "yes"; then |
---|
777 | case "$CXX" in |
---|
778 | icpc* | */icpc*) |
---|
779 | CXXLIBS="-lstdc++" |
---|
780 | ;; |
---|
781 | *) |
---|
782 | CXXLIBS="-lstdc++ -lm" # -lgcc" |
---|
783 | ;; |
---|
784 | esac |
---|
785 | else |
---|
786 | case $build in |
---|
787 | *-mingw32 | *-cygwin* ) |
---|
788 | case "$CXX" in |
---|
789 | cl* | */cl* | CL* | */CL*) |
---|
790 | CXXLIBS=nothing;; |
---|
791 | esac;; |
---|
792 | *-linux-*) |
---|
793 | case "$CXX" in |
---|
794 | icpc* | */icpc*) |
---|
795 | CXXLIBS="-lstdc++" |
---|
796 | ;; |
---|
797 | pgCC* | */pgCC*) |
---|
798 | CXXLIBS="-lstd -lC -lc" |
---|
799 | ;; |
---|
800 | esac;; |
---|
801 | *-ibm-*) |
---|
802 | CXXLIBS="-lC -lc" |
---|
803 | ;; |
---|
804 | *-hp-*) |
---|
805 | CXXLIBS="-L/opt/aCC/lib -l++ -lstd_v2 -lCsup_v2 -lm -lcl -lc" |
---|
806 | ;; |
---|
807 | *-*-solaris*) |
---|
808 | CXXLIBS="-lCstd -lCrun" |
---|
809 | esac |
---|
810 | fi |
---|
811 | fi |
---|
812 | if test -z "$CXXLIBS"; then |
---|
813 | AC_MSG_WARN([Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran or C).]) |
---|
814 | else |
---|
815 | AC_MSG_NOTICE([Assuming that CXXLIBS is \"$CXXLIBS\".]) |
---|
816 | fi |
---|
817 | if test x"$CXXLIBS" = xnothing; then |
---|
818 | CXXLIBS= |
---|
819 | fi |
---|
820 | AC_LANG_POP(C++) |
---|
821 | ]) # AC_COIN_CXXLIBS |
---|
822 | |
---|
823 | ########################################################################### |
---|
824 | # COIN_CHECK_HEADER # |
---|
825 | ########################################################################### |
---|
826 | |
---|
827 | # This macro checks for a header file, but it does so without the |
---|
828 | # standard header. This avoids warning messages like: |
---|
829 | # |
---|
830 | # configure: WARNING: dlfcn.h: present but cannot be compiled |
---|
831 | # configure: WARNING: dlfcn.h: check for missing prerequisite headers? |
---|
832 | # configure: WARNING: dlfcn.h: see the Autoconf documentation |
---|
833 | # configure: WARNING: dlfcn.h: section "Present But Cannot Be Compiled" |
---|
834 | # configure: WARNING: dlfcn.h: proceeding with the preprocessor's result |
---|
835 | # configure: WARNING: dlfcn.h: in the future, the compiler will take precedence |
---|
836 | |
---|
837 | # My guess that the problem lay with CPPFLAGS seems to be correct. With this |
---|
838 | # macro reduced to a direct call to AC_CHECK_HEADERS, there are no warnings |
---|
839 | # now that CPPFLAGS contains -mno-cygwin when it needs it. -- lh, 061214 -- |
---|
840 | |
---|
841 | # AW 070609: I restored the previous version, since otherwise the warnings |
---|
842 | # still pop up for the cl compiler |
---|
843 | |
---|
844 | AC_DEFUN([AC_COIN_CHECK_HEADER], |
---|
845 | [#if test x"$4" = x; then |
---|
846 | # hdr="#include <$1>" |
---|
847 | #else |
---|
848 | # hdr="$4" |
---|
849 | #fi |
---|
850 | #AC_CHECK_HEADERS([$1],[$2],[$3],[$hdr]) |
---|
851 | AC_CHECK_HEADERS([$1],[$2],[$3],[$4]) |
---|
852 | ]) # AC_COIN_CHECK_HEADER |
---|
853 | |
---|
854 | ########################################################################### |
---|
855 | # COIN_CHECK_CXX_CHEADER # |
---|
856 | ########################################################################### |
---|
857 | |
---|
858 | # This macro checks for C header files that are used from C++. For a give |
---|
859 | # stub (e.g., math), it first checks if the C++ library (cmath) is available. |
---|
860 | # If it is, it defines HAVE_CMATH (or whatever the stub is). If it is not |
---|
861 | # available, it checks for the old C head (math.h) and defines HAVE_MATH_H |
---|
862 | # if that one exists. |
---|
863 | |
---|
864 | AC_DEFUN([AC_COIN_CHECK_CXX_CHEADER], |
---|
865 | [AC_LANG_PUSH(C++) |
---|
866 | AC_COIN_CHECK_HEADER([c$1],[$2],[$3],[$4]) |
---|
867 | if test "$ac_cv_header_c$1" != "yes"; then |
---|
868 | AC_COIN_CHECK_HEADER([$1.h],[$2],[$3],[$4]) |
---|
869 | fi |
---|
870 | AC_LANG_POP(C++) |
---|
871 | ]) # AC_COIN_CHECK_CXX_CHEADER |
---|
872 | |
---|
873 | ########################################################################### |
---|
874 | # COIN_PROG_CC # |
---|
875 | ########################################################################### |
---|
876 | |
---|
877 | # Find the compile command by running AC_PROG_CC (with compiler names |
---|
878 | # for different operating systems) and put it into CC (unless it was |
---|
879 | # given my the user), and find an appropriate value for CFLAGS. It is |
---|
880 | # possible to provide additional -D flags in the variable CDEFS. |
---|
881 | |
---|
882 | AC_DEFUN([AC_COIN_PROG_CC], |
---|
883 | [AC_REQUIRE([AC_COIN_MINGW_LD_FIX]) |
---|
884 | AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) |
---|
885 | AC_LANG_PUSH(C) |
---|
886 | |
---|
887 | # For consistency, we set the C compiler to the same value of the C++ |
---|
888 | # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) |
---|
889 | if test x"$CXX" != x; then |
---|
890 | case "$CXX" in |
---|
891 | cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) |
---|
892 | if test x"$CC" = x; then |
---|
893 | CC="$CXX" |
---|
894 | AC_MSG_WARN([C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX]) |
---|
895 | fi |
---|
896 | ;; |
---|
897 | esac |
---|
898 | fi |
---|
899 | |
---|
900 | AC_ARG_VAR(CDEFS,[Additional -D flags to be used when compiling C code.]) |
---|
901 | AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options]) |
---|
902 | AC_ARG_VAR(DBG_CFLAGS,[Debug C compiler options]) |
---|
903 | AC_ARG_VAR(OPT_CFLAGS,[Optimize C compiler options]) |
---|
904 | |
---|
905 | coin_has_cc=yes |
---|
906 | |
---|
907 | save_cflags="$CFLAGS" |
---|
908 | |
---|
909 | # For *-*-solaris*, promote Studio/Workshop cc compiler to front of list. |
---|
910 | # Depending on the user's PATH, when Studio/Workshop cc is not present we may |
---|
911 | # find /usr/ucb/cc, which is almost certainly not a good choice for the C |
---|
912 | # compiler. In this case, put cc after gcc. |
---|
913 | |
---|
914 | case $build in |
---|
915 | *-cygwin* | *-mingw*) |
---|
916 | if test "$enable_doscompile" = msvc ; then |
---|
917 | comps="icl cl" |
---|
918 | else |
---|
919 | comps="gcc cl" |
---|
920 | fi ;; |
---|
921 | *-*-solaris*) |
---|
922 | AC_CHECK_PROG(sol_cc_compiler,cc,cc,[],[],/usr/ucb/cc) |
---|
923 | if test "$sol_cc_compiler" = "cc" ; then |
---|
924 | comps="cc xlc gcc pgcc icc" |
---|
925 | else |
---|
926 | comps="xlc gcc pgcc icc cc" |
---|
927 | fi |
---|
928 | ;; |
---|
929 | *-linux-*) comps="xlc gcc cc pgcc icc" ;; |
---|
930 | *) comps="xlc_r xlc cc gcc pgcc icc" ;; |
---|
931 | esac |
---|
932 | |
---|
933 | # We delete the cached value, since the test might not have been |
---|
934 | # performed with our choice of compilers earlier |
---|
935 | $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; } |
---|
936 | # AC_MSG_NOTICE([C compiler candidates: $comps]) |
---|
937 | AC_PROG_CC([$comps]) |
---|
938 | if test -z "$CC" ; then |
---|
939 | AC_MSG_ERROR([Failed to find a C compiler!]) |
---|
940 | fi |
---|
941 | # Autoconf incorrectly concludes that cl recognises -g. It doesn't. |
---|
942 | case "$CC" in |
---|
943 | cl* | */cl* | CL* | */CL* ) |
---|
944 | if test "$ac_cv_prog_cc_g" = yes ; then |
---|
945 | ac_cv_prog_cc_g=no |
---|
946 | AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.]) |
---|
947 | fi ;; |
---|
948 | esac |
---|
949 | CFLAGS="$save_cflags" |
---|
950 | |
---|
951 | # Check if a project specific CFLAGS variable has been set |
---|
952 | if test x$COIN_PRJCT != x; then |
---|
953 | eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set} |
---|
954 | if test x$coin_tmp = xset; then |
---|
955 | eval CFLAGS=\${${COIN_PRJCT}_CFLAGS} |
---|
956 | fi |
---|
957 | fi |
---|
958 | |
---|
959 | if test x"$CFLAGS" = x; then |
---|
960 | |
---|
961 | coin_add_cflags= |
---|
962 | coin_opt_cflags= |
---|
963 | coin_dbg_cflags= |
---|
964 | coin_warn_cflags= |
---|
965 | |
---|
966 | if test "$GCC" = "yes"; then |
---|
967 | case "$CC" in |
---|
968 | icc* | */icc*) |
---|
969 | ;; |
---|
970 | *) |
---|
971 | coin_opt_cflags="-O3 -fomit-frame-pointer" |
---|
972 | coin_add_cflags="-pipe" |
---|
973 | coin_dbg_cflags="-g" |
---|
974 | coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas" |
---|
975 | case $build in |
---|
976 | *-darwin*) |
---|
977 | ;; |
---|
978 | *) |
---|
979 | coin_warn_cflags="-pedantic-errors $coin_warn_cflags" |
---|
980 | ;; |
---|
981 | esac |
---|
982 | case $enable_doscompile in |
---|
983 | mingw) |
---|
984 | CFLAGS="-mno-cygwin" |
---|
985 | AC_TRY_LINK([],[int i=0; i++;], |
---|
986 | [coin_add_cflags="-mno-cygwin $coin_add_cflags"]) |
---|
987 | CFLAGS= |
---|
988 | ;; |
---|
989 | esac |
---|
990 | esac |
---|
991 | fi |
---|
992 | if test -z "$coin_opt_cflags"; then |
---|
993 | case $build in |
---|
994 | *-cygwin* | *-mingw*) |
---|
995 | case "$CC" in |
---|
996 | cl* | */cl* | CL* | */CL*) |
---|
997 | coin_opt_cflags='-MT -O2' |
---|
998 | coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE' |
---|
999 | coin_dbg_cflags='-MTd' |
---|
1000 | ;; |
---|
1001 | icl* | */icl* | ICL* | */ICL*) |
---|
1002 | coin_opt_cflags='-MT -Ox' |
---|
1003 | coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE' |
---|
1004 | coin_dbg_cflags='-MTd -debug' |
---|
1005 | ;; |
---|
1006 | esac |
---|
1007 | ;; |
---|
1008 | *-linux-*) |
---|
1009 | case "$CC" in |
---|
1010 | icc* | */icc*) |
---|
1011 | coin_opt_cflags="-O3 -ip -mp1" |
---|
1012 | coin_add_cflags="" |
---|
1013 | coin_dbg_cflags="-g" |
---|
1014 | # Check if -i_dynamic is necessary (for new glibc library) |
---|
1015 | CFLAGS= |
---|
1016 | AC_TRY_LINK([],[int i=0; i++;],[], |
---|
1017 | [coin_add_cflags="-i_dynamic $coin_add_cflags"]) |
---|
1018 | ;; |
---|
1019 | pgcc* | */pgcc*) |
---|
1020 | coin_opt_cflags="-fast" |
---|
1021 | coin_add_cflags="-Kieee -pc 64" |
---|
1022 | coin_dbg_cflags="-g" |
---|
1023 | ;; |
---|
1024 | esac |
---|
1025 | ;; |
---|
1026 | *-ibm-*) |
---|
1027 | case "$CC" in |
---|
1028 | xlc* | */xlc* | mpxlc* | */mpxlc*) |
---|
1029 | coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" |
---|
1030 | coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" |
---|
1031 | coin_dbg_cflags="-g" |
---|
1032 | ;; |
---|
1033 | esac |
---|
1034 | ;; |
---|
1035 | *-hp-*) |
---|
1036 | coin_opt_cflags="-O" |
---|
1037 | coin_add_cflags="-Ae" |
---|
1038 | coin_dbg_cflags="-g" |
---|
1039 | ;; |
---|
1040 | *-*-solaris*) |
---|
1041 | coin_opt_cflags="-xO4" |
---|
1042 | coin_dbg_cflags="-g" |
---|
1043 | ;; |
---|
1044 | *-sgi-*) |
---|
1045 | coin_opt_cflags="-O -OPT:Olimit=0" |
---|
1046 | coin_dbg_cflags="-g" |
---|
1047 | ;; |
---|
1048 | esac |
---|
1049 | fi |
---|
1050 | |
---|
1051 | if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then |
---|
1052 | coin_dbg_cflags="-g" |
---|
1053 | fi |
---|
1054 | |
---|
1055 | if test -z "$coin_opt_cflags"; then |
---|
1056 | # Try if -O option works if nothing else is set |
---|
1057 | CFLAGS="-O" |
---|
1058 | AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cflags="-O"]) |
---|
1059 | fi |
---|
1060 | |
---|
1061 | # if PM doesn't want the warning messages, take them out |
---|
1062 | if test x"$coin_skip_warn_cflags" = xyes; then |
---|
1063 | coin_warn_cflags= |
---|
1064 | fi |
---|
1065 | |
---|
1066 | if test x${DBG_CFLAGS+set} != xset; then |
---|
1067 | DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags" |
---|
1068 | fi |
---|
1069 | if test x${OPT_CFLAGS+set} != xset; then |
---|
1070 | OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags" |
---|
1071 | fi |
---|
1072 | |
---|
1073 | DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS" |
---|
1074 | OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS" |
---|
1075 | |
---|
1076 | if test "$coin_debug_compile" = "true"; then |
---|
1077 | CFLAGS="$DBG_CFLAGS" |
---|
1078 | else |
---|
1079 | CFLAGS="$OPT_CFLAGS" |
---|
1080 | fi |
---|
1081 | else |
---|
1082 | CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS" |
---|
1083 | if test x${DBG_CFLAGS+set} != xset; then |
---|
1084 | DBG_CFLAGS="$CFLAGS" |
---|
1085 | fi |
---|
1086 | if test x${OPT_CFLAGS+set} != xset; then |
---|
1087 | OPT_CFLAGS="$CFLAGS" |
---|
1088 | fi |
---|
1089 | fi |
---|
1090 | |
---|
1091 | # If CFLAGS contains -mno-cygwin, CPPFLAGS must also have it. |
---|
1092 | |
---|
1093 | case "$CFLAGS" in |
---|
1094 | *-mno-cygwin*) |
---|
1095 | if test x${CPPFLAGS+set} != xset ; then |
---|
1096 | CPPFLAGS="-mno-cygwin" |
---|
1097 | else |
---|
1098 | case "$CPPFLAGS" in |
---|
1099 | *-mno-cygwin*) |
---|
1100 | ;; |
---|
1101 | *) |
---|
1102 | CPPFLAGS="$CPPFLAGS -mno-cygwin" |
---|
1103 | ;; |
---|
1104 | esac |
---|
1105 | fi ;; |
---|
1106 | esac |
---|
1107 | |
---|
1108 | # Try if CFLAGS works |
---|
1109 | save_CFLAGS="$CFLAGS" |
---|
1110 | AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=]) |
---|
1111 | if test -z "$CFLAGS"; then |
---|
1112 | 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.]) |
---|
1113 | CFLAGS='-O' |
---|
1114 | AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=]) |
---|
1115 | if test -z "$CFLAGS"; then |
---|
1116 | AC_MSG_WARN([This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually.]) |
---|
1117 | fi |
---|
1118 | fi |
---|
1119 | |
---|
1120 | AC_MSG_NOTICE([C compiler options are: $CFLAGS]) |
---|
1121 | |
---|
1122 | AC_ARG_VAR(MPICC,[C MPI Compiler]) |
---|
1123 | if test x"$MPICC" = x; then :; else |
---|
1124 | AC_MSG_NOTICE([Will use MPI C compiler $MPICC]) |
---|
1125 | CC="$MPICC" |
---|
1126 | fi |
---|
1127 | |
---|
1128 | # Correct ADDLIBS initialization if we are using the MS compiler |
---|
1129 | case "$CC" in |
---|
1130 | cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) |
---|
1131 | ADDLIBS= |
---|
1132 | AC_COIN_MINGW_LD_FIX |
---|
1133 | ;; |
---|
1134 | esac |
---|
1135 | |
---|
1136 | AC_LANG_POP(C) |
---|
1137 | ]) # AC_COIN_PROG_CC |
---|
1138 | |
---|
1139 | ########################################################################### |
---|
1140 | # COIN_PROG_F77 # |
---|
1141 | ########################################################################### |
---|
1142 | |
---|
1143 | # Find the compile command by running AC_PROG_F77 (with compiler names |
---|
1144 | # for different operating systems) and put it into F77 (unless it was |
---|
1145 | # given by the user), and find an appropriate value for FFLAGS |
---|
1146 | |
---|
1147 | AC_DEFUN([AC_COIN_PROG_F77], |
---|
1148 | [AC_REQUIRE([AC_COIN_MINGW_LD_FIX]) |
---|
1149 | AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) |
---|
1150 | AC_REQUIRE([AC_COIN_PROG_CC]) |
---|
1151 | AC_REQUIRE([AC_COIN_F77_COMPS]) |
---|
1152 | AC_LANG_PUSH([Fortran 77]) |
---|
1153 | |
---|
1154 | AC_ARG_VAR(ADD_FFLAGS,[Additional Fortran compiler options]) |
---|
1155 | AC_ARG_VAR(DBG_FFLAGS,[Debug Fortran compiler options]) |
---|
1156 | AC_ARG_VAR(OPT_FFLAGS,[Optimize Fortran compiler options]) |
---|
1157 | |
---|
1158 | coin_has_f77=yes |
---|
1159 | |
---|
1160 | save_fflags="$FFLAGS" |
---|
1161 | |
---|
1162 | # We delete the cached value, since the test might not have been |
---|
1163 | # performed with our choice of compilers earlier |
---|
1164 | $as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; } |
---|
1165 | |
---|
1166 | # This is a real belt-and-suspenders approach. AC_COIN_FIND_F77 will use |
---|
1167 | # coin_f77_comps to see if there's a program that matches one of the names. |
---|
1168 | # If there's no such program, F77 = unavailable. If we match the name, |
---|
1169 | # feed AC_PROG_F77 the same search list, just to be sure it's a functioning |
---|
1170 | # compiler. |
---|
1171 | # AC_MSG_NOTICE([Fortran compiler candidates: $coin_f77_comps]) |
---|
1172 | AC_COIN_FIND_F77 |
---|
1173 | if test "$F77" != "unavailable" ; then |
---|
1174 | AC_PROG_F77($coin_f77_comps) |
---|
1175 | else |
---|
1176 | AC_MSG_WARN([Failed to find a Fortran compiler!]) |
---|
1177 | fi |
---|
1178 | |
---|
1179 | FFLAGS="$save_fflags" |
---|
1180 | |
---|
1181 | # Check if a project specific FFLAGS variable has been set |
---|
1182 | if test x$COIN_PRJCT != x; then |
---|
1183 | eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set} |
---|
1184 | if test x$coin_tmp = xset; then |
---|
1185 | eval FFLAGS=\${${COIN_PRJCT}_FFLAGS} |
---|
1186 | fi |
---|
1187 | fi |
---|
1188 | |
---|
1189 | if test "$F77" != "unavailable" && test x"$FFLAGS" = x ; then |
---|
1190 | |
---|
1191 | coin_add_fflags= |
---|
1192 | coin_opt_fflags= |
---|
1193 | coin_dbg_fflags= |
---|
1194 | coin_warn_fflags= |
---|
1195 | |
---|
1196 | if test "$G77" = "yes"; then |
---|
1197 | coin_opt_fflags="-O3 -fomit-frame-pointer" |
---|
1198 | coin_add_fflags="-pipe" |
---|
1199 | coin_dbg_fflags="-g" |
---|
1200 | case $enable_doscompile in |
---|
1201 | mingw) |
---|
1202 | FFLAGS="-mno-cygwin" |
---|
1203 | AC_TRY_LINK(,[ write(*,*) 'Hello world'], |
---|
1204 | [coin_add_fflags="-mno-cygwin $coin_add_fflags"]) |
---|
1205 | FFLAGS= |
---|
1206 | ;; |
---|
1207 | esac |
---|
1208 | else |
---|
1209 | case $build in |
---|
1210 | *-cygwin* | *-mingw*) |
---|
1211 | case $F77 in |
---|
1212 | ifort* | */ifort* | IFORT* | */IFORT* ) |
---|
1213 | coin_opt_fflags='-MT -O3' |
---|
1214 | coin_add_fflags='-fpp -nologo' |
---|
1215 | coin_dbg_fflags='-MTd -debug' |
---|
1216 | ;; |
---|
1217 | compile_f2c*) |
---|
1218 | coin_opt_fflags='-MT -O2' |
---|
1219 | coin_add_fflags='-nologo -wd4996' |
---|
1220 | coin_dbg_fflags='-MTd' |
---|
1221 | ;; |
---|
1222 | esac |
---|
1223 | ;; |
---|
1224 | *-linux-*) |
---|
1225 | case $F77 in |
---|
1226 | ifc* | */ifc* | ifort* | */ifort*) |
---|
1227 | coin_opt_fflags="-O3 -ip" |
---|
1228 | coin_add_fflags="-cm -w90 -w95" |
---|
1229 | coin_dbg_fflags="-g -CA -CB -CS" |
---|
1230 | # Check if -i_dynamic is necessary (for new glibc library) |
---|
1231 | FFLAGS= |
---|
1232 | AC_TRY_LINK(,[ write(*,*) 'Hello world'],[], |
---|
1233 | [coin_add_fflags="-i_dynamic $coin_add_fflags"]) |
---|
1234 | ;; |
---|
1235 | pgf77* | */pgf77* | pgf90* | */pgf90*) |
---|
1236 | coin_opt_fflags="-fast" |
---|
1237 | coin_add_fflags="-Kieee -pc 64" |
---|
1238 | coin_dbg_fflags="-g" |
---|
1239 | ;; |
---|
1240 | esac |
---|
1241 | ;; |
---|
1242 | *-ibm-*) |
---|
1243 | case "$F77" in |
---|
1244 | xlf* | */xlf* | mpxlf* | */mpxlf* ) |
---|
1245 | coin_opt_fflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" |
---|
1246 | coin_add_fflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" |
---|
1247 | coin_dbg_fflags="-g -C" |
---|
1248 | ;; |
---|
1249 | esac |
---|
1250 | ;; |
---|
1251 | *-hp-*) |
---|
1252 | coin_opt_fflags="+O3" |
---|
1253 | coin_add_fflags="+U77" |
---|
1254 | coin_dbg_fflags="-C -g" |
---|
1255 | ;; |
---|
1256 | *-*-solaris*) |
---|
1257 | coin_opt_fflags="-O4" |
---|
1258 | coin_dbg_fflags="-g" |
---|
1259 | ;; |
---|
1260 | *-sgi-*) |
---|
1261 | coin_opt_fflags="-O5 -OPT:Olimit=0" |
---|
1262 | coin_dbg_fflags="-g" |
---|
1263 | ;; |
---|
1264 | esac |
---|
1265 | fi |
---|
1266 | |
---|
1267 | if test "$ac_cv_prog_f77_g" = yes && test -z "$coin_dbg_fflags" ; then |
---|
1268 | coin_dbg_fflags="-g" |
---|
1269 | fi |
---|
1270 | |
---|
1271 | if test -z "$coin_opt_fflags"; then |
---|
1272 | # Try if -O option works if nothing else is set |
---|
1273 | FFLAGS=-O |
---|
1274 | AC_TRY_LINK(,[ integer i], [coin_opt_fflags="-O"]) |
---|
1275 | fi |
---|
1276 | |
---|
1277 | # if PM doesn't want the warning messages, take them out |
---|
1278 | if test x"$coin_skip_warn_fflags" = xyes; then |
---|
1279 | coin_warn_fflags= |
---|
1280 | fi |
---|
1281 | |
---|
1282 | if test x${DBG_FFLAGS+set} != xset; then |
---|
1283 | DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags" |
---|
1284 | fi |
---|
1285 | if test x${OPT_FFLAGS+set} != xset; then |
---|
1286 | OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags" |
---|
1287 | fi |
---|
1288 | |
---|
1289 | DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS" |
---|
1290 | OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS" |
---|
1291 | |
---|
1292 | if test "$coin_debug_compile" = "true"; then |
---|
1293 | FFLAGS="$DBG_FFLAGS" |
---|
1294 | else |
---|
1295 | FFLAGS="$OPT_FFLAGS" |
---|
1296 | fi |
---|
1297 | else |
---|
1298 | FFLAGS="$FFLAGS $ADD_FFLAGS" |
---|
1299 | if test x${DBG_FFLAGS+set} != xset; then |
---|
1300 | DBG_FFLAGS="$FFLAGS" |
---|
1301 | fi |
---|
1302 | if test x${OPT_FFLAGS+set} != xset; then |
---|
1303 | OPT_FFLAGS="$FFLAGS" |
---|
1304 | fi |
---|
1305 | fi |
---|
1306 | |
---|
1307 | # If FFLAGS contains -mno-cygwin, CPPFLAGS must have it. |
---|
1308 | case "$FFLAGS" in |
---|
1309 | *-mno-cygwin*) |
---|
1310 | if test x${CPPFLAGS+set} != xset ; then |
---|
1311 | CPPFLAGS="-mno-cygwin" |
---|
1312 | else |
---|
1313 | case "$CPPFLAGS" in |
---|
1314 | *-mno-cygwin*) |
---|
1315 | ;; |
---|
1316 | *) |
---|
1317 | CPPFLAGS="$CPPFLAGS -mno-cygwin" |
---|
1318 | ;; |
---|
1319 | esac |
---|
1320 | fi ;; |
---|
1321 | esac |
---|
1322 | |
---|
1323 | # Try if FFLAGS works |
---|
1324 | if test "$F77" != "unavailable" ; then |
---|
1325 | AC_TRY_LINK(,[ integer i],[],[FFLAGS=]) |
---|
1326 | if test -z "$FFLAGS"; then |
---|
1327 | AC_MSG_WARN([The flags FFLAGS="$FFLAGS" do not work. I will now just try '-O', but you might want to set FFLAGS manually.]) |
---|
1328 | FFLAGS='-O' |
---|
1329 | AC_TRY_LINK(,[ integer i],[],[FFLAGS=]) |
---|
1330 | if test -z "$FFLAGS"; then |
---|
1331 | AC_MSG_WARN([This value for FFLAGS does not work. I will continue with empty FFLAGS, but you might want to set FFLAGS manually.]) |
---|
1332 | fi |
---|
1333 | fi |
---|
1334 | fi |
---|
1335 | |
---|
1336 | AC_MSG_NOTICE([Fortran compiler options are: $FFLAGS]) |
---|
1337 | |
---|
1338 | AC_ARG_VAR(MPIF77,[Fortran MPI Compiler]) |
---|
1339 | if test x"$MPIF77" = x; then :; else |
---|
1340 | AC_MSG_NOTICE([Will use MPI Fortran compiler $MPIF77]) |
---|
1341 | F77="$MPIF77" |
---|
1342 | fi |
---|
1343 | |
---|
1344 | case "$F77" in |
---|
1345 | ifort* | */ifort* | IFORT* | */IFORT*) |
---|
1346 | AC_COIN_MINGW_LD_FIX |
---|
1347 | ;; |
---|
1348 | esac |
---|
1349 | |
---|
1350 | AC_LANG_POP([Fortran 77]) |
---|
1351 | ]) # AC_COIN_PROG_F77 |
---|
1352 | |
---|
1353 | ########################################################################### |
---|
1354 | # COIN_F77_WRAPPERS # |
---|
1355 | ########################################################################### |
---|
1356 | |
---|
1357 | # Calls autoconfs AC_F77_WRAPPERS and does additional corrections to FLIBS |
---|
1358 | |
---|
1359 | AC_DEFUN([AC_COIN_F77_WRAPPERS], |
---|
1360 | [AC_BEFORE([AC_COIN_PROG_F77],[$0])dnl |
---|
1361 | AC_BEFORE([AC_PROG_F77],[$0])dnl |
---|
1362 | |
---|
1363 | AC_LANG_PUSH([Fortran 77]) |
---|
1364 | |
---|
1365 | AC_F77_WRAPPERS |
---|
1366 | |
---|
1367 | # If FLIBS has been set by the user, we just restore its value here |
---|
1368 | if test x"$save_FLIBS" != x; then |
---|
1369 | FLIBS="$save_FLIBS" |
---|
1370 | else |
---|
1371 | # This is to correct a missing exclusion in autoconf 2.59 |
---|
1372 | if test x"$FLIBS" != x; then |
---|
1373 | my_flibs= |
---|
1374 | for flag in $FLIBS; do |
---|
1375 | case $flag in |
---|
1376 | -lcrt*.o) ;; |
---|
1377 | -lcygwin) ;; |
---|
1378 | *) my_flibs="$my_flibs $flag" ;; |
---|
1379 | esac |
---|
1380 | done |
---|
1381 | FLIBS="$my_flibs" |
---|
1382 | fi |
---|
1383 | |
---|
1384 | case $build in |
---|
1385 | # The following is a fix to define FLIBS for ifort on Windows |
---|
1386 | # In its original version, it linked in libifcorert.lib or libifcorertd.lib on Windows/ifort explicitly. |
---|
1387 | # However, this seem to create a dependency on libifcorert.dll (or libifcorertd.dll) in the executables. |
---|
1388 | # This is seem to be unnecessary, libifcorert(d).lib has been removed from the link line. |
---|
1389 | *-cygwin* | *-mingw*) |
---|
1390 | case "$F77" in |
---|
1391 | ifort* | */ifort* | IFORT* | */IFORT*) |
---|
1392 | FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib" |
---|
1393 | # if "$coin_debug_compile" = true ; then |
---|
1394 | # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib" |
---|
1395 | # else |
---|
1396 | # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmtd.lib" |
---|
1397 | # fi |
---|
1398 | ;; |
---|
1399 | compile_f2c*) |
---|
1400 | FLIBS=`$F77 -FLIBS` ;; |
---|
1401 | esac;; |
---|
1402 | *-hp-*) |
---|
1403 | FLIBS="$FLIBS -lm";; |
---|
1404 | *-ibm-*) |
---|
1405 | FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;; |
---|
1406 | *-linux-*) |
---|
1407 | case "$F77" in |
---|
1408 | pgf77* | */pgf77* | pgf90* | */pgf90*) |
---|
1409 | # ask linker to go through the archives multiple times |
---|
1410 | # (the Fortran compiler seems to do that automatically... |
---|
1411 | FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;; |
---|
1412 | esac |
---|
1413 | esac |
---|
1414 | ac_cv_f77_libs="$FLIBS" |
---|
1415 | fi |
---|
1416 | |
---|
1417 | AC_LANG_POP([Fortran 77]) |
---|
1418 | |
---|
1419 | ]) # AC_COIN_F77_WRAPPERS |
---|
1420 | |
---|
1421 | ########################################################################### |
---|
1422 | # COIN_FIND_F77 # |
---|
1423 | ########################################################################### |
---|
1424 | |
---|
1425 | # Attempt to preempt autoconf by locating an appropriate F77 program. This |
---|
1426 | # macro will not trigger a fatal error if a suitable compiler cannot be |
---|
1427 | # found. It should be called before COIN_PROG_F77 or COIN_TRY_FLINK. |
---|
1428 | |
---|
1429 | AC_DEFUN([AC_COIN_FIND_F77], |
---|
1430 | [AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) |
---|
1431 | AC_REQUIRE([AC_COIN_F77_COMPS]) |
---|
1432 | AC_MSG_NOTICE([Trying to determine Fortran compiler name]) |
---|
1433 | AC_CHECK_PROGS([F77],[$coin_f77_comps],[unavailable]) |
---|
1434 | ]) |
---|
1435 | |
---|
1436 | # Auxilliary macro to make sure both COIN_PROG_F77 and COIN_FIND_F77 use |
---|
1437 | # the same search lists for compiler names. |
---|
1438 | # For *-*-solaris*, promote Studio/Workshop compilers to front of list. |
---|
1439 | AC_DEFUN([AC_COIN_F77_COMPS], |
---|
1440 | [case $build in |
---|
1441 | *-cygwin* | *-mingw*) |
---|
1442 | if test "$enable_doscompile" = msvc ; then |
---|
1443 | coin_f77_comps="ifort fl32 compile_f2c" |
---|
1444 | else |
---|
1445 | coin_f77_comps="gfortran g77 ifort fl32 compile_f2c" |
---|
1446 | fi ;; |
---|
1447 | *-*-solaris*) |
---|
1448 | coin_f77_comps="f95 f90 f77 xlf_r fort77 gfortran g77 pgf90 pgf77 ifort ifc frt af77" ;; |
---|
1449 | *) coin_f77_comps="xlf_r fort77 gfortran f77 g77 pgf90 pgf77 ifort ifc frt af77" ;; |
---|
1450 | esac |
---|
1451 | ]) |
---|
1452 | |
---|
1453 | ########################################################################### |
---|
1454 | # COIN_INIT_AUTOMAKE # |
---|
1455 | ########################################################################### |
---|
1456 | |
---|
1457 | # This macro calls the regular INIT_AUTOMAKE and MAINTAINER_MODE |
---|
1458 | # macros, and defines additional variables and makefile conditionals, |
---|
1459 | # that are used in the maintainer parts of the makfile. It also |
---|
1460 | # checks if the correct versions of the autotools are used. |
---|
1461 | # |
---|
1462 | # This also defines the AC_SUBST variables: |
---|
1463 | # abs_source_dir absolute path to source code for this package |
---|
1464 | # abs_bin_dir absolute path to the directory where binaries are |
---|
1465 | # going to be installed (prefix/bin) |
---|
1466 | # abs_lib_dir absolute path to the directory where libraries are |
---|
1467 | # going to be installed (prefix/lib) |
---|
1468 | # abs_include_dir absolute path to the directory where the header files |
---|
1469 | # are installed (prefix/include) |
---|
1470 | |
---|
1471 | AC_DEFUN([AC_COIN_INIT_AUTOMAKE], |
---|
1472 | [AC_REQUIRE([AC_PROG_EGREP]) |
---|
1473 | |
---|
1474 | # AC_MSG_NOTICE([Beginning automake initialisation.]) |
---|
1475 | # Stuff for automake |
---|
1476 | AM_INIT_AUTOMAKE |
---|
1477 | AM_MAINTAINER_MODE |
---|
1478 | |
---|
1479 | coin_have_externals=no |
---|
1480 | if test "$enable_maintainer_mode" = yes; then |
---|
1481 | |
---|
1482 | # If maintainer mode is chosen, we make sure that the correct versions |
---|
1483 | # of the tools are used, and that we know where libtool.m4 is (to |
---|
1484 | # recreate acinclude.m4) |
---|
1485 | |
---|
1486 | AC_SUBST(LIBTOOLM4) |
---|
1487 | LIBTOOLM4= |
---|
1488 | # Normally, $HOME |
---|
1489 | AUTOTOOLS_DFLT=$HOME |
---|
1490 | |
---|
1491 | AC_CACHE_CHECK([whether we are using the correct autotools], |
---|
1492 | [ac_cv_use_correct_autotools], |
---|
1493 | [ac_cv_use_correct_autotools=check]) |
---|
1494 | |
---|
1495 | if test $ac_cv_use_correct_autotools = check; then |
---|
1496 | ac_cv_use_correct_autotools=yes |
---|
1497 | # Check if we have autoconf |
---|
1498 | AC_CHECK_PROG([have_autoconf],[autoconf],[yes],[no]) |
---|
1499 | if test $have_autoconf = no; then |
---|
1500 | AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find autoconf in your path.]) |
---|
1501 | fi |
---|
1502 | |
---|
1503 | # Check whether autoconf is the correct version |
---|
1504 | correct_version='2.59' |
---|
1505 | grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` |
---|
1506 | AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of autoconf]) |
---|
1507 | autoconf --version > confauto.out 2>&1 |
---|
1508 | if $EGREP $grep_version confauto.out >/dev/null 2>&1; then |
---|
1509 | AC_MSG_RESULT([yes]) |
---|
1510 | else |
---|
1511 | rm -f confauto.out |
---|
1512 | AC_MSG_RESULT([no]) |
---|
1513 | AC_MSG_ERROR([You don't have the correct version of autoconf as the first one in your path.]) |
---|
1514 | fi |
---|
1515 | rm -f confauto.out |
---|
1516 | |
---|
1517 | # Check if the executable autoconf is picked up from the correct location |
---|
1518 | AC_MSG_CHECKING([whether autoconf is coming from the correct location]) |
---|
1519 | autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` |
---|
1520 | autoconf_dir=`cd $autoconf_dir; pwd` |
---|
1521 | if test x$AUTOTOOLS_DIR = x; then |
---|
1522 | want_dir=$AUTOTOOLS_DFLT/bin |
---|
1523 | else |
---|
1524 | want_dir=$AUTOTOOLS_DIR/bin |
---|
1525 | fi |
---|
1526 | if test $autoconf_dir = `cd $want_dir; pwd`; then |
---|
1527 | AC_MSG_RESULT([yes]) |
---|
1528 | else |
---|
1529 | rm -f confauto.out |
---|
1530 | AC_MSG_RESULT([no]) |
---|
1531 | AC_MSG_ERROR([The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin.]) |
---|
1532 | fi |
---|
1533 | |
---|
1534 | # Check if we have automake |
---|
1535 | AC_CHECK_PROG([have_automake],[automake],[yes],[no]) |
---|
1536 | if test $have_automake = no; then |
---|
1537 | AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find automake in your path.]) |
---|
1538 | fi |
---|
1539 | |
---|
1540 | # Check whether automake is the correct version |
---|
1541 | correct_version='1.9.6' |
---|
1542 | grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` |
---|
1543 | AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of automake]) |
---|
1544 | automake --version > confauto.out 2>&1 |
---|
1545 | if $EGREP $grep_version confauto.out >/dev/null 2>&1; then |
---|
1546 | AC_MSG_RESULT([yes]) |
---|
1547 | else |
---|
1548 | rm -f confauto.out |
---|
1549 | AC_MSG_RESULT([no]) |
---|
1550 | AC_MSG_ERROR([You don't have the correct version of automake as the first one in your path.]) |
---|
1551 | fi |
---|
1552 | rm -f confauto.out |
---|
1553 | |
---|
1554 | # Check if the executable automake is picked up from the correct location |
---|
1555 | AC_MSG_CHECKING([whether automake is coming from the correct location]) |
---|
1556 | automake_dir=`which automake | sed -e 's=/automake=='` |
---|
1557 | automake_dir=`cd $automake_dir; pwd` |
---|
1558 | if test x$AUTOTOOLS_DIR = x; then |
---|
1559 | want_dir=$AUTOTOOLS_DFLT/bin |
---|
1560 | else |
---|
1561 | want_dir=$AUTOTOOLS_DIR/bin |
---|
1562 | fi |
---|
1563 | if test $automake_dir = `cd $want_dir; pwd`; then |
---|
1564 | AC_MSG_RESULT([yes]) |
---|
1565 | else |
---|
1566 | rm -f confauto.out |
---|
1567 | AC_MSG_RESULT([no]) |
---|
1568 | AC_MSG_ERROR([The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin.]) |
---|
1569 | fi |
---|
1570 | |
---|
1571 | # Check if this is the correct version of libtool (with escaped dots) |
---|
1572 | if test x$AUTOTOOLS_DIR = x; then |
---|
1573 | want_dir=$AUTOTOOLS_DFLT/share |
---|
1574 | else |
---|
1575 | want_dir=$AUTOTOOLS_DIR/share |
---|
1576 | fi |
---|
1577 | correct_version='1.5.22' |
---|
1578 | grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` |
---|
1579 | AC_COIN_CHECK_FILE([$want_dir/libtool/ltmain.sh], |
---|
1580 | [have_ltmain=yes], |
---|
1581 | [have_ltmain=no]) |
---|
1582 | AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of libtool.]) |
---|
1583 | if test $have_ltmain = yes; then |
---|
1584 | if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then |
---|
1585 | AC_MSG_RESULT([yes]) |
---|
1586 | else |
---|
1587 | AC_MSG_RESULT([no]) |
---|
1588 | AC_MSG_ERROR([You don't have the correct version of libtool.]) |
---|
1589 | fi |
---|
1590 | else |
---|
1591 | AC_MSG_RESULT([no]) |
---|
1592 | AC_MSG_ERROR([I cannot find the ltmain.sh file.]) |
---|
1593 | fi |
---|
1594 | fi |
---|
1595 | |
---|
1596 | # Check if we can find the libtool file |
---|
1597 | if test x$AUTOTOOLS_DIR = x; then |
---|
1598 | want_dir=$AUTOTOOLS_DFLT/share |
---|
1599 | else |
---|
1600 | want_dir=$AUTOTOOLS_DIR/share |
---|
1601 | fi |
---|
1602 | AC_COIN_CHECK_FILE([$want_dir/aclocal/libtool.m4], |
---|
1603 | [LIBTOOLM4="$want_dir/aclocal/libtool.m4"], |
---|
1604 | [AC_MSG_ERROR([I cannot find the libtool.m4 file.])]) |
---|
1605 | |
---|
1606 | # Check if we have an Externals file |
---|
1607 | if test -r $srcdir/Externals; then |
---|
1608 | coin_have_externals=yes |
---|
1609 | fi |
---|
1610 | # Check if subversion is installed and understands https |
---|
1611 | AC_CHECK_PROG([have_svn],[svn],[yes],[no]) |
---|
1612 | if test x$have_svn = xyes; then |
---|
1613 | AC_CACHE_CHECK([whether svn understands https], |
---|
1614 | [ac_cv_svn_understands_https], |
---|
1615 | [svn --version > confauto.out 2>&1 |
---|
1616 | if $EGREP https confauto.out >/dev/null 2>&1; then |
---|
1617 | ac_cv_svn_understands_https=yes |
---|
1618 | else |
---|
1619 | ac_cv_svn_understands_https=no |
---|
1620 | have_svn=no |
---|
1621 | ac_cv_prog_have_svn=no |
---|
1622 | fi |
---|
1623 | rm -f confauto.out]) |
---|
1624 | fi |
---|
1625 | |
---|
1626 | # Find the location of the BuildTools directory |
---|
1627 | BUILDTOOLSDIR= |
---|
1628 | if test -r $srcdir/BuildTools/coin.m4; then |
---|
1629 | BUILDTOOLSDIR=$srcdir/BuildTools |
---|
1630 | else |
---|
1631 | if test -r $srcdir/../BuildTools/coin.m4; then |
---|
1632 | BUILDTOOLSDIR=$srcdir/../BuildTools |
---|
1633 | else |
---|
1634 | if test -r $srcdir/../../BuildTools/coin.m4; then |
---|
1635 | BUILDTOOLSDIR=$srcdir/../../BuildTools |
---|
1636 | else |
---|
1637 | AC_MSG_ERROR(Cannot find the BuildTools directory) |
---|
1638 | fi |
---|
1639 | fi |
---|
1640 | fi |
---|
1641 | AC_SUBST(BUILDTOOLSDIR) |
---|
1642 | |
---|
1643 | # The following variable is set to the name of the directory where |
---|
1644 | # the autotool scripts are located |
---|
1645 | AC_SUBST(AUX_DIR) |
---|
1646 | AUX_DIR=$ac_aux_dir |
---|
1647 | fi |
---|
1648 | |
---|
1649 | # helpful variable for the base directory of this package |
---|
1650 | abs_source_dir=`cd $srcdir; pwd` |
---|
1651 | AC_SUBST(abs_source_dir) |
---|
1652 | |
---|
1653 | # Stuff for example Makefiles |
---|
1654 | if test x$prefix = xNONE; then |
---|
1655 | full_prefix=$ac_default_prefix |
---|
1656 | else |
---|
1657 | full_prefix=$prefix |
---|
1658 | fi |
---|
1659 | full_prefix=`cd $full_prefix ; pwd` |
---|
1660 | AC_SUBST(abs_lib_dir) |
---|
1661 | abs_lib_dir=$full_prefix/lib |
---|
1662 | AC_SUBST(abs_include_dir) |
---|
1663 | abs_include_dir=$full_prefix/include |
---|
1664 | AC_SUBST(abs_bin_dir) |
---|
1665 | abs_bin_dir=$full_prefix/bin |
---|
1666 | |
---|
1667 | AM_CONDITIONAL(HAVE_EXTERNALS, |
---|
1668 | test $coin_have_externals = yes && test x$have_svn = xyes) |
---|
1669 | |
---|
1670 | # AC_MSG_NOTICE([End automake initialisation.]) |
---|
1671 | |
---|
1672 | ]) # AC_COIN_INIT_AUTOMAKE |
---|
1673 | |
---|
1674 | ########################################################################### |
---|
1675 | # COIN_CREATE_LIBTOOL # |
---|
1676 | ########################################################################### |
---|
1677 | |
---|
1678 | # This does all the tests necessary to create the libtool script in the |
---|
1679 | # package base directory. If this is used, then the COIN_INIT_AUTO_TOOLS |
---|
1680 | # test in the subdirectories will be able to skip the libtool tests and |
---|
1681 | # just use the one in the package base directory. |
---|
1682 | |
---|
1683 | m4_define([AC_COIN_CREATE_LIBTOOL], |
---|
1684 | [AC_CANONICAL_BUILD |
---|
1685 | |
---|
1686 | # Check if user wants to produce debugging code |
---|
1687 | AC_COIN_DEBUG_COMPILE |
---|
1688 | |
---|
1689 | # Get the name of the C compiler and appropriate compiler options |
---|
1690 | AC_COIN_PROG_CC |
---|
1691 | |
---|
1692 | # Get the name of the C++ compiler and appropriate compiler options |
---|
1693 | AC_COIN_PROG_CXX |
---|
1694 | |
---|
1695 | # Get the name of the Fortran compiler and appropriate compiler options |
---|
1696 | AC_COIN_PROG_F77 |
---|
1697 | |
---|
1698 | # Initialize automake and libtool |
---|
1699 | # AC_MSG_NOTICE([Calling INIT_AUTO_TOOLS from CREATE_LIBTOOL.]) |
---|
1700 | AC_COIN_INIT_AUTO_TOOLS |
---|
1701 | # AC_MSG_NOTICE([Finished INIT_AUTO_TOOLS from CREATE_LIBTOOL.]) |
---|
1702 | ]) |
---|
1703 | |
---|
1704 | ########################################################################### |
---|
1705 | # COIN_INIT_AUTO_TOOLS # |
---|
1706 | ########################################################################### |
---|
1707 | |
---|
1708 | # Initialize the auto tools automake and libtool, with all |
---|
1709 | # modifications we want for COIN packages. |
---|
1710 | # |
---|
1711 | # RPATH_FLAGS link flags for hardcoding path to shared objects |
---|
1712 | |
---|
1713 | # This is a trick to have this code before AC_COIN_PROG_LIBTOOL |
---|
1714 | AC_DEFUN([AC_COIN_DISABLE_STATIC], |
---|
1715 | [ |
---|
1716 | # Test if force_shared has been set |
---|
1717 | if test "x$1" = xforce_shared; then |
---|
1718 | if test x$enable_shared = xno; then |
---|
1719 | AC_MSG_ERROR([Shared libraries are disabled by user, but this is not feasible with the given options]) |
---|
1720 | fi |
---|
1721 | enable_shared=yes; |
---|
1722 | else |
---|
1723 | # On Cygwin and AIX, building DLLs doesn't work |
---|
1724 | case $build in |
---|
1725 | *-cygwin*) |
---|
1726 | coin_disable_shared=yes |
---|
1727 | platform=Cygwin |
---|
1728 | ;; |
---|
1729 | *-aix*) |
---|
1730 | coin_disable_shared=yes |
---|
1731 | platform=AIX |
---|
1732 | ;; |
---|
1733 | *-mingw*) |
---|
1734 | coin_disable_shared=yes |
---|
1735 | platform="Msys" |
---|
1736 | # case "$CXX" in |
---|
1737 | # cl*) |
---|
1738 | # coin_disable_shared=yes |
---|
1739 | # platform="Msys with cl" |
---|
1740 | # ;; |
---|
1741 | # esac |
---|
1742 | ;; |
---|
1743 | esac |
---|
1744 | fi |
---|
1745 | if test x"$coin_disable_shared" = xyes; then |
---|
1746 | if test x"$enable_shared" = xyes; then |
---|
1747 | AC_MSG_WARN([On $platform, shared objects are not supported. I'm disabling your choice.]) |
---|
1748 | fi |
---|
1749 | enable_shared=no |
---|
1750 | fi |
---|
1751 | # By default, we only want the shared objects to be compiled |
---|
1752 | AC_DISABLE_STATIC |
---|
1753 | ]) |
---|
1754 | |
---|
1755 | m4_define([AC_COIN_INIT_AUTO_TOOLS], |
---|
1756 | [{AC_BEFORE([AC_COIN_PROG_CXX],[$0]) |
---|
1757 | AC_BEFORE([AC_COIN_PROG_CC],[$0]) |
---|
1758 | AC_BEFORE([AC_COIN_PROG_F77],[$0]) |
---|
1759 | |
---|
1760 | # START |
---|
1761 | AC_COIN_DISABLE_STATIC([$1]) |
---|
1762 | |
---|
1763 | # Initialize automake |
---|
1764 | AC_COIN_INIT_AUTOMAKE |
---|
1765 | |
---|
1766 | LIBTOOL= |
---|
1767 | if test -r ../libtool; then |
---|
1768 | coin_config_dir=.. |
---|
1769 | LIBTOOL='$(SHELL) $(top_builddir)/../libtool' |
---|
1770 | fi |
---|
1771 | if test "x$LIBTOOL" = x; then |
---|
1772 | if test -r ../../libtool; then |
---|
1773 | coin_config_dir=../.. |
---|
1774 | LIBTOOL='$(SHELL) $(top_builddir)/../../libtool' |
---|
1775 | fi |
---|
1776 | fi |
---|
1777 | |
---|
1778 | if test "x$LIBTOOL" = x; then |
---|
1779 | # AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).]) |
---|
1780 | # Stuff for libtool |
---|
1781 | AC_COIN_PROG_LIBTOOL |
---|
1782 | # AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.]) |
---|
1783 | # set RPATH_FLAGS to the compiler link flags required to hardcode location |
---|
1784 | # of the shared objects |
---|
1785 | AC_COIN_RPATH_FLAGS($abs_lib_dir) |
---|
1786 | |
---|
1787 | else |
---|
1788 | |
---|
1789 | AC_MSG_NOTICE([Using libtool script in directory $coin_config_dir]) |
---|
1790 | # get all missing information from the config.log file |
---|
1791 | |
---|
1792 | # output variables and defines |
---|
1793 | as_save_IFS=$IFS |
---|
1794 | IFS=' |
---|
1795 | ' |
---|
1796 | for oneline in `cat $coin_config_dir/config.status`; do |
---|
1797 | case "$oneline" in |
---|
1798 | # First some automake conditionals |
---|
1799 | s,@am__fastdep* | s,@AR@* | s,@CPP@* | s,@CPPFLAGS@* | s,@CXXCPP@* | \ |
---|
1800 | s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \ |
---|
1801 | s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \ |
---|
1802 | s,@ac_c_preproc_warn_flag@* | s,@ac_cxx_preproc_warn_flag@* ) |
---|
1803 | command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'` |
---|
1804 | # echo "$command" |
---|
1805 | eval "$command" |
---|
1806 | ;; |
---|
1807 | s,@DEFS@* ) |
---|
1808 | command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'` |
---|
1809 | # echo "$command" |
---|
1810 | eval "$command" |
---|
1811 | ;; |
---|
1812 | esac |
---|
1813 | done |
---|
1814 | IFS=$as_save_IFS |
---|
1815 | |
---|
1816 | # And some defines (assuming here that the packages base dir |
---|
1817 | # doesn't have a config.h file |
---|
1818 | for word in $defsline; do |
---|
1819 | # echo word $word |
---|
1820 | case $word in |
---|
1821 | -DHAVE_@<:@A-Z_@:>@*_H=1 | -DSTDC_HEADERS=1 ) |
---|
1822 | i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'` |
---|
1823 | # echo dd $i |
---|
1824 | echo $i >>confdefs.h |
---|
1825 | ;; |
---|
1826 | esac |
---|
1827 | done |
---|
1828 | fi |
---|
1829 | |
---|
1830 | # AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.]) |
---|
1831 | |
---|
1832 | # ToDo |
---|
1833 | # For now, don't use the -no-undefined flag, since the Makefiles are |
---|
1834 | # not yet set up that way. But we need to fix this, when we want |
---|
1835 | # to comile DLLs under Windows. |
---|
1836 | LT_LDFLAGS= |
---|
1837 | AC_SUBST(LT_LDFLAGS) |
---|
1838 | |
---|
1839 | #END |
---|
1840 | }]) |
---|
1841 | |
---|
1842 | |
---|
1843 | ########################################################################### |
---|
1844 | # COIN_PATCH_LIBTOOL_CYGWIN # |
---|
1845 | ########################################################################### |
---|
1846 | |
---|
1847 | # Patches to libtool for cygwin. Lots for cl, a few for GCC. |
---|
1848 | # For cl: |
---|
1849 | # - cygpath is not correctly quoted in fix_srcfile_path |
---|
1850 | # - paths generated for .lib files is not run through cygpath -w |
---|
1851 | |
---|
1852 | |
---|
1853 | AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN], |
---|
1854 | [ case "$CXX" in |
---|
1855 | cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) |
---|
1856 | AC_MSG_NOTICE(Applying patches to libtool for cl compiler) |
---|
1857 | sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ |
---|
1858 | -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ |
---|
1859 | -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ |
---|
1860 | -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ |
---|
1861 | -e 's%lib /OUT:%lib -OUT:%' \ |
---|
1862 | -e "s%cygpath -w%$CYGPATH_W%" \ |
---|
1863 | -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\`lib -nologo -list \\$f_ex_an_ar_oldlib | xargs echo '"$mydos2unix"'\\`; echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$f_ex_an_ar_oldlib; done%' \ |
---|
1864 | -e 's/$AR t/lib -nologo -list/' \ |
---|
1865 | -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \ |
---|
1866 | -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \ |
---|
1867 | -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \ |
---|
1868 | libtool > conftest.bla |
---|
1869 | |
---|
1870 | mv conftest.bla libtool |
---|
1871 | chmod 755 libtool |
---|
1872 | ;; |
---|
1873 | *) |
---|
1874 | AC_MSG_NOTICE(Applying patches to libtool for GNU compiler) |
---|
1875 | sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ |
---|
1876 | -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ |
---|
1877 | -e 's|libext="lib"|libext="a"|' \ |
---|
1878 | libtool > conftest.bla |
---|
1879 | |
---|
1880 | mv conftest.bla libtool |
---|
1881 | chmod 755 libtool |
---|
1882 | ;; |
---|
1883 | esac ]) # COIN_PATCH_LIBTOOL_CYGWIN |
---|
1884 | |
---|
1885 | ########################################################################### |
---|
1886 | # COIN_PATCH_LIBTOOL_SOLARIS # |
---|
1887 | ########################################################################### |
---|
1888 | # If we want to do a 64-bit build with GCC on Solaris, the system search |
---|
1889 | # libraries need to point to 64-bit subdirectories. If they do not already do |
---|
1890 | # that, fix them. This patch is evolving, as are GCC compilers. GCC 4.2.1 |
---|
1891 | # reports the correct search list, given the correct call. GCC 4.1.1 does not. |
---|
1892 | # `Correct call' means -m64 is specified. `Correct search list' seems to amount |
---|
1893 | # to prepending the list of 64-bit subdirectories to the 32-bit directories. |
---|
1894 | # Both SPARC and x86 have this issue, but a different hardware id string is |
---|
1895 | # required depending on the underlying CPU. The macro executes isainfo to get |
---|
1896 | # the string. This will fail, of course, if we're cross-compiling. The |
---|
1897 | # alternative is to fail on a regular basis each time a new CPU identifier is |
---|
1898 | # needed. This macro will also fail if the search list reported with |
---|
1899 | # -print-search-dirs differs between the C, C++, and Fortran compilers; each |
---|
1900 | # have their own setting in libtool. If GCC reports the correct search list |
---|
1901 | # given the -m64 flag, the best solution is to define CC='gcc -m64', and |
---|
1902 | # similarly for CXX, F77, so that libtool will make the correct call. |
---|
1903 | ########################################################################### |
---|
1904 | AC_DEFUN([AC_COIN_PATCH_LIBTOOL_SOLARIS], |
---|
1905 | [ if test "$GCC" = yes && \ |
---|
1906 | (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then |
---|
1907 | hdwisa=`isainfo | sed -e 's/\(@<:@^ @:>@*\) .*$/\1/'` |
---|
1908 | if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then |
---|
1909 | AC_MSG_NOTICE([Applying patches to libtool for 64-bit GCC compilation]) |
---|
1910 | fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'` |
---|
1911 | fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'` |
---|
1912 | if `echo "$fixlibtmp" | $EGREP -v $hdwisa >/dev/null 2>&1` ; then |
---|
1913 | # AC_MSG_NOTICE(Compensating for broken gcc) |
---|
1914 | for lib in $fixlibtmp ; do |
---|
1915 | if test -d "${lib}${hdwisa}" ; then |
---|
1916 | syslibpath64="$syslibpath64 ${lib}${hdwisa}/" |
---|
1917 | fi |
---|
1918 | done |
---|
1919 | syslibpath64="${syslibpath64} ${fixlibtmp}" |
---|
1920 | else |
---|
1921 | syslibpath64="$fixlibtmp" |
---|
1922 | fi |
---|
1923 | sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla |
---|
1924 | mv conftest.bla libtool |
---|
1925 | chmod 755 libtool |
---|
1926 | fi |
---|
1927 | # AC_MSG_NOTICE(Result is ) |
---|
1928 | # $EGREP 'sys_lib_search_path_spec=' libtool |
---|
1929 | fi ]) # COIN_PATCH_LIBTOOL_SOLARIS |
---|
1930 | |
---|
1931 | ########################################################################### |
---|
1932 | # COIN_PROG_LIBTOOL # |
---|
1933 | ########################################################################### |
---|
1934 | |
---|
1935 | # Setup the libtool stuff together with any modifications to make it |
---|
1936 | # work on additional platforms |
---|
1937 | |
---|
1938 | AC_DEFUN([AC_COIN_LIBTOOL_WRAPPER], |
---|
1939 | [AC_BEFORE([AC_COIN_BLA],[$0]) |
---|
1940 | AC_PROG_LIBTOOL]) |
---|
1941 | |
---|
1942 | AC_DEFUN([AC_COIN_BLA],[echo bla]) |
---|
1943 | |
---|
1944 | AC_DEFUN([AC_COIN_PROG_LIBTOOL], |
---|
1945 | [# No longer needed now that CPPFLAGS is correctly set -- lh, 061214 -- |
---|
1946 | # AC_REQUIRE([AC_COIN_DLFCN_H]) |
---|
1947 | |
---|
1948 | # NEW: If libtool exists in the directory higher up, we use that one |
---|
1949 | # instead of creating a new one |
---|
1950 | |
---|
1951 | # It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED |
---|
1952 | # out in front of this macro body. You'll notice that LIBTOOL is already |
---|
1953 | # defined here. We'll have to count on this macro not being called if libtool |
---|
1954 | # already exists, or at least move the libtool fixes outside the conditional. |
---|
1955 | # AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".]) |
---|
1956 | # This test is therefore removed. -- lh, 061214 -- |
---|
1957 | # if test "x$LIBTOOL" = x; then |
---|
1958 | |
---|
1959 | # AC_MSG_NOTICE([Calling PROG_LIBTOOL.]) |
---|
1960 | AC_PROG_LIBTOOL |
---|
1961 | # AC_MSG_NOTICE([Finished PROG_LIBTOOL.]) |
---|
1962 | AC_SUBST(ac_c_preproc_warn_flag) |
---|
1963 | AC_SUBST(ac_cxx_preproc_warn_flag) |
---|
1964 | |
---|
1965 | AC_MSG_NOTICE([Build is "$build".]) |
---|
1966 | mydos2unix='| dos2unix' |
---|
1967 | case $build in |
---|
1968 | *-mingw*) |
---|
1969 | CYGPATH_W=echo |
---|
1970 | mydos2unix= |
---|
1971 | ;; |
---|
1972 | esac |
---|
1973 | |
---|
1974 | case $build in |
---|
1975 | # Here we need to check if -m32 is specified. If so, we need to correct |
---|
1976 | # sys_lib_search_path_spec |
---|
1977 | *x86_64-*) |
---|
1978 | if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then |
---|
1979 | AC_MSG_NOTICE(Applying patches to libtool for 32bit compilation) |
---|
1980 | sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla |
---|
1981 | mv conftest.bla libtool |
---|
1982 | chmod 755 libtool |
---|
1983 | fi |
---|
1984 | ;; |
---|
1985 | |
---|
1986 | *-solaris*) |
---|
1987 | AC_COIN_PATCH_LIBTOOL_SOLARIS |
---|
1988 | ;; |
---|
1989 | # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro. |
---|
1990 | *-cygwin* | *-mingw*) |
---|
1991 | AC_COIN_PATCH_LIBTOOL_CYGWIN |
---|
1992 | ;; |
---|
1993 | *-darwin*) |
---|
1994 | AC_MSG_NOTICE(Applying patches to libtool for Darwin) |
---|
1995 | sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \ |
---|
1996 | -e 's/ -dynamiclib / -dynamiclib -single_module /g' \ |
---|
1997 | libtool > conftest.bla |
---|
1998 | |
---|
1999 | mv conftest.bla libtool |
---|
2000 | chmod 755 libtool |
---|
2001 | ;; |
---|
2002 | esac |
---|
2003 | # This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of |
---|
2004 | # the macro. -- lh, 061214 -- |
---|
2005 | # fi |
---|
2006 | |
---|
2007 | # AC_MSG_NOTICE([End libtool initialisation.]) |
---|
2008 | ]) # AC_COIN_PROG_LIBTOOL |
---|
2009 | |
---|
2010 | # This is a trick to force the check for the dlfcn header to be done before |
---|
2011 | # the checks for libtool |
---|
2012 | # No longer needed now that CPPFLAGS is correctly set. -- lh, 061214 -- |
---|
2013 | # ACDEFUN([AC_COIN_DLFCN_H], |
---|
2014 | # [AC_LANG_PUSH(C) |
---|
2015 | # AC_COIN_CHECK_HEADER([dlfcn.h]) |
---|
2016 | # AC_LANG_POP(C) |
---|
2017 | # ]) # AC_COIN_DLFCN_H |
---|
2018 | |
---|
2019 | ########################################################################### |
---|
2020 | # COIN_RPATH_FLAGS # |
---|
2021 | ########################################################################### |
---|
2022 | |
---|
2023 | # This macro, in case shared objects are used, defines a variable |
---|
2024 | # RPATH_FLAGS that can be used by the linker to hardwire the library |
---|
2025 | # search path for the given directories. This is useful for example |
---|
2026 | # Makefiles |
---|
2027 | |
---|
2028 | AC_DEFUN([AC_COIN_RPATH_FLAGS], |
---|
2029 | [RPATH_FLAGS= |
---|
2030 | |
---|
2031 | if test $enable_shared = yes; then |
---|
2032 | case $build in |
---|
2033 | *-linux-*) |
---|
2034 | if test "$GXX" = "yes"; then |
---|
2035 | RPATH_FLAGS= |
---|
2036 | for dir in $1; do |
---|
2037 | RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir" |
---|
2038 | done |
---|
2039 | fi ;; |
---|
2040 | *-darwin*) |
---|
2041 | RPATH_FLAGS=nothing ;; |
---|
2042 | *-ibm-*) |
---|
2043 | case "$CXX" in |
---|
2044 | xlC* | */xlC* | mpxlC* | */mpxlC*) |
---|
2045 | RPATH_FLAGS=nothing ;; |
---|
2046 | esac ;; |
---|
2047 | *-hp-*) |
---|
2048 | RPATH_FLAGS=nothing ;; |
---|
2049 | *-mingw32) |
---|
2050 | RPATH_FLAGS=nothing ;; |
---|
2051 | *-*-solaris*) |
---|
2052 | RPATH_FLAGS= |
---|
2053 | for dir in $1; do |
---|
2054 | RPATH_FLAGS="$RPATH_FLAGS -R$dir" |
---|
2055 | done |
---|
2056 | esac |
---|
2057 | |
---|
2058 | if test "$RPATH_FLAGS" = ""; then |
---|
2059 | 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.]) |
---|
2060 | fi |
---|
2061 | if test "$RPATH_FLAGS" = "nothing"; then |
---|
2062 | RPATH_FLAGS= |
---|
2063 | fi |
---|
2064 | fi |
---|
2065 | |
---|
2066 | AC_SUBST(RPATH_FLAGS) |
---|
2067 | ]) # AC_COIN_RPATH_FLAGS |
---|
2068 | |
---|
2069 | ########################################################################### |
---|
2070 | # COIN_LINK_INPUT_CMD # |
---|
2071 | ########################################################################### |
---|
2072 | |
---|
2073 | # This macro determines which command should be used to "link" files |
---|
2074 | # that are input to the generated executables. On Windows, the codes |
---|
2075 | # using the native Windows system libraries, cannot understand symbolic |
---|
2076 | # links, and a copy should be used instead of 'ln -s'. |
---|
2077 | # The result is stored in coin_link_input_cmd |
---|
2078 | |
---|
2079 | AC_DEFUN([AC_COIN_LINK_INPUT_CMD], |
---|
2080 | [AC_REQUIRE([AC_PROG_LN_S]) |
---|
2081 | AC_BEFORE([AC_COIN_PROG_CC], [$0]) |
---|
2082 | AC_BEFORE([AC_COIN_ENABLE_DOSCOMPILE], [$0]) |
---|
2083 | |
---|
2084 | AC_MSG_CHECKING([which command should be used to link input files]) |
---|
2085 | coin_link_input_cmd="$LN_S" |
---|
2086 | if test "$enable_doscompile" = mingw; then |
---|
2087 | coin_link_input_cmd=cp |
---|
2088 | fi |
---|
2089 | case "$CC" in |
---|
2090 | cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) |
---|
2091 | coin_link_input_cmd=cp ;; |
---|
2092 | esac |
---|
2093 | AC_MSG_RESULT($coin_link_input_cmd) |
---|
2094 | ]) |
---|
2095 | |
---|
2096 | ########################################################################### |
---|
2097 | # COIN_FINALIZE # |
---|
2098 | ########################################################################### |
---|
2099 | |
---|
2100 | # This macro should be called at the very end of the configure.ac file. |
---|
2101 | # It creates the output files (by using AC_OUTPUT), and might do some other |
---|
2102 | # things (such as generating links to data files in a VPATH configuration). |
---|
2103 | # It also prints the "success" message. |
---|
2104 | # Note: If the variable coin_skip_ac_output is set to yes, then no output |
---|
2105 | # files are written. |
---|
2106 | |
---|
2107 | AC_DEFUN([AC_COIN_FINALIZE], |
---|
2108 | [ |
---|
2109 | AC_REQUIRE([AC_COIN_LINK_INPUT_CMD]) |
---|
2110 | if test x$coin_skip_ac_output != xyes; then |
---|
2111 | |
---|
2112 | FADDLIBS="$ADDLIBS" |
---|
2113 | if test x"$coin_need_flibs" = xyes; then |
---|
2114 | ADDLIBS="$ADDLIBS $FLIBS" |
---|
2115 | fi |
---|
2116 | |
---|
2117 | # library extension |
---|
2118 | AC_SUBST(LIBEXT) |
---|
2119 | case "$CC" in |
---|
2120 | cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) |
---|
2121 | LIBEXT=lib ;; |
---|
2122 | *) LIBEXT=a ;; |
---|
2123 | esac |
---|
2124 | |
---|
2125 | # Define VPATH_DISTCLEANFILES to be everything that needs to be |
---|
2126 | # cleaned for distclean in a vpath configuration |
---|
2127 | AC_SUBST(VPATH_DISTCLEANFILES) |
---|
2128 | VPATH_DISTCLEANFILES="$coin_vpath_link_files" |
---|
2129 | |
---|
2130 | # Take out subdirectories if their configuration concluded that they |
---|
2131 | # don't need to be compiled |
---|
2132 | if test x"$coin_ac_skip_subdirs" != x; then |
---|
2133 | new_subdirs= |
---|
2134 | for i in $subdirs; do |
---|
2135 | skipme=no |
---|
2136 | for j in $coin_ac_skip_subdirs; do |
---|
2137 | if test $i = $j; then |
---|
2138 | skipme=yes; |
---|
2139 | fi |
---|
2140 | done |
---|
2141 | if test $skipme = no; then |
---|
2142 | new_subdirs="$new_subdirs $i" |
---|
2143 | fi |
---|
2144 | done |
---|
2145 | subdirs="$new_subdirs" |
---|
2146 | fi |
---|
2147 | |
---|
2148 | AC_OUTPUT |
---|
2149 | |
---|
2150 | if test x"$coin_vpath_link_files" = x; then : ; else |
---|
2151 | lnkcmd="$coin_link_input_cmd" |
---|
2152 | if test "$lnkcmd" = cp; then |
---|
2153 | AC_MSG_NOTICE(Copying data files for VPATH configuration) |
---|
2154 | else |
---|
2155 | AC_MSG_NOTICE(Creating VPATH links for data files) |
---|
2156 | fi |
---|
2157 | for file in $coin_vpath_link_files; do |
---|
2158 | dir=`AS_DIRNAME(["./$file"])` |
---|
2159 | if test -d $dir; then : ; else |
---|
2160 | AS_MKDIR_P($dir) |
---|
2161 | fi |
---|
2162 | rm -f $file |
---|
2163 | $lnkcmd $abs_source_dir/$file $file |
---|
2164 | done |
---|
2165 | fi |
---|
2166 | |
---|
2167 | if test x$coin_projectdir = xyes; then |
---|
2168 | AC_MSG_NOTICE([Configuration of $PACKAGE_NAME successful]) |
---|
2169 | else |
---|
2170 | AC_MSG_NOTICE([Main configuration of $PACKAGE_NAME successful]) |
---|
2171 | fi |
---|
2172 | else |
---|
2173 | AC_MSG_NOTICE([No configuration of $PACKAGE_NAME necessary]) |
---|
2174 | fi |
---|
2175 | |
---|
2176 | ]) #AC_COIN_FINALIZE |
---|
2177 | |
---|
2178 | ########################################################################### |
---|
2179 | # COIN_VPATH_LINK # |
---|
2180 | ########################################################################### |
---|
2181 | |
---|
2182 | # This macro makes sure that a symbolic link is created to a file in |
---|
2183 | # the source code directory tree if we are in a VPATH compilation, and |
---|
2184 | # if this package is the main package to be installed |
---|
2185 | |
---|
2186 | AC_DEFUN([AC_COIN_VPATH_LINK], |
---|
2187 | [AC_REQUIRE([AC_COIN_CHECK_VPATH]) |
---|
2188 | if test $coin_vpath_config = yes; then |
---|
2189 | coin_vpath_link_files="$coin_vpath_link_files $1" |
---|
2190 | fi |
---|
2191 | ]) #AC_COIN_VPATH_LINK |
---|
2192 | |
---|
2193 | ########################################################################### |
---|
2194 | # COIN_ENABLE_GNU_PACKAGES # |
---|
2195 | ########################################################################### |
---|
2196 | |
---|
2197 | # This macro defined the --enable-gnu-packages flag. This can be used |
---|
2198 | # to check if a user wants to compile GNU packges (such as readline or |
---|
2199 | # zlib) into the executable. By default, GNU packages are disabled. |
---|
2200 | # This also defines the automake conditional COIN_ENABLE_GNU_PACKAGES |
---|
2201 | |
---|
2202 | AC_DEFUN([AC_COIN_ENABLE_GNU_PACKAGES], |
---|
2203 | [AC_ARG_ENABLE([gnu-packages], |
---|
2204 | [AC_HELP_STRING([--enable-gnu-packages], |
---|
2205 | [compile with GNU packages (disabled by default)])], |
---|
2206 | [coin_enable_gnu=$enableval], |
---|
2207 | [coin_enable_gnu=no]) |
---|
2208 | ]) # AC_COIN_ENABLE_GNU_PACKAGES |
---|
2209 | |
---|
2210 | ########################################################################### |
---|
2211 | # COIN_CHECK_GNU_ZLIB # |
---|
2212 | ########################################################################### |
---|
2213 | |
---|
2214 | # This macro checks for the libz library. |
---|
2215 | |
---|
2216 | AC_DEFUN([AC_COIN_CHECK_GNU_ZLIB], |
---|
2217 | [AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES]) |
---|
2218 | AC_BEFORE([AC_COIN_PROG_CXX],[$0]) |
---|
2219 | AC_BEFORE([AC_COIN_PROG_CC],[$0]) |
---|
2220 | AC_BEFORE([AC_COIN_PROG_F77],[$0]) |
---|
2221 | AC_BEFORE([$0],[AC_COIN_FINALIZE]) |
---|
2222 | |
---|
2223 | coin_has_zlib=no |
---|
2224 | if test $coin_enable_gnu = yes; then |
---|
2225 | AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes]) |
---|
2226 | |
---|
2227 | if test $coin_has_zlib = yes; then |
---|
2228 | AC_CHECK_LIB([z],[gzopen], |
---|
2229 | [ADDLIBS="-lz $ADDLIBS"], |
---|
2230 | [coin_has_zlib=no]) |
---|
2231 | fi |
---|
2232 | |
---|
2233 | if test $coin_has_zlib = yes; then |
---|
2234 | AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available]) |
---|
2235 | fi |
---|
2236 | fi |
---|
2237 | |
---|
2238 | AM_CONDITIONAL(COIN_HAS_ZLIB,test x$coin_has_zlib = xyes) |
---|
2239 | ]) # AC_COIN_CHECK_GNU_ZLIB |
---|
2240 | |
---|
2241 | |
---|
2242 | ########################################################################### |
---|
2243 | # COIN_CHECK_GNU_BZLIB # |
---|
2244 | ########################################################################### |
---|
2245 | |
---|
2246 | # This macro checks for the libbz2 library. |
---|
2247 | |
---|
2248 | AC_DEFUN([AC_COIN_CHECK_GNU_BZLIB], |
---|
2249 | [AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES]) |
---|
2250 | AC_BEFORE([AC_COIN_PROG_CXX],[$0]) |
---|
2251 | AC_BEFORE([AC_COIN_PROG_CC],[$0]) |
---|
2252 | AC_BEFORE([AC_COIN_PROG_F77],[$0]) |
---|
2253 | AC_BEFORE([$0],[AC_COIN_FINALIZE]) |
---|
2254 | |
---|
2255 | coin_has_bzlib=no |
---|
2256 | if test $coin_enable_gnu = yes; then |
---|
2257 | AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes]) |
---|
2258 | |
---|
2259 | if test $coin_has_bzlib = yes; then |
---|
2260 | AC_CHECK_LIB([bz2],[BZ2_bzReadOpen], |
---|
2261 | [ADDLIBS="-lbz2 $ADDLIBS"], |
---|
2262 | [coin_has_bzlib=no]) |
---|
2263 | fi |
---|
2264 | |
---|
2265 | if test $coin_has_bzlib = yes; then |
---|
2266 | AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available]) |
---|
2267 | fi |
---|
2268 | fi |
---|
2269 | ]) # AC_COIN_CHECK_GNU_BZLIB |
---|
2270 | |
---|
2271 | |
---|
2272 | ########################################################################### |
---|
2273 | # COIN_CHECK_GNU_READLINE # |
---|
2274 | ########################################################################### |
---|
2275 | |
---|
2276 | # This macro checks for GNU's readline. It verifies that the header |
---|
2277 | # readline/readline.h is available, and that the -lreadline library |
---|
2278 | # contains "readline". It is assumed that #include <stdio.h> is included |
---|
2279 | # in the source file before the #include<readline/readline.h> |
---|
2280 | |
---|
2281 | AC_DEFUN([AC_COIN_CHECK_GNU_READLINE], |
---|
2282 | [AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES]) |
---|
2283 | AC_BEFORE([AC_COIN_PROG_CXX],[$0]) |
---|
2284 | AC_BEFORE([AC_COIN_PROG_CC],[$0]) |
---|
2285 | AC_BEFORE([AC_COIN_PROG_F77],[$0]) |
---|
2286 | AC_BEFORE([$0],[AC_COIN_FINALIZE]) |
---|
2287 | |
---|
2288 | coin_has_readline=no |
---|
2289 | if test $coin_enable_gnu = yes; then |
---|
2290 | AC_COIN_CHECK_HEADER([readline/readline.h], |
---|
2291 | [coin_has_readline=yes],[], |
---|
2292 | [#include <stdio.h>]) |
---|
2293 | |
---|
2294 | coin_save_LIBS="$LIBS" |
---|
2295 | LIBS= |
---|
2296 | # First we check if tputs and friends are available |
---|
2297 | if test $coin_has_readline = yes; then |
---|
2298 | AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[], |
---|
2299 | [coin_has_readline=no]) |
---|
2300 | fi |
---|
2301 | |
---|
2302 | # Now we check for readline |
---|
2303 | if test $coin_has_readline = yes; then |
---|
2304 | AC_CHECK_LIB([readline],[readline], |
---|
2305 | [ADDLIBS="-lreadline $LIBS $ADDLIBS"], |
---|
2306 | [coin_has_readline=no]) |
---|
2307 | fi |
---|
2308 | |
---|
2309 | if test $coin_has_readline = yes; then |
---|
2310 | AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available]) |
---|
2311 | fi |
---|
2312 | |
---|
2313 | LIBS="$coin_save_LIBS" |
---|
2314 | fi |
---|
2315 | ]) # AC_COIN_CHECK_GNU_READLINE |
---|
2316 | |
---|
2317 | ########################################################################### |
---|
2318 | # COIN_DATA_PATH # |
---|
2319 | ########################################################################### |
---|
2320 | |
---|
2321 | # This macro defines a preprocessor macro with the absolute path to a |
---|
2322 | # subdirectory of Data. The argument of this macro is the name of the |
---|
2323 | # subdirectory (in correct case), and the name of the macro is |
---|
2324 | # COIN_DATA_DIR_PATH, where dir is replaced by the capitalized name of |
---|
2325 | # the directory. The path ends with a separator ("/" for linux and |
---|
2326 | # '\\' for Windows). The default value for this path can be |
---|
2327 | # overwritten with the input variable with the same name |
---|
2328 | # (COIN_DATA_DIR_PATH). At this point we chech only for the |
---|
2329 | # $srcdir/../Data subdirectory. |
---|
2330 | |
---|
2331 | AC_DEFUN([AC_COIN_DATA_PATH], |
---|
2332 | [AC_MSG_CHECKING([absolute path to data directory $1]) |
---|
2333 | |
---|
2334 | AC_ARG_VAR(m4_toupper(COIN_DATA_$1_PATH),[Set to absolute path to Data/$1 subdirectory]) |
---|
2335 | |
---|
2336 | if test x"$m4_toupper(COIN_DATA_$1_PATH)" = x; then |
---|
2337 | m4_toupper(COIN_DATA_$1_PATH)=`cd $srcdir/../Data/$1; pwd` |
---|
2338 | fi |
---|
2339 | |
---|
2340 | # Under Cygwin, use Windows path. Add separator |
---|
2341 | case $build in |
---|
2342 | *-cygwin*) |
---|
2343 | m4_toupper(COIN_DATA_$1_PATH)=`cygwin -w $m4_toupper(COIN_DATA_$1_PATH)`\\ |
---|
2344 | ;; |
---|
2345 | *) |
---|
2346 | m4_toupper(COIN_DATA_$1_PATH)="$m4_toupper(COIN_DATA_$1_PATH)/" |
---|
2347 | ;; |
---|
2348 | esac |
---|
2349 | |
---|
2350 | if test -r $m4_toupper(COIN_DATA_$1_PATH); then |
---|
2351 | AC_DEFINE_UNQUOTED(m4_toupper(COIN_DATA_$1_PATH),["$m4_toupper(COIN_DATA_$1_PATH)"], |
---|
2352 | [Define to absolute path for Data subdirectory $1]) |
---|
2353 | AC_MSG_RESULT($m4_toupper(COIN_DATA_$1_PATH)) |
---|
2354 | else |
---|
2355 | AC_MSG_ERROR(Directory $m4_toupper(COIN_DATA_$1_PATH) does not exist) |
---|
2356 | fi |
---|
2357 | ]) # AC_COIN_HAS_DATA |
---|
2358 | |
---|
2359 | ########################################################################### |
---|
2360 | # COIN_LINK_FROM_FILELIST # |
---|
2361 | ########################################################################### |
---|
2362 | |
---|
2363 | # This macro creates links (or copies, if necessary) to files listed |
---|
2364 | # as content in a text file (second argument) into a target directory |
---|
2365 | # (first argument), which is created if it doesn't exist yet. If s link |
---|
2366 | # already exists, nothing happens. |
---|
2367 | |
---|
2368 | AC_DEFUN([AC_COIN_LINKCOPY_FROM_FILELIST], |
---|
2369 | [cmd="$3" |
---|
2370 | if test -e $srcdir/$2 ; then |
---|
2371 | my_target_dir="$1" |
---|
2372 | my_link_files=`cat $srcdir/$2` |
---|
2373 | my_dirname=`AS_DIRNAME($2)` |
---|
2374 | # if test -e $my_target_dir; then : ; else |
---|
2375 | # AS_MKDIR_P($my_target_dir) |
---|
2376 | # fi |
---|
2377 | for i in $my_link_files; do |
---|
2378 | #rm -rf $my_target_dir/$i |
---|
2379 | if test -e $my_target_dir/$i; then : ; else |
---|
2380 | dirn2=`AS_DIRNAME($my_target_dir/$i)` |
---|
2381 | if test -e $dirn2; then : ; else |
---|
2382 | AS_MKDIR_P($dirn2) |
---|
2383 | fi |
---|
2384 | $cmd $abs_source_dir/$my_dirname/$i $my_target_dir/$i |
---|
2385 | fi |
---|
2386 | done |
---|
2387 | else |
---|
2388 | AC_MSG_WARN([File list file $2 missing!]) |
---|
2389 | fi |
---|
2390 | ]) |
---|
2391 | |
---|
2392 | AC_DEFUN([AC_COIN_LINK_FROM_FILELIST], |
---|
2393 | [ |
---|
2394 | AC_REQUIRE([AC_COIN_LINK_INPUT_CMD]) |
---|
2395 | echo Creating links in $1 ... |
---|
2396 | AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, $coin_link_input_cmd) |
---|
2397 | ]) |
---|
2398 | |
---|
2399 | ########################################################################### |
---|
2400 | # COIN_COPY_FROM_FILELIST # |
---|
2401 | ########################################################################### |
---|
2402 | |
---|
2403 | # Like COIN_LINK_FROM_FILELIST, but copies the files. |
---|
2404 | |
---|
2405 | AC_DEFUN([AC_COIN_COPY_FROM_FILELIST], |
---|
2406 | [ |
---|
2407 | echo Creating copies in $1 ... |
---|
2408 | AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, [cp]) |
---|
2409 | ]) |
---|
2410 | |
---|
2411 | ########################################################################### |
---|
2412 | # COIN_EXAMPLE_FILES # |
---|
2413 | ########################################################################### |
---|
2414 | |
---|
2415 | # This macro determines the names of the example files (using the |
---|
2416 | # argument in an "ls" command) and sets up the variables EXAMPLE_FILES |
---|
2417 | # and EXAMPLE_CLEAN_FILES. If this is a VPATH configuration, it also |
---|
2418 | # creates soft links to the example files. |
---|
2419 | |
---|
2420 | AC_DEFUN([AC_COIN_EXAMPLE_FILES], |
---|
2421 | [AC_REQUIRE([AC_COIN_CHECK_GNU_ZLIB]) |
---|
2422 | AC_REQUIRE([AC_COIN_CHECK_VPATH]) |
---|
2423 | files=`cd $srcdir; ls $1` |
---|
2424 | # We need to do the following loop to make sure that are no newlines |
---|
2425 | # in the variable |
---|
2426 | for file in $files; do |
---|
2427 | EXAMPLE_FILES="$EXAMPLE_FILES $file" |
---|
2428 | done |
---|
2429 | if test $coin_vpath_config = yes; then |
---|
2430 | lnkcmd= |
---|
2431 | if test "$enable_doscompile" != no; then |
---|
2432 | lnkcmd=cp |
---|
2433 | fi |
---|
2434 | case "$CC" in |
---|
2435 | cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) |
---|
2436 | lnkcmd=cp ;; |
---|
2437 | esac |
---|
2438 | if test "$lnkcmd" = cp; then |
---|
2439 | AC_MSG_NOTICE([Copying example files ($1)]) |
---|
2440 | else |
---|
2441 | AC_PROG_LN_S |
---|
2442 | AC_MSG_NOTICE([Creating links to the example files ($1)]) |
---|
2443 | lnkcmd="$LN_S" |
---|
2444 | fi |
---|
2445 | for file in $EXAMPLE_FILES; do |
---|
2446 | rm -f $file |
---|
2447 | $lnkcmd $srcdir/$file $file |
---|
2448 | done |
---|
2449 | EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES $1" |
---|
2450 | else |
---|
2451 | EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES" |
---|
2452 | fi |
---|
2453 | |
---|
2454 | # In case there are compressed files, we create a variable with the |
---|
2455 | # uncompressed names |
---|
2456 | EXAMPLE_UNCOMPRESSED_FILES= |
---|
2457 | for file in $EXAMPLE_FILES; do |
---|
2458 | case $file in |
---|
2459 | *.gz) |
---|
2460 | EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`" |
---|
2461 | ;; |
---|
2462 | esac |
---|
2463 | done |
---|
2464 | |
---|
2465 | AC_SUBST(EXAMPLE_UNCOMPRESSED_FILES) |
---|
2466 | AC_SUBST(EXAMPLE_FILES) |
---|
2467 | AC_SUBST(EXAMPLE_CLEAN_FILES) |
---|
2468 | ]) #AC_COIN_EXAMPLE_FILES |
---|
2469 | |
---|
2470 | ########################################################################### |
---|
2471 | # COIN_HAS_PROJECT # |
---|
2472 | ########################################################################### |
---|
2473 | |
---|
2474 | # This macro sets up usage of a Coin package. It defines the |
---|
2475 | # PKGSRCDIR and PKGOBJDIR variables, refering to the main source and |
---|
2476 | # object directory of the package, respectively. It also defines |
---|
2477 | # a COIN_HAS_PKG preprocessor macro and makefile conditional. The |
---|
2478 | # argument should be the name (Pkg) of the project (in correct lower |
---|
2479 | # and upper case) |
---|
2480 | |
---|
2481 | AC_DEFUN([AC_COIN_HAS_PROJECT], |
---|
2482 | [AC_MSG_CHECKING([for COIN project $1]) |
---|
2483 | |
---|
2484 | # First check, if the sub-project is actually available (ToDo: allow |
---|
2485 | # other locations) |
---|
2486 | |
---|
2487 | m4_tolower(coin_has_$1)=unavailable |
---|
2488 | if test x"$COIN_SKIP_PROJECTS" != x; then |
---|
2489 | for dir in $COIN_SKIP_PROJECTS; do |
---|
2490 | if test $dir = $1; then |
---|
2491 | m4_tolower(coin_has_$1)=skipping |
---|
2492 | fi |
---|
2493 | done |
---|
2494 | fi |
---|
2495 | |
---|
2496 | if test $m4_tolower(coin_has_$1) != skipping; then |
---|
2497 | if test $PACKAGE_TARNAME = m4_tolower($1); then |
---|
2498 | m4_tolower(coin_has_$1)=. |
---|
2499 | else |
---|
2500 | if test -d $srcdir/../$1; then |
---|
2501 | m4_tolower(coin_has_$1)=../$1 |
---|
2502 | fi |
---|
2503 | fi |
---|
2504 | fi |
---|
2505 | |
---|
2506 | if test $m4_tolower(coin_has_$1) != unavailable && |
---|
2507 | test $m4_tolower(coin_has_$1) != skipping; then |
---|
2508 | # Set the #define if the component is available |
---|
2509 | AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is used]) |
---|
2510 | |
---|
2511 | # Set the variables for source and object code location |
---|
2512 | AC_SUBST(m4_toupper($1SRCDIR)) |
---|
2513 | m4_toupper($1SRCDIR)=`cd $srcdir/$m4_tolower(coin_has_$1); pwd` |
---|
2514 | AC_SUBST(m4_toupper($1OBJDIR)) |
---|
2515 | m4_toupper($1OBJDIR)=`pwd`/$m4_tolower(coin_has_$1) |
---|
2516 | AC_SUBST(m4_toupper($1DOCDIR)) |
---|
2517 | m4_toupper($1DOCDIR)=$abs_lib_dir/../share/doc/coin/$1 |
---|
2518 | fi |
---|
2519 | |
---|
2520 | # Define the Makefile conditional |
---|
2521 | AM_CONDITIONAL(m4_toupper(COIN_HAS_$1), |
---|
2522 | [test $m4_tolower(coin_has_$1) != unavailable && |
---|
2523 | test $m4_tolower(coin_has_$1) != skipping]) |
---|
2524 | AC_MSG_RESULT([$m4_tolower(coin_has_$1)]) |
---|
2525 | ]) # AC_COIN_HAS_PROJECT |
---|
2526 | |
---|
2527 | ########################################################################### |
---|
2528 | # COIN_HAS_USER_LIBRARY # |
---|
2529 | ########################################################################### |
---|
2530 | # This macro sets up usage of a user library with header files. The assumption |
---|
2531 | # is that the header file(s) and library do not reside in standard system |
---|
2532 | # directories, hence both the include directory and link flags must be |
---|
2533 | # specified. There are two mandatory arguments and two optional arguments. |
---|
2534 | # |
---|
2535 | # The first argument (mandatory) should be a name (LibraryName) for the |
---|
2536 | # library. The second argument (mandatory) should be an abbreviation in |
---|
2537 | # upper case letters (LBRY) for the library. Ultimately, the macro will |
---|
2538 | # specify two variables, LBRYINCDIR and LBRYLIB, to be substituted in files |
---|
2539 | # generated during configuration; a preprocessor symbol COIN_HAS_LBRY; and a |
---|
2540 | # matching automake conditional COIN_HAS_LBRY. LBRYINCDIR should specify the |
---|
2541 | # directory containing include files for the library. LBRYLIB should specify |
---|
2542 | # the flags necessary to link to the library. A variable coin_has_lbry will |
---|
2543 | # be set to true or false, as appropriate. A variable lbry_libcheck will be |
---|
2544 | # be set to yes or no; no indicates link checks should not be attempted. |
---|
2545 | # |
---|
2546 | # The macro defines three configure arguments, --with-libraryname-incdir, |
---|
2547 | # --with-libraryname-lib, and --disable-libraryname-libcheck, by converting |
---|
2548 | # LibraryName to lower case. |
---|
2549 | # |
---|
2550 | # LBRYINCDIR and LBRYLIB can be specified as environment variables or as |
---|
2551 | # part of the configure command using --with-libraryname-incdir and |
---|
2552 | # --with-libraryname-lib, respectively. Command line arguments override |
---|
2553 | # environment variables. |
---|
2554 | # |
---|
2555 | # If a third argument is given, it should specify a file in LBRYINCDIR. The |
---|
2556 | # macro will check for the presence of the file. If a fourth argument is given, |
---|
2557 | # it should specify a function name, `fname'. The macro will attempt to link a |
---|
2558 | # trivial program containing a parameterless call to the function, `fname()', |
---|
2559 | # using the LBRYLIB flags. The link check uses C as the language; this has been |
---|
2560 | # adequate to date but has limitations. It is possible to disable the link |
---|
2561 | # check by specifying --disable-libraryname-libcheck. This is a workaround for |
---|
2562 | # instances where the link check does not work properly, for whatever reason. |
---|
2563 | # If you're trying to link to a Fortran library, consider using F77_FUNC or |
---|
2564 | # FC_FUNC to obtain a mangled fname appropriate for use from C code. For a C++ |
---|
2565 | # library, you're on your own unless the library declares some function with |
---|
2566 | # extern "C" linkage. Otherwise, you'll have to somehow find the mangled C++ |
---|
2567 | # name. |
---|
2568 | |
---|
2569 | AC_DEFUN([AC_COIN_HAS_USER_LIBRARY], |
---|
2570 | [ AC_REQUIRE([AC_COIN_PROJECTDIR_INIT]) |
---|
2571 | AC_MSG_CHECKING(if user provides library for $1) |
---|
2572 | |
---|
2573 | # Check for header file directory |
---|
2574 | |
---|
2575 | AC_ARG_WITH(m4_tolower($1)-incdir, |
---|
2576 | AS_HELP_STRING([--with-m4_tolower($1)-incdir], |
---|
2577 | [specify the header file directory for library $1]), |
---|
2578 | [$2INCDIR=`cd $withval; pwd`]) |
---|
2579 | |
---|
2580 | # Check for library directory |
---|
2581 | |
---|
2582 | AC_ARG_WITH(m4_tolower($1)-lib, |
---|
2583 | AS_HELP_STRING([--with-m4_tolower($1)-lib], |
---|
2584 | [specify the flags used to link with the library $1]), |
---|
2585 | [$2LIB=$withval]) |
---|
2586 | |
---|
2587 | # Switch to disable library check if requested |
---|
2588 | |
---|
2589 | AC_ARG_ENABLE(m4_tolower($1)-libcheck, |
---|
2590 | AS_HELP_STRING([--enable-m4_tolower($1)-libcheck], |
---|
2591 | [use disable-m4_tolower($1)-libcheck to skip the link |
---|
2592 | check at configuration time]), |
---|
2593 | [m4_tolower($1)_libcheck=$enableval], |
---|
2594 | [m4_tolower($1)_libcheck=yes]) |
---|
2595 | |
---|
2596 | # At this point, if we're going to use the library, both LBRYINCDIR and |
---|
2597 | # LBRYLIB must be defined and not empty. |
---|
2598 | |
---|
2599 | if test x"$$2INCDIR" != x || test x"$$2LIB" != x; then |
---|
2600 | if test x"$$2INCDIR" = x || test x"$$2LIB" = x; then |
---|
2601 | AC_MSG_ERROR([You need to specify both an include directory and link flags to use library $1. Use --with-m4_tolower($1)-incdir of environment variable $$2INCDIR to specify the include directory. Use --with-m4_tolower($1)-lib or environment variable $$2LIB to specify link flags.]) |
---|
2602 | fi |
---|
2603 | m4_tolower(coin_has_$2)=true |
---|
2604 | AC_MSG_RESULT(yes) |
---|
2605 | else |
---|
2606 | m4_tolower(coin_has_$2)=false |
---|
2607 | AC_MSG_RESULT(no) |
---|
2608 | fi |
---|
2609 | |
---|
2610 | # If we have instructions for use, consider header and link checks. |
---|
2611 | |
---|
2612 | if test $m4_tolower(coin_has_$2) = true; then |
---|
2613 | |
---|
2614 | # If argument 3 (file) is given, check for the file. Typically this will be a |
---|
2615 | # header file, but that's not assumed. |
---|
2616 | |
---|
2617 | m4_ifval([$3], |
---|
2618 | [AC_COIN_CHECK_FILE([$$2INCDIR/$3],[], |
---|
2619 | [AC_MSG_ERROR([Cannot find file $3 in $$2INCDIR])])]) |
---|
2620 | |
---|
2621 | # Now see if we can link the function. There are arguments for and against |
---|
2622 | # assuming argument 3 is a header file declaring the function. A correct |
---|
2623 | # function declaration is the main argument in favour. Having to cope with |
---|
2624 | # possible dependencies or other oddities are the main arguments against. |
---|
2625 | # Force the use of C as the best single choice amongst C++, C, and Fortran. |
---|
2626 | # Obviously, this has limits. |
---|
2627 | |
---|
2628 | m4_ifvaln([$4], |
---|
2629 | [if test x"$m4_tolower($1)_libcheck" != xno; then |
---|
2630 | coin_save_LIBS="$LIBS" |
---|
2631 | LIBS="$$2LIB $ADDLIBS" |
---|
2632 | coin_$2_link=no |
---|
2633 | AC_LANG_PUSH(C) |
---|
2634 | for fnm in $4 ; do |
---|
2635 | AC_MSG_CHECKING([whether symbol $fnm is available with $2]) |
---|
2636 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[$fnm()]])], |
---|
2637 | [AC_MSG_RESULT(yes) |
---|
2638 | coin_$2_link=yes |
---|
2639 | break], |
---|
2640 | [AC_MSG_RESULT(no)]) |
---|
2641 | done |
---|
2642 | AC_LANG_POP(C) |
---|
2643 | if test x"$coin_$2_link" = xyes ; then |
---|
2644 | LIBS="$coin_save_LIBS" |
---|
2645 | else |
---|
2646 | AC_MSG_ERROR([Cannot find symbol(s) $4 with $2]) |
---|
2647 | fi |
---|
2648 | fi]) |
---|
2649 | |
---|
2650 | # If we make it this far, we've verified the file and linked the function. Add |
---|
2651 | # the necessary link flags to ADDLIBS and define the preprocessor symbol |
---|
2652 | # COIN_HAS_LBRY. |
---|
2653 | |
---|
2654 | ADDLIBS="$$2LIB $ADDLIBS" |
---|
2655 | AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is available]) |
---|
2656 | fi |
---|
2657 | |
---|
2658 | # Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the |
---|
2659 | # automake conditional. These actions must occur unconditionally. |
---|
2660 | |
---|
2661 | AC_SUBST($2INCDIR) |
---|
2662 | AC_SUBST($2LIB) |
---|
2663 | AM_CONDITIONAL(COIN_HAS_$2, test $m4_tolower(coin_has_$2) = true) |
---|
2664 | ]) #AC_COIN_HAS_USER_LIBRARY |
---|
2665 | |
---|
2666 | ########################################################################### |
---|
2667 | # COIN_HAS_ASL # |
---|
2668 | ########################################################################### |
---|
2669 | |
---|
2670 | # This macro checks if the user has provide arguments that say where |
---|
2671 | # the precompiled ASL files should be found (with the --with-asldir |
---|
2672 | # flag). If this is not the case, we check if the ThirdParty/ASL |
---|
2673 | # directory has been configured, which indicates that the files will |
---|
2674 | # be in that directory and can be used. |
---|
2675 | |
---|
2676 | AC_DEFUN([AC_COIN_HAS_ASL], |
---|
2677 | [coin_aslobjdir=../ThirdParty/ASL |
---|
2678 | coin_aslsrcdir=$srcdir/$coin_aslobjdir |
---|
2679 | |
---|
2680 | # Determine the name of the ASL library |
---|
2681 | case "$CC" in |
---|
2682 | cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) |
---|
2683 | ampllib=amplsolv.lib ;; |
---|
2684 | *) |
---|
2685 | ampllib=amplsolver.a ;; |
---|
2686 | esac |
---|
2687 | |
---|
2688 | AC_ARG_WITH([asldir], |
---|
2689 | AC_HELP_STRING([--with-asldir], |
---|
2690 | [specify path to AMPL solver directory (or BUILD for compilation, or "no" for disabling AMPL)]), |
---|
2691 | [use_asldir=$withval], [use_asldir=]) |
---|
2692 | |
---|
2693 | if test "$use_asldir" = BUILD; then |
---|
2694 | if test "$PACKAGE_NAME" != ThirdPartyASL; then |
---|
2695 | # If we are configuring ThirdParty/ASL, don't check |
---|
2696 | if test -r $coin_aslobjdir/.MakeOk; then :; else |
---|
2697 | AC_MSG_ERROR([option \"BUILD\" specified for asldir, but directory is not configure (sources missing?)]) |
---|
2698 | fi |
---|
2699 | fi |
---|
2700 | elif test -z "$use_asldir"; then |
---|
2701 | # try to find sources - if not given don't compile |
---|
2702 | if test "$PACKAGE_NAME" != ThirdPartyASL; then |
---|
2703 | if test -r $coin_aslobjdir/.MakeOk; then |
---|
2704 | use_asldir=BUILD |
---|
2705 | else |
---|
2706 | use_asldir=no |
---|
2707 | fi |
---|
2708 | else |
---|
2709 | use_asldir=no |
---|
2710 | fi |
---|
2711 | elif test "$use_asldir" != "no"; then |
---|
2712 | AC_COIN_CHECK_FILE([$use_asldir/$ampllib],[], |
---|
2713 | [AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but library missing])]) |
---|
2714 | AC_COIN_CHECK_FILE([$use_asldir/asl.h],[], |
---|
2715 | [AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but header files are missing])]) |
---|
2716 | use_asldir=`cd $use_asldir; pwd` |
---|
2717 | case $build in |
---|
2718 | *-cygwin*) use_asldir=`cygpath -w $use_asldir | sed -e sX\\\\\\\\X/Xg` ;; |
---|
2719 | esac |
---|
2720 | fi |
---|
2721 | |
---|
2722 | # Variable containing ASL library (including full path) |
---|
2723 | AC_SUBST(ASLLIB) |
---|
2724 | # Variable containing flags for including ASL header files |
---|
2725 | AC_SUBST(ASL_CPPFLAGS) |
---|
2726 | |
---|
2727 | if test "$use_asldir" = BUILD; then |
---|
2728 | coin_aslobjdir=`cd $coin_aslobjdir; pwd` |
---|
2729 | ASLLIB=`$CYGPATH_W $coin_aslobjdir/$ampllib | sed -e sX\\\\\\\\X/Xg` |
---|
2730 | coin_aslsrcdir=`cd $coin_aslsrcdir; pwd` |
---|
2731 | ASL_CPPFLAGS="-I"`$CYGPATH_W $coin_aslobjdir | sed -e sX\\\\\\\\X/Xg`" -I"`$CYGPATH_W $coin_aslsrcdir/solvers | sed -e sX\\\\\\\\X/Xg` |
---|
2732 | elif test "$use_asldir" != no; then |
---|
2733 | ASLLIB=`$CYGPATH_W $use_asldir/$ampllib | sed -e sX\\\\\\\\X/Xg` |
---|
2734 | ASL_CPPFLAGS="-I"`$CYGPATH_W $use_asldir | sed -e sX\\\\\\\\X/Xg` |
---|
2735 | fi |
---|
2736 | |
---|
2737 | if test "$use_asldir" != no; then |
---|
2738 | AC_LANG_PUSH(C) |
---|
2739 | AC_CHECK_LIB(dl,[dlopen],[ASLLIB="$ASLLIB -ldl"],[]) |
---|
2740 | coin_has_asl=yes |
---|
2741 | AC_DEFINE([COIN_HAS_ASL],[1], |
---|
2742 | [If defined, the Ampl Solver Library is available.]) |
---|
2743 | AC_LANG_POP(C) |
---|
2744 | else |
---|
2745 | coin_has_asl=no |
---|
2746 | fi |
---|
2747 | AM_CONDITIONAL(COIN_HAS_ASL, test $coin_has_asl = yes) |
---|
2748 | ]) # AC_COIN_HAS_ASL |
---|
2749 | |
---|
2750 | ########################################################################### |
---|
2751 | # COIN_TRY_FLINK # |
---|
2752 | ########################################################################### |
---|
2753 | |
---|
2754 | # Auxilliary macro to test if a Fortran function name can be linked, |
---|
2755 | # given the current settings of LIBS. We determine from the context, what |
---|
2756 | # the currently active programming language is, and cast the name accordingly. |
---|
2757 | # The first argument is the name of the function/subroutine, in small letters, |
---|
2758 | # the second argument are the actions taken when the test works, and the |
---|
2759 | # third argument are the actions taken if the test fails. |
---|
2760 | |
---|
2761 | AC_DEFUN([AC_COIN_TRY_FLINK], |
---|
2762 | [case $ac_ext in |
---|
2763 | f) |
---|
2764 | AC_TRY_LINK(,[ call $1],[$2],[$3]) |
---|
2765 | ;; |
---|
2766 | c) |
---|
2767 | AC_F77_FUNC($1,cfunc$1) |
---|
2768 | if test x"$coin_need_flibs" = xyes; then |
---|
2769 | flink_try=no; |
---|
2770 | else |
---|
2771 | AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()], |
---|
2772 | [flink_try=yes],[flink_try=no]) |
---|
2773 | fi |
---|
2774 | if test $flink_try = yes; then |
---|
2775 | $2 |
---|
2776 | else |
---|
2777 | if test x"$FLIBS" != x; then |
---|
2778 | flink_save_libs="$LIBS" |
---|
2779 | LIBS="$LIBS $FLIBS" |
---|
2780 | AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()], |
---|
2781 | [LIBS="$flink_save_libs" |
---|
2782 | $2 |
---|
2783 | coin_need_flibs=yes], |
---|
2784 | [LIBS="$flink_save_libs" |
---|
2785 | $3]) |
---|
2786 | else |
---|
2787 | $3 |
---|
2788 | fi |
---|
2789 | fi |
---|
2790 | ;; |
---|
2791 | cc|cpp) |
---|
2792 | AC_F77_FUNC($1,cfunc$1) |
---|
2793 | if test x"$coin_need_flibs" = xyes; then |
---|
2794 | flink_try=no; |
---|
2795 | else |
---|
2796 | AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()], |
---|
2797 | [flink_try=yes],[flink_try=no]) |
---|
2798 | fi |
---|
2799 | if test $flink_try = yes; then |
---|
2800 | $2 |
---|
2801 | else |
---|
2802 | if test x"$FLIBS" != x; then |
---|
2803 | flink_save_libs="$LIBS" |
---|
2804 | LIBS="$LIBS $FLIBS" |
---|
2805 | AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()], |
---|
2806 | [LIBS="$flink_save_libs" |
---|
2807 | $2 |
---|
2808 | coin_need_flibs=yes], |
---|
2809 | [LIBS="$flink_save_libs" |
---|
2810 | $3]) |
---|
2811 | else |
---|
2812 | $3 |
---|
2813 | fi |
---|
2814 | fi |
---|
2815 | ;; |
---|
2816 | esac |
---|
2817 | ]) # AC_COIN_TRY_FLINK |
---|
2818 | |
---|
2819 | ########################################################################### |
---|
2820 | # COIN_HAS_BLAS # |
---|
2821 | ########################################################################### |
---|
2822 | |
---|
2823 | # This macro checks for a library containing the BLAS library. It |
---|
2824 | # tries standard libraries, and if none is found to be working, it |
---|
2825 | # checks whether the BLAS ThirdParty/Blas directory has been configured. |
---|
2826 | # It adds to ADDLIBS any flags required to link with an externally provided |
---|
2827 | # BLAS. It defines the makefile conditional and preprocessor macro |
---|
2828 | # COIN_HAS_BLAS, if blas is available, and it defines the makefile conditional |
---|
2829 | # COIN_BUILD_BLAS, if blas is compiled within COIN. |
---|
2830 | |
---|
2831 | AC_DEFUN([AC_COIN_HAS_BLAS], |
---|
2832 | [if test "$PACKAGE_NAME" = ThirdPartyBlas || test "$PACKAGE_NAME" = ThirdPartyLapack || test "$PACKAGE_NAME" = ThirdPartyMumps; then |
---|
2833 | coin_blasobjdir=../Blas |
---|
2834 | else |
---|
2835 | coin_blasobjdir=../ThirdParty/Blas |
---|
2836 | fi |
---|
2837 | coin_blassrcdir=$srcdir/$coin_blasobjdir |
---|
2838 | |
---|
2839 | AC_ARG_WITH([blas], |
---|
2840 | AC_HELP_STRING([--with-blas], |
---|
2841 | [specify BLAS library (or BUILD for compilation)]), |
---|
2842 | [use_blas=$withval], [use_blas=]) |
---|
2843 | |
---|
2844 | MAKEOKFILE=.MakeOk |
---|
2845 | # Check if user supplied option makes sense |
---|
2846 | if test x"$use_blas" != x; then |
---|
2847 | if test "$use_blas" = "BUILD"; then |
---|
2848 | # Don't check for course code if this is executed in ThirdParty/Blas |
---|
2849 | if test "$PACKAGE_NAME" != ThirdPartyBlas; then |
---|
2850 | if test -r $coin_blasobjdir/.MakeOk; then :; else |
---|
2851 | AC_MSG_ERROR([option \"BUILD\" specified for Blas, but $coin_blasobjdir directory is not properly configured]) |
---|
2852 | fi |
---|
2853 | fi |
---|
2854 | elif test "$use_blas" != no ; then |
---|
2855 | AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works]) |
---|
2856 | LIBS="$use_blas $LIBS" |
---|
2857 | ADDLIBS="$use_blas $ADDLIBS" |
---|
2858 | AC_COIN_TRY_FLINK([daxpy], |
---|
2859 | [AC_MSG_RESULT([yes])], |
---|
2860 | [AC_MSG_RESULT([no]) |
---|
2861 | AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])]) |
---|
2862 | fi |
---|
2863 | else |
---|
2864 | # Try to autodetect the library for blas based on build system |
---|
2865 | #AC_MSG_CHECKING([default locations for BLAS]) |
---|
2866 | skip_lblas_check=no |
---|
2867 | case $build in |
---|
2868 | *-sgi-*) |
---|
2869 | SAVE_LIBS="$LIBS" |
---|
2870 | AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS]) |
---|
2871 | LIBS="-lcomplib.sgimath $LIBS" |
---|
2872 | AC_COIN_TRY_FLINK([daxpy], |
---|
2873 | [AC_MSG_RESULT([yes]) |
---|
2874 | use_blas=-lcomplib.sgimath; |
---|
2875 | ADDLIBS="-lcomplib.sgimath $ADDLIBS"], |
---|
2876 | [AC_MSG_RESULT([no]) |
---|
2877 | SAVE_LIBS="$LIBS"]) |
---|
2878 | ;; |
---|
2879 | |
---|
2880 | # Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio |
---|
2881 | # cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't |
---|
2882 | # recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims |
---|
2883 | # that CC and cc will understand -library in Studio 13. The main extra |
---|
2884 | # function of -xlic_lib and -library is to arrange for the Fortran run-time |
---|
2885 | # libraries to be linked for C++ and C. We can arrange that explicitly. |
---|
2886 | *-*-solaris*) |
---|
2887 | SAVE_LIBS="$LIBS" |
---|
2888 | AC_MSG_CHECKING([for BLAS in libsunperf]) |
---|
2889 | LIBS="-lsunperf $FLIBS $LIBS" |
---|
2890 | AC_COIN_TRY_FLINK([daxpy], |
---|
2891 | [AC_MSG_RESULT([yes]) |
---|
2892 | use_blas='-lsunperf' |
---|
2893 | ADDLIBS="-lsunperf $ADDLIBS" |
---|
2894 | coin_need_flibs=yes], |
---|
2895 | [AC_MSG_RESULT([no]) |
---|
2896 | LIBS="$SAVE_LIBS"]) |
---|
2897 | ;; |
---|
2898 | *-cygwin* | *-mingw*) |
---|
2899 | # On cygwin, consider -lblas only if doscompile is disabled. The prebuilt |
---|
2900 | # library will want to link with cygwin, hence won't run standalone in DOS. |
---|
2901 | if test "$enable_doscompile" = mingw; then |
---|
2902 | skip_lblas_check=yes |
---|
2903 | fi |
---|
2904 | case "$CC" in |
---|
2905 | cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) |
---|
2906 | SAVE_LIBS="$LIBS" |
---|
2907 | AC_MSG_CHECKING([for BLAS in MKL]) |
---|
2908 | LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS" |
---|
2909 | AC_COIN_TRY_FLINK([daxpy], |
---|
2910 | [AC_MSG_RESULT([yes]) |
---|
2911 | use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib' |
---|
2912 | ADDLIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $ADDLIBS"], |
---|
2913 | [AC_MSG_RESULT([no]) |
---|
2914 | LIBS="$SAVE_LIBS"]) |
---|
2915 | ;; |
---|
2916 | esac |
---|
2917 | ;; |
---|
2918 | esac |
---|
2919 | |
---|
2920 | if test -z "$use_blas" && test $skip_lblas_check = no; then |
---|
2921 | SAVE_LIBS="$LIBS" |
---|
2922 | AC_MSG_CHECKING([whether -lblas has BLAS]) |
---|
2923 | LIBS="-lblas $LIBS" |
---|
2924 | AC_COIN_TRY_FLINK([daxpy], |
---|
2925 | [AC_MSG_RESULT([yes]) |
---|
2926 | ADDLIBS="-lblas $ADDLIBS" |
---|
2927 | use_blas='-lblas'], |
---|
2928 | [AC_MSG_RESULT([no]) |
---|
2929 | LIBS="$SAVE_LIBS"]) |
---|
2930 | fi |
---|
2931 | |
---|
2932 | # If we have no other ideas, consider building BLAS. |
---|
2933 | if test -z "$use_blas"; then |
---|
2934 | if test "$PACKAGE_NAME" != ThirdPartyBlas; then |
---|
2935 | if test -r $coin_blasobjdir/.MakeOk; then |
---|
2936 | use_blas=BUILD |
---|
2937 | fi |
---|
2938 | fi |
---|
2939 | fi |
---|
2940 | fi |
---|
2941 | |
---|
2942 | if test "$use_blas" = BUILD; then |
---|
2943 | coin_need_flibs=yes |
---|
2944 | fi |
---|
2945 | |
---|
2946 | AM_CONDITIONAL([COIN_HAS_BLAS],[test x"$use_blas" != x]) |
---|
2947 | AM_CONDITIONAL([COIN_BUILD_BLAS],[test "$use_blas" = BUILD]) |
---|
2948 | |
---|
2949 | if test x"$use_blas" = x || test "$use_blas" = no; then |
---|
2950 | coin_has_blas=no |
---|
2951 | else |
---|
2952 | coin_has_blas=yes |
---|
2953 | AC_DEFINE([COIN_HAS_BLAS],[1], |
---|
2954 | [If defined, the BLAS Library is available.]) |
---|
2955 | fi |
---|
2956 | ]) # AC_COIN_HAS_BLAS |
---|
2957 | |
---|
2958 | ########################################################################### |
---|
2959 | # COIN_HAS_LAPACK # |
---|
2960 | ########################################################################### |
---|
2961 | |
---|
2962 | # This macro checks for a library containing the LAPACK library. It |
---|
2963 | # tries standard libraries, and if none is found to be working, it |
---|
2964 | # checks whether the LAPACK ThirdParty/Lapack directory has been |
---|
2965 | # configured. It adds to ADDLIBS any flags required to link with an |
---|
2966 | # externally provided LAPACK. It defines the makefile conditional and |
---|
2967 | # preprocessor macro COIN_HAS_LAPACK, if lapack is available, and it |
---|
2968 | # defines the makefile conditional COIN_BUILD_LAPACK, if lapack is |
---|
2969 | # compiled within COIN. |
---|
2970 | |
---|
2971 | AC_DEFUN([AC_COIN_HAS_LAPACK], |
---|
2972 | [coin_lapackobjdir=../ThirdParty/Lapack |
---|
2973 | coin_lapacksrcdir=$srcdir/$coin_lapackobjdir |
---|
2974 | |
---|
2975 | AC_ARG_WITH([lapack], |
---|
2976 | AC_HELP_STRING([--with-lapack], |
---|
2977 | [specify LAPACK library (or BUILD for compilation)]), |
---|
2978 | [use_lapack=$withval], [use_lapack=]) |
---|
2979 | |
---|
2980 | # Check if user supplied option makes sense |
---|
2981 | if test x"$use_lapack" != x; then |
---|
2982 | if test "$use_lapack" = "BUILD"; then |
---|
2983 | # Don't check for course code if this is executed in ThirdParty/Lapack |
---|
2984 | if test "$PACKAGE_NAME" != ThirdPartyLapack; then |
---|
2985 | if test -r $coin_lapackobjdir/.MakeOk; then :; else |
---|
2986 | AC_MSG_ERROR([option \"BUILD\" specified for LAPACK, but $coin_lapackobjdir directory is not configured]) |
---|
2987 | fi |
---|
2988 | fi |
---|
2989 | elif test "$use_lapack" != no; then |
---|
2990 | AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works]) |
---|
2991 | LIBS="$use_lapack $LIBS" |
---|
2992 | ADDLIBS="$use_lapack $ADDLIBS" |
---|
2993 | AC_COIN_TRY_FLINK([dsyev], |
---|
2994 | [AC_MSG_RESULT([yes])], |
---|
2995 | [AC_MSG_RESULT([no]) |
---|
2996 | AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])]) |
---|
2997 | fi |
---|
2998 | else |
---|
2999 | if test x$coin_has_blas = xyes; then |
---|
3000 | # First try to see if LAPACK is already available with BLAS library |
---|
3001 | AC_MSG_CHECKING([whether LAPACK is already available with BLAS library]) |
---|
3002 | AC_COIN_TRY_FLINK([dsyev], |
---|
3003 | [AC_MSG_RESULT([yes]); use_lapack=ok], |
---|
3004 | [AC_MSG_RESULT([no])]) |
---|
3005 | fi |
---|
3006 | skip_llapack_check=no |
---|
3007 | if test -z "$use_lapack"; then |
---|
3008 | # Try to autodetect the library for lapack based on build system |
---|
3009 | case $build in |
---|
3010 | *-sgi-*) |
---|
3011 | SAVE_LIBS="$LIBS" |
---|
3012 | AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK]) |
---|
3013 | LIBS="-lcomplib.sgimath $LIBS" |
---|
3014 | AC_COIN_TRY_FLINK([dsyev], |
---|
3015 | [AC_MSG_RESULT([yes]) |
---|
3016 | use_lapack=-lcomplib.sgimath; |
---|
3017 | ADDLIBS="-lcomplib.sgimath $ADDLIBS"], |
---|
3018 | [AC_MSG_RESULT([no]) |
---|
3019 | SAVE_LIBS="$LIBS"]) |
---|
3020 | ;; |
---|
3021 | |
---|
3022 | # See comments in COIN_HAS_BLAS. |
---|
3023 | *-*-solaris*) |
---|
3024 | SAVE_LIBS="$LIBS" |
---|
3025 | AC_MSG_CHECKING([for LAPACK in libsunperf]) |
---|
3026 | LIBS="-lsunperf $FLIBS $LIBS" |
---|
3027 | AC_COIN_TRY_FLINK([dsyev], |
---|
3028 | [AC_MSG_RESULT([yes]) |
---|
3029 | use_blas='-lsunperf' |
---|
3030 | ADDLIBS="-lsunperf $ADDLIBS" |
---|
3031 | coin_need_flibs=yes], |
---|
3032 | [AC_MSG_RESULT([no]) |
---|
3033 | LIBS="$SAVE_LIBS"]) |
---|
3034 | ;; |
---|
3035 | # On cygwin, do this check only if doscompile is disabled. The prebuilt library |
---|
3036 | # will want to link with cygwin, hence won't run standalone in DOS. |
---|
3037 | *-cygwin*) |
---|
3038 | if test "$enable_doscompile" = mingw; then |
---|
3039 | skip_llapack_check=yes |
---|
3040 | fi |
---|
3041 | ;; |
---|
3042 | esac |
---|
3043 | fi |
---|
3044 | |
---|
3045 | if test -z "$use_lapack" && test $skip_llapack_check = no; then |
---|
3046 | SAVE_LIBS="$LIBS" |
---|
3047 | AC_MSG_CHECKING([whether -llapack has LAPACK]) |
---|
3048 | LIBS="-llapack $LIBS" |
---|
3049 | AC_COIN_TRY_FLINK([dsyev], |
---|
3050 | [AC_MSG_RESULT([yes]) |
---|
3051 | ADDLIBS="-llapack $ADDLIBS" |
---|
3052 | use_lapack='-llapack'], |
---|
3053 | [AC_MSG_RESULT([no]) |
---|
3054 | LIBS="$SAVE_LIBS"]) |
---|
3055 | fi |
---|
3056 | |
---|
3057 | # If we have no other ideas, consider building LAPACK. |
---|
3058 | if test -z "$use_lapack"; then |
---|
3059 | if test "$PACKAGE_NAME" != ThirdPartyLapack; then |
---|
3060 | if test -r $coin_lapackobjdir/.MakeOk; then |
---|
3061 | use_lapack=BUILD |
---|
3062 | fi |
---|
3063 | fi |
---|
3064 | fi |
---|
3065 | fi |
---|
3066 | |
---|
3067 | if test "$use_lapack" = BUILD; then |
---|
3068 | coin_need_flibs=yes |
---|
3069 | fi |
---|
3070 | |
---|
3071 | AM_CONDITIONAL([COIN_HAS_LAPACK],[test x"$use_lapack" != x]) |
---|
3072 | AM_CONDITIONAL([COIN_BUILD_LAPACK],[test "$use_lapack" = BUILD]) |
---|
3073 | |
---|
3074 | if test x"$use_lapack" = x || test "$use_lapack" = no; then |
---|
3075 | coin_has_lapack=no |
---|
3076 | else |
---|
3077 | coin_has_lapack=yes |
---|
3078 | AC_DEFINE([COIN_HAS_LAPACK],[1], |
---|
3079 | [If defined, the LAPACK Library is available.]) |
---|
3080 | fi |
---|
3081 | ]) # AC_COIN_HAS_LAPACK |
---|
3082 | |
---|
3083 | ########################################################################### |
---|
3084 | # COIN_HAS_MUMPS # |
---|
3085 | ########################################################################### |
---|
3086 | |
---|
3087 | # This macro checks for a library containing the MUMPS library. It |
---|
3088 | # checks if the user has provided an argument for the MUMPS library, |
---|
3089 | # and if not, it checks whether the MUMPS ThirdParty/Mumps directory has |
---|
3090 | # been configured. It adds to ADDLIBS any flags required to link with |
---|
3091 | # an externally provided MUMPS. It defines the makefile conditional |
---|
3092 | # and preprocessor macro COIN_HAS_MUMPS, if MUMPS is available, and it |
---|
3093 | # defines the makefile conditional COIN_BUILD_MUMPS, if MUMPS is |
---|
3094 | # compiled within COIN. |
---|
3095 | |
---|
3096 | AC_DEFUN([AC_COIN_HAS_MUMPS], |
---|
3097 | [ |
---|
3098 | if test "$PACKAGE_NAME" = ThirdPartyMumps; then |
---|
3099 | coin_mumpsobjdir=../Mumps |
---|
3100 | else |
---|
3101 | coin_mumpsobjdir=../ThirdParty/Mumps |
---|
3102 | fi |
---|
3103 | coin_mumpssrcdir=$abs_source_dir/$coin_mumpsobjdir/MUMPS |
---|
3104 | |
---|
3105 | MAKEOKFILE=.MakeOk |
---|
3106 | |
---|
3107 | #check if user provides a MUMPS library (that works) |
---|
3108 | AC_LANG_PUSH(C) |
---|
3109 | SAVE_ADDLIBS="$ADDLIBS" |
---|
3110 | ADDLIBS="$ADDLIBS $FLIBS" |
---|
3111 | AC_COIN_HAS_USER_LIBRARY(mumps, MUMPS, dmumps_c.h, dmumps_c) |
---|
3112 | ADDLIBS="$SAVE_ADDLIBS" |
---|
3113 | AC_LANG_POP(C) |
---|
3114 | |
---|
3115 | if test "$coin_has_mumps" = "true"; then # user provided mumps library |
---|
3116 | use_mumps=yes |
---|
3117 | coin_has_mumps=yes |
---|
3118 | |
---|
3119 | MUMPS_INCFLAGS="-I\`\$(CYGPATH_W) $MUMPSINCDIR\`" |
---|
3120 | ADDLIBS="$MUMPSLIB $ADDLIBS" |
---|
3121 | |
---|
3122 | else # no user provided library, so we try to build our own |
---|
3123 | use_mumps=BUILD |
---|
3124 | |
---|
3125 | # Check if the MUMPS' ThirdParty project has been configured |
---|
3126 | if test "$PACKAGE_NAME" != ThirdPartyMumps; then |
---|
3127 | if test -r $coin_mumpsobjdir/.MakeOk; then |
---|
3128 | use_mumps=BUILD |
---|
3129 | # Mumps needs pthreads |
---|
3130 | AC_LANG_PUSH(C) |
---|
3131 | save_LIBS="$LIBS" |
---|
3132 | LIBS="$LIBS $FLIBS" |
---|
3133 | AC_CHECK_LIB([pthread],[pthread_create],[LIBS="-lpthread $save_LIBS"; ADDLIBS="-lpthread $ADDLIBS"],[LIBS="save_LIBS"]) |
---|
3134 | AC_LANG_POP(C) |
---|
3135 | |
---|
3136 | MUMPS_INCFLAGS="-I\`\$(CYGPATH_W) $coin_mumpssrcdir/libseq\` -I\`\$(CYGPATH_W) $coin_mumpssrcdir/include\`" |
---|
3137 | else |
---|
3138 | use_mumps= |
---|
3139 | fi |
---|
3140 | fi |
---|
3141 | |
---|
3142 | # if a user provided library is used, then COIN_HAS_USER_LIBRARY takes care of the COIN_HAS_MUMPS conditional and preprocessor symbol |
---|
3143 | AM_CONDITIONAL([COIN_HAS_MUMPS],[test x"$use_mumps" != x]) |
---|
3144 | if test x"$use_mumps" != x; then |
---|
3145 | AC_DEFINE([COIN_HAS_MUMPS],[1],[If defined, the MUMPS Library is available.]) |
---|
3146 | coin_has_mumps=yes |
---|
3147 | else |
---|
3148 | coin_has_mumps=no |
---|
3149 | fi |
---|
3150 | AC_MSG_CHECKING([whether MUMPS is available]) |
---|
3151 | AC_MSG_RESULT([$coin_has_mumps]) |
---|
3152 | fi |
---|
3153 | |
---|
3154 | if test x"$use_mumps" != x; then |
---|
3155 | # we need the Fortran runtime libraries if we want to link with C/C++ |
---|
3156 | coin_need_flibs=yes |
---|
3157 | |
---|
3158 | AC_SUBST(MUMPS_INCFLAGS) |
---|
3159 | fi |
---|
3160 | |
---|
3161 | AM_CONDITIONAL([COIN_BUILD_MUMPS],[test "$use_mumps" = BUILD]) |
---|
3162 | |
---|
3163 | ]) # AC_COIN_HAS_MUMPS |
---|
3164 | |
---|
3165 | ########################################################################### |
---|
3166 | # COIN_HAS_METIS # |
---|
3167 | ########################################################################### |
---|
3168 | |
---|
3169 | # This macro checks for a library containing the METIS library. It |
---|
3170 | # checks if the user has provided an argument for the METIS library, |
---|
3171 | # and if not, it checks whether the METIS ThirdParty/Metis directory has |
---|
3172 | # been configured. It adds to ADDLIBS any flags required to link with |
---|
3173 | # an externally provided METIS. It defines the makefile conditional |
---|
3174 | # and preprocessor macro COIN_HAS_METIS, if METIS is available, and it |
---|
3175 | # defines the makefile conditional COIN_BUILD_METIS, if METIS is |
---|
3176 | # compiled within COIN. |
---|
3177 | |
---|
3178 | AC_DEFUN([AC_COIN_HAS_METIS], |
---|
3179 | [ |
---|
3180 | case "$PACKAGE_NAME" in |
---|
3181 | ThirdParty*) |
---|
3182 | coin_metisobjdir=../Metis |
---|
3183 | ;; |
---|
3184 | *) |
---|
3185 | coin_metisobjdir=../ThirdParty/Metis |
---|
3186 | ;; |
---|
3187 | esac |
---|
3188 | |
---|
3189 | MAKEOKFILE=.MakeOk |
---|
3190 | |
---|
3191 | #check if user provides a METIS library (that works) |
---|
3192 | AC_LANG_PUSH(C) |
---|
3193 | AC_ARG_WITH(metis, |
---|
3194 | AS_HELP_STRING([--with-metis], [specify flags to link with METIS library]), |
---|
3195 | [METISLIB="$withval"; coin_has_metis=true], [coin_has_metis=no]) |
---|
3196 | |
---|
3197 | if test $coin_has_metis = true; then |
---|
3198 | coin_save_LIBS="$LIBS" |
---|
3199 | LIBS="$METISLIB $ADDLIBS" |
---|
3200 | AC_MSG_CHECKING([whether symbol metis_nodend is available with ]) |
---|
3201 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[metis_nodend()]])], |
---|
3202 | [AC_MSG_RESULT(yes)], |
---|
3203 | [AC_MSG_RESULT(no) |
---|
3204 | AC_MSG_ERROR([User-supplied METIS library does not work])]) |
---|
3205 | LIBS="$coin_save_LIBS" |
---|
3206 | fi |
---|
3207 | AC_LANG_POP(C) |
---|
3208 | |
---|
3209 | if test "$coin_has_metis" = "true"; then # user provided metis library |
---|
3210 | use_metis=yes |
---|
3211 | coin_has_metis=yes |
---|
3212 | |
---|
3213 | ADDLIBS="$METISLIB $ADDLIBS" |
---|
3214 | |
---|
3215 | else # no user provided library, so we try to build our own |
---|
3216 | use_metis=BUILD |
---|
3217 | |
---|
3218 | # Check if the METIS' ThirdParty project has been configured |
---|
3219 | if test "$PACKAGE_NAME" != ThirdPartyMetis; then |
---|
3220 | if test -r $coin_metisobjdir/.MakeOk; then |
---|
3221 | use_metis=BUILD |
---|
3222 | else |
---|
3223 | use_metis= |
---|
3224 | fi |
---|
3225 | fi |
---|
3226 | |
---|
3227 | if test x"$use_metis" != x; then |
---|
3228 | coin_has_metis=yes |
---|
3229 | else |
---|
3230 | coin_has_metis=no |
---|
3231 | fi |
---|
3232 | AC_MSG_CHECKING([whether METIS is available]) |
---|
3233 | AC_MSG_RESULT([$coin_has_metis]) |
---|
3234 | fi |
---|
3235 | |
---|
3236 | AM_CONDITIONAL([COIN_HAS_METIS],[test $coin_has_metis = yes]) |
---|
3237 | if test $coin_has_metis = yes; then |
---|
3238 | AC_DEFINE([COIN_HAS_METIS],[1],[If defined, the METIS library is available.]) |
---|
3239 | fi |
---|
3240 | |
---|
3241 | ]) # AC_COIN_HAS_METIS |
---|
3242 | |
---|
3243 | |
---|
3244 | ########################################################################### |
---|
3245 | # COIN_HAS_GLPK # |
---|
3246 | ########################################################################### |
---|
3247 | # |
---|
3248 | # This macro checks for the GLPK package. GLPK provides two capabilities, |
---|
3249 | # an LP and MIP solver (GLPK) and the GNU Mathprog modelling language (GMPL). |
---|
3250 | # The macro checks for either Glpk or Gmpl, according to the value specified as |
---|
3251 | # the parameter. Use one of Glpk or Gmpl. Use *exactly* these strings, eh? |
---|
3252 | # |
---|
3253 | # |
---|
3254 | # The macro first uses COIN_HAS_USER_LIBRARY to see if the user has specified |
---|
3255 | # a preexisting library (this allows the use of any glpk version, if the user |
---|
3256 | # is fussy). The macro then checks for ThirdParty/Glpk. |
---|
3257 | # |
---|
3258 | # This macro will define the following variables for Glpk: |
---|
3259 | # coin_has_glpk true or false |
---|
3260 | # GLPKLIB link flags for GLPK (if user supplied) |
---|
3261 | # GLPKINCDIR location of glpk include files |
---|
3262 | # COIN_HAS_GLPK Preprocessor symbol, defined to 1 |
---|
3263 | # COIN_HAS_GLPK Automake conditional |
---|
3264 | # COIN_BUILD_GLPK Automake conditional, defined only if Glpk is to be |
---|
3265 | # built in ThirdParty/Glpk |
---|
3266 | # |
---|
3267 | # With the exception of COIN_BUILD_GLPK, an identical set of variables is |
---|
3268 | # defined for Gmpl. |
---|
3269 | |
---|
3270 | AC_DEFUN([AC_COIN_HAS_GLPK], |
---|
3271 | [ |
---|
3272 | if test "$PACKAGE_NAME" = ThirdPartyGlpk; then |
---|
3273 | coin_glpkobjdir=../Glpk |
---|
3274 | else |
---|
3275 | coin_glpkobjdir=../ThirdParty/Glpk |
---|
3276 | fi |
---|
3277 | coin_glpksrcdir=$abs_source_dir/$coin_glpkobjdir |
---|
3278 | |
---|
3279 | use_thirdpartyglpk=no |
---|
3280 | |
---|
3281 | # Check for the requested component. If the user specified an external glpk |
---|
3282 | # library don't force a ThirdParty build, let the error propagate. |
---|
3283 | |
---|
3284 | m4_if([$1],[Glpk], |
---|
3285 | [AC_COIN_HAS_USER_LIBRARY([Glpk],[GLPK],[glpk.h], |
---|
3286 | [_glp_lpx_simplex glp_lpx_simplex]) |
---|
3287 | if test x"$coin_has_glpk" = xfalse && test x"$GLPKLIB" = x ; then |
---|
3288 | use_thirdpartyglpk=try |
---|
3289 | fi]) |
---|
3290 | m4_if([$1],[Gmpl], |
---|
3291 | [AC_COIN_HAS_USER_LIBRARY([Gmpl],[GMPL],[glpmpl.h], |
---|
3292 | [_glp_mpl_initialize glp_mpl_initialize]) |
---|
3293 | if test x"$coin_has_gmpl" = xfalse && test x"$GMPLLIB" = x ; then |
---|
3294 | use_thirdpartyglpk=try |
---|
3295 | fi]) |
---|
3296 | |
---|
3297 | # If the user has supplied an external library, use it. Otherwise, consider |
---|
3298 | # a build in ThirdParty/Glpk. If we build, assume we get both glpk and gmpl. |
---|
3299 | |
---|
3300 | if test x"$use_thirdpartyglpk" = xtry ; then |
---|
3301 | MAKEOKFILE=.MakeOk |
---|
3302 | # Check if the Glpk's ThirdParty project has been configured |
---|
3303 | if test "$PACKAGE_NAME" != ThirdPartyGlpk; then |
---|
3304 | if test -r $coin_glpkobjdir/.MakeOk; then |
---|
3305 | use_thirdpartyglpk=build |
---|
3306 | else |
---|
3307 | use_thirdpartyglpk=no |
---|
3308 | fi |
---|
3309 | else |
---|
3310 | use_thirdpartyglpk=build |
---|
3311 | fi |
---|
3312 | |
---|
3313 | # If we're building, set the library and include directory variables, create a |
---|
3314 | # preprocessor symbol, define a variable that says we're using glpk/gmpl, and |
---|
3315 | # another to indicate a link check is a bad idea (hard to do before the library |
---|
3316 | # exists). |
---|
3317 | |
---|
3318 | if test x"$use_thirdpartyglpk" = xbuild ; then |
---|
3319 | m4_toupper($1INCDIR)="$coin_glpksrcdir/glpk/include" |
---|
3320 | AC_SUBST(m4_toupper($1INCDIR)) |
---|
3321 | AC_DEFINE(m4_toupper(COIN_HAS_$1),[1], |
---|
3322 | [Define to 1 if $1 package is available]) |
---|
3323 | m4_tolower(coin_has_$1)=true |
---|
3324 | m4_tolower($1_libcheck)=no |
---|
3325 | m4_toupper($1OBJDIR)=`cd $coin_glpkobjdir; pwd` |
---|
3326 | AC_SUBST(m4_toupper($1OBJDIR)) |
---|
3327 | AC_MSG_NOTICE([Using $1 in ThirdParty/Glpk]) |
---|
3328 | fi |
---|
3329 | fi |
---|
3330 | |
---|
3331 | # Define the necessary automake conditionals. |
---|
3332 | |
---|
3333 | AM_CONDITIONAL(m4_toupper(COIN_HAS_$1), |
---|
3334 | [test x"$m4_tolower(coin_has_$1)" = xtrue]) |
---|
3335 | AM_CONDITIONAL([COIN_BUILD_GLPK],[test x"$use_thirdpartyglpk" = xbuild]) |
---|
3336 | |
---|
3337 | ]) # AC_COIN_HAS_GLPK |
---|