-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
171 lines (152 loc) · 5.82 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
AC_INIT([URFIT],[0.1],[[email protected]])
AM_INIT_AUTOMAKE([-Wall subdir-objects])
AC_PROG_CC
AM_PROG_CC_C_O
AC_LANG([C])
AC_PROG_RANLIB ## include a check for libtool if not use ranlib?
AM_PROG_AR
AC_C_BIGENDIAN
## SET up the m4
AC_CONFIG_MACRO_DIR([m4])
## prefix!!
AC_DEFINE_UNQUOTED([HAVE_PREFIX],["$prefix"],[Look for where we prefix to])
## Tells us where we are prefixed to
AC_MSG_NOTICE([Configuring for location "$prefix"])
## If we prefix away from the default /usr/ then create binary GLU
## will still try and create shared object libraries there
AM_CONDITIONAL([PREF],[ test "$prefix" == "NONE" ])
if test "$prefix" == "NONE" ; then
AC_MSG_NOTICE([Not creating binary "URFIT"])
else
AC_MSG_NOTICE([Creating binary "URFIT" in $prefix/bin])
mkdir $prefix
mkdir $prefix/bin
fi
AC_SUBST(PREF)
## C standard libraries
AC_CHECK_HEADERS([math.h],[
LDFLAGS="$LDFLAGS -lm" ])
## code needs gsl
gsl=false
AC_ARG_WITH([gsl],
AS_HELP_STRING([--with-gsl=<name>],[Specify GSL location for the GF]),
[GSL=${with_gsl}
## test to see if something is there ...
if [ test -a ${GSL}include/gsl/gsl_rng.h ]; then
AC_MSG_NOTICE([User defined Gnu Scientific Library (GSL) @ $GSL])
## check if the gsl static lib is available
if [ test -a ${GSL}lib/libgsl.a ]; then
AC_MSG_NOTICE([Statically linking to the user's GSL lib])
CFLAGS="$CFLAGS -I${GSL}include"
LDFLAGS="$LDFLAGS ${GSL}lib/libgsl.a"
AC_DEFINE([HAVE_GSL],,[Do we have the GSL libs?])
elif [ test -a ${GSL}lib/libgsl.so ]; then
AC_MSG_NOTICE([Static link to GSL not found!! Shared object (.so) linking to the user's GSL link ])
CFLAGS="$CFLAGS -I${GSL}include -L${GSL}lib/ "
LDFLAGS="$LDFLAGS -lgsl -lgslcblas"
AC_DEFINE([HAVE_GSL],,[Do we have the GSL libs?])
else
AC_MSG_ERROR([gsl_rng.h found, but cannot find the static or shared libraries needed to link against!])
fi
echo " "
fi
## have a look for the ones in /usr/
AC_CHECK_HEADERS([gsl/gsl_eigen.h],[LDFLAGS="$LDFLAGS -lgsl -lgslcblas"])
],[ AC_MSG_ERROR([GSL needed (need --with-gsl) ]) ])
AM_CONDITIONAL([DEFGSL],[$gsl])
## Include where it is just in case people want to do something in Makefile.am
AC_SUBST(GSL)
## Look for fftw in the useer specified place
fftw=false
AC_ARG_WITH([fftw],
AS_HELP_STRING([--with-fftw=<name>],[Specify FFTW location for the GF]),
[
## see if we already have it
AC_CHECK_HEADERS([fftw3.h],[local_fftw=true],[local_fftw=false])
FFTW=${with_fftw}
## are we compiling for single precision or not?
if test x$single = xtrue ; then
float_version=f
else
float_version=""
fi
AC_CHECK_HEADERS([${FFTW}include/fftw3.h],[
AC_MSG_NOTICE([User defined fftw library @ $FFTW])
AC_MSG_NOTICE([Attempting linking to the user's FFTW lib ${FFTW}lib/libfftw3${float_version}])
## if we use the user one, only link to the static lib
if [ test -a ${FFTW}lib/libfftw3${float_version}.a ]; then
AC_MSG_NOTICE([Statically linking to the user's FFTW lib])
CFLAGS="$CFLAGS -I${FFTW}include"
LDFLAGS="$LDFLAGS ${FFTW}lib/libfftw3${float_version}.a"
if test x$OMP_FFTW = xtrue ; then
if test -a ${FFTW}lib/libfftw3${float_version}_omp.a ; then
LDFLAGS="$LDFLAGS ${FFTW}lib/libfftw3${float_version}_omp.a"
AC_DEFINE([OMP_FFTW],[],[OpenMP-parallel FFT routines.])
fi
fi
AC_DEFINE([HAVE_FFTW3_H],[],[FFTW library.])
## Have a look for the shared object library ...
elif [ test -a ${FFTW}lib/libfftw3${float_version}.so ]; then
AC_MSG_NOTICE([Static link not found !! Shared object (.so) linking to the user's FFTW lib])
CFLAGS="$CFLAGS -I${FFTW}include -L${FFTW}lib/"
LDFLAGS="$LDFLAGS -lfftw3${float_version}"
if test x$OMP_FFTW = xtrue ; then
## check to see if it is there otherwise don't include it
if test -a ${FFTW}lib/libfftw3${float_version}_omp.so ; then
LDFLAGS="$LDFLAGS -lfftw3${float_version}_omp"
AC_DEFINE([OMP_FFTW],[],[OpenMP-parallel FFT routines.])
fi
fi
AC_DEFINE([HAVE_FFTW3_H],[],[FFTW library.])
else
AC_MSG_ERROR([fftw3.h found, but cannot find the shared or static libraries!])
fi
]
, [
## see if we already have it
AC_CHECK_HEADERS([fftw3.h],[local_fftw=true],[local_fftw=false])
## get desperate here and check for the header in the usual places
## as omp routines are special I doubt they will be installed, maybe should do a special check
if test x$local_fftw = "xtrue" ; then
LDFLAGS="$LDFLAGS -lfftw3${float_version}"
AC_MSG_NOTICE([Using the system's fftw])
AC_DEFINE([HAVE_FFTW3_H],[],[FFTW library.])
else
AC_MSG_NOTICE([No local fftw3.h found either!])
fi
]) ## closes the check headers ...
]
## closes with-FFTW
)
AM_CONDITIONAL([DEFFFTW],[$fftw])
AC_SUBST(FFTW)
## QDP_GAMMA_CONVENTIONS
AC_ARG_ENABLE([QDP_GAMMA_CONVENTION],
[--enable-QDP_GAMMA_CONVENTION],
[case "${enableval}" in
yes)
AC_MSG_NOTICE([Using QDP++ gamma labelling convention])
AC_DEFINE([QDP_GAMMA_CONVENTION],[],[QDP++ gamma conventions])
;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-QDP_GAMMA_CONVENTION]) ;;
esac
],[])
## Some compiler checks
## My code is littered with consts
AC_C_CONST([])
## Also use the restrict flag a lot
AC_C_RESTRICT([])
## Many of my functions are "inlined" {compiler's choice so maybe not} ,
## hence the large binary
AC_C_INLINE([])
## Set up config.h, one of the most important headers of them all
AC_CONFIG_HEADERS([config.h])
## where are my files?
AC_CONFIG_FILES([
Makefile
src/Makefile
])
## tell us what flags we are using
echo CFLAGS used :: $CFLAGS
echo LDFLAGS used :: $LDFLAGS
AC_OUTPUT