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
|
dnl Process this file with autoconf to produce a configure script.
AC_INIT([pix_opencv], 0.4, antoine.villeret@gmail.com,[pix_opencv])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_FILES([help/Makefile examples/Makefile])
AC_CONFIG_FILES([pix_opencv-meta.pd])
AC_CONFIG_SRCDIR(src)
AC_SUBST(PD_CPPFLAGS)
AC_SUBST(PD_LDFLAGS)
AC_SUBST(GEM_CPPFLAGS)
AC_SUBST(GEM_LDFLAGS)
AC_SUBST(FACETRACKER_CPPFLAGS)
AC_SUBST(FACETRACKER_LDFLAGS)
AC_SUBST(EXTENSION)
AM_INIT_AUTOMAKE([1.10 foreign])
AC_ARG_WITH([pd], [ --with-pd=</path/to/pd> where to look for pd-headers and and -libs])
AC_ARG_WITH([gem], [ --with-gem=</path/to/gem> where to look for gem-headers and and -libs])
AC_ARG_WITH([extension],[ --with-extension=<ext> enforce a certain extension for the dynamic library (e.g. dll)])
AC_ARG_WITH([facetracker],[ --with-facetracker=</path/to/gem> where to look for facetracker-headers and -libs])
ARCH=$(uname -m)
KERN=$(uname -s)
AC_PROG_CXX
AC_PROG_LIBTOOL
if test "x${libdir}" = "x\${exec_prefix}/lib"; then
libdir='${exec_prefix}/lib/pd/extra'
fi
if test "x$with_pd" != "x"; then
if test -d "${with_pd}"; then
PDPATH=${with_pd}
fi
if test -d "${PDPATH}/src"; then
AC_MSG_RESULT([adding ${PDPATH}/src to INCLUDES])
PD_CPPFLAGS="-I${PDPATH}/src ${CPPFLAGS}"
AC_MSG_RESULT([adding ${PDPATH}/src to LDFLAGS])
PD_LDFLAGS="-L${PDPATH}/src ${LDFLAGS}"
else
if test -d "${PDPATH}"; then
AC_MSG_RESULT([adding ${PDPATH} to INCLUDES])
PD_CPPFLAGS="-I${PDPATH} ${CPPFLAGS}"
fi
fi
if test -d "${PDPATH}/bin"; then
AC_MSG_RESULT([adding ${PDPATH}/bin to LDFLAGS])
PD_LDFLAGS="-L${PDPATH}/bin ${LDFLAGS}"
else
if test -d "${PDPATH}"; then
AC_MSG_RESULT([adding ${PDPATH} to LDFLAGS])
PD_LDFLAGS="-L${PDPATH} ${LDFLAGS}"
fi
fi
else
AC_MSG_RESULT([no pd path given, trying with pkg-config data])
PD_CPPFLAGS=`pkg-config --cflags pd`
PD_LDFLAGS=`pkg-config --libs pd`
fi
if test "x$with_gem" != "x"; then
if test -d "${with_gem}"; then
GEMPATH=${with_gem}
fi
if test -d "${GEMPATH}/src"; then
AC_MSG_RESULT([adding ${GEMPATH}/src to INCLUDES])
GEM_CPPFLAGS="-I${GEMPATH}/src ${CPPFLAGS}"
AC_MSG_RESULT([adding ${GEMPATH}/src to LDFLAGS])
GEM_LDFLAGS="-L${GEMPATH}/src ${LDFLAGS}"
else
if test -d "${GEMPATH}"; then
AC_MSG_RESULT([adding ${GEMPATH} to INCLUDES])
GEM_CPPFLAGS="-I${GEMPATH} ${CPPFLAGS}"
fi
fi
if test -d "${GEMPATH}/bin"; then
AC_MSG_RESULT([adding ${GEMPATH}/bin to LDFLAGS])
GEM_LDFLAGS="-L${GEMPATH}/bin ${LDFLAGS}"
else
if test -d "${GEMPATH}"; then
AC_MSG_RESULT([adding ${GEMPATH} to LDFLAGS])
GEM_LDFLAGS="-L${GEMPATH} ${LDFLAGS}"
fi
fi
else
AC_MSG_RESULT([no Gem path given, trying with pkg-config data])
GEM_CPPFLAGS=`pkg-config --cflags Gem`
GEM_LDFLAGS=`pkg-config --libs Gem`
fi
if test "x$with_facetracker" != "x"; then
if test -d "${with_facetracker}"; then
FACETRACKERPATH=${with_facetracker}
fi
else
if test -d "FaceTracker/src"; then
#~ ouch ! I don't know how to do that in a cleaner way...
FACETRACKERPATH=$(pwd)/FaceTracker
fi
fi
if test "x$FACETRACKERPATH" != "x"; then
AC_MSG_RESULT([FaceTracker library detected])
if test -d "${FACETRACKERPATH}/include"; then
AC_MSG_RESULT([adding ${FACETRACKERPATH}/include to INCLUDES])
FACETRACKER_CPPFLAGS="-I${FACETRACKERPATH}/include ${CPPFLAGS} -DHAVE_FACETRACKER"
fi
if test -d "${FACETRACKERPATH}/src/lib"; then
for obj in "${FACETRACKERPATH}/src/lib/*.o"; do
AC_MSG_RESULT([adding $obj to LDFLAGS])
FACETRACKER_LDFLAGS+="$obj"
done
fi
fi
AC_MSG_CHECKING([extension])
if test "x$with_extension" != "x"
then
EXTENSION=$with_extension
else
case "$KERN" in
Darwin)
EXTENSION=pd_darwin
;;
Linux)
if test "$ARCH" == x86_64
then
EXTENSION=l_ia64
else
EXTENSION=l_i386
fi
;;
*CYGWIN*)
EXTENSION=dll
;;
*MINGW*)
EXTENSION=dll
;;
*)
EXTENSION=pd_linux
;;
esac
fi
AC_MSG_RESULT([$EXTENSION])
AC_CHECK_LIB([opencv_core], [error],,[AC_MSG_ERROR([[please install libopencv_core and try again]])])
AC_CHECK_LIB([opencv_imgproc], [cvCvtColor],,[AC_MSG_ERROR([[please install libopencv_imgproc and try again]])])
AC_CHECK_LIB([opencv_legacy], [_Z38cvCreateModuleBlobTrackAnalysisHistPVSv],,[AC_MSG_ERROR([[please install libopencv_legacy and try again]])])
AC_CHECK_LIB([opencv_objdetect], [cvHaarDetectObjects],,)
AC_CHECK_LIB([opencv_ml], [_ZN10CvKNearestC1EPK5CvMatS2_S2_bi],,)
AC_CHECK_LIB([opencv_ocl], [_init],,)
AC_CHECK_LIB([opencv_calib3d], [cvFindChessboardCorners],,[AC_MSG_ERROR([[please install libopencv_calib3d and try again]])])
AC_CHECK_LIB([opencv_video], [_ZTSN2cv20BackgroundSubtractorE],,[AC_MSG_ERROR([[please install libopencv_video and try again]])])
AC_CHECK_LIB([opencv_nonfree],[_ZN2cv18initModule_nonfreeEv],,)
PKG_CHECK_EXISTS([opencv >= 2.4],[AC_DEFINE([HAVE_BGSUB],[1], [Define if opencv version >= 2.4])]);
PKG_CHECK_EXISTS([opencv >= 2.4.5],[AC_DEFINE([HAVE_CLAHE],[1], [Define if opencv version >= 2.4.5])]);
AC_OUTPUT(Makefile src/Makefile)
|