-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
269 lines (214 loc) · 6.28 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT([libperseus_sdr], [0.7], [[email protected]])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([perseuserr.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([build-aux])
AM_SILENT_RULES
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
SVNREV=`(svnversion $srcdir | sed 's/:.*//') 2>/dev/null`
if { ! ( svnversion ) >/dev/null 2>&1 || test "$SVNREV" = "exported" || test "$SVNREV" = "Unversioned directory" || test "$SVNREV" = "Unversioned file"; } ;
then SVNREV=`cat $srcdir/SVNREV`
else echo $SVNREV | sed 's/ /_/' >$srcdir/SVNREV
fi
AC_SUBST(SVNREV)
case $host in
*-linux* | *-uclinux*)
AC_MSG_RESULT([Linux])
backend="linux"
threads="posix"
;;
*-darwin*)
AC_MSG_RESULT([Darwin/Mac OS X])
backend="darwin"
threads="posix"
;;
*-openbsd*)
AC_MSG_RESULT([OpenBSD])
backend="openbsd"
threads="posix"
;;
*-netbsd*)
AC_MSG_RESULT([NetBSD])
backend="netbsd"
threads="posix"
;;
*-mingw*)
AC_MSG_RESULT([Windows])
backend="windows"
threads="posix"
create_import_lib="yes"
####AM_CFLAGS="${AM_CFLAGS} -fno-omit-frame-pointer"
;;
*-cygwin*)
AC_MSG_RESULT([Cygwin (using Windows backend)])
backend="windows"
threads="posix"
;;
*-haiku*)
AC_MSG_RESULT([Haiku])
AC_CONFIG_SUBDIRS([libusb/os/haiku])
backend="haiku"
threads="posix"
;;
*)
AC_MSG_ERROR([unsupported operating system])
esac
#
# configure platform
# On a x86 PC with linux running $host is: i686-pc-linux-gnu
#
#
case $backend in
*linux*)
AC_MSG_NOTICE([Platform LINUX: $host])
AC_DEFINE(OS_LINUX, 1, [Linux backend])
AC_SUBST(OS_LINUX)
XXX_PRFX_DEF="/usr/local"
export XXX_PRFX_DEF
# Checks for libraries.
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([usb-1.0], [libusb_init])
AC_CHECK_LIB([usb-1.0], [libusb_init], [],
[
echo "Error! You need to have libusb-1.0 around."
echo "Ubuntu/Debian: sudo apt-get install libusb-1.0-0-dev"
echo "RedHat: yum install libusb1 libusb1-devel"
exit -1
])
AC_CHECK_LIB([dl], [dlopen])
# check for specific functions
AC_CHECK_FUNCS([libusb_strerror], [],[])
AC_MSG_NOTICE([Platform LINUX])
;;
*darwin*)
AC_MSG_NOTICE([Platform MAC OSX: $host])
OSX_LDFLAGS=" -L/opt/local/lib"
OSX_CFLAGS="-I/opt/local/include"
LDFLAGS="$LDFLAGS $OSX_LDFLAGS"
CFLAGS="$CFLAGS $OSX_CFLAGS"
export LDFLAGS
export CFLAGS
XXX_PRFX_DEF="/opt/local"
export XXX_PRFX_DEF
;;
*windows*)
AC_DEFINE(OS_WINDOWS, 1, [Windows backend])
AC_SUBST(OS_WINDOWS)
#LIBS=""
LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
CFLAGS="$CFLAGS -I../libusb-1.0.last/"
CXXFLAGS="$CXXFLAGS -I../libusb-1.0.last/"
LDFLAGS="$LDFLAGS -L../libusb-1.0.last/libusb/"
AC_CHECK_HEADERS([libusb-1.0/libusb.h])
#### AC_CHECK_LIB([usb-1.0], [libusb_init])
AC_CHECK_LIB([usb-1.0], [libusb_init], [],
[
echo "Error! You need to have libusb-1.0 around."
echo "Take a look at README.Windows"
exit -1
])
# check for specific functions
AC_CHECK_FUNCS([libusb_strerror], [],[])
AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
AC_MSG_NOTICE([Platform Windows])
;;
*-*-*-*)
AC_MSG_NOTICE([Platform unknown: $backend])
;;
esac
AS_IF([test "x$XXX_PRFX_DEF" = x], AC_PREFIX_DEFAULT([`pwd`]), AC_PREFIX_DEFAULT(["$XXX_PRFX_DEF"]))
#
# Checking for build cpu
# and, if 64 bit, add some linking option
#
case $build_cpu in
i686)
AC_MSG_NOTICE([Platform: ix86 32 bit])
# checks for platform dependent compiler optimizations
AX_CHECK_COMPILE_FLAG(-ffast-math, SIMD_FLAGS="$SIMD_FLAGS -ffast-math", [])
AX_CHECK_COMPILE_FLAG(-fopenmp, SIMD_FLAGS="$SIMD_FLAGS -fopenmp", [])
SIMD_FLAGS="$SIMD_FLAGS -march=native "
AC_SUBST(SIMD_FLAGS)
;;
x86_64)
AC_MSG_NOTICE([Platform: ix86 64 bit])
LDFLAGS="$LDFLAGS -L/lib64 -L/usr/lib64"
export LDFLAGS
AC_MSG_NOTICE([${LDFLAGS}])
# checks for platform dependent compiler optimizations
AX_CHECK_COMPILE_FLAG(-ffast-math, SIMD_FLAGS="$SIMD_FLAGS -ffast-math", [])
AX_CHECK_COMPILE_FLAG(-fopenmp, SIMD_FLAGS="$SIMD_FLAGS -fopenmp", [])
SIMD_FLAGS="$SIMD_FLAGS -march=native "
AC_SUBST(SIMD_FLAGS)
;;
armv6l)
AC_MSG_NOTICE([Platform: ARM 6])
CFLAGS="-O3 -pipe -march=armv6 -mfpu=vfp -mfloat-abi=hard"
CXXFLAGS="-O3 -pipe -march=armv6 -mfpu=vfp -mfloat-abi=hard"
export CFLAGS
export CXXFLAGS
AC_MSG_NOTICE([${CFLAGS}])
AC_MSG_NOTICE([${CXXFLAGS}])
;;
armv7l)
AC_MSG_NOTICE([Platform: ARM 7])
CFLAGS="-O3 -pipe -march=armv7 -mfpu=neon -fno-tree-vectorize -fopenmp"
CXXFLAGS="-O3 -pipe -march=armv7 -mfpu=neon -fno-tree-vectorize -fopenmp"
export CFLAGS
export CXXFLAGS
AC_MSG_NOTICE([${CFLAGS}])
AC_MSG_NOTICE([${CXXFLAGS}])
;;
esac
INST_USER=`echo $(whoami)`
AC_SUBST(INST_USER)
#
# defines macros to be used in Makefile.am
#
AM_CONDITIONAL(OS_LINUX, test "x$backend" = xlinux)
AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
#
# Check for utility used in code generation for FPGA
#
AC_CHECK_PROG(HAVE_XXD, xxd, true, false)
if test "x$HAVE_XXD" = "xfalse"; then
AC_MSG_ERROR([xxd needed but was not found, please install it (bsdmainutils package in Debian/Ubuntu)])
fi
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_SSIZE_T
AC_HEADER_TIME
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
AC_C_VOLATILE
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([gettimeofday])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
#
# check the compiler option really working
#
corw=`gcc -Q --help=target -march=native`
echo \
"-----------------------------------------------------
${PACKAGE_NAME} Version ${PACKAGE_VERSION}
Prefix: '${prefix}'.
Compiler: '${CC} ${CFLAGS} ${CPPFLAGS}'
Now type 'make @<:@<target>@:>@'
where the otpional <target> is:
all - build all binaries
install - install everything
${corw}
-----------------------------------------------------"