-
Notifications
You must be signed in to change notification settings - Fork 34
/
configure.ac
116 lines (95 loc) · 2.85 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
AC_INIT(antidote, 2.1)
PACKAGE=antidote
VERSION=2.1
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
LT_INIT
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AM_PROG_CC_C_O
AC_CHECK_HEADER([stdio.h])
build_linux=no
build_mac=no
# Detect the target system
case "${host_os}" in
linux*)
build_linux=yes
;;
darwin*)
build_mac=yes
;;
*)
AC_MSG_ERROR(["OS $host_os is not supported"])
;;
esac
AC_ARG_ENABLE([tests], \
[AS_HELP_STRING([--enable-tests], \
[Enable tests compilation, \
enabled by default ])])
if test "$enable_tests" = no; then
have_tests="no"
else
AC_CHECK_HEADER(/usr/include/CUnit/CUnit.h, \
[have_tests="yes"], \
[have_tests="no"],[])
fi
#Avoids a warning in pthread_mutexattr_settype
AC_DEFINE(_GNU_SOURCE)
#Enabling test compilation
if test "$have_tests" = yes; then
AC_MSG_NOTICE([ -- Tests enabled.])
CUNIT_CFLAGS="-I/usr/include/CUnit -Itests"
CUNIT_LIBS="-lcunit"
AC_DEFINE([TEST_ENABLED], 1, [])
else
AC_MSG_NOTICE([ -- Tests disabled.])
fi
AC_ARG_ENABLE([coverage], \
[AS_HELP_STRING([--enable-coverage], \
[Enable code coverage])])
if test "$enable_coverage" = "yes"; then
AC_MSG_NOTICE([ -- Code coverage enabled.])
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage -lgcov -O0"
fi
if test "$build_linux" = "yes"; then
#Enabling D-BUS network module
PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.4.0])
PKG_CHECK_MODULES(GLIB, glib-2.0)
PKG_CHECK_MODULES(GIO, gio-2.0)
PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1)
#usb libraries
PKG_CHECK_MODULES(USB1, libusb-1.0)
fi
CFLAGS="$CFLAGS $CUNIT_CFLAGS -Isrc -g -pthread -Wall -Wextra -Wno-unused-parameter -Werror -fPIC"
LIBS="$LIBS -lm $CUNIT_LIBS"
AM_CONDITIONAL([BUILD_LINUX], [test "x$build_linux" = xyes])
AM_CONDITIONAL([BUILD_MAC], [test "x$build_mac" = xyes])
AC_CONFIG_FILES([Makefile \
apps/Makefile \
src/Makefile \
src/api/Makefile \
src/dim/Makefile \
src/util/Makefile \
src/communication/Makefile \
src/communication/plugin/Makefile \
src/communication/parser/Makefile \
src/trans/Makefile \
src/specializations/Makefile \
src/antidote.pc \
sdk/Makefile \
tests/Makefile \
tests/api/Makefile \
tests/dim/Makefile \
tests/communication/Makefile \
tests/communication/parser/Makefile \
tests/communication/encoder/Makefile \
tests/functional_test_cases/Makefile] \
)
AM_COND_IF([BUILD_LINUX],
[AC_CONFIG_FILES([
src/communication/plugin/bluez/Makefile \
src/communication/plugin/usb/Makefile \
src/communication/plugin/trans/Makefile \
src/trans/plugin/Makefile \
])])
AC_OUTPUT