-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
304 lines (280 loc) · 9.17 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
dnl configure.ac
dnl
dnl Autoconf configuration
dnl
dnl Use autoconf to process this into a configure script
dnl
dnl (C) Copyright 2014-2022 Fred Gleason <[email protected]>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License version 2 as
dnl published by the Free Software Foundation.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public
dnl License along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
AC_INIT(drouter,m4_esyscmd(cat PACKAGE_VERSION))
AM_INIT_AUTOMAKE
AC_SUBST(RPM_RELEASE,1)
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
#
# Basic Compiler Checks
#
AC_PROG_CXX
AC_LANG(C++)
# to avoid rpath usage :
# http://wiki.debian.net/index.cgi?RpathIssue
case ${host} in
*-pc-linux-gnu)
AC_MSG_RESULT([Fixing libtool for -rpath problems.])
sed < libtool > libtool-2 \
's/^hardcode_libdir_flag_spec.*$/hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/'
mv libtool-2 libtool
chmod 755 libtool
;;
esac
#
# Option Switches
#
AC_ARG_ENABLE(docbook,[ --disable-docbook disable building of DocBook documentation],[DOCBOOK_DISABLED=yes],[])
#
# Check for Qt (Mandatory)
#
PKG_CHECK_MODULES(QT5CLI,Qt5Core Qt5Network Qt5Sql,[],[AC_MSG_ERROR([*** Qt5 CLI components not found ***])])
PKG_CHECK_MODULES(QT5GUI,Qt5Core Qt5Gui Qt5Widgets Qt5Network Qt5Sql,[],[AC_MSG_ERROR([*** Qt5 GUI components not found ***])])
AC_CHECK_PROG(MOC_NAME,moc-qt5,[moc-qt5],[moc])
AC_SUBST(QT_MOC,$MOC_NAME)
#
# Check for Switchyard5 (Mandatory)
#
PKG_CHECK_MODULES(SWITCHYARD5,switchyard5,[],[AC_MSG_ERROR([*** Switchyard5 not found ***])])
#
# Determine Distro
#
AR_GET_DISTRO()
AC_SUBST(DISTRO,$ar_gcc_distro)
AC_MSG_NOTICE($ar_distro_id)
DISTRO_NAME="| Distribution Name ... Unknown |"
case "$ar_distro_id" in
debian)
AC_MSG_NOTICE([Distro is Debian-ish])
DISTRO_FAMILY="| Distribution Family ... Debian |"
DISTRO_IS_DEBIANISH=yes
DISTRO_NAME="| Distribution Name ... Debian |"
AC_SUBST(APACHE_PKG,"apache2")
AC_SUBST(APACHE_CONFIG_DIR,"/etc/apache2/conf.d")
AC_SUBST(USERMODE_PKG,"")
AC_SUBST(MYSQL_PKG,"mariadb-client")
AC_SUBST(QT_MYSQL_PKG,"libqt5sql5-mysql")
AC_SUBST(DOC_PATH,"/usr/share/doc/rivendell")
AC_SUBST(HAVE_USERMODE,"no")
;;
raspbian)
AC_MSG_NOTICE([Distro is Debian-ish])
DISTRO_FAMILY="| Distribution Family ... Debian |"
DISTRO_IS_DEBIANISH=yes
DISTRO_NAME="| Distribution Name ... Raspbian |"
AC_SUBST(APACHE_PKG,"apache2")
AC_SUBST(APACHE_CONFIG_DIR,"/etc/apache2/conf.d")
AC_SUBST(USERMODE_PKG,"")
AC_SUBST(MYSQL_PKG,"mariadb-client")
AC_SUBST(QT_MYSQL_PKG,"libqt5sql5-mysql")
AC_SUBST(DOC_PATH,"/usr/share/doc/rivendell")
AC_SUBST(HAVE_USERMODE,"no")
;;
linuxmint|ubuntu)
AC_MSG_NOTICE([Distro is Debian-ish])
DISTRO_FAMILY="| Distribution Family ... Debian |"
DISTRO_IS_DEBIANISH=yes
DISTRO_NAME="| Distribution Name ... Ubuntu |"
AC_SUBST(APACHE_PKG,"apache2")
AC_SUBST(APACHE_CONFIG_DIR,"/etc/apache2/conf.d")
AC_SUBST(USERMODE_PKG,"")
AC_SUBST(MYSQL_PKG,"mariadb-client")
AC_SUBST(QT_MYSQL_PKG,"libqt5sql5-mysql")
AC_SUBST(DOC_PATH,"/usr/share/doc/rivendell")
AC_SUBST(HAVE_USERMODE,"no")
;;
centos|fedora|rhel|rocky)
AC_MSG_NOTICE([Distro is RedHat-ish])
DISTRO_FAMILY="| Distribution Family ... RedHat |"
if test $ar_distro_id = "centos" ; then
DISTRO_NAME="| Distribution Name ... CentOS |"
fi
if test $ar_distro_id = "fedora" ; then
DISTRO_NAME="| Distribution Name ... Fedora |"
fi
if test $ar_distro_id = "rhel" ; then
DISTRO_NAME="| Distribution Name ... RHEL |"
fi
if test $ar_distro_id = "rocky" ; then
DISTRO_NAME="| Distribution Name ... Rocky |"
fi
AC_SUBST(APACHE_PKG,"httpd")
AC_SUBST(APACHE_CONFIG_DIR,"/etc/httpd/conf.d")
AC_SUBST(USERMODE_PKG,"usermode usermode-gtk")
AC_SUBST(MYSQL_PKG,"mariadb")
AC_SUBST(QT_MYSQL_PKG,"qt5-qtbase-mysql")
AC_SUBST(DOC_PATH,"/usr/share/doc/rivendell-$PACKAGE_VERSION")
AC_SUBST(HAVE_USERMODE,"yes")
;;
*)
AC_MSG_NOTICE([Distro is unknown])
DISTRO_FAMILY="| Distribution Family ... Unknown |"
AC_SUBST(APACHE_PKG,"apache2")
AC_SUBST(APACHE_CONFIG_DIR,"/etc/apache2/conf.d")
AC_SUBST(USERMODE_PKG,"")
AC_SUBST(MYSQL_PKG,"mysql")
AC_SUBST(QT_MYSQL_PKG,"qt-mysql")
AC_SUBST(DOC_PATH,"/usr/share/doc/rivendell")
AC_SUBST(HAVE_USERMODE,"no")
;;
esac
#
# Check for Python (Mandatory)
#
if test -z $DISTRO_IS_DEBIANISH ; then
AM_PATH_PYTHON([3])
AC_SUBST(PYTHON_BASE_DEP,"python"`echo $PYTHON_VERSION | sed -e s/3./3/`)
else
#
# FIXME: Horrible hack to make Python install correctly on Debianish setups
#
AC_MSG_NOTICE([Configuring Debian-style Python installation])
PYTHON="/usr/bin/python3"
AC_ARG_VAR(PYTHON,[the Python interpreter])
pythondir="/usr/lib/python3/dist-packages"
AC_ARG_VAR(pythondir,[the Python modules directory])
pyexecdir="/usr/lib/python3/dist-packages"
AC_ARG_VAR(pyexecdir,[the Python extension modules directory])
fi
#
# Check for SystemD (Optional)
#
PKG_CHECK_MODULES(LIBSYSTEMD,libsystemd,[LIBSYSTEMD_FOUND=yes],[LIBSYSTEMD_FAILED=yes])
if test $LIBSYSTEMD_FOUND ; then
AC_DEFINE(LIBSYSTEMD)
fi
#
# Check for DocBook Toolchain
#
if test -z $DOCBOOK_DISABLED ; then
USING_DOCBOOK=yes
fi
AM_CONDITIONAL([DOCBOOK_AM], [test "$USING_DOCBOOK" = yes])
#
# Determine the target architecture
#
AR_GCC_TARGET()
AC_SUBST(VENDOR,$ar_gcc_distro)
AC_SUBST(ARCH,$ar_gcc_arch)
#
# Determine number of available CPU cores for building packages
#
AX_COUNT_CPUS([],[])
if test $CPU_COUNT -lt 2 ; then
AC_SUBST(CPUS_AVAIL,1)
else
if test $CPU_COUNT -gt 16 ; then
AC_SUBST(CPUS_AVAIL,16)
else
AC_SUBST(CPUS_AVAIL,$(($CPU_COUNT-1)))
fi
fi
#
# Determine Distro
#
AR_GET_DISTRO()
AC_SUBST(DISTRO,$ar_gcc_distro)
#
# Configure RPM Build
#
AC_CHECK_PROG(RPMBUILD_FOUND,rpmbuild,[yes],[])
if test -z $RPMBUILD_FOUND ; then
AC_SUBST(RPMBUILD,rpm)
else
AC_SUBST(RPMBUILD,rpmbuild)
fi
if test -d /usr/src/redhat ; then
AC_SUBST(RPM_ROOT,/usr/src/redhat)
AC_SUBST(VENDOR,redhat)
else
AC_SUBST(RPM_ROOT,/usr/src/packages)
AC_SUBST(VENDOR,suse)
fi
#
# Generated File Warnings
#
AC_SUBST_FILE(GENERATED_C_FILE_WARNING)
GENERATED_C_FILE_WARNING=$srcdir/helpers/c_file_warning
AC_SUBST_FILE(GENERATED_SCRIPT_FILE_WARNING)
GENERATED_SCRIPT_FILE_WARNING=$srcdir/helpers/script_file_warning
AC_SUBST_FILE(GENERATED_XML_FILE_WARNING)
GENERATED_XML_FILE_WARNING=$srcdir/helpers/xml_file_warning
AC_CONFIG_FILES([ \
helpers/Makefile \
conf/Makefile \
debian/source/Makefile \
debian/Makefile \
docs/Makefile \
icons/Makefile \
python/api/Makefile \
python/examples/Makefile \
python/Makefile \
scripts/install_python.sh \
scripts/Makefile \
src/Makefile \
src/buttonpanel/Makefile \
src/common/Makefile \
src/common/paths.h\
src/dmap/Makefile \
src/drouterd/Makefile \
src/eventlogpanel/Makefile \
src/outputpanel/Makefile \
src/shotpanel/Makefile \
src/tests/Makefile \
src/xpointpanel/Makefile \
src/xypanel/Makefile \
systemd/Makefile \
systemd/drouter.service \
drouter.spec \
build_debs.sh \
Makefile ])
AC_OUTPUT()
chmod 755 build_debs.sh
chmod 755 scripts/install_python.sh
#
# Link Common Elements
#
./link_common.sh buttonpanel
./link_common.sh dmap
./link_common.sh drouterd
./link_common.sh eventlogpanel
./link_common.sh outputpanel
./link_common.sh shotpanel
./link_common.sh tests
./link_common.sh xpointpanel
./link_common.sh xypanel
AC_MSG_NOTICE()
AC_MSG_NOTICE("|---------------------------------------------------------|")
AC_MSG_NOTICE("| *** DROUTER CONFIGURATION SUMMARY *** |")
AC_MSG_NOTICE("|---------------------------------------------------------|")
AC_MSG_NOTICE("| Platform Information: |")
AC_MSG_NOTICE("$DISTRO_NAME")
AC_MSG_NOTICE("$DISTRO_FAMILY")
if test $I18N_ENABLED ; then
AC_MSG_NOTICE("| Update I18N Data ... Yes |")
else
AC_MSG_NOTICE("| Update I18N Data ... No |")
fi
AC_MSG_NOTICE("|---------------------------------------------------------|")
AC_MSG_NOTICE()
AC_MSG_NOTICE()
AC_MSG_NOTICE(Now enter 'make' to build the software.)
AC_MSG_NOTICE()