source: branches/dev/configure.ac @ 555

Last change on this file since 555 was 555, checked in by andreasw, 15 years ago
  • integrated MA57 Interface into build system
  • minor changes in Ma57TSolverInterface code
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 43.4 KB
Line 
1# Copyright (C) 2004, 2005 International Business Machines and others.
2# All Rights Reserved.
3# This file is distributed under the Common Public License.
4
5## $Id: configure.ac 555 2005-10-28 20:32:05Z andreasw $
6
7# Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
8
9AC_PREREQ(2.59)
10
11AC_INIT([Ipopt],[3.0.0],[coin-ipopt@www-124.ibm.com])
12
13AC_COPYRIGHT([
14Copyright 2004, 2005 International Business Machines and others.
15All Rights Reserved.
16This file is part of the open source package IPOPT which is distributed
17under the Common Public License.])
18
19AC_REVISION(3.0.0)
20
21AC_CONFIG_SRCDIR(Common/IpDebug.hpp)
22
23# Get the system type
24AC_CANONICAL_BUILD
25
26# Check if user wants to produce debugging code
27AC_ARG_ENABLE([debug],
28  AC_HELP_STRING([--enable-debug], [compile with debug options and runtime tests]),
29  [case "${enableval}" in
30    yes) debugcompile=true
31         AC_DEFINE([IP_DEBUG],[1],
32                   [If defined, debug sanity checks are performed during runtime])
33         ;;
34    no)  debugcompile=false ;;
35    *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
36  esac],[debugcompile=false])
37
38########################
39# C++ Compiler Options #
40########################
41
42AC_LANG_PUSH(C++)
43SAVE_CXXFLAGS="$CXXFLAGS"
44case $build in
45  *-cygwin) comps="g++" ;;
46  *)        comps="xlC aCC CC g++ c++ icpc" ;;
47esac
48AC_PROG_CXX([$comps])
49CXXFLAGS="$SAVE_CXXFLAGS"
50
51warn_cxxflags=
52
53if test -z "$CXXFLAGS"; then
54  add_cxxflags=
55  opt_cxxflags=
56  dbg_cxxflags=
57
58  if test "$GXX" = "yes"; then
59    case "$CXX" in
60      icpc | */icpc) ;;
61      *)
62# ToDo decide about unroll-loops
63        opt_cxxflags="-O3"
64#        case $build in
65#          x86_64-* | i686-* | i586-* )
66#            # Check for enabling special instructions
67#            myflags=`grep flags /proc/cpuinfo | tail -1 | cut -d: -f2-`
68#            have_sse=no
69#            for i in $myflags; do
70#              case $i in
71#                sse3) CXXFLAGS="-mfpmath=sse -msse3"
72#                     AC_MSG_CHECKING([whether flag \"$CXXFLAGS\" works])
73#                     AC_TRY_LINK([#include <cmath>],[double s = sin(1.0);],
74#                       [AC_MSG_RESULT([yes])
75#                         opt_cxxflags="$opt_cxxflags $CXXFLAGS"],
76#                        [AC_MSG_RESULT([no])])
77#                     have_sse=yes;
78#                     CXXFLAGS=
79#                     ;;
80#                sse2)
81#                     CXXFLAGS="-mfpmath=sse -msse2"
82#                     AC_MSG_CHECKING([whether flag \"$CXXFLAGS\" works])
83#                     AC_TRY_LINK([#include <cmath>],[double s = sin(1.0);],
84#                       [AC_MSG_RESULT([yes])
85#                         if test $have_sse = no; then
86#                           opt_cxxflags="$opt_cxxflags $CXXFLAGS"
87#                        else
88#                          opt_cxxflags="$opt_cxxflags -msse2"
89#                         fi],
90#                        [AC_MSG_RESULT([no])])
91#                     have_sse=yes;
92#                     CXXFLAGS=
93#                     ;;
94#                sse)
95#                     CXXFLAGS="-mfpmath=sse -msse"
96#                     AC_MSG_CHECKING([whether flag \"$CXXFLAGS\" works])
97#                     AC_TRY_LINK([#include <cmath>],[double s = sin(1.0);],
98#                       [AC_MSG_RESULT([yes])
99#                         if test $have_sse = no; then
100#                           opt_cxxflags="$opt_cxxflags $CXXFLAGS"
101#                        else
102#                          opt_cxxflags="$opt_cxxflags -msse"
103#                         fi],
104#                        [AC_MSG_RESULT([no])])
105#                     have_sse=yes;
106#                     CXXFLAGS=
107#                     ;;
108#                mmx) CXXFLAGS="-mmmx"
109#                     AC_MSG_CHECKING([whether flag \"$CXXFLAGS\" works])
110#                     AC_TRY_LINK([#include <cmath>],[double s = sin(1.0);],
111#                       [AC_MSG_RESULT([yes])
112#                         opt_cxxflags="$opt_cxxflags $CXXFLAGS"],
113#                        [AC_MSG_RESULT([no])])
114#                     CXXFLAGS= ;;
115#                3dnow) CXXFLAGS="-m3dnow"
116#                     AC_MSG_CHECKING([whether flag \"$CXXFLAGS\" works])
117#                     AC_TRY_LINK([#include <cmath>],[double s = sin(1.0);],
118#                       [AC_MSG_RESULT([yes])
119#                         opt_cxxflags="$opt_cxxflags $CXXFLAGS"],
120#                        [AC_MSG_RESULT([no])])
121#                     CXXFLAGS= ;;
122#              esac
123#            done
124#          ;;
125#        esac
126        add_cxxflags="-pipe"
127        dbg_cxxflags="-g"
128        warn_cxxflags="-pedantic-errors -Wimplicit -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Werror -Wconversion"
129        case $build in
130          *-cygwin*) AC_MSG_CHECKING([whether flag \" -mno-cygwin\" works])
131                    CXXFLAGS="-mno-cygwin"
132                    AC_TRY_LINK(,[int i=0; i++;],
133                                    [AC_MSG_RESULT([yes]); add_cxxflags="-mno-cygwin $add_cxxflags"; use_mingw=yes],
134                                    [AC_MSG_RESULT([no])])
135                    CXXFLAGS= ;;
136        esac ;;
137    esac
138  fi
139  if test -z "$opt_cxxflags"; then
140    case $build in
141     *-cygwin*)
142      case "$CXX" in
143      cl | */cl)
144             opt_cxxflags="-Ot1"
145             add_cxxflags="-nologo -EHsc -GR"
146             dbg_cxxflags="-Yd";;
147      esac;;
148     *-linux-*)
149      case "$CXX" in
150      icpc | */icpc)
151#             AC_MSG_CHECKING([whether flag \"-fast\" works])
152#               CXXFLAGS="-fast"
153#               AC_TRY_RUN(,[int i=0; i++;],
154#                               [AC_MSG_RESULT([yes]); opt_cxxflags="-fast"],
155#                               [AC_MSG_RESULT([no]); opt_cxxflags="-O3 -ip -static"])
156#               CXXFLAGS=
157             opt_cxxflags="-O3 -ip"
158             add_cxxflags="-mp -pc64"
159             dbg_cxxflags="-g"
160             # Check if -i_dynamic is necessary (for new glibc library)
161             AC_MSG_CHECKING([whether flag \"-i_dynamic\" is needed])
162             CXXFLAGS=
163             AC_TRY_LINK(,[int i=0; i++;],
164                         [AC_MSG_RESULT([apparently not])],
165                         [AC_MSG_RESULT([seems so]);
166                               add_cxxflags="-i_dynamic $add_cxxflags"])
167             ;;
168      esac;;
169    *-ibm-*)
170      case "$CXX" in
171      xlC* | */xlC* | mpxlC* | */mpxlC*)
172             opt_cxxflags="-O3 -qarch=auto -qcache=auto -qhot -qtune=auto -qmaxmem=-1"
173             add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna"
174             dbg_cxxflags="-g";;
175      esac;;
176    *-hp-*)
177      case "$CXX" in
178      aCC | */aCC )
179             opt_cxxflags="-O"
180             add_cxxflags="-AA"
181             dbg_cxxflags="-g";;
182      esac;;
183    *-sun-*)
184             opt_cxxflags="-O4 -xtarget=native"
185             dbg_cxxflags="-g";;
186    esac
187  fi
188
189  if test "$ac_cv_prog_cxx_g" = yes && test -z "$dbg_cxxflags" ; then
190    dbg_cxxflags="-g"
191  fi
192
193  if test "$debugcompile" = "true"; then
194    CXXFLAGS="$dbg_cxxflags $add_cxxflags"
195  else
196    if test -z "$opt_cxxflags"; then
197# Try if -O option works if nothing else is set
198      CXXFLAGS="-O"
199      AC_TRY_LINK([],[int i=0; i++;],[opt_cxxflags="-O"],[])
200    fi
201    CXXFLAGS="$opt_cxxflags $add_cxxflags"
202  fi
203fi
204
205# Try if CXXFLAGS works
206AC_MSG_CHECKING([whether CXXFLAGS=\"$CXXFLAGS\" works])
207AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
208if test -z "$CXXFLAGS"; then
209  AC_MSG_RESULT([no])
210  AC_MSG_WARN([This value for CXXFLAGS does not work.  I will now just try '-O', but you might want to set CXXFLAGS manually.])
211  CXXFLAGS='-O'
212  AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
213  if test -z "$CXXFLAGS"; then
214    AC_MSG_RESULT([no])
215    AC_MSG_WARN([This value for CXXFLAGS does not work.  I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually.])
216  fi
217else
218  AC_MSG_RESULT([yes])
219fi
220
221# C++ link libraries #
222AC_ARG_VAR(CXXLIBS,[Libraries necessary for linking C++ code with Fortran compiler])
223if test -z "$CXXLIBS"; then
224  if test "$GXX" = "yes"; then
225    case "$CXX" in
226      icpc | */icpc)
227        CXXLIBS=""
228        ;;
229      *)
230        CXXLIBS="-lstdc++ -lm -lgcc"
231        ;;
232    esac
233  else
234    case $build in
235     *-linux-*)
236      case "$CXX" in
237      icpc | */icpc)
238        CXXLIBS=""
239             ;;
240      esac;;
241    *-ibm-*)
242      CXXLIBS="-lC -lc"
243      ;;
244    *-hp-*)
245      CXXLIBS="-L/opt/aCC/lib -l++ -lstd_v2 -lCsup_v2 -lm -lcl -lc"
246      ;;
247    *-sun-*)
248      CXXLIBS="-lCstd -lCrun"
249    esac
250  fi
251fi
252if test -z "$CXXLIBS"; then
253  AC_MSG_WARN([Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran of C).])
254else
255  AC_MSG_NOTICE([Assuming that CXXLIBS is \"$CXXLIBS\".])
256fi
257AC_LANG_POP(C++)
258
259###############################################
260# Set variables for the archiver              #
261# (for AIX in 64bit mode also on SGI, SUN...) #
262###############################################
263if test -z "$AR"; then
264  if test ! "$GXX" = "yes"; then
265    case $build in
266      *-sun-*)
267        AR="CC -xar"
268        ;;
269      *-sgi-*)
270        AR="CC -ar"
271        ;;
272    esac
273  fi
274  if test -z "$AR"; then
275    AR="ar"
276  fi
277fi
278AC_ARG_VAR(AR,[Command for handling archives (default is `ar')])
279AC_MSG_NOTICE([Using AR=\"$AR\".])
280
281if test -z "$ARFLAGS"; then
282  if test ! "$GXX" = "yes"; then
283    case $build in
284      *-sun-*)
285        ARFLAGS="-o"
286        ;;
287      *-sgi-*)
288        ARFLAGS="-o"
289        ;;
290    esac
291  fi
292  if test -z "$ARFLAGS"; then
293    ARFLAGS="crv"
294  fi
295fi
296AC_ARG_VAR(ARFLAGS,[Flags for adding file for archive command (default is `crv')])
297AC_MSG_NOTICE([Using ARFLAGS=\"$ARFLAGS\".])
298
299if test -z "$AR_X"; then
300  AR_X="ar x"
301fi
302AC_ARG_VAR(AR_X,[Command for extracing an archive (default is `ar x')])
303AC_MSG_NOTICE([Using AR_X=\"$AR_X\".])
304
305######################
306# C Compiler Options #
307######################
308
309AC_LANG_PUSH(C)
310SAVE_CFLAGS="$CFLAGS"
311case $build in
312  *-cygwin) comps="gcc" ;;
313  *)        comps="xlc cc gcc icc" ;;
314esac
315AC_PROG_CC([$comps])
316CFLAGS="$SAVE_CFLAGS"
317
318warn_cflags=
319
320if test -z "$CFLAGS"; then
321  add_cflags=
322  opt_cflags=
323  dbg_cflags=
324
325  if test "$GCC" = "yes"; then
326    case "$CC" in
327      icc | */icc) ;;
328      *)
329        opt_cflags="-O3"
330#        case $build in
331#          x86_64-* | i686-* | i586-* )
332#            # Check for enabling special instructions
333#            myflags=`grep flags /proc/cpuinfo | tail -1 | cut -d: -f2-`
334#            have_sse=no
335#            SAVE_LIBS="$LIBS"
336#            LIBS="$LIBS -lm"
337#            for i in $myflags; do
338#              case $i in
339#                sse3) CFLAGS="-mfpmath=sse -msse3"
340#                     AC_MSG_CHECKING([whether flag \"$CFLAGS\" works])
341#                     AC_TRY_LINK([#include <math.h>],[double s = sin(1.0);],
342#                       [AC_MSG_RESULT([yes])
343#                         opt_cflags="$opt_cflags $CFLAGS"],
344#                        [AC_MSG_RESULT([no])])
345#                     have_sse=yes;
346#                     CFLAGS=
347#                     ;;
348#                sse2)
349#                     CFLAGS="-mfpmath=sse -msse2"
350#                     AC_MSG_CHECKING([whether flag \"$CFLAGS\" works])
351#                     AC_TRY_LINK([#include <math.h>],[double s = sin(1.0);],
352#                       [AC_MSG_RESULT([yes])
353#                         if test $have_sse = no; then
354#                           opt_cflags="$opt_cflags $CFLAGS"
355#                        else
356#                          opt_cflags="$opt_cflags -msse2"
357#                         fi],
358#                        [AC_MSG_RESULT([no])])
359#                     have_sse=yes;
360#                     CFLAGS=
361#                     ;;
362#                sse)
363#                     CFLAGS="-mfpmath=sse -msse"
364#                     AC_MSG_CHECKING([whether flag \"$CFLAGS\" works])
365#                     AC_TRY_LINK([#include <math.h>],[double s = sin(1.0);],
366#                       [AC_MSG_RESULT([yes])
367#                         if test $have_sse = no; then
368#                           opt_cflags="$opt_cflags $CFLAGS"
369#                        else
370#                          opt_cflags="$opt_cflags -msse"
371#                         fi],
372#                        [AC_MSG_RESULT([no])])
373#                     have_sse=yes;
374#                     CFLAGS=
375#                     ;;
376#                mmx) CFLAGS="-mmmx"
377#                     AC_MSG_CHECKING([whether flag \"$CFLAGS\" works])
378#                     AC_TRY_LINK([#include <math.h>],[double s = sin(1.0);],
379#                       [AC_MSG_RESULT([yes])
380#                         opt_cflags="$opt_cflags $CFLAGS"],
381#                        [AC_MSG_RESULT([no])])
382#                     CFLAGS= ;;
383#                3dnow) CFLAGS="-m3dnow"
384#                     AC_MSG_CHECKING([whether flag \"$CFLAGS\" works])
385#                     AC_TRY_LINK([#include <math.h>],[double s = sin(1.0);],
386#                       [AC_MSG_RESULT([yes])
387#                         opt_cflags="$opt_cflags $CFLAGS"],
388#                        [AC_MSG_RESULT([no])])
389#                     CFLAGS= ;;
390#              esac
391#            done
392#            LIBS="$SAVE_LIBS"
393#          ;;
394#        esac
395        add_cflags="-pipe"
396        dbg_cflags="-g"
397        warn_cflags="-pedantic-errors -Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Werror "
398        case $build in
399          *-cygwin*) AC_MSG_CHECKING([whether flag \"-mno-cygwin\" works])
400                    CFLAGS="-mno-cygwin"
401                    AC_TRY_LINK(,[int i=0; i++;],
402                                    [AC_MSG_RESULT([yes]); add_cflags="-mno-cygwin $add_cflags"; use_mingw=yes],
403                                    [AC_MSG_RESULT([no])])
404                    CFLAGS= ;;
405        esac ;;
406    esac
407  fi
408  if test -z "$opt_cflags"; then
409    case $build in
410     *-cygwin*)
411      case "$CC" in
412      cl | */cl)
413             opt_cflags="-Ot1"
414             add_cflags="-nologo"
415             dbg_cflags="-Yd";;
416      esac;;
417     *-linux-*)
418      case "$CC" in
419      icc | */icc)
420#             AC_MSG_CHECKING([whether flag \"-fast\" works])
421#               CFLAGS="-fast"
422#               AC_TRY_RUN(,[int i=0; i++;],
423#                               [AC_MSG_RESULT([yes]); opt_cflags="-fast"],
424#                               [AC_MSG_RESULT([no]); opt_cflags="-O3 -ipo -static"])
425#               CFLAGS=
426             opt_cflags="-O3 -ip"
427             add_cflags="-mp -pc64"
428             dbg_cflags="-g"
429             # Check if -i_dynamic is necessary (for new glibc library)
430             AC_MSG_CHECKING([whether flag \"-i_dynamic\" is needed])
431             CFLAGS=
432             AC_TRY_LINK(,[int i=0; i++;],
433                         [AC_MSG_RESULT([apparently not])],
434                         [AC_MSG_RESULT([seems so]);
435                               add_cflags="-i_dynamic $add_cflags"])
436             ;;
437      pgcc | */pgcc)
438             opt_cflags="-fast"
439             add_cflags="-Kieee -Mstabs -pc 64"
440             dbg_cflags="-g" ;;
441      esac;;
442    *-ibm-*)
443      case "$CC" in
444      xlc* | */xlc* | mpxlc* | */mpxlc*)
445             opt_cflags="-O3 -qarch=auto -qcache=auto -qhot -qtune=auto -qmaxmem=-1"
446             add_cflags="-bmaxdata:0x80000000"
447             dbg_cflags="-g";;
448      esac;;
449    *-hp-*)
450             opt_cflags="-O"
451             add_cflags="-Ae"
452             dbg_cflags="-g";;
453    *-sun-*)
454             opt_cflags="-xO4 -xtarget=native"
455             dbg_cflags="-g";;
456    *-sgi-*)
457             opt_cflags="-O -OPT:Olimit=0"
458             dbg_cflags="-g";;
459    esac
460  fi
461
462  if test "$ac_cv_prog_cc_g" = yes && test -z "$dbg_cflags" ; then
463    dbg_cflags="-g"
464  fi
465
466  if test "$debugcompile" = "true"; then
467    CFLAGS="$dbg_cflags $add_cflags"
468  else
469    if test -z "$opt_cflags"; then
470# Try if -O option works if nothing else is set
471      CFLAGS="-O"
472      AC_TRY_LINK([],[int i=0; i++;],[opt_cflags="-O"],[])
473    fi
474    CFLAGS="$opt_cflags $add_cflags"
475  fi
476fi
477
478# Try if CFLAGS works
479AC_MSG_CHECKING([whether CFLAGS=\"$CFLAGS\" works])
480AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
481if test -z "$CFLAGS"; then
482  AC_MSG_RESULT([no])
483  AC_MSG_WARN([This value for CFLAGS does not work.  I will now just try '-O', but you might want to set CFLAGS manually.])
484  CFLAGS='-O'
485  AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
486  if test -z "$CFLAGS"; then
487    AC_MSG_RESULT([no])
488    AC_MSG_WARN([This value for CFLAGS does not work.  I will continue with empty CFLAGS, but you might want to set CFLAGS manually.])
489  fi
490else
491  AC_MSG_RESULT([yes])
492fi
493AC_LANG_POP(C)
494
495###################################
496#   Fortran 77 compiler options   #
497###################################
498
499AC_LANG_PUSH(Fortran 77)
500SAVE_FFLAGS="$FFLAGS"
501case $build in
502  *-cygwin) comps="gfortran g77" ;;
503  *)        comps="xlf fort77 gfortran f77 g77 ifort ifc" ;;
504esac
505AC_PROG_F77($comps)
506FFLAGS="$SAVE_FFLAGS"
507
508if test -z "$FFLAGS"; then
509  add_fflags=
510  opt_fflags=
511  dbg_fflags=
512
513  if test "$G77" = "yes"; then
514    opt_fflags="-O3"
515#        case $build in
516#          x86_64-* | i686-* | i586-* )
517#            # Check for enabling special instructions
518#            myflags=`grep flags /proc/cpuinfo | tail -1 | cut -d: -f2-`
519#            have_sse=no
520#            for i in $myflags; do
521#              case $i in
522#                sse3) FFLAGS="-mfpmath=sse -msse3"
523#                     AC_MSG_CHECKING([whether flag \"$FFLAGS\" works])
524#                     AC_TRY_LINK(,[      double precision x
525#      x = sin(1.d0)],
526#                       [AC_MSG_RESULT([yes])
527#                         opt_fflags="$opt_fflags $FFLAGS"],
528#                        [AC_MSG_RESULT([no])])
529#                     have_sse=yes;
530#                     FFLAGS=
531#                     ;;
532#                sse2)
533#                     FFLAGS="-mfpmath=sse -msse2"
534#                     AC_MSG_CHECKING([whether flag \"$FFLAGS\" works])
535#                     AC_TRY_LINK(,[      double precision x
536#      x = sin(1.d0)],
537#                       [AC_MSG_RESULT([yes])
538#                         if test $have_sse = no; then
539#                           opt_fflags="$opt_fflags $FFLAGS"
540#                        else
541#                          opt_fflags="$opt_fflags -msse2"
542#                         fi],
543#                        [AC_MSG_RESULT([no])])
544#                     have_sse=yes;
545#                     FFLAGS=
546#                     ;;
547#                sse)
548#                     FFLAGS="-mfpmath=sse -msse"
549#                     AC_MSG_CHECKING([whether flag \"$FFLAGS\" works])
550#                     AC_TRY_LINK(,[      double precision x
551#      x = sin(1.d0)],
552#                       [AC_MSG_RESULT([yes])
553#                         if test $have_sse = no; then
554#                           opt_fflags="$opt_fflags $FFLAGS"
555#                        else
556#                          opt_fflags="$opt_fflags -msse"
557#                         fi],
558#                        [AC_MSG_RESULT([no])])
559#                     have_sse=yes;
560#                     FFLAGS=
561#                     ;;
562#                mmx) FFLAGS="-mmmx"
563#                     AC_MSG_CHECKING([whether flag \"$FFLAGS\" works])
564#                     AC_TRY_LINK(,[      double precision x
565#      x = sin(1.d0)],
566#                       [AC_MSG_RESULT([yes])
567#                         opt_fflags="$opt_fflags $FFLAGS"],
568#                        [AC_MSG_RESULT([no])])
569#                     FFLAGS= ;;
570#                3dnow) FFLAGS="-m3dnow"
571#                     AC_MSG_CHECKING([whether flag \"$FFLAGS\" works])
572#                     AC_TRY_LINK(,[      double precision x
573#      x = sin(1.d0)],
574#                       [AC_MSG_RESULT([yes])
575#                         opt_fflags="$opt_fflags $FFLAGS"],
576#                        [AC_MSG_RESULT([no])])
577#                     FFLAGS= ;;
578#              esac
579#            done
580#          ;;
581#        esac
582
583#    case $build in
584#      i686-* )
585#        FFLAGS="-march=i686 -mfpmath=sse -msse"
586#        AC_MSG_CHECKING([whether flags \"$FFLAGS\" work])
587#        AC_TRY_LINK(,[
588#      double precision x
589#      x = sin(1.d0)],
590#                       [AC_MSG_RESULT([yes]); opt_fflags="$opt_fflags $FFLAGS"],
591#                       [AC_MSG_RESULT([no])])
592#        FFLAGS=
593#      ;;
594#    esac
595    add_fflags="-pipe"
596    dbg_fflags="-g"
597    case $build in
598      *-cygwin*) AC_MSG_CHECKING([whether flag \"-mno-cygwin\" works])
599                FFLAGS="-mno-cygwin"
600                AC_TRY_LINK(,[      write(*,*) 'Hello world'],
601                                [AC_MSG_RESULT([yes]); add_fflags="-mno-cygwin $add_fflags"],
602                                [AC_MSG_RESULT([no])])
603                FFLAGS= ;;
604    esac
605  else
606    case $build in
607    *-cygwin*)
608      case $F77 in
609      ifort | */ifort)
610             opt_fflags="-O3"
611             add_fflags="-nologo -Qprec -fpp"
612             dbg_fflags="-debug" ;;
613      esac;;
614    *-linux-*)
615      case $F77 in
616      ifc | */ifc | ifort | */ifort)
617#             AC_MSG_CHECKING([whether flag \"-fast\" works])
618#               FFLAGS="-fast"
619#               AC_TRY_RUN(,[      write(*,*) 'Hello world'],
620#                               [AC_MSG_RESULT([yes]); opt_fflags="-fast"],
621#                               [AC_MSG_RESULT([no]); opt_fflags="-O3 -ipo -static"])
622#               FFLAGS=
623             opt_fflags="-O3 -ip"
624             add_fflags="-mp -pc64 -cm -w90 -w95"
625             dbg_fflags="-g -CA -CB -CS -CU"
626             # Check if -i_dynamic is necessary (for new glibc library)
627             AC_MSG_CHECKING([whether flag \"-i_dynamic\" is needed])
628             FFLAGS=
629             AC_TRY_LINK(,[      write(*,*) 'Hello world'],
630                         [AC_MSG_RESULT([apparently not])],
631                         [AC_MSG_RESULT([seems so]);
632                               add_fflags="-i_dynamic $add_fflags"])
633             ;;
634      pgf77 | */pgf77)
635             opt_fflags="-fast"
636             add_fflags="-Kieee -Mstabs -pc 64"
637             dbg_fflags="-g" ;;
638      esac;;
639    *-ibm-*)
640      case $F77 in
641      xlf* | */xlf* | mpxlf* | */mpxlf* )
642             opt_fflags="-O3 -qarch=auto -qcache=auto -qhot -qtune=auto -qmaxmem=-1"
643             add_fflags="-bmaxdata:0x80000000"
644             dbg_fflags="-g -C";;
645      esac;;
646    *-hp-*)
647             opt_fflags="+O3"
648             add_fflags="+U77"
649             dbg_fflags="-C -g";;
650    *-sun-*)
651             opt_fflags="-O4 -xtarget=native"
652             dbg_fflags="-g";;
653    *-sgi-*)
654             opt_fflags="-O5 -OPT:Olimit=0"
655             dbg_fflags="-g";;
656    esac
657  fi
658
659  if test "$ac_cv_prog_f77_g" = yes && test -z "$dbg_fflags" ; then
660    dbg_fflags="-g"
661  fi
662
663  if test "$debugcompile" = true; then
664    FFLAGS="$dbg_fflags $add_fflags"
665  else
666    if test -z "$opt_fflags"; then
667# Try if -O option works if nothing else is set
668      AC_MSG_CHECKING([whether FFLAGS=\"-O\" works])
669      FFLAGS=-O
670      AC_TRY_LINK(,[      integer i],[AC_MSG_RESULT([yes]); opt_fflags="-O"],[AC_MSG_RESULT([no])])
671    fi
672    FFLAGS="$opt_fflags $add_fflags"
673  fi
674fi
675
676# Try if FFLAGS works
677AC_MSG_CHECKING([whether FFLAGS=\"$FFLAGS\" works])
678AC_TRY_LINK([],[      integer i],[],[FFLAGS=])
679if test -z "$FFLAGS"; then
680  AC_MSG_RESULT([no])
681  AC_MSG_WARN([This value for FFLAGS does not work.  I will now just try '-O', but you might want to set FFLAGS manually.])
682  FFLAGS='-O'
683  AC_TRY_LINK([],[      integer i],[],[FFLAGS=])
684  if test -z "$FFLAGS"; then
685    AC_MSG_RESULT([no])
686    AC_MSG_WARN([This value for FFLAGS does not work.  I will continue with empty FFLAGS, but you might want to set FFLAGS manually.])
687  fi
688else
689  AC_MSG_RESULT([yes])
690fi
691
692AC_F77_WRAPPERS
693
694case $build in
695# The following is a fix to define FLIBS for ifort on Windows
696   *-cygwin*)
697     case $F77 in
698       ifort | */ifort)
699           FLIBS="libifcorert.lib libcmt.lib /link /NODEFAULTLIB:libc.lib $LIBS";;
700     esac;;
701   *-hp-*)
702       FLIBS="$FLIBS -lm";;
703   *-ibm-*)
704       FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;;
705esac
706
707AC_LANG_POP(Fortran 77)
708
709AC_PROG_RANLIB
710
711AC_PREFIX_DEFAULT([`pwd`])
712
713AC_PROG_LN_S
714
715# Stuff for automake
716AM_INIT_AUTOMAKE
717AM_MAINTAINER_MODE
718
719############################################################################
720############################################################################
721#                   Stuff that we need for C++ programs                    #
722############################################################################
723############################################################################
724
725AC_LANG_PUSH(C++)
726
727################
728# Header Files #
729################
730
731AC_DEFUN([MY_CHECK_CXX_HEADER],
732         [AC_CHECK_HEADERS([c$1])
733          if test ! "$ac_cv_header_c$1" = "yes"; then
734            AC_CHECK_HEADERS([$1.h])
735          fi])
736
737MY_CHECK_CXX_HEADER(math)
738MY_CHECK_CXX_HEADER(ctype)
739MY_CHECK_CXX_HEADER(assert)
740MY_CHECK_CXX_HEADER(stdio)
741MY_CHECK_CXX_HEADER(stdlib)
742MY_CHECK_CXX_HEADER(stdarg)
743MY_CHECK_CXX_HEADER(float)
744MY_CHECK_CXX_HEADER(time)
745
746###################
747# Function finite #
748###################
749
750# First check for a few headers
751
752case $build in
753  *-cygwin*) ;;
754  *) MY_CHECK_CXX_HEADER([ieeefp]) ;;
755esac
756
757# now try to guess the correct name of the finite function
758
759MY_C_FINITE=
760AC_CHECK_DECL([finite],[MY_C_FINITE=finite],,[
761#ifdef HAVE_CMATH
762# include <cmath>
763#else
764# ifdef HAVE_MATH_H
765#  include <math.h>
766# endif
767#endif
768#ifdef HAVE_CFLOAT
769# include <cfloat>
770#else
771# ifdef HAVE_FLOAT_H
772#  include <float.h>
773# endif
774#endif
775#ifdef HAVE_CIEEEFP
776# include <cieeefp>
777#else
778# ifdef HAVE_IEEEFP_H
779#  include <ieeefp.h>
780# endif
781#endif])
782if test -z "$MY_C_FINITE"; then
783  AC_CHECK_DECL([_finite],[MY_C_FINITE=_finite],,[
784#ifdef HAVE_CMATH
785# include <cmath>
786#else
787# ifdef HAVE_MATH_H
788#  include <math.h>
789# endif
790#endif
791#ifdef HAVE_CFLOAT
792# include <cfloat>
793#else
794# ifdef HAVE_FLOAT_H
795#  include <float.h>
796# endif
797#endif
798#ifdef HAVE_CIEEEFP
799# include <cieeefp>
800#else
801# ifdef HAVE_IEEEFP_H
802#  include <ieeefp.h>
803# endif
804#endif])
805  if test -z "$MY_C_FINITE"; then
806    AC_CHECK_DECL([isfinite],[MY_C_FINITE=isfinite],,[
807#ifdef HAVE_CMATH
808# include <cmath>
809#else
810# ifdef HAVE_MATH_H
811#  include <math.h>
812# endif
813#endif
814#ifdef HAVE_CFLOAT
815# include <cfloat>
816#else
817# ifdef HAVE_FLOAT_H
818#  include <float.h>
819# endif
820#endif
821#ifdef HAVE_CIEEEFP
822# include <cieeefp>
823#else
824# ifdef HAVE_IEEEFP_H
825#  include <ieeefp.h>
826# endif
827#endif])
828  fi
829fi
830if test -z "$MY_C_FINITE"; then
831  AC_MSG_WARN(Cannot find C-function for checking NaN and Inf.  Check will be disabled)
832else
833  AC_DEFINE_UNQUOTED([MY_C_FINITE],[$MY_C_FINITE],
834                     [Define to be the name of C-function for NaNInf check])
835fi
836
837###########
838# va_copy #
839###########
840
841AC_CHECK_DECL([va_copy],[AC_DEFINE([HAVE_VA_COPY],[1],
842                                   [Define to 1 if va_copy is avaliable])],,[
843#ifdef HAVE_CSTDARG
844# include <cstdarg>
845#else
846# ifdef HAVE_STDARG_H
847#  include <stdarg.h>
848# endif
849#endif])
850
851##########################################################################
852
853# Additional libraries and packages
854
855IPADDLIBS=
856AC_SUBST(IPADDLIBS)
857
858##########
859#  BLAS  #
860##########
861
862ipblaslibdir="\$(top_builddir)/Extern/blas"
863
864AC_ARG_WITH([blas],
865            AC_HELP_STRING([--with-blas],
866                           [specify BLAS library (or BUILD for compilation)]),
867            [use_blas=$withval], [use_blas=])
868# Check if user supplied option makes sense
869if test ! -z "$use_blas"; then
870  if test "$use_blas" = "BUILD"; then
871    AC_CHECK_FILE([$srcdir/Extern/blas/dgemm.f],[],
872                  [AC_MSG_ERROR([option \"BUILD\" specified for blas, but sources are missing])])
873  else
874    AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works])
875    LIBS="$use_blas $LIBS"
876    IPADDLIBS="$use_blas $IPADDLIBS"
877    # Probably the blas library requires the Fortran libraries, so add
878    # them for this test.  They are added at the end anyway
879    SAVE_LIBS="$LIBS"
880    LIBS="$LIBS $FLIBS"
881    AC_F77_FUNC(daxpy,cfunc)
882    AC_TRY_LINK([extern "C" {void $cfunc();}],[$cfunc()],
883                [AC_MSG_RESULT([yes])],
884                [AC_MSG_RESULT([no])
885                 AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])])
886    LIBS="$SAVE_LIBS"
887  fi
888else
889# Try to autodetect the library for blas based on build system
890  case $build in
891    *-sgi-*) AC_F77_FUNC(daxpy,cfunc)
892             AC_CHECK_LIB([complib.sgimath],[$cfunc],
893                          [use_blas=-lcomplib.sgimath;
894                           LIBS="-lcomplib.sgimath $LIBS";
895                           IPADDLIBS="-lcomplib.sgimath $IPADDLIBS"])
896             ;;
897    *-sun-*) SAVE_LIBS="$LIBS"
898             AC_MSG_CHECKING([whether -xlic_lib=sunperf has BLAS])
899             LIBS="-xlic_lib=sunperf $LIBS"
900             AC_F77_FUNC(daxpy,cfunc)
901             AC_TRY_LINK([extern "C" {void $cfunc();}],[$cfunc()],
902                         [AC_MSG_RESULT([yes])
903                          IPADDLIBS="-xlic_lib=sunperf $IPADDLIBS"
904                          use_blas=-xlic_lib=sunperf],
905                         [AC_MSG_RESULT([no])
906                          LIBS="$SAVE_LIBS"])
907             ;;
908  esac
909  if test -z "$use_blas"; then
910    # Probably the blas library requires the Fortran libraries, so add
911    # them for this test.  They are added at the end anyway
912    AC_F77_FUNC(daxpy,cdaxpy)
913    SAVE_LIBS="$LIBS"
914    LIBS="$LIBS $FLIBS"
915    AC_CHECK_LIB(blas,$cdaxpy,[use_blas=-lblas;
916                               LIBS="-lblas $SAVE_LIBS";
917                               IPADDLIBS="-lblas $IPADDLIBS"],
918                              [LIBS="$SAVE_LIBS"])
919  fi
920  if test -z "$use_blas"; then
921    AC_CHECK_FILE([$srcdir/Extern/blas/dgemm.f],[use_blas=BUILD],
922                  [AC_MSG_ERROR([cannot find BLAS, and sources are missing in $srcdir/Extern/blas/])])
923  fi
924fi
925
926# ##########
927# # LAPACK #
928# ##########
929#
930# iplapacklibdir="\$(top_builddir)/Extern/lapack"
931# lapackdir=Extern/lapack/LAPACK/SRC
932# lapacksrcdir=$srcdir/$lapackdir
933# lapackobjdir=Extern/lapack
934#
935# AC_ARG_WITH([lapack],
936#             AC_HELP_STRING([--with-lapack],
937#                            [specify LAPACK library (or BUILD for compilation)]),
938#             [use_lapack=$withval], [use_lapack=])
939# # Check if user supplied option makes sense
940# if test ! -z "$use_lapack"; then
941#   if test "$use_lapack" = "BUILD"; then
942#     AC_CHECK_FILE([$lapacksrcdir/dlarf.f],[],
943#                   [AC_MSG_ERROR([option \"BUILD\" specified for lapack, but sources are missing])])
944#   else
945#     AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
946#     LIBS="$use_lapack $LIBS"
947#     IPADDLIBS="$use_lapack $IPADDLIBS"
948#     AC_TRY_LINK([],[      call dlasr],[AC_MSG_RESULT([yes])],
949#                 [AC_MSG_RESULT([no]); AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])])
950#   fi
951# else
952# # First try to see if LAPACK is already available with BLAS library
953#   AC_MSG_CHECKING([whether LAPACK is already available with BLAS library])
954#   AC_TRY_LINK([],[      call dgetrf()],
955#             [AC_MSG_RESULT([yes]); use_lapack=ok],
956#             [AC_MSG_RESULT([no])])
957#   if test -z "$use_lapack"; then
958#     # Try to autodetect the library for lapack based on build system
959#     case $build in
960#       *-sgi-*)   AC_CHECK_LIB([complib.sgimath],[dgetrf],
961#                             [use_lapack=-lcomplib.sgimath;
962#                              LIBS="-lcomplib.sgimath $LIBS";
963#                              IPADDLIBS="-lcomplib.sgimath $IPADDLIBS"]);;
964#       *-sun-*) SAVE_LDFLAGS="$LDFLAGS"
965#                AC_MSG_CHECKING([whether -xlic_lib=sunperf has LAPACK])
966#                LDFLAGS="-xlic_lib=sunperf $LDFLAGS"
967#                AC_TRY_LINK([],[      call dgetrf],
968#                            [AC_MSG_RESULT([yes]); use_lapack=-xlic_lib=sunperf],
969#                            [AC_MSG_RESULT([no]); LDFLAGS="$SAVE_LDFLAGS"]) ;;
970#     esac
971#   fi
972#   if test -z "$use_lapack"; then
973#     AC_CHECK_LIB(lapack,dgetrf,[use_lapack=-llapack;
974#                                 LIBS="-llapack $LIBS";
975#                                 IPADDLIBS="-llapack $IPADDLIBS"],[])
976#   fi
977#   if test -z "$use_lapack"; then
978#     AC_CHECK_FILE([$lapacksrcdir/dlarf.f],[use_lapack=BUILD],
979#                   [AC_MSG_ERROR([cannot find LAPACK, and sources are missing in $lapacksrcdir])])
980#   fi
981# fi
982
983#######################
984# HARWELL SUBROUTINES #
985#######################
986
987hslsrcdir="$srcdir/Extern/HSL"
988hsllibdir="\$(top_builddir)/Extern/HSL"
989
990AC_DEFUN([MY_CHECK_HSL],
991         [AC_MSG_CHECKING([for $1 in $use_hsl])
992          use_$2=
993          AC_F77_FUNC($1,cfunc)
994          AC_TRY_LINK([extern "C" {void $cfunc();}],[$cfunc()],
995                      [AC_DEFINE(HAVE_$2,1,[Define to 1 if $2 is available])
996                       AC_MSG_RESULT([yes]); use_$2=yes],
997                      [AC_MSG_RESULT([no]); use_$2=no])])
998
999AC_DEFUN([MY_CHECK_HSLFILE],
1000         [AC_CHECK_FILE([$hslsrcdir/$1.f],
1001                        [AC_DEFINE(HAVE_$2,1,[Define to 1 if $2 is available]) use_$2=BUILD],
1002                        [use_$2=no])])
1003
1004AC_MSG_NOTICE([Checking for Harwell subroutine library])
1005
1006AC_ARG_WITH([hsl],
1007            AC_HELP_STRING([--with-hsl],
1008                           [specify Harwell library (or BUILD for compilation)]),
1009            [use_hsl=$withval], [use_hsl=BUILD])
1010
1011if test "$use_hsl" = BUILD; then
1012# Check which files are available
1013  MY_CHECK_HSLFILE(ma27ad,MA27)
1014  if test "$use_MA27" = BUILD; then
1015    AC_MSG_CHECKING([whether MA27 is threadsafe])
1016    if $EGREP MA27UD $hslsrcdir/ma27ad.f >&5 ; then
1017      AC_MSG_RESULT(yes)
1018    else
1019      AC_MSG_RESULT(no)
1020      AC_MSG_ERROR([Please obtain the threadsafe (newer) version of MA27])
1021    fi
1022  fi
1023  MY_CHECK_HSLFILE(mc19ad,MC19)
1024  MY_CHECK_HSLFILE(ma57ad,MA57)
1025else
1026  SAVE_LIBS="$LIBS"
1027  LIBS="$use_hsl $LIBS $FLIBS"
1028  IPADDLIBS="$use_hsl $IPADDLIBS"
1029  MY_CHECK_HSL([ma27ad],[MA27])
1030  if test "$use_MA27" = "yes"; then
1031    AC_MSG_CHECKING([whether MA27 is threadsafe])
1032    AC_F77_FUNC(ma27ud, cfunc)
1033    AC_TRY_LINK([extern "C" {void $cfunc();}],[$cfunc],
1034                [AC_MSG_RESULT(yes)],
1035                [AC_MSG_RESULT(no)
1036                 AC_MSG_ERROR([Please obtain the threadsafe (newer) version of MA27])])
1037  fi
1038  MY_CHECK_HSL([mc19ad],[MC19])
1039  MY_CHECK_HSL([ma57ad],[MA57])
1040  LIBS="$use_hsl $SAVE_LIBS"
1041fi
1042
1043###########
1044# PARDISO #
1045###########
1046
1047AC_ARG_WITH([pardiso],
1048            AC_HELP_STRING([--with-pardiso],
1049                           [specify Pardiso library (unsupported)]),
1050            [use_pardiso=$withval], [use_pardiso=no])
1051
1052if test ! "$use_pardiso" = "no"; then
1053  LIBS="$use_pardiso $LIBS"
1054  IPADDLIBS="$use_pardiso $IPADDLIBS"
1055
1056# ToDo put this back in
1057#  AC_MSG_CHECKING([whether user-supplied Pardiso library \"$use_pardiso\" works])
1058#  AC_TRY_LINK([],[      call PARDISO()],
1059#              [AC_MSG_RESULT(yes)],
1060#              [AC_MSG_ERROR([Pardiso library $use_pardiso does not seem to work])])
1061
1062  AC_DEFINE(HAVE_PARDISO,1,
1063            [Define to 1 if Pardiso is available (unsupported)])
1064fi
1065
1066#########
1067# TAUCS #
1068#########
1069
1070AC_ARG_WITH([taucs],
1071            AC_HELP_STRING([--with-taucs],
1072                           [specify TAUCS library and dependencies (unsupported)]),
1073            [use_taucs=$withval], [use_taucs=no])
1074
1075if test ! "$use_taucs" = "no"; then
1076  LIBS="$use_taucs $LIBS"
1077  IPADDLIBS="$use_taucs $IPADDLIBS"
1078
1079  AC_DEFINE(HAVE_TAUCS,1,
1080            [Define to 1 if TAUCS is available (unsupported)])
1081
1082  AC_ARG_VAR(TAUCS_INCFLAGS,[Flags for including taucs header files])
1083  CXXFLAGS="$CXXFLAGS $TAUCS_INCFLAGS"
1084fi
1085
1086# Check if at least one linear solver was found
1087
1088AC_ARG_ENABLE([distconf],,
1089  [case "${enableval}" in
1090    yes) distconf=true ;;
1091    no)  distconf=false ;;
1092    *) AC_MSG_ERROR(bad value ${enableval} for --enable-distconf) ;;
1093  esac],[distconf=false])
1094
1095if test "$use_MA27" = "no" -a "$use_MA57" = "no" -a "$use_pardiso" = "no" -a "$use_taucs" = no; then
1096  if test "$distconf" = false; then
1097    AC_MSG_ERROR("No linear solver (such as MA27) available")
1098  fi
1099fi
1100
1101# For the remaining tests we need to include FLIBS into LIBS, so that
1102# the C compiler can link programs
1103LIBS="$LIBS $FLIBS"
1104
1105#######################
1106# AMPL SOLVER LIBRARY #
1107#######################
1108
1109asldir=Extern/ASL/solvers
1110aslsrcdir=$srcdir/$asldir
1111
1112AC_ARG_WITH([asldir],
1113            AC_HELP_STRING([--with-asldir],
1114                           [specify absolute path to AMPL solver directory (or BUILD for compilation, or "no" for disabling AMPL)]),
1115            [use_asldir=$withval], [use_asldir=])
1116
1117if test "$use_asldir" = BUILD; then
1118  AC_CHECK_FILE([$aslsrcdir/asl.h],[],
1119                [AC_MSG_ERROR([option \"BUILD\" specified for asldir, but sources are missing])])
1120elif test -z "$use_asldir"; then
1121 # try to find sources - if not given don't compile
1122  AC_CHECK_FILE([$aslsrcdir/asl.h],[use_asldir=BUILD],[use_asldir=no])
1123elif test ! "$use_asldir" = "no"; then
1124  AC_CHECK_FILE([$use_asldir/amplsolver.a],[],[AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but library missing])])
1125  AC_CHECK_FILE([$use_asldir/asl.h],[],[AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but header files are missing])])
1126  use_asldir=`cd $use_asldir; pwd`
1127  case $build in
1128    *-cygwin*) use_asldir=`cygpath -w $use_asldir` ;;
1129  esac
1130fi
1131
1132if test "$use_asldir" = BUILD; then
1133  if test -z "$ASLMAKEFLAGS" ; then
1134    asladdcflags=
1135    case $build in
1136      *-linux*) asladdcflags="-DNON_STDIO"
1137                case $CC in
1138                  pgcc | */pgcc)
1139                     asladdcflags="$asladdcflags -DNO_fpu_control";;
1140                esac
1141                  ;;
1142      *-cygwin*) asladdcflags="-DNON_STDIO"
1143                if test "$use_mingw" = yes; then
1144                  asladdcflags="$asladdcflags -DNo_Control87 -DNO_RUSAGE"
1145                fi
1146                ;;
1147    esac
1148#    ASLMAKEFLAGS="CFLAGS=\"\$(CFLAGS) $asladdcflags\""
1149# Do the following for now to make sure we are not interupting compilation
1150# of ASL because of warning message:
1151    bla=
1152    for i in $CFLAGS; do
1153      if test ! "$i" = "-Werror"; then
1154        bla="$bla $i"
1155      fi
1156    done
1157    ASLMAKEFLAGS="CFLAGS=\"$bla $asladdcflags\""
1158
1159#   Somehow, -qtune=auto makes ASL segfault on AIX compiler, so take them out
1160    case $CC in
1161      xlc* | */xlc* | mpxlc* | */mpxlc*)
1162        ASLMAKEFLAGS=`echo $ASLMAKEFLAGS | sed 's/-qtune=auto//g' | sed 's/-qarch=auto//g' | sed 's/-qcache=auto//g' | sed 's/-qhot//g' | sed 's/-O3/-O/g'`
1163      ;;
1164    esac
1165
1166    AC_MSG_CHECKING([whether $am_make is the GNU make])
1167    rm -f conftest.mak
1168    ($am_make -v -f conftest.mak > conftest.grp) 2>&5
1169    if $EGREP GNU conftest.grp >&5 ; then
1170      AC_MSG_RESULT([yes])
1171      ASLMAKEFLAGS="-j 1 $ASLMAKEFLAGS"
1172    else
1173      AC_MSG_RESULT([no])
1174    fi
1175    rm -f conftest.mak conftest.grp
1176
1177#    if test $USE_MAINTAINER_MODE = 'yes'; then
1178#      AC_MSG_WARN([Assuming that maintainer mode is only used for GNU make])
1179#      ASLMAKEFLAGS="-j 1 $ASLMAKEFLAGS"
1180#    else
1181#      AC_LANG_PUSH(Fortran 77)
1182#      AC_MSG_CHECKING([whether $am_make understands the `-j 1' flag])
1183#      AC_LANG_CONFTEST([[bladfaoekja:]])
1184#      if ($am_make -f conftest.c -j 1 bladfaoekja >&5) 2>&5 ; then
1185#        AC_MSG_RESULT([yes])
1186#        ASLMAKEFLAGS="-j 1 $ASLMAKEFLAGS"
1187#      else
1188#        AC_MSG_RESULT([no])
1189#        AC_MSG_CHECKING([whether $am_make understands the `-J 1' flag])
1190#        if ($am_make -f conftest.c -J 1 bladfaoekja >&5) 2>&5 ; then
1191#          AC_MSG_RESULT([yes])
1192#          ASLMAKEFLAGS="-J 1 $ASLMAKEFLAGS"
1193#        else
1194#          AC_MSG_RESULT([no])
1195#        fi
1196#      fi
1197#      AC_LANG_POP(Fortran 77)
1198#    fi
1199  fi
1200  ASLMAKEFILECMDS="sed 's/ar \$\$(ARFLAGS)/$AR $ARFLAGS/' makefile.u | sed 's/ar ruv/$AR $ARFLAGS/' "
1201  if test "$EXEEXT" = ".exe"; then
1202    ASLMAKEFILECMDS="$ASLMAKEFILECMDS | sed 's/a.out/a.exe/'"
1203  fi
1204  case $build in
1205    *-cygwin*) ASLMAKEFILECMDS="$ASLMAKEFILECMDS | sed 's%s/System_details/\`uname -sr\`/%s|System_details|\`uname -sr\`|%'" ;;
1206  esac
1207  ASLMAKEFILECMDS="$ASLMAKEFILECMDS > makefile"
1208fi
1209AC_ARG_VAR(ASLMAKEFLAGS,[Compilation flags necessary for compiling the AMPL solver library])
1210AC_SUBST(ASLMAKEFILECMDS)
1211
1212if test ! "$use_asldir" = no; then
1213  AC_CHECK_LIB(dl,[dlopen],[LIBS="$LIBS -ldl"],[])
1214fi
1215
1216AC_LANG_POP(C++)
1217
1218######################################
1219# Equivalent int Fortran and C types #
1220######################################
1221
1222AC_DEFINE([FORTRAN_INTEGER_TYPE],[int],[Define to the C type corresponding to Fortran INTEGER])
1223#AC_CHECK_SIZEOF([long])
1224#AC_CHECK_SIZEOF([int])
1225#AC_CHECK_SIZEOF([double])
1226#AC_MSG_CHECKING([for C type corresponding to Fortran INTEGER])
1227#if test $ac_cv_sizeof_long = $ac_cv_sizeof_double; then
1228#  AC_DEFINE([FORTRAN_INTEGER_TYPE],[int],[Define to the C type corresponding to Fortran INTEGER])
1229#  AC_MSG_RESULT([int])
1230#else
1231#  AC_DEFINE([FORTRAN_INTEGER_TYPE],[long])
1232#  AC_MSG_RESULT([long])
1233#fi
1234
1235
1236IPADDLIBS="$IPADDLIBS"
1237
1238##########
1239# ASTYLE #
1240##########
1241ASTYLE=astyle
1242AC_SUBST(ASTYLE)
1243ASTYLEFLAGS="--mode=c --indent=spaces=2 --indent-cases --indent-namespaces --min-conditional-indent=1 --brackets=linux --brackets=break-closing-headers --max-instatement-indent=2"
1244AC_SUBST(ASTYLEFLAGS)
1245
1246# The following one is for the example makefiles
1247case $build in
1248  *-cygwin*) ipoptlib='`cygpath -w \$(IPOPTLIBDIR)`\\libipopt.a';;
1249  *)         ipoptlib="-L\$(IPOPTLIBDIR) -lipopt";;
1250esac
1251AC_SUBST(ipoptlib)
1252
1253# For ASL
1254AC_SUBST(AMPL_CPPFLAGS)
1255AMPL_CPPFLAGS="-I\$(top_builddir)/Extern/ASL -I\$(top_srcdir)/Extern/ASL/solvers"
1256
1257# Add the compiler warning flags for GNU compilers
1258# (we can't use them during tests)
1259case $build in
1260# Cygwin seems to be giving too many error messages
1261  *-cygwin*) warn_cflags=""
1262             warn_cxxflags=""
1263             ;;
1264esac
1265CFLAGS="$CFLAGS $warn_cflags"
1266CXXFLAGS="$CXXFLAGS $warn_cxxflags"
1267
1268#########################
1269# Makefile conditionals #
1270#########################
1271
1272# The following variable collects the names of libraries that should be
1273# included into libipopt.a
1274AC_SUBST(IPALLLIBS)
1275IPALLLIBS="Algorithm/libipoptalg.a Algorithm/LinearSolvers/liblinsolvers.a Interfaces/libinterfaces.a Common/libcommon.a LinAlg/liblinalg.a LinAlg/TMatrices/libtmatrices.a"
1276
1277AM_CONDITIONAL([BUILDBLAS],[test "$use_blas" = "BUILD"])
1278if test "$use_blas" = BUILD; then
1279  LIBS="$ipblaslibdir/libipblas.a $LIBS"
1280  IPALLLIBS="Extern/blas/libipblas.a $IPALLLIBS"
1281fi
1282
1283# AM_CONDITIONAL([BUILDLAPACK],[test "$use_lapack" = "BUILD"])
1284# if test "$use_lapack" = BUILD; then
1285#   LIBS="$iplapacklibdir/libiplapack.a $LIBS"
1286#   IPALLLIBS="Extern/lapack/libiplapack.a $IPALLLIBS"
1287#   for file in dgesv.f dgetf2.f dgetrf.f dgetrs.f dlabad.f dlacon.f dlacpy.f dlae2.f dlaebz.f dlaev2.f dlagtf.f dlagts.f dlamch.f dlansp.f dlanst.f dlapy2.f dlaqsp.f dlarf.f dlarfg.f dlarnv.f dlartg.f dlaruv.f dlascl.f dlaset.f dlasr.f dlasrt.f dlassq.f dlaswp.f dlatps.f dopgtr.f dopmtr.f dorg2l.f dorg2r.f dppcon.f dppequ.f dpprfs.f dppsv.f dppsvx.f dpptrf.f dpptrs.f drscl.f dspev.f dspevx.f dsptrd.f dstebz.f dstein.f dsteqr.f dsterf.f ieeeck.f ilaenv.f; do
1288#     AC_CONFIG_LINKS($lapackobjdir/$file:$lapackdir/$file)
1289#   done
1290# fi
1291
1292AM_CONDITIONAL([BUILDHSL],[test "$use_hsl" = "BUILD"])
1293if test "$use_hsl" = BUILD ; then
1294#  LDFLAGS="-L$hsllibdir $LDFLAGS"
1295  LIBS="$hsllibdir/libiphsl.a $LIBS"
1296  IPALLLIBS="Extern/HSL/libiphsl.a $IPALLLIBS"
1297fi
1298AM_CONDITIONAL([BUILDMA27],[test "$use_MA27" = BUILD])
1299AM_CONDITIONAL([BUILDMA57],[test "$use_MA57" = BUILD])
1300AM_CONDITIONAL([BUILDMC19],[test "$use_MC19" = BUILD])
1301
1302AM_CONDITIONAL([BUILDBLASDIR],[test "$use_blas" = BUILD])
1303# AM_CONDITIONAL([BUILDLAPACKDIR],[test "$use_lapack" = BUILD])
1304AM_CONDITIONAL([BUILDHSLDIR],[test "$use_hsl" = BUILD])
1305
1306AM_CONDITIONAL([HAVE_MA27],[test ! "$use_MA27" = no])
1307AM_CONDITIONAL([HAVE_MA57],[test ! "$use_MA57" = no])
1308AM_CONDITIONAL([HAVE_MC19],[test ! "$use_MC19" = no])
1309AM_CONDITIONAL([HAVE_PARDISO],[test ! "$use_pardiso" = no])
1310AM_CONDITIONAL([HAVE_TAUCS],[test ! "$use_taucs" = no])
1311
1312AM_CONDITIONAL([BUILDASLDIR],[test "$use_asldir" = BUILD])
1313AM_CONDITIONAL([BUILDAMPLINTERFACE],[test ! "$use_asldir" = "no"])
1314AC_SUBST(ASLLIB)
1315AC_SUBST(AMPL_CPPFLAGS)
1316if test "$use_asldir" = BUILD; then
1317  ASLLIB="\$(top_builddir)/Extern/ASL/amplsolver.a"
1318  AMPL_CPPFLAGS="-I\$(top_builddir)/Extern/ASL -I\$(top_srcdir)/Extern/ASL/solvers"
1319  AC_CONFIG_LINKS(Extern/ASL/ASLsolvers:$asldir)
1320elif test ! "$use_asldir" = no; then
1321  case $build in
1322    *-cygwin*) AMPL_CPPFLAGS="-I\"$use_asldir\""
1323               ASLLIB="\"$use_asldir\amplsolver.a\"" ;;
1324    *)         AMPL_CPPFLAGS="-I$use_asldir"
1325               ASLLIB="$use_asldir/amplsolver.a";;
1326  esac
1327fi
1328
1329
1330AC_CONFIG_FILES([Makefile Common/Makefile
1331                 LinAlg/Makefile LinAlg/TMatrices/Makefile
1332                 Interfaces/Makefile Algorithm/Makefile
1333                 Algorithm/LinearSolvers/Makefile
1334                 Apps/Makefile Apps/AmplSolver/Makefile
1335                 Apps/CUTErInterface/Makefile
1336                 Examples/hs071_f/Makefile
1337                 Examples/Cpp_example/Makefile
1338                 Examples/hs071_cpp/Makefile
1339                 Examples/hs071_c/Makefile
1340                 Extern/Makefile Extern/blas/Makefile
1341                 Extern/HSL/Makefile
1342                 Extern/ASL/Makefile])
1343
1344AC_CONFIG_HEADER([inc/config.h])
1345
1346AC_OUTPUT
1347
1348AC_MSG_NOTICE([Configuration successful])
Note: See TracBrowser for help on using the repository browser.