File: configure.ac

package info (click to toggle)
eviacam 2.1.3-4.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 12,324 kB
  • sloc: xml: 29,876; cpp: 18,220; ansic: 3,032; makefile: 337; sh: 46; sed: 16
file content (256 lines) | stat: -rw-r--r-- 7,666 bytes parent folder | download
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
AC_INIT([eviacam], 2.1.3)
AC_CONFIG_SRCDIR([src/eviacamapp.cpp])
AC_PREREQ(2.61)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE
COPYRIGHT="© 2008-18"
PUBLISHER="César Mauri Loba"

AC_SUBST(COPYRIGHT, [`echo $COPYRIGHT`])
AC_DEFINE_UNQUOTED([COPYRIGHT], ["$COPYRIGHT"], [Copyright notice])
AC_SUBST(PUBLISHER, [`echo $PUBLISHER`])
AC_DEFINE_UNQUOTED([PUBLISHER], ["$PUBLISHER"], [Publisher info])

# Use libtool for building static libraries only
AC_ENABLE_SHARED
AC_DISABLE_STATIC

AC_PROG_LIBTOOL
AM_PROG_LIBTOOL

# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P

ALL_LINGUAS="ca es gl it tr ast de oc fr ar he ru pt_BR ja el lt zh_TW zh_CN"

AM_GNU_GETTEXT([external])

# ----------------- Debug mode switch --------------------
AC_ARG_ENABLE(debug,
[  --enable-debug          turn on debug build],
[case "${enableval}" in
yes) debug=true ;;
full) debug=true ;;
no)  debug=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],[debug=false])
AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")
AC_MSG_NOTICE([build in debug mode... $debug])
# ----------------- Debug mode switch --------------------

# ------------- Check for updates switch  ----------------
# This adds the option of compiling without automatic check for
# updates which is undesired for some builds (e.g. debian)
AC_ARG_ENABLE(updates_check,
  [  --disable-updates-check disable check for updates feature],
  [case "${enableval}" in
     yes | no ) WITH_UPDATES_CHECK="${enableval}" ;;
     *) AC_MSG_ERROR(bad value ${enableval} for --disable-updates-check) ;;
   esac],
  [WITH_UPDATES_CHECK="no"]
)
AM_CONDITIONAL([WITH_UPDATES_CHECK], [test "x$WITH_UPDATES_CHECK" = "xyes"])

# Define UPDATES_CHECK in config.h if we're going to compile it
if test "x$WITH_UPDATES_CHECK" = "xyes"; then
    AC_DEFINE([ENABLE_UPDATES_CHECK], [], [Enable check for updates feature])
    AC_MSG_NOTICE([check for updates feature... yes])
else
    AC_MSG_NOTICE([check for updates feature... no])
fi
# ------------- Check for updates switch  ----------------

# ------------- Check dependencies switch  ----------------
# This adds the option of compiling without automatic check for
# updates which is undesired for some builds (e.g. debian)
AC_ARG_ENABLE(dependencies_check,
  [  --disable-dependencies-check do not check dependencies (e.g. if building for Win)],
  [case "${enableval}" in
     yes | no ) WITH_DEPENDENCIES_CHECK="${enableval}" ;;
     *) AC_MSG_ERROR(bad value ${enableval} for --disable-dependencies-check) ;;
   esac],
  [WITH_DEPENDENCIES_CHECK="yes"]
)
AM_CONDITIONAL([WITH_DEPENDENCIES_CHECK], [test "x$WITH_DEPENDENCIES_CHECK" = "xyes"])

if test "x$WITH_DEPENDENCIES_CHECK" = "xyes"; then
    AC_MSG_NOTICE([check dependencies... yes])
else
    AC_MSG_NOTICE([check dependencies... no])
fi
# ------------- Check dependencies switch  ----------------

# Checks for libraries.
# FIXME: Replace `main' with a function of each library

if test "x$WITH_DEPENDENCIES_CHECK" = "xyes"; then
	AC_CHECK_LIB([X11], [main])
	AC_CHECK_LIB([Xext], [main], , AC_MSG_ERROR([libXext is required.]) )
	AC_CHECK_LIB([Xtst], [main], , AC_MSG_ERROR([libXtst is required.]) )
	AC_CHECK_FUNCS([pow])
	AC_CHECK_FUNCS([sqrt])
fi

# -----------------       gtk+  --------------------
# Put this early on, since gtk may rely on it.
AC_PATH_XTRA

AC_DEFUN([GTKTEST],
[
	AC_REQUIRE([AC_PROG_AWK])
	AC_MSG_CHECKING([gtk version])
	if gtkversion=`pkg-config gtk+-3.0 --silence-errors --modversion`; then
		AC_MSG_RESULT([$gtkversion])
		GTKCONFIG='pkg-config gtk+-3.0'
	elif gtkversion=`pkg-config gtk+-2.0 --silence-errors --modversion`; then
		AC_MSG_RESULT([$gtkversion])
		GTKCONFIG='pkg-config gtk+-2.0'
	else
		AC_MSG_RESULT([not found])
		AC_MSG_ERROR([gtk+-2 or 3 is required.])
	fi
])

if test "x$WITH_DEPENDENCIES_CHECK" = "xyes"; then
    GTKTEST()
	GTK_CPPFLAGS="`$GTKCONFIG --cflags`"
	GTK_LIBS="`$GTKCONFIG --libs`"
fi
# -----------------   gtk+      --------------------

# -----------------       wxWidgets --------------------
WXCONFIG=wx-config
AC_ARG_WITH(wx-config,
[[  --with-wx-config=FILE     Use the given path to wx-config when determining
                            wxWidgets configuration; defaults to "wx-config"]],
[
    if test "$withval" != "yes" -a "$withval" != ""; then
        WXCONFIG=$withval
    fi
])

wxversion=0

AC_DEFUN([WXTEST],
[
	AC_REQUIRE([AC_PROG_AWK])
	AC_MSG_CHECKING([wxWidgets version])
	if wxversion=`$WXCONFIG --version`; then
		AC_MSG_RESULT([$wxversion])
	else
		AC_MSG_RESULT([not found])
		AC_MSG_ERROR([wxWidgets is required. Try --with-wx-config.])
	fi])

if test "x$WITH_DEPENDENCIES_CHECK" = "xyes"; then
	# Call WXTEST func
	WXTEST

	# Verify minimum requires
	vers=`echo $wxversion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'`
	if test -n "$vers" && test "$vers" -ge 2008003; then
		if ! "$debug"; then
			WX_CPPFLAGS="`$WXCONFIG --cppflags`"
			WX_CXXFLAGS="`$WXCONFIG --cxxflags | sed -e 's/-fno-exceptions//'`"
			WX_LIBS="`$WXCONFIG --libs`"
		else
			WX_CPPFLAGS="`$WXCONFIG --cppflags`"
			WX_CXXFLAGS="`$WXCONFIG --cxxflags | sed -e 's/-fno-exceptions//'`"
			WX_LIBS="`$WXCONFIG --libs`"
		fi
	else
		AC_MSG_ERROR([wxWidgets 2.8.3 or newer is required])
	fi
fi
# -----------------       wxWidgets --------------------

# -----------------       opencv  --------------------
OPENCVCONFIG='pkg-config opencv'
AC_DEFUN([OPENCVTEST],
[
	AC_REQUIRE([AC_PROG_AWK])
	AC_MSG_CHECKING([opencv version])
	if opencvversion=`pkg-config opencv --modversion`; then
		AC_MSG_RESULT([$opencvversion])
	else
		AC_MSG_RESULT([not found])
		AC_MSG_ERROR([opencv is required.])
	fi])

if test "x$WITH_DEPENDENCIES_CHECK" = "xyes"; then
	# Call OPENCVTEST func
	OPENCVTEST

	OPENCVVERSION=`echo $opencvversion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'`
	AC_SUBST(OPENCVVERSION)
	OPENCV_CPPFLAGS="`$OPENCVCONFIG --cflags`"
	if test "$OPENCVVERSION" -ge 3000000; then
		OPENCV_LIBS=" -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_objdetect -lopencv_video -lopencv_videoio -lopencv_imgcodecs"
	else
		OPENCV_LIBS=" -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_objdetect -lopencv_video"
	fi
fi
# -----------------       opencv  --------------------

# Checks for header files.
AC_PATH_X
AC_CHECK_HEADERS([float.h])
AC_CHECK_HEADERS([sys/timeb.h])

if test "x$WITH_DEPENDENCIES_CHECK" = "xyes"; then
	AC_CHECK_HEADER([libv4l1-videodev.h],
		[AC_SUBST(VIDEODEV_INCLUDE_FILE, libv4l1-videodev.h)],
		[AC_CHECK_HEADER([linux/videodev.h],
			[AC_SUBST(VIDEODEV_INCLUDE_FILE, linux/videodev.h)],
			[AC_MSG_ERROR([Could not find linux/videodev.h nor libv4l1-videodev.h])])
		]
	)
fi
		
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE

COMPFLAGS="-fexceptions $WX_CPPFLAGS $OPENCV_CPPFLAGS $GTK_CPPFLAGS"
if ! "$debug"; then
	COMPFLAGS="$COMPFLAGS -DNDEBUG -O2"
else
	COMPFLAGS="$COMPFLAGS -Wall -Wconversion -DDEBUG -g -O0"
fi

CXXFLAGS="$CXXFLAGS $COMPFLAGS -std=c++11"
LDFLAGS="$LDFLAGS -Wl,--as-needed"

AC_SUBST(WX_LIBS)
AC_SUBST(OPENCV_LIBS)
AC_SUBST(GTK_LIBS)

# libtool variables
Xsed="sed -e s/^X//"
LTLIBOBJS=`echo X"$LIBOBJS"|\
           [$Xsed -e "s,\.[^.]* ,.lo ,g;s,\.[^.]*$,.lo,"]`
AC_SUBST(LTLIBOBJS)

AC_OUTPUT(
	[Makefile] 
	[po/Makefile.in] 
	[man/Makefile] 
	[doc/Makefile] 
	[wxutil/Makefile] 
	[creavision/Makefile] 
	[creavision/libwebcam/Makefile] 
	[simplelog/Makefile] 
	[wxcamwindow/Makefile] 
	[src/Makefile] 
	[src/eviacamloader.c]
	[win32/installer.iss]
	[creavision/libwebcam/incvideodev.h]
)