forked from Dronecode/camera-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
203 lines (174 loc) · 6.15 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
AC_PREREQ(2.64)
AC_INIT([dronecode-camera-manager],
[1],
[],
[dronecode-camera-manager],
[])
PKG_CHECK_MODULES(GLIB, [glib-2.0])
PKG_CHECK_MODULES(GST, [gstreamer-rtsp-1.0, gstreamer-1.0, gstreamer-rtsp-server-1.0 gstreamer-app-1.0])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_AUX_DIR([build-aux])
AC_ARG_ENABLE([realsense], AS_HELP_STRING([--enable-realsense], [Enable Realsense Support]),
[
AC_SEARCH_LIBS([rs_create_context], [realsense],
[
enable_realsense=yes
AM_CONDITIONAL([ENABLE_REALSENSE], true)
],
[
AC_MSG_ERROR([librealsense not installed, cannot enable realsense support])
enable_realsense=no
AM_CONDITIONAL([ENABLE_REALSENSE], false)
])
],
[
enable_realsense=no
AM_CONDITIONAL([ENABLE_REALSENSE], false)
])
AC_ARG_ENABLE([aero], AS_HELP_STRING([--enable-aero], [Include streams specific for Intel Aero drone]),
[
enable_aero=yes
AM_CONDITIONAL([ENABLE_AERO], true)
],
[
enable_aero=no
AM_CONDITIONAL([ENABLE_AERO], false)
])
AC_ARG_ENABLE([custom], AS_HELP_STRING([--enable-custom], [Include custom camera device]),
[
enable_custom=yes
AM_CONDITIONAL([ENABLE_CUSTOM], true)
],
[
enable_custom=no
AM_CONDITIONAL([ENABLE_CUSTOM], false)
])
AC_ARG_ENABLE([mavlink],
AS_HELP_STRING([--enable-mavlink], [Enable MAVLink advertisement]),
[
enable_mavlink=yes
AM_CONDITIONAL([ENABLE_MAVLINK], true)
AC_DEFINE(ENABLE_MAVLINK, 1, [Enable MAVLink advertisement])
],
[
enable_mavlink=no
AM_CONDITIONAL([ENABLE_MAVLINK], false)
])
AC_ARG_ENABLE([avahi],
AS_HELP_STRING([--enable-avahi], [Enable avahi advertisement]),
[
PKG_CHECK_MODULES(AVAHI, [avahi-client, avahi-core, avahi-glib])
enable_avahi=yes
AM_CONDITIONAL([ENABLE_AVAHI], true)
AC_DEFINE(ENABLE_AVAHI, 1, [Enable avahi advertisement])
],
[
enable_avahi=no
AM_CONDITIONAL([ENABLE_AVAHI], false)
])
AC_ARG_ENABLE([gazebo],
AS_HELP_STRING([--enable-gazebo], [Enable Gazebo Simulator Mode]),
[
PKG_CHECK_MODULES(GZB, [gazebo])
enable_gazebo=yes
AM_CONDITIONAL([ENABLE_GAZEBO], true)
AC_DEFINE(ENABLE_GAZEBO, 1, [Enable Gazebo Simulator Mode])
],
[
enable_gazebo=no
AM_CONDITIONAL([ENABLE_GAZEBO], false)
])
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
AC_PREFIX_DEFAULT([/usr])
PKG_PROG_PKG_CONFIG
AM_MAINTAINER_MODE([enable])
AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests])
AM_SILENT_RULES([yes])
#####################################################################
# Program checks and configurations
#####################################################################
AC_PROG_CC_C99
AX_CXX_COMPILE_STDCXX([11], [ext], [mandatory])
AM_PATH_PYTHON([2.7])
#####################################################################
LT_INIT([disable-static pic-only])
#####################################################################
# Function and structure checks
#####################################################################
AC_MSG_CHECKING([whether _Static_assert() is supported])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([[_Static_assert(1, "Test");]])],
[AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define if _Static_assert() is available])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([whether _Noreturn is supported])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([[_Noreturn int foo(void) { exit(0); }]])],
[AC_DEFINE([HAVE_NORETURN], [1], [Define if _Noreturn is available])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
#####################################################################
# --with-
#####################################################################
AC_ARG_WITH([rootlibdir],
AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
[], [with_rootlibdir=$libdir])
AC_ARG_WITH([systemdsystemunitdir],
AC_HELP_STRING([--with-systemdsystemunitdir=DIR],
[path to systemd system unit directory]),
[path_systemunitdir=${withval}])
if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
AC_MSG_CHECKING([systemd system unit dir])
path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
if (test -z "${path_systemunitdir}"); then
AC_MSG_ERROR([systemd system unit directory is required])
fi
AC_MSG_RESULT([${path_systemunitdir}])
fi
AC_SUBST([rootlibdir], [$with_rootlibdir])
#####################################################################
# --enable-
#####################################################################
AC_ARG_ENABLE(systemd, AC_HELP_STRING([--disable-systemd],
[disable systemd integration]), [enable_systemd=${enableval}])
AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
#####################################################################
# Default CFLAGS and LDFLAGS
#####################################################################
DEFAULT_FLAGS=" -fstack-protector-all -fPIE -fPIC -O2 -D_FORTIFY_SOURCE=2 -pthread -Wformat -Wformat-security"
CFLAGS+=$DEFAULT_FLAGS
CXXFLAGS+=$DEFAULT_FLAGS
LDFLAGS+=" -z noexecstack -z relro -z now"
#####################################################################
# Generate files from *.in
#####################################################################
AC_CONFIG_FILES([
Makefile
])
#####################################################################
AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE $VERSION
==========================
prefix: ${prefix}
sysconfdir: ${sysconfdir}
libdir: ${libdir}
rootlibdir: ${rootlibdir}
includedir: ${includedir}
bindir: ${bindir}
C compiler: ${CC}
C++ compiler: ${CXX}
CFLAGS: ${CFLAGS}
CXXFLAGS: ${CXXFLAGS}
LDFLAGS: ${LDFLAGS}
RealSense support: $enable_realsense
MAVLink support: $enable_mavlink
AVAHI support: $enable_avahi
Intel Aero support: $enable_aero
Gazebo support: $enable_gazebo
Custom support: $enable_custom
])