1 | # Copyright (C) 2007-2009 International Business Machines. |
---|
2 | # All Rights Reserved. |
---|
3 | # This file is distributed under the Common Public License. |
---|
4 | |
---|
5 | ## $Id: configure.ac 1765 2010-11-03 07:12:05Z stefan $ |
---|
6 | |
---|
7 | # Author: Andreas Waechter IBM 2006-04-13 |
---|
8 | |
---|
9 | ############################################################################# |
---|
10 | # Names and other basic things # |
---|
11 | ############################################################################# |
---|
12 | |
---|
13 | AC_PREREQ(2.59) |
---|
14 | |
---|
15 | AC_INIT([ThirdPartyMumps],[trunk],[http://projects.coin-or.org/BuildTools/newticket]) |
---|
16 | |
---|
17 | AC_COPYRIGHT([ |
---|
18 | Copyright 2007-2009 International Business Machines and others. |
---|
19 | All Rights Reserved. |
---|
20 | This file is part of the open source package Coin which is distributed |
---|
21 | under the Common Public License.]) |
---|
22 | |
---|
23 | # List one file in the package so that the configure script can test |
---|
24 | # whether the package is actually there |
---|
25 | AC_CONFIG_SRCDIR(MUMPS/src/dmumps_part1.F) |
---|
26 | |
---|
27 | # Where should everything be installed by default? Here, we want it |
---|
28 | # to be installed directly in 'bin', 'lib', 'include' subdirectories |
---|
29 | # of the directory where configure is run. The default would be |
---|
30 | # /usr/local. |
---|
31 | AC_PREFIX_DEFAULT([`pwd`]) |
---|
32 | |
---|
33 | AC_COIN_PROJECTDIR_INIT(Mumps) |
---|
34 | |
---|
35 | ############################################################################# |
---|
36 | # Standard build tool stuff # |
---|
37 | ############################################################################# |
---|
38 | |
---|
39 | # Get the system type |
---|
40 | AC_CANONICAL_BUILD |
---|
41 | |
---|
42 | #turn off warnings and pedantic mode since they could make trouble on some platforms, |
---|
43 | #and we couldn't fix them anyway |
---|
44 | coin_skip_warn_cflags=yes |
---|
45 | coin_skip_warn_fflags=yes |
---|
46 | |
---|
47 | # Check if user wants to produce debugging code |
---|
48 | AC_COIN_DEBUG_COMPILE(Mumps) |
---|
49 | |
---|
50 | # Get the name of the C compiler |
---|
51 | AC_COIN_PROG_CC |
---|
52 | |
---|
53 | # Get the name of the Fortran compiler and appropriate compiler options |
---|
54 | AC_COIN_PROG_F77 |
---|
55 | |
---|
56 | # Find out how to call Fortran from C and determine Fortran runtime libraries |
---|
57 | AC_COIN_F77_WRAPPERS |
---|
58 | |
---|
59 | # Add FLIBS to MUMPS_PCLIBS, so that they get into the .pc files |
---|
60 | MUMPS_PCLIBS="$FLIBS" |
---|
61 | |
---|
62 | # We need to translate the result from autoconf to what MUMPS wants |
---|
63 | case "$ac_cv_f77_mangling" in |
---|
64 | "lower case, no underscore, no extra underscore") |
---|
65 | ;; |
---|
66 | "lower case, underscore, no extra underscore") |
---|
67 | MY_DEFS="-DAdd_" |
---|
68 | ;; |
---|
69 | "lower case, no underscore, extra underscore") |
---|
70 | MY_DEFS="-DAdd_" |
---|
71 | ;; |
---|
72 | "lower case, underscore, extra underscore") |
---|
73 | MY_DEFS="-DAdd__" |
---|
74 | ;; |
---|
75 | "upper case, no underscore, no extra underscore") |
---|
76 | MY_DEFS="-DUPPER" |
---|
77 | ;; |
---|
78 | "upper case, no underscore, extra underscore") |
---|
79 | MY_DEFS="-DUPPER" |
---|
80 | ;; |
---|
81 | "upper case, underscore, no extra underscore") |
---|
82 | MY_DEFS="-DUPPER" |
---|
83 | ;; |
---|
84 | "upper case, underscore, extra underscore") |
---|
85 | MY_DEFS="-DUPPER" |
---|
86 | ;; |
---|
87 | esac |
---|
88 | |
---|
89 | # check for pthread.h header file |
---|
90 | AC_COIN_CHECK_HEADER([pthread.h],,[MY_DEFS="$MY_DEFS -DWITHOUT_PTHREAD=1"]) |
---|
91 | |
---|
92 | MY_DEFS="$MY_DEFS -DALLOW_NON_INIT -DMUMPS_ARITH=MUMPS_ARITH_d" |
---|
93 | AC_SUBST(MY_DEFS) |
---|
94 | |
---|
95 | # Initialize automake |
---|
96 | AC_COIN_INIT_AUTO_TOOLS |
---|
97 | |
---|
98 | AC_COIN_CHECK_PACKAGE_BLAS(MUMPS) |
---|
99 | AC_COIN_CHECK_PACKAGE(Metis, [coinmetis >= 4.0], MUMPS) |
---|
100 | |
---|
101 | if test "$coin_has_metis" = yes; then |
---|
102 | MY_DEFS="$MY_DEFS -Dmetis" |
---|
103 | MY_FDEFS="$MY_FDEFS -Dmetis" |
---|
104 | fi |
---|
105 | |
---|
106 | # Mumps can make use of pthreads |
---|
107 | AC_CHECK_LIB([pthread],[pthread_create],[MUMPS_PCLIBS="-lpthread $MUMPS_PCLIBS"]) |
---|
108 | |
---|
109 | # Verify that we can compile Fortran 90 code |
---|
110 | AC_MSG_CHECKING([whether we can compile Fortran 90 code]) |
---|
111 | AC_LANG_PUSH(Fortran 77) |
---|
112 | AC_COMPILE_IFELSE([ MODULE BLA |
---|
113 | DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: BLUBB |
---|
114 | END MODULE BLA],[can_f90=yes],[can_f90=no]) |
---|
115 | AC_MSG_RESULT([$can_f90]) |
---|
116 | AC_LANG_POP(Fortran 77) |
---|
117 | if test $can_f90 = no; then |
---|
118 | AC_MSG_ERROR([Your Fortran compiler can't compile Fortran 90, I cannot compile MUMPS]) |
---|
119 | fi |
---|
120 | |
---|
121 | MUMPSDIR=MUMPS |
---|
122 | MUMPSOBJDIR=`pwd` |
---|
123 | MUMPSSRCDIR=$abs_source_dir/$coin_mumpsobjdir/$MUMPSDIR |
---|
124 | |
---|
125 | AC_SUBST(MUMPSDIR) |
---|
126 | AC_SUBST(MUMPSOBJDIR) |
---|
127 | AC_SUBST(MUMPSSRCDIR) |
---|
128 | |
---|
129 | # Fix Fortran preprocessor flags |
---|
130 | case $F77 in |
---|
131 | *xlf*) |
---|
132 | fdefs= |
---|
133 | for flag in "$MY_FDEFS"; do |
---|
134 | fdefs="$fdefs -WF,$flag" |
---|
135 | done |
---|
136 | MY_FDEFS="$fdefs" |
---|
137 | ;; |
---|
138 | esac |
---|
139 | AC_SUBST(MY_FDEFS) |
---|
140 | |
---|
141 | AC_MSG_CHECKING([for additional preprocessor C flags]) |
---|
142 | AC_MSG_RESULT([$MY_DEFS]) |
---|
143 | AC_MSG_CHECKING([for additional preprocessor Fortran flags]) |
---|
144 | AC_MSG_RESULT([$MY_FDEFS]) |
---|
145 | |
---|
146 | AC_CONFIG_FILES([Makefile coinmumps.pc coinmumps-uninstalled.pc]) |
---|
147 | |
---|
148 | AC_COIN_FINALIZE |
---|