1 | # Copyright (C) 2007-2009 International Business Machines. |
---|
2 | # All Rights Reserved. |
---|
3 | # This file is distributed under the Eclipse Public License. |
---|
4 | |
---|
5 | # Author: Andreas Waechter IBM 2006-04-13 |
---|
6 | |
---|
7 | ############################################################################# |
---|
8 | # Names and other basic things # |
---|
9 | ############################################################################# |
---|
10 | |
---|
11 | AC_PREREQ(2.59) |
---|
12 | |
---|
13 | AC_INIT([ThirdPartyMumps],[trunk],[https://github.com/coin-or-tools/ThirdParty-Mumps/issues/new],,[https://github.com/coin-or-tools/ThirdParty-Mumps]) |
---|
14 | |
---|
15 | AC_COPYRIGHT([ |
---|
16 | Copyright 2007-2009 International Business Machines and others. |
---|
17 | All Rights Reserved. |
---|
18 | This file is part of the open source package Coin which is distributed |
---|
19 | under the Eclipse Public License.]) |
---|
20 | |
---|
21 | # List one file in the package so that the configure script can test |
---|
22 | # whether the package is actually there |
---|
23 | AC_CONFIG_SRCDIR(MUMPS/src/dmumps_part1.F) |
---|
24 | |
---|
25 | AC_COIN_INITIALIZE |
---|
26 | |
---|
27 | ############################################################################# |
---|
28 | # Standard build tool stuff # |
---|
29 | ############################################################################# |
---|
30 | |
---|
31 | # Get the name of the C compiler and appropriate compiler options |
---|
32 | AC_COIN_PROG_CC |
---|
33 | |
---|
34 | # Get the name of the Fortran compiler and appropriate compiler options |
---|
35 | AC_COIN_PROG_FC |
---|
36 | |
---|
37 | # Initialize libtool |
---|
38 | AC_COIN_PROG_LIBTOOL |
---|
39 | |
---|
40 | # Add FLIBS to MUMPS_LFLAGS, so that they get into the .pc files section for static builds |
---|
41 | MUMPS_LFLAGS="$MUMPS_LFLAGS $FLIBS" |
---|
42 | |
---|
43 | # Figure out name mangling that Fortran objects will have and translate |
---|
44 | # them to what MUMPS wants |
---|
45 | AC_FC_WRAPPERS |
---|
46 | case "$ac_cv_fc_mangling" in |
---|
47 | "lower case, no underscore, no extra underscore" ) ;; |
---|
48 | "lower case, underscore, no extra underscore" ) MY_DEFS="-DAdd_" ;; |
---|
49 | "lower case, no underscore, extra underscore" ) MY_DEFS="-DAdd_" ;; |
---|
50 | "lower case, underscore, extra underscore" ) MY_DEFS="-DAdd__" ;; |
---|
51 | "upper case, no underscore, no extra underscore" ) MY_DEFS="-DUPPER" ;; |
---|
52 | "upper case, no underscore, extra underscore" ) MY_DEFS="-DUPPER" ;; |
---|
53 | "upper case, underscore, no extra underscore" ) MY_DEFS="-DUPPER" ;; |
---|
54 | "upper case, underscore, extra underscore" ) MY_DEFS="-DUPPER" ;; |
---|
55 | esac |
---|
56 | |
---|
57 | # Mumps can make use of pthreads |
---|
58 | # check for pthread.h header file and library |
---|
59 | AC_ARG_ENABLE([pthread-mumps], |
---|
60 | [AC_HELP_STRING([--disable-pthread-mumps],[disable use of pthread library])], |
---|
61 | [enable_pthread_mumps=$enableval], |
---|
62 | [enable_pthread_mumps=yes]) |
---|
63 | if test $enable_pthread_mumps = yes ; then |
---|
64 | AC_CHECK_HEADER([pthread.h],[],[enable_pthread_mumps=no]) |
---|
65 | fi |
---|
66 | if test $enable_pthread_mumps = yes ; then |
---|
67 | AC_CHECK_LIB([pthread],[pthread_create], |
---|
68 | [MUMPS_LFLAGS="$MUMPS_LFLAGS -lpthread"], |
---|
69 | [enable_pthread_mumps=no]) |
---|
70 | fi |
---|
71 | if test $enable_pthread_mumps = no ; then |
---|
72 | MY_DEFS="$MY_DEFS -DWITHOUT_PTHREAD=1" |
---|
73 | fi |
---|
74 | |
---|
75 | MY_DEFS="$MY_DEFS -DALLOW_NON_INIT -DMUMPS_ARITH=MUMPS_ARITH_d" |
---|
76 | AC_SUBST(MY_DEFS) |
---|
77 | |
---|
78 | AC_COIN_CHK_LAPACK(MUMPS) |
---|
79 | if test $coin_has_lapack != yes; then |
---|
80 | AC_MSG_ERROR([Required package LAPACK not found.]) |
---|
81 | fi |
---|
82 | |
---|
83 | AC_COIN_CHK_LIBM(METISCHECK) |
---|
84 | AC_LANG_PUSH(Fortran) |
---|
85 | AC_COIN_CHK_LIB(Metis,[MUMPS],[-lmetis "$METISCHECK_LFLAGS"],[],[],[metis_nodend]) |
---|
86 | AC_LANG_POP(Fortran) |
---|
87 | |
---|
88 | if test $coin_has_metis = yes ; then |
---|
89 | AC_LANG_PUSH(C) |
---|
90 | coin_CPPFLAGS="$CPPFLAGS" |
---|
91 | CPPFLAGS="$CPPFLAGS $metis_cflags" |
---|
92 | AC_CHECK_HEADER([metis.h],,[coin_has_metis=no]) |
---|
93 | CPPFLAGS="$coin_CPPFLAGS" |
---|
94 | AC_LANG_POP(C) |
---|
95 | fi |
---|
96 | |
---|
97 | # check whether we can redefine metis_nodend to coinmetis_nodend from metis_adapter |
---|
98 | if test $coin_has_metis = yes ; then |
---|
99 | AC_FC_PP_DEFINE([],[coin_has_metis=no]) |
---|
100 | fi |
---|
101 | AM_CONDITIONAL(COIN_HAS_METIS, [test $coin_has_metis = yes]) |
---|
102 | |
---|
103 | if test "$coin_has_metis" = yes; then |
---|
104 | MY_DEFS="$MY_DEFS -Dmetis" |
---|
105 | MY_FDEFS="$MY_FDEFS -Dmetis" |
---|
106 | fi |
---|
107 | |
---|
108 | # Fix Fortran preprocessor flags |
---|
109 | case $FC in |
---|
110 | *xlf*) |
---|
111 | fdefs= |
---|
112 | if test -n "$MY_FDEFS"; then |
---|
113 | for flag in $MY_FDEFS; do |
---|
114 | fdefs="$fdefs -WF,$flag" |
---|
115 | done |
---|
116 | fi |
---|
117 | MY_FDEFS="$fdefs" |
---|
118 | ;; |
---|
119 | esac |
---|
120 | AC_SUBST(MY_FDEFS) |
---|
121 | |
---|
122 | AC_COIN_FINALIZE_FLAGS([MUMPS]) |
---|
123 | |
---|
124 | # if libexport_attribute is set by COIN_FINALIZE_FLAGS to __declspec(dllimport) |
---|
125 | # then we want to use MUMPS_CALL=__declspec(dllexport) when building Mumps |
---|
126 | # and users should use __declspec(dllimport), but the parenthesis are difficult |
---|
127 | # to pass on via compiler flags |
---|
128 | # so also create and install our own version of mumps_compat.h instead |
---|
129 | if test "$libexport_attribute" = "__declspec(dllimport)" ; then |
---|
130 | MY_DEFS="$MY_DEFS -DMUMPS_CALL=\"__declspec(dllexport)\"" |
---|
131 | fi |
---|
132 | AC_DEFINE_UNQUOTED(MUMPS_CALL, [$libexport_attribute], [Library Visibility Attribute]) |
---|
133 | |
---|
134 | AC_MSG_NOTICE([additional C preprocessor flags: $MY_DEFS]) |
---|
135 | AC_MSG_NOTICE([additional Fortran preprocessor flags: $MY_FDEFS]) |
---|
136 | |
---|
137 | AC_CONFIG_FILES([Makefile coinmumps.pc]) |
---|
138 | AC_CONFIG_HEADER(config.h mumps_compat.h) |
---|
139 | |
---|
140 | AC_COIN_FINALIZE |
---|