forked from edman007/chiton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
201 lines (168 loc) · 7.79 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
##########################################################################
#
# This file is part of Chiton.
#
# Chiton is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Chiton is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chiton. If not, see <https://www.gnu.org/licenses/>.
#
# Copyright 2020 Ed Martin <[email protected]>
#
##########################################################################
define([BUILDVER], [0.4.0pre])
AC_INIT([Chiton Security], BUILDVER, [[email protected]], [chiton], [https://edman007.com/])
AC_CONFIG_SRCDIR([main.cpp])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([subdir-objects tar-pax dist-xz])
LT_INIT
#pull the correct git revesion
git_version=$(echo $(git log --oneline --no-walk || echo Unknown) | head -1 | cut -d ' ' -f 1 )
AS_IF([test "x$git_version" == "xUnknown"],
#assume we are in a dist build, pull the version from that
AC_CHECK_FILE(["$srcdir/dist-version"],
git_version=$(cat "$srcdir/dist-version"),
[]),
[])
git_version_str=$(echo '"'git_$git_version'"')
define([GITVERSION], [$git_version_str])
AC_SUBST([DIST_VERSION], [$git_version])
AC_DEFINE_UNQUOTED([GIT_VER], GITVERSION, [Git version])
AS_IF([test "x$git_version" != "xUnknown"],
AC_SUBST([VER_GITVER], [_$git_version]),
AC_SUBST([VER_GITVER], [])
AC_MSG_WARN([Unable to detect the git revision of this build]))
define([CONFDATE], [$(echo \"$(date -R)\")])
AC_DEFINE_UNQUOTED([BUILD_DATE], CONFDATE, [Build Date])
AC_PROG_CC
AC_PROG_CXX
#Build adjustements
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Enable Debugging])], [], [enable_debug=no])
AC_ARG_ENABLE([profiling], [AS_HELP_STRING([--enable-profiling], [Enable Profiling])], [], [enable_profiling=no])
AS_IF([test "x$enable_debug" != "xno"],
[AS_VAR_APPEND([[CXXFLAGS]], [[" -g -O0 -rdynamic "]])
AC_DEFINE([DEBUG], [1], [Debugging enabled])
],
[AS_VAR_APPEND([[CXXFLAGS]], [[" -O3 "]])
AC_DEFINE([NDEBUG], [1], [Debugging Disabled])
]
)
#CPU specific debug flags...
case $host in
arm*-*-*) AS_IF([test "x$enable_debug" != "xno"], [AS_VAR_APPEND([[CXXFLAGS]], [[" -funwind-tables "]])]) ;;
i?86-*-*) AS_IF([test "x$enable_debug" != "xno"], [], [AS_VAR_APPEND([[CXXFLAGS]], [[" "]])]) ;;
esac
AS_IF([test "x$enable_profiling" != "xno"],
[AS_VAR_APPEND([[CXXFLAGS]], [[" -pg -fprofile-arcs -ftest-coverage "]])
],
[]
)
#our required libs:
PKG_PROG_PKG_CONFIG
#untested with mysql...
PKG_CHECK_MODULES([MARIADB], [mariadb],
[AS_VAR_APPEND([[CPPFLAGS]], [" $MARIADB_CFLAGS"])
AS_VAR_APPEND([[LIBS]], [" $MARIADB_LIBS "])],
[PKG_CHECK_MODULES([MYSQL], [mysqlclient],
[AS_VAR_APPEND([[CPPFLAGS]], [" $MYSQL_CFLAGS"])
AS_VAR_APPEND([[LIBS]], [" $MYSQL_LIBS "])]
)])
##ffmpeg
PKG_CHECK_MODULES([FFMPEG], [libavformat libavcodec libavutil libavfilter],
[AS_VAR_APPEND([[CPPFLAGS]], [" $FFMPEG_CFLAGS"])
AS_VAR_APPEND([[LIBS]], [" $FFMPEG_LIBS "])])
AC_ARG_ENABLE([vaapi],
[AS_HELP_STRING([--enable-vaapi], [Enable VA-API, not strictly required to use vaapi])],
[],
[enable_vaapi=auto])
AS_IF([test "x$enable_vaapi" != "xno"],
[PKG_CHECK_MODULES([VA], [libva],
[have_vaapi=1 AS_VAR_APPEND([[CPPFLAGS]], [" $VA_CFLAGS "])
AS_VAR_APPEND([[LIBS]], [" $VA_LIBS "])])
AC_DEFINE([HAVE_VAAPI], [1], [Have VAAPI])])
AS_IF([test "x$enable_vaapi" == "xyes" && test "x$have_vaapi" != "x1"], [AC_MSG_ERROR([Could not find vaapi])])
AC_ARG_ENABLE([vdpau],
[AS_HELP_STRING([--enable-vdpau], [Enable VA-API, not strictly required to use vdpau])],
[],
[enable_vdpau=auto])
AS_IF([test "x$enable_vdpau" != "xno"],
[PKG_CHECK_MODULES([VDPAU], [vdpau],
[have_vdpau=1 AS_VAR_APPEND([[CPPFLAGS]], [" $VDPAU_CFLAGS "])
AS_VAR_APPEND([[LIBS]], [" $VDPAU_LIBS "])])
AC_DEFINE([HAVE_VDPAU], [1], [Have VDPAU])])
AS_IF([test "x$enable_vdpau" == "xyes" && test "x$have_vdpau" != "x1"], [AC_MSG_ERROR([Could not find vdpau])])
AC_ARG_ENABLE([opencv],
[AS_HELP_STRING([--enable-opencv], [Enable OpenCV and associated components])],
[],
[enable_opencv=auto])
AS_IF([test "x$enable_opencv" != "xno"],
[PKG_CHECK_MODULES([OPENCV], [opencv4],
[have_opencv=1 AS_VAR_APPEND([[CPPFLAGS]], [" $OPENCV_CFLAGS "])
AS_VAR_APPEND([[LIBS]], [" $OPENCV_LIBS "])])
AC_DEFINE([HAVE_OPENCV], [1], [Have OpenCV])])
AS_IF([test "x$enable_opencv" == "xyes" && test "x$have_opencv" != "x1"], [AC_MSG_ERROR([Could not find OpenCV])])
AC_ARG_ENABLE([opencl],
[AS_HELP_STRING([--enable-opencl], [Enable OpenCL and associated components])],
[],
[enable_opencl=auto])
AS_IF([test "x$enable_opencl" != "xno"],[AX_CHECK_CL])
AS_IF([test "x$enable_opencl" == "xyes" && test "X$no_cl" == "Xyes"], [AC_MSG_ERROR([Could not find OpenCL])])
AS_IF([test "X$no_cl" == "Xyes" || test "x$enable_opencl" == "xno"], [AC_MSG_NOTICE([OpenCL Support Disabled])], [AS_VAR_APPEND([[CPPFLAGS]], [" $CL_CFLAGS "])
AS_VAR_APPEND([[LIBS]], [" $CL_LIBS "])
AC_DEFINE([HAVE_OPENCL], [1], [Have OpenCL])])
AC_ARG_WITH([apacheconfigdir],
[AS_HELP_STRING([--with-apacheconfigdir=DIR], [Directory to install apache config])],
[apacheconfdir=$withval],
[apacheconfdir="\${sysconfdir}/apache2/sites-available/"])
AC_SUBST([apacheconfdir])
AC_ARG_WITH([runuser],
[AS_HELP_STRING([--with-runuser=USER], [Username to run the daemon as [$PACKAGE_TARNAME]])],
[runuser=$withval],
[runuser=$PACKAGE_TARNAME])
AC_SUBST([runuser])
AC_ARG_WITH([smartydir],
[AS_HELP_STRING([--with-smartydir=DIR], [Directory of system Smarty 3.x installation [no]])],
[SMARTYDIR=$withval],
[SMARTYDIR=no])
AC_SUBST([SMARTYDIR])
AM_CONDITIONAL([INSTALLSMARTY], [test "x$SMARTYDIR" = "xno"])
AC_ARG_WITH([initdir],
[AS_HELP_STRING([--with-initdir=DIR], [Directory of init script [SYSCONFDIR/systemd/system]])],
[initdir=$withval],
[initdir=${sysconfdir}/systemd/system])
AC_SUBST([initdir])
AC_ARG_ENABLE([sysv],
[AS_HELP_STRING([--with-sysv], [Install a SysV compatible init script [disabled]])],
[sysv=true],
[sysv=false])
AM_CONDITIONAL([ENABLESYSV], [test "x$sysv" = "xtrue"])
AC_ARG_WITH([webuser],
[AS_HELP_STRING([--with-webuser=user], [User that the webserver will run under [apache]])],
[webuser=$withval],
[webuser=apache])
AC_SUBST([webuser])
AC_ARG_WITH([apachesymlinkdir],
[AS_HELP_STRING([--with-apachesymlinkdir=dir], [Directory to create a symlink to the conf [no]])],
[apachesymlinkdir=$withval],
[apachesymlinkdir=no])
AC_SUBST([apachesymlinkdir])
AC_ARG_WITH([apacheappendconf],
[AS_HELP_STRING([--with-apacheappendconf=file], [File to include the configuration from [no]])],
[apacheappendconf=$withval],
[apacheappendconf=apache])
AC_SUBST([apacheappendconf])
AC_ARG_VAR([IMAGEMAGICK_CONVERT], [The path to imagemagick's convert])
AC_CHECK_PROG([IMAGEMAGICK_CONVERT], [convert], [convert], [false])
AS_IF([test x"$IMAGEMAGICK_CONVERT" = x"false"], [AC_MSG_ERROR([Could not find imagemagick, required for building])])
AC_CONFIG_FILES(Makefile)
AC_CONFIG_HEADERS([config_build.hpp])
AC_OUTPUT