-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
323 lines (264 loc) · 8.34 KB
/
configure.ac
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# $Id: configure.ac,v 1.16 2008/12/02 21:28:54 cvsuser Exp $
# configure.ac
AC_PREREQ(2.6)
AC_INIT([libdrdc], [0.2-0])
AC_CONFIG_SRCDIR([src/libdrdc.h])
AM_INIT_AUTOMAKE
# determine system type by conventional m4 macro
AC_CANONICAL_TARGET
AM_PROG_AR
LT_INIT
# Get the date timestamp for library / documentation version control
DATE=$(date)
AC_SUBST(DATE)
AC_CONFIG_MACRO_DIR([m4])
# Library Version Master Version DO NOT TOUCH
MAJORVERSION=0
MINORVERSION=2
REVISION=0
VER='${MAJORVERSION}:${MINORVERSION}:${REVISION}'
#
# USE PKGCONFIG
PKG_PROG_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
# Horrible hack for systems where the pkg-config install directory is simply wrong!
if $PKG_CONFIG --variable=pc_path pkg-config 2>/dev/null | grep -q /libdata/; then
PKG_INSTALLDIR(['${prefix}/libdata/pkgconfig'])
else
PKG_INSTALLDIR
fi
fi
#
# Test for target type or accept default = build || target
AC_MSG_CHECKING([Target OS type])
if test -z "$DRDC_PREFIX" ; then
#AC_MSG_WARN([ DRDC_PREFIX was not specified])
DRDC_PREFIX=$host_triplet
fi
# determine target operating system for library compilation
# carried out by drdc-target-prefix.m4 file in aclocal
TARGET_PREFIX
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_SUBST(MAJORVERSION)
AC_SUBST(MINORVERSION)
AC_SUBST(REVISION)
REL_VER=${REVISION}
LIB_VER=${MAJORVERSION}.${MINORVERSION}-${REVISION}
# | | |
# +------+ | +----+
# | | |
# current : revision : age
# | | |
# | | +- increment if interfaces have been added
# | | set to zero if interfaces have been removed
# | | or changed
# | +- increment if source code has changed
# | set to zero if current is incremented
# +- increment if interfaces have been added, removed or changed
AC_SUBST(LIB_VER)
AC_SUBST(REL_VER)
# generic declaration before modification
AM_CFLAGS=
AM_LDFLAGS=
# assign library prefix based on output
#
DRDC_PREFIX=libdrdc
AC_ARG_ENABLE(
[tests],
[AC_HELP_STRING([--enable-tests],[enable tests (default:false)])],
[case "${enableval}" in
yes) enable_tests=true ;;
no) enable_tests=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-tests]) ;;
esac],
[enable_tests=false]
)
AM_CONDITIONAL([TESTS], [test x$enable_tests = xtrue])
AC_ARG_ENABLE(
[f2cblas],
[AC_HELP_STRING([--enable-f2cblas],[enable f2cblas (default:false)])],
[case "${enableval}" in
yes) enable_f2cblas=true ;;
no) enable_f2cblas=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-f2cblas]) ;;
esac],
[enable_f2cblas=false]
)
AM_CONDITIONAL([F2CBLAS], [test x$enable_f2cblas = xtrue])
AC_ARG_ENABLE(
[extras],
[AC_HELP_STRING([--enable-extras],[enable extra functions (default:false)])],
[case "${enableval}" in
yes) enable_extras=true ;;
no) enable_extras=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-extras]) ;;
esac],
[enable_extras=false]
)
AM_CONDITIONAL([EXTRAS], [test x$enable_extras = xtrue])
#AC_ARG_ENABLE(
#[cppwrapper],
#[AC_HELP_STRING([--enable-cppwrapper],[enable cppwrapper (default:false)])],
#[case "${enableval}" in
# yes) enable_cppwrapper=true ;;
# no) enable_cppwrapper=false ;;
# *) AC_MSG_ERROR([bad value ${enableval} for --enable-cppwrapper]) ;;
#esac],
#[enable_cppwrapper=false]
#)
#AM_CONDITIONAL([CPPWRAPPER], [test x$enable_cppwrapper = xtrue])
AC_PROG_CC_STDC
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AM_CFLAGS=
AM_LDFLAGS=
case "${BUILD_TYPE}" in
rtems)
DRDC_PREFIX=${DRDC_PREFIX}/${target_alias}
CC=${target_alias}-gcc
AR=${target_alias}-ar
AS=${target_alias}-as
NM=${target_alias}-nm
LD=${target_alias}-ld
CXX=${target_alias}-g++
OBJCOPY=${target_alias}-objcopy
RANLIB=${target_alias}-ranlib
export CC
export AR
export AS
export NM
export LD
export CXX
export OBJCOPY
export RANLIB
;;
gnu)
DRDC_PREFIX=${DRDC_PREFIX}/${target_cpu}-gnu
# Checks for programs.
;;
esac
#now set include directory name
libdir=$libdir/$DRDC_PREFIX
includedir=$includedir/$DRDC_PREFIX
# check for standard C headers
AC_CHECK_HEADER([math.h])
AC_CHECK_HEADER([stdio.h])
AC_CHECK_HEADER([stdlib.h])
AC_CHECK_HEADER([assert.h])
# check for kernel headers
AC_CHECK_HEADER([setjmp.h])
# configure to use ATLAS library and make all checks within.
# check for ATLAS availability of headers and functions here as a series of checks
AC_ARG_WITH([atlas],
[AS_HELP_STRING([--with-atlas],
[supports ATLAS Linear Algebra Suite vector and matrix multiplication])],
[AC_CHECK_HEADER([atlas_buildinfo.h]) \
AC_CHECK_HEADER([atlas_pthreads.h]) \
AC_CHECK_HEADER([atlas/atlas_f77.h])
AC_CHECK_HEADER([atlas/blas.h]) \
AC_CHECK_HEADER([atlas/cblas.h]) \
AC_CHECK_HEADER([atlas/atlas.h]) \
AC_CHECK_HEADER([atlas/clapack.h]) \
AC_CHECK_HEADER([atlas.h]) \
AC_CHECK_LIB([atlas],[ATL_cswap],[],[echo libatlas not found] ) \
AC_CHECK_FUNC([ATL_cswap], [AC_DEFINE([HAVE_ATL_CSWAP], [1],[Define function ATL_cswap exists.])],[] ) \
AC_CHECK_FUNC([ATL_sdot], [AC_DEFINE([HAVE_ATL_SDOT], [1],[Define function ATL_sdot exists.])],[] ) \
AC_CHECK_FUNC([ATL_ddot], [AC_DEFINE([HAVE_ATL_DDOT], [1],[Define function ATL_ddot exists.])],[] ) \
AC_DEFINE([WITH_ATLAS], [1], [Define with ATLAS support included.] )
],
[])
AC_SUBST(WITH_ATLAS)
# alternate location
AC_CHECK_HEADER([blas.h])
AC_CHECK_HEADER([cblas.h])
AC_CHECK_HEADER([lapack.h])
AC_CHECK_HEADER([clapack.h])
# try to find libray in usual spaces
AC_CHECK_LIB([m],[fabs],[],[echo fabs not found] )
AC_CHECK_LIB([blas],[dgemm_],[],[echo blas not found] )
AC_CHECK_LIB([cblas],[cblas_xerbla],[],[echo cblas not found] )
AC_SUBST(DRDC_PREFIX)
AC_SUBST(prefix)
AC_SUBST(libdir)
AC_SUBST(includedir)
AC_SUBST(srcdir)
# output phase - puts results into files
AC_CONFIG_HEADER([config.h])
# standard compilation directories
AC_CONFIG_FILES([
Makefile
doxygen/libdrdc.cfg
src/Makefile
src/cexcept/Makefile
src/coordinate/Makefile
src/matrix_ops/Makefile
src/homogeneous/Makefile
src/quaternion/Makefile
src/time_conv/Makefile
src/unit_conv/Makefile
src/data_conv/Makefile
src/wrapper/Makefile
src/sglib/Makefile
])
# conditional compilation directories
AS_IF(
[test "$enable_f2cblas" = true ],
[
AC_CONFIG_FILES([
src/f2c_blas/Makefile])
])
AS_IF(
[test "$enable_extras" = true ],
[
AC_CONFIG_FILES([
src/extras/Makefile
src/extras/dp46/Makefile
])
])
# conditional test suite
AS_IF(
[test "$enable_tests" = true ],
[
AC_CONFIG_FILES([
tests/Makefile
tests/common/Makefile
tests/cexcept/Makefile
tests/wrapper/Makefile
tests/extras/Makefile
tests/sglib/Makefile
])
])
# configure for pkgconfig files.
AC_CONFIG_FILES([
libdrdc.pc])
AM_DEP_TRACK
AC_OUTPUT
dnl AC_MSG_NOTICE(configured install directory is )
dnl AC_MSG_RESULT($DRDC_PREFIX)
dnl AC_MSG_RESULT($libdir)
dnl AC_MSG_RESULT($includedir)
dnl AC_MSG_RESULT($PACKAGE)
dnl AC_MSG_RESULT($enable_tests)
dnl echo ${PACKAGE_STRING} "library version is... " ${LIB_VER}
dnl echo ${PACKAGE_STRING} "library release is... " ${REL_VER}
dnl LIBDRDC configuration summary
dnl -------------------------
cat <<EOF
LIBDRDC configuration summary
-------------------------
TARGET_OS : ${TARGET_OS}
target_cpu : ${target_cpu}
DRDC_PREFIX : ${DRDC_PREFIX}
PATH : ${PATH}
AM_CFLAGS : ${AM_CFLAGS}
AM_LDFLAGS : ${AM_LDFLAGS}
Install lib directory : ${libdir}
Install include directory : ${includedir}
Library version : ${LIB_VER}
Library release : ${REL_VER}
enable tests : ${enable_tests}
enable F2CBLAS library : ${enable_f2cblas}
enable extras : ${enable_extras}
enable ATLAS : ${with_atlas}
EOF