• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4m4_define([xcam_major_version], [1])
5m4_define([xcam_minor_version], [1])
6m4_define([xcam_micro_version], [0])
7m4_define([xcam_version], [xcam_major_version.xcam_minor_version.xcam_micro_version])
8
9AC_PREREQ([2.60])
10AC_CONFIG_MACRO_DIR([m4])
11AC_INIT([libxcam], [xcam_version], [feng.yuan@intel.com], [libxcam])
12AC_CONFIG_HEADERS([config.h])
13AM_INIT_AUTOMAKE([foreign subdir-objects])
14
15#xcam version
16XCAM_MAJOR_VERSION=xcam_major_version
17XCAM_MINOR_VERSION=xcam_minor_version
18XCAM_MICRO_VERSION=xcam_micro_version
19XCAM_VERSION=xcam_version
20XCAM_VERSION_HEX="0x$XCAM_MAJOR_VERSION$XCAM_MINOR_VERSION$XCAM_MICRO_VERSION"
21AC_DEFINE_UNQUOTED(XCAM_VERSION, $XCAM_VERSION_HEX,
22    [define libxcam version])
23AC_SUBST(XCAM_VERSION)
24
25XCAM_LT_VERSION="xcam_major_version:xcam_minor_version:xcam_micro_version"
26XCAM_LT_LDFLAGS="-version-number $XCAM_LT_VERSION"
27AC_SUBST(XCAM_LT_VERSION)
28AC_SUBST(XCAM_LT_LDFLAGS)
29
30# Checks for programs.
31AC_PROG_CC
32AC_PROG_CXX
33AC_PROG_INSTALL
34PKG_PROG_PKG_CONFIG
35LT_INIT
36
37AC_ARG_ENABLE(debug,
38    AS_HELP_STRING([--enable-debug],
39                   [enable debug, @<:@default=no@:>@]),
40    [], [enable_debug="no"])
41AM_CONDITIONAL([DEBUG], [test "$enable_debug" = "yes"])
42
43AC_ARG_ENABLE(profiling,
44    AS_HELP_STRING([--enable-profiling],
45                   [enable profiling, @<:@default=no@:>@]),
46    [], [enable_profiling="no"])
47
48AC_ARG_ENABLE(drm,
49    AS_HELP_STRING([--enable-drm],
50                   [enable drm buffer, @<:@default=no@:>@]),
51    [], [enable_drm="no"])
52
53AC_ARG_ENABLE([aiq],
54    AS_HELP_STRING([--enable-aiq],
55                   [enable Aiq 3A algorithm build, @<:@default=no@:>@]),
56    [], [enable_aiq="no"])
57
58AC_ARG_ENABLE([gst],
59    AS_HELP_STRING([--enable-gst],
60                   [enable gstreamer plugin build, @<:@default=no@:>@]),
61    [], [enable_gst="no"])
62
63AC_ARG_ENABLE(libcl,
64    AS_HELP_STRING([--enable-libcl],
65                   [enable libcl image processor, @<:@default=yes@:>@]),
66    [], [enable_libcl="yes"])
67
68AC_ARG_ENABLE(opencv,
69    AS_HELP_STRING([--enable-opencv],
70                   [enable opencv library, @<:@default=no@:>@]),
71    [], [enable_opencv="no"])
72
73AC_ARG_ENABLE(capi,
74    AS_HELP_STRING([--enable-capi],
75                   [enable libxcam-capi library, @<:@default=yes@:>@]),
76    [], [enable_capi="yes"])
77
78# documentation
79AC_ARG_ENABLE(docs,
80    [AC_HELP_STRING([--enable-docs],
81                    [build Doxygen documentation @<:@default=no@:>@])],
82    [], [enable_docs="no"])
83
84AC_ARG_ENABLE([3alib],
85    AS_HELP_STRING([--enable-3alib],
86                   [enable 3A lib build, @<:@default=no@:>@]),
87    [], [enable_3alib="no"])
88
89AC_ARG_ENABLE([smartlib],
90    AS_HELP_STRING([--enable-smartlib],
91                   [enable smart analysis lib build, @<:@default=no@:>@]),
92    [], [enable_smartlib="no"])
93
94# Check for Doxygen
95if test "$enable_docs" = "yes"; then
96    AC_CHECK_TOOL([DOXYGEN], [doxygen], [no])
97    if test "$DOXYGEN" = "no"; then
98       enable_docs="no"
99    fi
100fi
101AM_CONDITIONAL(ENABLE_DOCS, test "$enable_docs" = "yes")
102
103# check profiling
104ENABLE_PROFILING=0
105if test "$enable_profiling" = "yes"; then
106    ENABLE_PROFILING=1
107fi
108
109# check drm
110HAVE_LIBDRM=0
111if test "$enable_drm" = "yes"; then
112    PKG_CHECK_MODULES(LIBDRM, [libdrm], [HAVE_LIBDRM=1], [HAVE_LIBDRM=0])
113fi
114
115# check libcl
116HAVE_LIBCL=0
117if test "$enable_libcl" = "yes"; then
118    PKG_CHECK_MODULES(LIBCL, [libcl], [HAVE_LIBCL=1], [HAVE_LIBCL=0])
119fi
120
121if test "$enable_libcl" = "yes" && test "$HAVE_LIBCL" -eq 0; then
122    PKG_CHECK_MODULES(LIBCL, [OpenCL], [HAVE_LIBCL=1], [HAVE_LIBCL=0])
123fi
124
125if test "$HAVE_LIBCL" -eq 1; then
126    AC_CHECK_PROGS([GAWK], [gawk], [no])
127    if test "x$GAWK" = "xno"; then
128        AC_MSG_ERROR([gawk not found])
129    fi
130
131    if test "$HAVE_LIBDRM" -eq 1; then
132        HAVE_CL_INTEL_H=1
133        AC_CHECK_HEADERS([CL/cl_intel.h], [HAVE_CL_INTEL_H=1], [HAVE_CL_INTEL_H=0])
134        if test "$HAVE_CL_INTEL_H" -eq 0; then
135            # https://raw.githubusercontent.com/intel/beignet/Release_v1.3/include/CL/cl_intel.h
136            XCAM_WGET(
137                [https://cgit.freedesktop.org/beignet/plain/include/CL/cl_intel.h?id=Release_v1.3.0],
138                [./ext/beignet/include/CL/cl_intel.h],
139                [6a6619073cb35e6987b7379a5a1a1497])
140
141            CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/beignet/include"
142        fi
143    fi
144fi
145
146# check opencv minimum version number
147HAVE_OPENCV=0
148if test "$enable_opencv" = "yes"; then
149    OPENCV_VERSION_STR=`$PKG_CONFIG --modversion opencv`
150        PKG_CHECK_MODULES([OPENCV], [opencv >= 3.0.0], [HAVE_OPENCV=1], [HAVE_OPENCV=0])
151        echo "OpenCV version:"$OPENCV_VERSION_STR "minimum required version:3.0.0" "have opencv:"$HAVE_OPENCV
152fi
153
154# check opencv videostab module
155ENABLE_DVS=0
156if test "$HAVE_OPENCV" -eq 1; then
157    AC_LANG(C++)
158    saved_CPPFLAGS="$CPPFLAGS"
159    CPPFLAGS="$CPPFLAGS $OPENCV_CFLAGS"
160    saved_LIBS="$LIBS"
161    LIBS="$LIBS $OPENCV_LIBS"
162    AC_CHECK_HEADER([opencv2/videostab.hpp], [ENABLE_DVS=1], [ENABLE_DVS=0])
163    CPPFLAGS="$saved_CPPFLAGS"
164    LIBS="$saved_LIBS"
165fi
166
167# check dvs opencl path
168ENABLE_DVS_CL_PATH=0
169if test "$HAVE_OPENCV" -eq 1; then
170    AC_LANG(C++)
171    saved_CPPFLAGS="$CPPFLAGS"
172    CPPFLAGS="$CPPFLAGS $OPENCV_CFLAGS"
173    saved_LIBS="$LIBS"
174    LIBS="$LIBS $OPENCV_LIBS"
175    AC_COMPILE_IFELSE(
176        [AC_LANG_PROGRAM(
177            [[#include <opencv2/core.hpp>
178              #include <opencv2/opencv.hpp>
179            ]],
180            [[cv::UMat frame0;
181              cv::UMat frame1;
182              cv::videostab::MotionEstimatorRansacL2 est;
183              cv::videostab::KeypointBasedMotionEstimator kpest(&est);
184              kpest.estimate(frame0, frame1);
185            ]]
186           )],
187        [ENABLE_DVS_CL_PATH=1],
188        [ENABLE_DVS_CL_PATH=0]
189    )
190    CPPFLAGS="$saved_CPPFLAGS"
191    LIBS="$saved_LIBS"
192fi
193
194# check capi build
195ENABLE_CAPI=0
196if test "$enable_capi" = "yes"; then
197    ENABLE_CAPI=1
198fi
199
200# check AIQ
201ENABLE_IA_AIQ=0
202USE_LOCAL_AIQ=0
203if test "$enable_aiq" = "yes"; then
204    ENABLE_IA_AIQ=1
205    PKG_CHECK_MODULES(IA_AIQ, ia_imaging,
206        PKG_CHECK_EXISTS(ia_imaging >= 2.7,
207            AC_DEFINE(HAVE_AIQ_2_7, 1, [defined if module ia_imaging >= v2.0_007 is found])
208        ),
209        [USE_LOCAL_AIQ=1]
210    )
211
212    if test "$USE_LOCAL_AIQ" -eq 1; then
213        #check HAVE_AIQ_2_7
214        AC_CACHE_CHECK([for ext/ia_imaging >=v2.0_007],
215            ac_cv_have_aiq_2_7, [
216            saved_CPPFLAGS="$CPPFLAGS"
217            CPPFLAGS="$CPPFLAGS -I./ext/ia_imaging/include"
218            saved_LIBS="$LIBS"
219            LIBS="$LIBS"
220            AC_COMPILE_IFELSE(
221                [AC_LANG_PROGRAM(
222                    [[#include <stdint.h>
223                      #include <stdio.h>
224                      #include "ia_aiq_types.h"
225                    ]],
226                    [[ia_aiq_ae_results ae_result;
227                      ae_result.flashes = NULL;
228                    ]]
229                   )],
230                [ac_cv_have_aiq_2_7="yes"],
231                [ac_cv_have_aiq_2_7="no"]
232            )
233            CPPFLAGS="$saved_CPPFLAGS"
234            LIBS="$saved_LIBS"
235        ])
236
237        if test "$ac_cv_have_aiq_2_7" = "yes"; then
238            AC_DEFINE(HAVE_AIQ_2_7, 1, [defined if ia_imaging >= v2.0_007 is found])
239        fi
240    fi
241
242    if test "$USE_LOCAL_AIQ" -eq 0; then
243        IA_IMAGING_CFLAGS="$IA_AIQ_CFLAGS"
244        IA_IMAGING_LIBS="$IA_AIQ_LIBS"
245    else
246        IA_IMAGING_CFLAGS="-I\$(top_srcdir)/ext/ia_imaging/include"
247        IA_IMAGING_LIBS="-L\$(top_srcdir)/ext/ia_imaging/lib -lia_aiq -lia_isp_2_2 -lia_cmc_parser -lia_mkn -lia_nvm -lia_exc -lia_log"
248    fi
249    AC_SUBST(IA_IMAGING_CFLAGS)
250    AC_SUBST(IA_IMAGING_LIBS)
251    LIBS="$LIBS $IA_IMAGING_LIBS"
252fi
253
254# check 3a lib build
255ENABLE_3ALIB=0
256if test "$enable_3alib" = "yes"; then
257    ENABLE_3ALIB=1
258fi
259AM_CONDITIONAL([ENABLE_3ALIB], [test "$ENABLE_3ALIB" -eq 1])
260
261# check smart analysis lib build
262ENABLE_SMART_LIB=0
263if test "$enable_smartlib" = "yes"; then
264    ENABLE_SMART_LIB=1
265fi
266AM_CONDITIONAL([ENABLE_SMART_LIB], [test "$ENABLE_SMART_LIB" -eq 1])
267
268# check atomisp headers
269USE_LOCAL_ATOMISP=0
270#AC_CHECK_HEADERS([linux/atomisp.h], [USE_LOCAL_ATOMISP=0], [USE_LOCAL_ATOMISP=1])
271AC_CACHE_CHECK([for linux/atomisp.h],
272    ac_cv_have_atomisp_headers, [
273    saved_CPPFLAGS="$CPPFLAGS"
274    CPPFLAGS="$CPPFLAGS"
275    saved_LIBS="$LIBS"
276    LIBS="$LIBS"
277    AC_COMPILE_IFELSE(
278        [AC_LANG_PROGRAM(
279            [[#ifndef __user
280              #define __user
281              #endif
282              #include <stdint.h>
283              #include <stdio.h>
284              #include <linux/atomisp.h>]],
285            [[struct atomisp_parm param;]]
286           )],
287        [ac_cv_have_atomisp_headers="yes"],
288        [ac_cv_have_atomisp_headers="no" USE_LOCAL_ATOMISP=1]
289    )
290    CPPFLAGS="$saved_CPPFLAGS"
291    LIBS="$saved_LIBS"
292])
293
294
295# build gstreamer plugin
296GST_API_VERSION=1.0
297GST_VERSION_REQUIRED=1.2.3
298ENABLE_GST=0
299if test "$enable_gst" = "yes"; then
300    ENABLE_GST=1
301    PKG_CHECK_MODULES([GST], [gstreamer-$GST_API_VERSION >= $GST_VERSION_REQUIRED])
302    PKG_CHECK_MODULES([GST_ALLOCATOR], [gstreamer-allocators-$GST_API_VERSION >= $GST_VERSION_REQUIRED])
303    PKG_CHECK_MODULES([GST_VIDEO], [gstreamer-video-$GST_API_VERSION >= $GST_VERSION_REQUIRED])
304fi
305AM_CONDITIONAL([ENABLE_GST], [test "$ENABLE_GST" -eq 1])
306
307dnl set XCAM_CFLAGS and XCAM_CXXFLAGS
308XCAM_CFLAGS=" -fPIC -DSTDC99 -W -Wall -D_REENTRANT -Wformat -Wformat-security -fstack-protector"
309if test "$enable_debug" = "yes"; then
310    XCAM_CFLAGS="$XCAM_CFLAGS -g -DDEBUG"
311fi
312XCAM_CXXFLAGS="$XCAM_CFLAGS -std=c++0x"
313AC_SUBST(XCAM_CFLAGS)
314AC_SUBST(XCAM_CXXFLAGS)
315
316PTHREAD_LDFLAGS="$PTHREAD_LDFLAGS -pthread"
317AC_SUBST(PTHREAD_LDFLAGS)
318
319# define macor in config.h
320AC_DEFINE_UNQUOTED([ENABLE_PROFILING], $ENABLE_PROFILING,
321    [enable profiling])
322
323AC_DEFINE_UNQUOTED([HAVE_LIBDRM], $HAVE_LIBDRM,
324    [have libdrm])
325AM_CONDITIONAL([HAVE_LIBDRM], [test "$HAVE_LIBDRM" -eq 1])
326
327AC_DEFINE_UNQUOTED([HAVE_LIBCL], $HAVE_LIBCL,
328    [have libcl])
329AM_CONDITIONAL([HAVE_LIBCL], [test "$HAVE_LIBCL" -eq 1])
330
331AC_DEFINE_UNQUOTED([HAVE_OPENCV], $HAVE_OPENCV,
332    [have opencv])
333AM_CONDITIONAL([HAVE_OPENCV], [test "$HAVE_OPENCV" -eq 1])
334
335AC_DEFINE_UNQUOTED([ENABLE_DVS], $ENABLE_DVS,
336    [enable dvs])
337AM_CONDITIONAL([ENABLE_DVS], [test "$ENABLE_DVS" -eq 1])
338
339AC_DEFINE_UNQUOTED([ENABLE_DVS_CL_PATH], $ENABLE_DVS_CL_PATH,
340    [enable dvs cl path])
341AM_CONDITIONAL([ENABLE_DVS_CL_PATH], [test "$ENABLE_DVS_CL_PATH" -eq 1])
342
343AC_DEFINE_UNQUOTED([ENABLE_CAPI], $ENABLE_CAPI,
344    [enable capi build])
345AM_CONDITIONAL([ENABLE_CAPI], [test "$ENABLE_CAPI" -eq 1])
346
347#atomisp
348AM_CONDITIONAL([USE_LOCAL_ATOMISP], [test "$USE_LOCAL_ATOMISP" -eq 1])
349
350# aiq (ia_imaging)
351AC_DEFINE_UNQUOTED([HAVE_IA_AIQ], $ENABLE_IA_AIQ,
352    [have aiq binary])
353AM_CONDITIONAL([ENABLE_IA_AIQ], [test "$ENABLE_IA_AIQ" -eq 1])
354AM_CONDITIONAL([USE_LOCAL_AIQ], [test "$USE_LOCAL_AIQ" -eq 1])
355
356AC_CONFIG_FILES([Makefile
357                 clx_kernel/Makefile
358                 xcore/Makefile
359                 modules/Makefile
360                 modules/soft/Makefile
361                 modules/isp/Makefile
362                 modules/ocl/Makefile
363                 wrapper/Makefile
364                 wrapper/gstreamer/Makefile
365                 wrapper/gstreamer/interface/Makefile
366                 plugins/Makefile
367                 plugins/3a/hybrid/Makefile
368                 plugins/3a/aiq/Makefile
369                 plugins/3a/Makefile
370                 plugins/smart/Makefile
371                 plugins/smart/dvs/Makefile
372                 plugins/smart/dvs/libdvs/Makefile
373                 plugins/smart/sample/Makefile
374                 capi/Makefile
375                 tests/Makefile
376                 pkgconfig/Makefile
377                 pkgconfig/libxcam.pc
378                ])
379
380AC_OUTPUT
381
382if test "$HAVE_LIBDRM" -eq 1; then have_drm="yes"; else have_drm="no"; fi
383if test "$USE_LOCAL_AIQ" -eq 1; then use_local_aiq="yes"; else  use_local_aiq="no"; fi
384if test "$USE_LOCAL_ATOMISP" -eq 1; then use_local_atomisp="yes"; else  use_local_atomisp="no"; fi
385if test "$HAVE_LIBCL" -eq 1; then have_libcl="yes"; else  have_libcl="no"; fi
386if test "$HAVE_OPENCV" -eq 1; then have_opencv="yes"; else have_opencv="no"; fi
387if test "$ENABLE_DVS" -eq 1; then enable_dvs="yes"; else enable_dvs="no"; fi
388
389echo "
390     libxcam configuration summary
391     version                    : $XCAM_VERSION
392     enable debug               : $enable_debug
393     enable profiling           : $enable_profiling
394     enable drm lib             : $have_drm
395     build GStreamer plugin     : $enable_gst
396     build aiq analyzer         : $enable_aiq
397     use local aiq              : $use_local_aiq
398     use local atomisp          : $use_local_atomisp
399     have opencl lib            : $have_libcl
400     have opencv lib            : $have_opencv
401     enable 3a lib              : $enable_3alib
402     enable smart analysis lib  : $enable_smartlib
403     enable dvs                 : $enable_dvs
404     enable libxcam-capi lib    : $enable_capi
405"
406