File: configure.ac

package info (click to toggle)
sdpa 7.3.20-2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,688 kB
  • sloc: cpp: 15,021; sh: 4,870; makefile: 318; ansic: 81
file content (185 lines) | stat: -rw-r--r-- 5,545 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
dnl
dnl Configure for SDPA 
dnl Copyright (C) 2004-2025 SDPA Project
dnl

AC_INIT([sdpa],[7.3.20])
AM_INIT_AUTOMAKE
AC_PROG_RANLIB
AC_PROG_CC
AC_PROG_CXX
AC_PROG_FC
AC_FC_LIBRARY_LDFLAGS
AC_FC_WRAPPERS
AC_CANONICAL_HOST

AC_ARG_WITH(pthread-include,
[  --with-pthread-include  Gives pthread include you use(e.g., "-I/usr/include")],
PTHREAD_INCLUDE=$withval
)

AC_ARG_WITH(pthread-libs,
[  --with-pthread-libs     Gives pthread name you use(e.g., "-lpthread")],
PTHREAD_LIBS=$withval
)

AC_ARG_WITH(blas,
[  --with-blas             Gives BLAS full name you use(e.g., "/usr/lib/liblblas.a")],
BLAS_LIBS=$withval
)

AC_ARG_WITH(lapack,
[  --with-lapack           Gives LAPACK full name you use(e.g., "/usr/lib/liblapack.a")],
LAPACK_LIBS=$withval
)

AC_ARG_WITH(mumps-include,
[  --with-mumps-include    Gives MUMPS include you use(e.g., "-I/usr/include    or    -I/usr/lib/mumps/include")],
MUMPS_INCLUDE=$withval
if test x"$MUMPS_INCLUDE" = x; then
  if test -d /usr/include/mumps; then
    MUMPS_INCLUDE="-I/usr/include/mumps"
  fi
fi
)

AC_ARG_WITH(mumps-libs,
[  --with-mumps-libs       Gives MUMPS library you use(e.g., "/usr/lib/libdmumps_seq.a /usr/lib/libmumps_common_seq.a /usr/lib/libmpiseq_seq.a /usr/lib/libpord_seq.a    or   /usr/lib/mumps/lib/libdmumps.a /usr/lib/mumps/lib/libmumps_common.a /usr/lib/mumps/lib/libpord.a /usr/lib/mumps/libseq/libmpiseq.a")],
MUMPS_LIBS=$withval
)

dnl spooles requires -lm when linking.
LIB="-lm"

dnl How thread we link thread library esp. needed for spooles.
case "$host" in
        *-*-linux*|*-*-uclinux*)
            pthread_cflags="-D_REENTRANT"
            ;;
esac
CXXFLAGS="$CXXFLAGS $pthread_cflags"

dnl -fPIC is necessary to link with mex files on 64bit linux
CFLAGS="$CFLAGS -Wall -fPIC -funroll-all-loops"
CXXFLAGS="$CXXFLAGS -Wall -fPIC -funroll-all-loops"
FCFLAGS="$FCFLAGS -Wall -fPIC -funroll-all-loops"

AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(FCFLAGS)
AC_SUBST(FCLIBS)


dnl check pthread rountines
HAVE_PTHREAD=""
dnl default blas name is libpthread, thus we pass -lpthread.
if test x"$PTHREAD_INCLUDE" = x; then
  PTHREAD_INCLUDE="-I/usr/include"
fi
if test x"$PTHREAD_LIBS" = x; then
  PTHREAD_LIBS="-lpthread"
fi
save_LIBS="$LIBS"
LIBS="$LIBS $PTHREAD_LIBS"
checkLIBS=$LIBS
AC_CHECK_FUNC(pthread_create, [HAVE_PTHREAD=yes])
LIBS="$save_LIBS"
AC_SUBST(PTHREAD_INCLUDE)
AC_SUBST(PTHREAD_LIBS)

if test x"$HAVE_PTHREAD" != xyes; then
  echo "Pthread function (pthread_create) was compiled by"
  echo "( $CC $CXXFLAGS $PTHREAD_INCLUDE conftest.c $checkLIBS )"
  echo "but failed."
  echo "(1) Please verify config.log to check whether libraries are linked correctrly"
  AC_MSG_ERROR([Pthread link failed])
fi


dnl check BLAS/LAPACK rountines
HAVE_BLAS=""

dnl default blas name is libblas, thus we pass -lblas.
if test x"$BLAS_LIBS" = x; then
  BLAS_LIBS="-lblas"
fi
save_LIBS="$LIBS"
AC_FC_FUNC(dgemm)
LIBS="$LIBS $BLAS_LIBS $FCLIBS $PTHREAD_LIBS"
checkLIBS=$LIBS
AC_CHECK_FUNC($dgemm, [HAVE_BLAS=yes])
LIBS="$save_LIBS"
AC_SUBST(BLAS_LIBS)

if test x"$HAVE_BLAS" != xyes; then
  echo "BLAS function (dgemm) was compiled by"
  echo "( $CC $CFLAGS conftest.c $checkLIBS )"
  echo "but failed."
  echo "(1) Please verify config.log to check whether libraries are linked correctrly"
  echo "(2) Please install one of your favorite BLAS"
  echo "OpenBLAS:  http://xianyi.github.com/OpenBLAS/"
  echo "BLAS:      http://www.netlib.org/blas/"
  echo "ATLAS:     http://math-atlas.sourceforge.net/"
  AC_MSG_ERROR([BLAS link failed])
fi
          
dnl Check whether we can call LAPACK subroutines
HAVE_LAPACK=""

dnl default lapack name is liblapack, thus we pass -llapack.
if test x"$LAPACK_LIBS" = x; then
  LAPACK_LIBS="-llapack"
fi
save_LIBS="$LIBS"
AC_FC_FUNC(dsyev)
LIBS="$LIBS $LAPACK_LIBS $BLAS_LIBS $FCLIBS $PTHREAD_LIBS"
checkLIBS=$LIBS
AC_CHECK_FUNC($dsyev, [HAVE_LAPACK=yes])
LIBS="$save_LIBS"
AC_SUBST(LAPACK_LIBS)

if test x"$HAVE_LAPACK" != xyes; then
  echo "LAPACK function (dsyev) was compiled by"
  echo "( $CC $CFLAGS conftest.c $checkLIBS )"
  echo "but failed."
  echo "Please verify config.log to check whether libraries are linked correctrly"
  echo "Please install LAPACK"
  echo "LAPACK:   http://www.netlib.org/lapack/"
  AC_MSG_ERROR([LAPACK link failed])
fi

dnl Check whether we can call MUMPS subroutines
HAVE_MUMPS=""
dnl default lapack name is liblapack, thus we pass -llapack.
if test x"$MUMPS_INCLUDE" = x; then
  MUMPS_INCLUDE="-I/usr/include"
fi
if test x"$MUMPS_LIBS" = x; then
   dnl MUMPS_LIBS="/usr/lib/libdmumps_seq.a /usr/lib/libmumps_common_seq.a /usr/lib/libmpiseq_seq.a /usr/lib/libpord_seq.a"
   MUMPS_LIBS="-ldmumps_seq -lsmumps_seq -lcmumps_seq -lzmumps_seq -lmumps_common_seq -lmpiseq_seq -lpord -lscotch -lscotcherr -lesmumps"
fi
save_LIBS="$LIBS"
AC_FC_FUNC(dmumps)
LIBS="$LIBS $MUMPS_LIBS $LAPACK_LIBS $BLAS_LIBS $FCLIBS $PTHREAD_LIBS"
checkLIBS=$LIBS
AC_CHECK_FUNC($dmumps, [HAVE_MUMPS=yes])
LIBS="$save_LIBS"

if test x"$HAVE_MUMPS" != xyes; then
  echo "MUMPS link failed"
  echo "MUMPS function (dmumps) was compiled by"
  echo "( $CC $CFLAGS $MUMPS_INCLUDE conftest.c $checkLIBS )"
  echo "but failed."
  echo "MUMPS packages will be downloaded by wget command."
  MUMPS_DIR=`pwd`/mumps/build
  MUMPS_INCLUDE="-I${MUMPS_DIR}/include"
  MUMPS_LIBS="-L${MUMPS_DIR}/lib -ldmumps -lmumps_common -lpord -L${MUMPS_DIR}/libseq -lmpiseq"
fi
AC_SUBST(MUMPS_INCLUDE)
AC_SUBST(MUMPS_LIBS)
AC_SUBST(MUMPS_DIR)
AM_CONDITIONAL(HAVE_PACKAGE_MUMPS, [test x"$HAVE_MUMPS" = xyes])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT