-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac.source
336 lines (247 loc) · 8.26 KB
/
configure.ac.source
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
324
325
326
327
328
329
330
331
332
333
334
335
#
# Process this file with autoconf to produce a configure script.
#
AC_INIT([__PROGNAME__], [__PROGVERSION__], [[email protected]])
AC_PREREQ(2.61)
#AC_CONFIG_HEADER([config.h])
# sanity check a file to see if we're really in the build directory
AC_CONFIG_SRCDIR([src/CLIcore.c])
AC_CONFIG_MACRO_DIR([m4])
# Init Automake
AM_INIT_AUTOMAKE([foreign -Wall])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# Init Libtool
LT_INIT
# find the c-complier
#AC_PROG_CC
AM_PROG_CC_C_O
# check for openMP
AC_OPENMP
# Support for Bison and Flex
AC_PROG_YACC
AM_PROG_LEX
# Support for pthreads
ACX_PTHREAD
#LIBS="$PTHREAD_LIBS $LIBS"
#CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
#CC="$PTHREAD_CC"
#
# Coerce @prefix@ default from /usr/local/ to fullpath of dir configure is run in
AC_PREFIX_DEFAULT(`readlink -f .`)
CPPFLAGS="$CPPFLAGS -I/usr/local/include/"
#LDFLAGS="$LDFLAGS -L/usr/lib/"
AC_ARG_ENABLE(fftwmt,
[AS_HELP_STRING( --enable-fftwmt Enable FFTW multi-thread )],
[ fftwmt=yes
])
#
# Look for libraries
#
AC_CHECK_LIB([m],[main],
[],
[ echo "Cannot find required library:math";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:math"]);
exit 0;
])
AC_CHECK_LIB([rt], [clock],
[],
[ echo "Cannot find required library:rt";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:rt"]);
exit 0;
])
AC_CHECK_LIB([pthread], [pthread_create].
[],
[ echo "Cannot find required library:pthread";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:pthread"]);
exit 0;
])
AC_CHECK_LIB([gslcblas],[main],
[],
[ echo "Cannot find required library:gslcblas";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:gslcblas"]);
exit 0;
])
AC_CHECK_LIB([gsl],[main],
[],
[ echo "Cannot find required library:gsl";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:gsl"]);
exit 0;
])
AC_CHECK_LIB([cfitsio],[main],
[],
[ echo "Cannot find required static library:fitsio";
echo "did you install libcfitsio3-dev package ?";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:fitsio"]);
exit 0;
])
AC_SEARCH_LIBS( [readline], [readline],
[AC_DEFINE([HAVE_READLINE_H], 1, "Define to 1 if you have <readline.h>") ],
[ echo "Cannot find required static library:readline";
echo "did you install libreadline<#>-dev package ?";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:readlline"]);
exit 0;
])
AC_CHECK_LIB( [ncurses], [initscr],
[],
[ echo "Cannot find required library:ncurses";
echo "did you install ncurses package ?";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:ncurses"]);
]
)
AC_CHECK_LIB( [fftw3f], [main],
[],
[ echo "Cannot find required library:fftw3f";
echo "did you install fftw3f-dev package ?";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:fftw3f"]);
]
)
AC_CHECK_LIB( [fftw3], [main],
[],
[ echo "Cannot find required library:fftw3";
echo "did you install fftw3-dev package ?";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:fftw3"]);
]
)
AC_CHECK_LIB([gomp], [omp_get_num_threads])
#
# fftw multi-thread
#
if test "x$fftwmt" = "xyes" ; then
AC_CHECK_LIB( [fftw3f_threads], [main],
[],
[ echo "Cannot find required library:fftw3f_threads";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:fftw3f_threads"]);
]
)
AC_CHECK_LIB( [fftw3_threads], [main],
[],
[ echo "Cannot find required library:fftw3_threads";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:fftw3f_threads"]);
]
)
AC_CHECK_LIB([pthread], [pthread_create],
[],
[ echo "Cannot find required library:pthread";
cat doc/configure.howto;
AC_MSG_FAILURE(["FATAL...Cannot find required library:pthread"]);
exit 0;
])
AC_DEFINE(FFTWMT)
fi
#AC_CHECK_LIB([usb], [usb_close], ,[AC_MSG_ERROR(
# [libusb library not found. Check with vendor or see http://libusb.sourceforge.net])],
# [$USBLDFLAGS])
#AC_SEARCH_LIBS( [bob],
# [tom],
# [AC_DEFINE([HAVE_BOB_H], 1,
# "Define to 1 if you have <readline.h>")] ,
# [AC_MSG_ERROR([$str]); exit 0] )
#AC_CHECK_HEADERS( [bob.h],
# [],
# [ echo "Cannot find required header:bob.h";
# cat doc/configure.howto;
# AC_MSG_FAILURE(["Cannot find required header:bob.h"]);
# ]
#)
AC_CHECK_HEADERS( [fftw3.h],
[],
[ echo "Cannot find required header:fftw3.h";
cat doc/configure.howto;
AC_MSG_FAILURE(["Cannot find required header:fftw3.h"]);
]
)
AC_CHECK_HEADERS( [fitsio.h],
[],
[ echo "Cannot find required header:fitsio.h";
cat doc/configure.howto;
AC_MSG_FAILURE(["Cannot find required header:fitsio.h"]);
]
)
#AC_MSG_NOTICE([Looking for special libraries])
#AC_INCLUDES_DEFAULT
#AC_CHECK_LIB(gsl,gsl_ran_gaussian_ziggurat, , echo "FATAL..."; exit 0; )
#AC_PROG_LEX
#AC_PROG_YACC
#AC_PROG_INSTALL
#AC_MSG_CHECKING (feature-description)
#AC_MSG_NOTICE([eg:checking if stack overflow is detectable])
#AC_MSG_FAILURE (error-description, [exit-status])
#=================================================
# Setup default CUDA paths
#CUDA_INSTALL_PATH="/usr/local/cuda"
#CUDA_SDK_INSTALL_PATH="/usr/local/NVIDIA_GPU_Computing_SDK"
# Check: enable CUDA?
AC_MSG_CHECKING([whether to use CUDA library])
AC_ARG_ENABLE(cuda,
[AS_HELP_STRING(--enable-cuda,enable CUDA support)],
cudaval="yes",
cudaval="no")
AC_MSG_RESULT([$cudaval])
# check to see if CUDA been selected
if test "$cudaval" == "no"; then
AC_MSG_WARN([Not using CUDA!])
fi
# Setup custom CUDA paths
AC_ARG_WITH([cuda],
[AS_HELP_STRING(
[--with-cuda=PATH],
[prefix where CUDA is installed @<:@default=auto@:>@])],
[CUDA_INSTALL_PATH=$withval],
[with_cuda=auto])
AC_ARG_WITH([cuda-sdk],
[AS_HELP_STRING(
[--with-cuda-sdk=PATH],
[prefix where CUDA SDK is installed @<:@default=auto@:>@])],
[CUDA_SDK_INSTALL_PATH=$withval],
[with_cuda_sdk=auto])
# Setup nvcc flags
if test "$cudaval" = "yes"; then
NVCCFLAGS="$NVCCFLAGS"
CUDA_CFLAGS="$CUDA_CFLAGS"
CUDA_CFLAGS="$CUDA_CFLAGS -I$CUDA_SDK_INSTALL_PATH/C/common/inc/"
CUDA_CFLAGS="$CUDA_CFLAGS -I$CUDA_INSTALL_PATH/include -I/usr/local/cuda/include/"
CUDA_LDFLAGS="-L$CUDA_INSTALL_PATH/lib64"
CUDA_LIBS="-lcuda -lcudart -lcufft -lcublas"
NVCCFLAGS="$NVCCFLAGS $CUDA_CFLAGS $CUDA_LDFLAGS $CUDA_LIBS"
NVCC="nvcc"
AC_SUBST(NVCC)
AC_SUBST(NVCCFLAGS)
AC_DEFINE([HAVE_CUDA],[1],[Defined if CUDA should be used])
eval "ARRAY${N}='-D_CUDA'"
N=`expr $N + 1`
LIBS="$LIBS $CUDA_LIBS"
LDFLAGS="$LDFLAGS $CUDA_LDFLAGS -L/usr/local/cuda/lib64/"
CFLAGS="$CFLAGS $CUDA_CFLAGS"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH -L/usr/local/cuda/lib64/"
fi
# Create our own a symbol for execname until we can find the right one
EXECNAME=__PROGNAME__
AC_SUBST(EXECNAME)
LIBS="$LIBS -lpthread"
#if test "$cudaval" = "yes"; then
# LIBS="$LIBS -lcuda -lcudart -lcufft"
#fi
AC_CONFIG_FILES(Makefile src/Makefile __MODULES__)
AC_OUTPUT
echo ""
echo " Configure Summary"
echo " ================="
echo ""
echo "Compiling Options:"
echo "------------------"
echo " C Compiler: $CC"
echo " CFLAGS: $CFLAGS"
echo " LDFLAGS: $LDFLAGS"
echo " LIBS: $LIBS"