-
Notifications
You must be signed in to change notification settings - Fork 38
/
configure.ac
539 lines (404 loc) · 13.1 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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
AC_INIT([ghpsdr3], [iw0hdv], [andrew att montefusco dott com])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([README])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([build-aux])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_LIBTOOL
# compiling `client.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac'
AM_PROG_CC_C_O
# Python checks for pylauncher
AM_PATH_PYTHON([2.5],, [:])
#
# attempt to build the GUI
#
have_GUI=yes
#
# 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 flags and 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 flags and 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}])
# no GUI available on Raspberry PI
have_GUI=no
;;
armv7l)
AC_MSG_NOTICE([Platform: ARM 7])
CFLAGS="-O3 -pipe -mfpu=neon -fno-tree-vectorize -fopenmp"
CXXFLAGS="-O3 -pipe -mfpu=neon -fno-tree-vectorize -fopenmp"
export CFLAGS
export CXXFLAGS
AC_MSG_NOTICE([${CFLAGS}])
AC_MSG_NOTICE([${CXXFLAGS}])
;;
esac
dnl # library (in DttSP) used but `RANLIB' is undefined: the usual way to define `RANLIB' is to add `AC_PROG_RANLIB'
dnl #AC_PROG_RANLIB
case $host in
*-linux*)
CFLAGS="$CFLAGS -I/usr/include/libusb-1.0/ -I/usr/local/include/"
;;
esac
#
# Check for compilation options which affect debugging
#
AC_ARG_ENABLE([debug-threads],
AC_HELP_STRING([--enable-debug-threads],
[Enable thread debugging facilities in dspserver]),
[threaddebug=$enableval], [threaddebug=no])
THREAD_DEBUG_CFLAGS=""
if test "x$threaddebug" = "xyes"; then
THREAD_DEBUG_CFLAGS="-DTHREAD_DEBUG"
fi
AC_SUBST([THREAD_DEBUG_CFLAGS])
#
# Checks for libraries.
# Check both libraries binary and header files
#
have_m=no
AC_SEARCH_LIBS([round], [m],[have_m=yes])
have_pthreads=no
AC_SEARCH_LIBS([pthread_create], [pthread],[have_pthreads=yes])
have_portaudio2=no
AC_SEARCH_LIBS([Pa_Initialize], [portaudio],[have_portaudio2=yes])
have_fftw3=no
AC_SEARCH_LIBS([fftwf_malloc], [fftw3f],[have_fftw3=yes])
have_codec2=no
AC_SEARCH_LIBS([codec2_create], [codec2],[have_codec2=yes])
have_pulse_simple=no
AC_SEARCH_LIBS([pa_simple_new], [pulse-simple],[have_pulse_simple=yes])
have_pulse=no
AC_SEARCH_LIBS([pa_strerror], [pulse],[have_pulse=yes])
have_usb=no
AC_SEARCH_LIBS([usb_init], [usb],[have_usb=yes])
have_jack=no
AC_SEARCH_LIBS([jack_client_open], [jack],[have_jack=yes])
have_config=no
AC_SEARCH_LIBS([config_init], [config],[have_config=yes])
have_usb10=no
AC_SEARCH_LIBS([libusb_init], [usb-1.0],[have_usb10=yes])
have_event20=no
AC_SEARCH_LIBS([event_init], [event],[have_event20=yes])
have_event20_pthreads=no
AC_SEARCH_LIBS([evthread_use_pthreads], [event_pthreads],
[have_event20_pthreads=yes])
have_event20_openssl=no
AC_SEARCH_LIBS([bufferevent_openssl_socket_new], [event_openssl],[have_event20_openssl=yes])
have_samplerate=no
AC_SEARCH_LIBS([src_new], [samplerate],[have_samplerate=yes])
have_ortp=no
AC_SEARCH_LIBS([ortp_init], [ortp],[have_ortp=yes])
have_gomp=no
AC_SEARCH_LIBS([omp_get_active_level], [gomp],[have_gomp=yes])
# Checks for header files.
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/timeb.h unistd.h])
if test "x${have_pthreads}" = xyes; then
AC_CHECK_HEADERS([pthread.h], [], [have_pthreads=no])
fi
if test "x${have_pthreads}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The pthread library and header file required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_portaudio2}" = xyes; then
AC_CHECK_HEADERS([portaudio.h], [], [have_portaudio2=no])
fi
if test "x${have_portaudio2}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The portaudio2 library and header file required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_fftw3}" = xyes; then
AC_CHECK_HEADERS([fftw3.h], [], [have_fftw3=no])
fi
if test "x${have_fftw3}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The fftw3 library and header file required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_codec2}" = xyes; then
AC_CHECK_HEADERS([codec2/codec2.h], [], [have_codec2=no])
fi
if test "x${have_codec2}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The codec2 library and header file required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_pulse_simple}" = xyes; then
AC_CHECK_HEADERS([pulse/simple.h], [], [have_pulse_simple=no])
fi
if test "x${have_pulse_simple}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The pulse-simple library and header file required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_pulse}" = xyes; then
AC_CHECK_HEADERS([pulse/error.h], [], [have_pulse=no])
fi
if test "x${have_pulse}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The pulse library and header file required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_usb}" = xyes; then
AC_CHECK_HEADERS([usb.h], [], [have_usb=no])
fi
if test "x${have_usb}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The libusb-0.1 library and header file required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_jack}" = xyes; then
AC_CHECK_HEADERS([jack/jack.h], [], [have_jack=no])
fi
if test "x${have_jack}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The libjack library and header file required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_config}" = xyes; then
AC_CHECK_HEADERS([libconfig.h], [], [have_config=no])
fi
if test "x${have_config}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The libconfig8 library and header file required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_usb10}" = xyes; then
AC_CHECK_HEADERS([libusb.h], [], [have_usb10=no])
fi
if test "x${have_usb10}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The libusb-1.0 library and header file required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_event20}" = xyes; then
AC_CHECK_HEADERS([event2/event.h], [], [have_event20=no])
fi
if test "x${have_event20}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The libevent-2.0 library and header file required to build ghpsdr3. See README for installation instructions.
-----------------------------------])
fi
if test "x${have_event20_pthreads}" = xyes; then
AC_CHECK_HEADERS([event2/thread.h], [], [have_event20_pthreads=no])
fi
if test "x${have_event20_pthreads}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The libevent-2.0 library must be built with pthreads support to build
ghpsdr3. See the README file for installation instructions.
-----------------------------------
])
fi
if test "x${have_event20_openssl}" = xyes; then
AC_CHECK_HEADERS([event2/bufferevent_ssl.h], [], [have_event20_openssl=no])
fi
if test "x${have_event20_openssl}" = xyes; then
AC_CHECK_HEADERS([openssl/ssl.h], [], [have_event20_openssl=no])
fi
if test "x${have_event20_openssl}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The libevent-2.0 library and header file with Openssl support required.
Required lib is libevent-openssl. You also need to install libssl-dev.
-----------------------------------])
fi
if test "x${have_samplerate}" = xyes; then
AC_CHECK_HEADERS([samplerate.h], [], [have_samplerate=no])
fi
if test "x${have_samplerate}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The samplerate library and header file is required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_ortp}" = xyes; then
AC_CHECK_HEADERS([ortp/ortp.h], [], [have_ortp=no])
fi
if test "x${have_ortp}" = xyes; then
AC_LINK_IFELSE(
[AC_LANG_CALL([], [rtp_session_set_pktinfo])],
[AC_DEFINE(HAVE_RTCP_ORTP, 1, [have ORTP with RTCP functionality])],
[])
fi
if test "x${have_ortp}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The ortp library and header file is required to build ghpsdr3.
-----------------------------------])
fi
if test "x${have_gomp}" = xno; then
AC_MSG_ERROR([
-----------------------------------
The gomp library is required to build ghpsdr3.
-----------------------------------])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_TYPE_UINT32_T
AC_CHECK_TYPES([ptrdiff_t])
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_CHECK_FUNCS([floor ftime getcwd gethostbyname gettimeofday inet_ntoa memset pow select socket sqrt strrchr strstr strtol])
#
# Optionally built sub packages
#
#
# PERSEUS
#
AC_CHECK_LIB([perseus-sdr], [main], [do_perseus=yes], [do_perseus=no])
if test "x${do_perseus}" = xyes ; then
AC_MSG_NOTICE([
-----------------------------------
Perseus SDR enabled.
-----------------------------------])
AC_CONFIG_SUBDIRS([trunk/src/perseus])
MAKE_PERSEUS="trunk/src/perseus"
AC_SUBST([MAKE_PERSEUS])
fi
#
# RTLSDR (OSMOCOSMO)
#
# if rtlsdr lib is present, enable the build even if the user didn't request to do so
#
AC_CHECK_LIB([rtlsdr], [rtlsdr_open], [do_rtlsdr=yes], [do_rtlsdr=no])
if test "x${do_rtlsdr}" = xyes ; then
AC_MSG_NOTICE([
-----------------------------------
RTL SDR enabled.
-----------------------------------])
AC_CONFIG_SUBDIRS([trunk/src/rtlsdr])
MAKE_RTLSDR="trunk/src/rtlsdr"
AC_SUBST([MAKE_RTLSDR])
fi
#
# USRP
#
have_uhd=no
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <uhd/usrp/multi_usrp.hpp>]],[[uhd::device_addr_t hint;]])],
[AC_MSG_NOTICE([uhd found])
have_uhd=yes
],
[AC_MSG_WARN([uhd lib not found])]
)
AC_LANG_POP([C++])
if test "x${have_uhd}" = xyes; then
AC_MSG_NOTICE([
-----------------------------------
USRP enabled.
-----------------------------------])
AC_CONFIG_SUBDIRS([trunk/src/usrp])
MAKE_USRP="trunk/src/usrp"
AC_SUBST([MAKE_USRP])
fi
#
# Subpackage QtRadio is unconditionally compiled
#
if test "x${have_GUI}" = xyes; then
AC_MSG_NOTICE([
-----------------------------------
QtRadio build enabled.
-----------------------------------])
AC_CONFIG_SUBDIRS([trunk/src/QtRadio])
MAKE_QTRADIO="trunk/src/QtRadio"
AC_SUBST([MAKE_QTRADIO])
fi
AC_CONFIG_FILES([Makefile
trunk/src/softrock/Makefile
trunk/src/DttSP/Makefile
trunk/src/dspserver/Makefile
trunk/src/widget-server/Makefile
trunk/src/server/Makefile
trunk/bin/Makefile
trunk/src/pylauncher/Makefile
trunk/src/hiqsdr/Makefile
trunk/src/sdriq/Makefile
trunk/src/sdr1000/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 optional <target> is:
all - build all binaries
install - install everything
build: ${build}
build vendor: ${build_vendor}
build os: ${build_os}
build cpu: ${build_cpu}
host: ${host}
host cpu: ${host_cpu}
host vendor: ${host_vendor}
host os: ${host_os}
target: ${target}
target cpu: ${target_cpu}
target vendor: ${target_vendor}
target os: ${target_os}
Compiler options in use:
${corw}
-----------------------------------------------------"