source: branches/dev/configure.ac @ 567

Last change on this file since 567 was 567, checked in by andreasw, 15 years ago

adapted for Portland compilers

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