1
# gdigicam package version number, (as distinct from shared library version)
2
# An odd micro number indicates in-progress developmen
3
# An even micro number indicates a released version.
4
m4_define(gdigicam_major_version, 0)
5
m4_define(gdigicam_minor_version, 3)
6
m4_define(gdigicam_micro_version, 5)
7
8
m4_define([gdigicam_version],
9
          [gdigicam_major_version.gdigicam_minor_version.gdigicam_micro_version])
10
11
m4_define([gdigicam_api_version],
12
          [gdigicam_major_version.gdigicam_minor_version])
13
14
# increase the interface age for each release; if the API changes, set to 0
15
m4_define([gdigicam_interface_age], [0])
16
m4_define([gdigicam_binary_age],
17
          [m4_eval(100 * gdigicam_minor_version + gdigicam_micro_version)])
18
19
AC_PREREQ(2.53)
20
21
AC_INIT([gdigicam], [gdigicam_version],
22
        [alexander.bokovoy@nokia.com])
23
dnl         [https://bugs.maemo.org/enter_bug.cgi?product=gdigicam])
24
AC_CONFIG_SRCDIR([src/gdigicam.h])
25
AM_CONFIG_HEADER([config.h])
26
27
AM_INIT_AUTOMAKE([1.7 foreign])
28
29
GDIGICAM_MAJOR_VERSION=gdigicam_major_version
30
GDIGICAM_MINOR_VERSION=gdigicam_minor_version
31
GDIGICAM_MICRO_VERSION=gdigicam_micro_version
32
GDIGICAM_VERSION=gdigicam_version
33
GDIGICAM_API_VERSION=gdigicam_api_version
34
GDIGICAM_MAJORMINOR=gdigicam_api_version
35
AC_SUBST(GDIGICAM_MAJOR_VERSION)
36
AC_SUBST(GDIGICAM_MINOR_VERSION)
37
AC_SUBST(GDIGICAM_MICRO_VERSION)
38
AC_SUBST(GDIGICAM_VERSION)
39
AC_SUBST(GDIGICAM_API_VERSION)
40
AC_SUBST(GDIGICAM_MAJORMINOR)
41
42
m4_define([lt_current],
43
          [m4_eval(100 * gdigicam_minor_version + gdigicam_micro_version - gdigicam_interface_age)])
44
m4_define([lt_revision], [gdigicam_interface_age])
45
m4_define([lt_age], [m4_eval(gdigicam_binary_age - gdigicam_interface_age)])
46
47
GDIGICAM_LT_CURRENT=lt_current
48
GDIGICAM_LT_REV=lt_revision
49
GDIGICAM_LT_AGE=lt_age
50
GDIGICAM_LT_VERSION="$GDIGICAM_LT_CURRENT:$GDIGICAM_LT_REV:$GDIGICAM_LT_AGE"
51
GDIGICAM_LT_LDFLAGS="-version-info $GDIGICAM_LT_VERSION"
52
53
AC_SUBST(GDIGICAM_LT_VERSION)
54
AC_SUBST(GDIGICAM_LT_LDFLAGS)
55
56
dnl = parameters ====================================================
57
58
if test "x${prefix}" = "xNONE";
59
  then gdigicam_prefix=${ac_default_prefix};
60
  else gdigicam_prefix=${prefix}
61
fi
62
63
dnl If the user didn't specify the $sysconfdir on the command line,
64
dnl let it be /etc, not /usr/local/etc or /usr/etc
65
if [[ x$sysconfdir = 'x${prefix}/etc' ]]; then
66
   sysconfdir=/etc
67
fi
68
69
if test "x{$sysconfdir}" = "xNONE";
70
  then confdir=${gdigicam_prefix}/etc;
71
  else confdir=$sysconfdir;
72
fi
73
74
GREETING_STRING="$PACKAGE_NAME: Open Source GDigicam"
75
AC_DEFINE_UNQUOTED(GREETING,"$GREETING_STRING",[The greeting string])
76
77
AC_ARG_WITH(config-dir,
78
  [  --with-config-dir=DIR     Directory for config files],
79
CONFIG_DIR="${withval}", CONFIG_DIR="${confdir}/gdigicam")
80
81
AC_SUBST(CONFIG_DIR)
82
83
AC_DEFINE_UNQUOTED(CONFIG_DIR,"$CONFIG_DIR",[GDigicam configuration])
84
85
dnl =  determine over what platform to build ===============================
86
87
AC_MSG_NOTICE([Determining what platform to build])
88
PKG_CHECK_MODULES(LIBOSSO,libosso,[with_platform=maemo],true)
89
90
AC_ARG_WITH(platform,
91
[--with-platform=gnome		platform to build for [gnome]],
92
[case "${with_platform}" in
93
       gnome) GDIGICAM_PLATFORM=gnome;;
94
       maemo) GDIGICAM_PLATFORM=maemo;;
95
       *)     GDIGICAM_PLATFORM=${with_platform}
96
esac], [GDIGICAM_PLATFORM=gnome
97
               with_platform=gnome])
98
AC_SUBST(GDIGICAM_PLATFORM)
99
100
if test "x$with_platform" = "xmaemo"; then
101
102
   PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.9.9, hildon1=yes, hildon1=no)
103
   if test "$hildon1" == "yes"; then   # the 'new' hildon
104
       PKG_CHECK_MODULES(GDIGICAM_MAEMO, hildon-1 libosso)
105
106
   else	                               # the old hildon
107
       PKG_CHECK_MODULES(GDIGICAM_MAEMO, hildon-libs >= 0.12.0 libosso)
108
       AC_DEFINE_UNQUOTED(GDIGICAM_HILDON_VERSION_0, 1, ["The Hildon version we support."])
109
   fi
110
111
  AC_DEFINE_UNQUOTED(GDIGICAM_PLATFORM_MAEMO, 1, ["Whether GDigicam is being built for the Maemo platform."])
112
113
  # don't check format errors, because it breaks with logical id's
114
  CFLAGS="$CFLAGS -Wno-format-extra-args"
115
else
116
   AC_DEFINE_UNQUOTED(GDIGICAM_PLATFORM_GNOME, 1, ["Whether GDigicam is being built for the GNOME platform."])
117
fi
118
119
dnl ========================================================================
120
121
# Checks for programs.
122
AC_PROG_CC
123
AC_DISABLE_STATIC
124
AC_PROG_LIBTOOL
125
126
# Checks for header files.
127
AC_HEADER_STDC
128
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
129
130
# Checks for typedefs, structures, and compiler characteristics.
131
AC_C_CONST
132
133
# Checks for library functions.
134
AC_FUNC_MALLOC
135
AC_FUNC_MMAP
136
AC_CHECK_FUNCS([memset munmap strcasecmp strdup])
137
138
dnl = Specify some additional warnings =====================================
139
140
dnl if test "x$GCC" = "xyes"; then
141
dnl         GCC_FLAGS="-g -Wall -Wmissing-prototypes -Wmissing-declarations"
142
dnl fi
143
144
dnl = Check for Performance measurement =========================================
145
146
AC_ARG_ENABLE(performance,[--enable-performance performance macros will be enabled],,enable_performance=no)
147
148
if test "x$enable_performance" = "xyes"; then
149
   AC_DEFINE_UNQUOTED(GDIGICAM_PERFORMANCE, 1, ["Whether GDigicam is being built with performance analysis macros."])
150
   AC_SUBST(GDIGICAM_PERFORMANCE)
151
fi
152
153
dnl = Additinoal CFLAGS =========================================
154
155
dnl ====================================
156
dnl = Additional CFLAGS
157
dnl ====================================
158
159
# Option to enable debugging
160
AC_ARG_ENABLE(debug,
161
              [AC_HELP_STRING([  --enable-debug],[Debugging (default=no)])],
162
              [with_debug=yes], [with_debug=no])
163
164
# Option to enable optimized code
165
AC_ARG_ENABLE(opt,
166
              [AC_HELP_STRING([  --enable-opt],[Optimizing (default=no)])],
167
              [with_opt=yes], [with_opt=no])
168
169
AC_ARG_ENABLE(log,
170
              [AC_HELP_STRING([  --enable-log],[Logging (default=no)])],
171
              [with_log=yes], [with_log=no])
172
173
# Option to enable code coverage
174
AC_ARG_ENABLE(coverage,
175
              [AC_HELP_STRING([  --enable-coverage],[Compile with coverage (default=no)])],
176
              [enable_coverage=yes], [enable_coverage=no])
177
178
if test x$enable_coverage = xyes; then
179
  if test "x$with_debug" == "xyes" ; then
180
    DEBUG_CFLAGS="$WARN_CFLAGS -ggdb -DDEBUG -Werror -DGST_USE_UNSTABLE_API -Wall -Wunreachable-code"
181
  else
182
    DEBUG_CFLAGS="$WARN_CFLAGS -ggdb -DDEBUG -Wall -Wunreachable-code"
183
  fi
184
  AC_PATH_PROG(LCOV, [lcov], [lcov])
185
  AC_PATH_PROG(GENHTML, [genhtml], [genhtml])
186
  if test "x$LCOV" = x; then
187
    echo You need to install lcov to get actual reports!
188
    echo See http://ltp.sf.net/coverage/lcov.php
189
  fi
190
  if test "x$SBOX_USE_CCACHE" == xyes; then
191
    AC_MSG_ERROR([Please set SBOX_USE_CCACHE=no to use coverage.])
192
  fi
193
  COV_CFLAGS="-fprofile-arcs -ftest-coverage"
194
  COV_LDFLAGS="-lgcov"
195
  AC_SUBST(COV_CFLAGS)
196
  AC_SUBST(COV_LDFLAGS)
197
198
  with_opt=no
199
else
200
  if test "x$with_debug" == "xyes" ; then
201
    DEBUG_CFLAGS="$WARN_CFLAGS -ggdb -DDEBUG -Werror -DGST_USE_UNSTABLE_API -Wall -Wunreachable-code"
202
203
    with_opt=no
204
  else
205
    DEBUG_CFLAGS=""
206
  fi
207
fi
208
AC_SUBST(DEBUG_CFLAGS)
209
dnl AC_SUBST(CFLAGS)
210
211
if test "x$with_opt" == "xyes" ; then
212
dnl   OPT_CFLAGS=" -O2 -DG_DISABLE_CAST_CHECKS"
213
  OPT_CFLAGS=" -O2 -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT"
214
else
215
  OPT_CFLAGS=" -O0"
216
fi
217
AC_SUBST(OPT_CFLAGS)
218
219
if test "x$with_log" == "xyes" ; then
220
  LOG_CFLAGS=" -DOSSOLOG_COMPILE"
221
fi
222
AC_SUBST(LOG_CFLAGS)
223
224
AM_CONDITIONAL(ENABLE_COVERAGE,
225
               [test "x$enable_coverage" != xno && test -n "$LCOV" && test -n "$GENHTML"])
226
227
dnl ========================================================================
228
229
gdigicamlib=libgdigicam-$GDIGICAM_API_VERSION.la
230
gdigicamgstcamerabinlib=libgdigicam-gst-camerabin-$GDIGICAM_API_VERSION.la
231
232
dnl = Check for glib =======================================================
233
234
GLIB_REQUIRED=2.2
235
AC_SUBST(GLIB_REQUIRED)
236
237
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
238
AC_SUBST(GLIB_CFLAGS)
239
AC_SUBST(GLIB_LIBS)
240
241
dnl = Check for gobject ====================================================
242
243
PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
244
AC_SUBST(GOBJECT_CFLAGS)
245
AC_SUBST(GOBJECT_LIBS)
246
247
dnl dnl = Check for GCONF =======================================================
248
249
GCONF_REQUIRED=2.2
250
AC_SUBST(GCONF_REQUIRED)
251
252
PKG_CHECK_MODULES(GCONF, [gconf-2.0 >= $GCONF_REQUIRED])
253
AC_SUBST(GCONF_CFLAGS)
254
AC_SUBST(GCONF_LIBS)
255
256
dnl = Check for GdkPixbuf ==================================================
257
258
GDKPIXBUF_REQUIRED=2.12.12
259
AC_SUBST(GDKPIXBUF_REQUIRED)
260
261
PKG_CHECK_MODULES(GDKPIXBUF, gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED)
262
263
AC_SUBST(GDKPIXBUF_LIBS)
264
AC_SUBST(GDKPIXBUF_CFLAGS)
265
266
dnl = Check for Gtk+, which is optional and used in examples ================
267
268
HAVE_GTK=NO
269
PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.2.0, HAVE_GTK_22=yes, HAVE_GTK_22=no)
270
if test "x$HAVE_GTK_22" = "xyes"; then
271
  HAVE_GTK=yes
272
  GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
273
  AC_SUBST(GTK_VERSION)
274
  GTK_PREFIX=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
275
  AC_SUBST(GTK_BASE_DIR)
276
  GDK_PIXBUF_LIBDIR=`$PKG_CONFIG --variable=libdir gdk-pixbuf-2.0`
277
  GDK_PIXBUF_PREFIXDIR=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
278
  AC_SUBST(GTK_BASE_DIR)
279
else
280
  PKG_CHECK_MODULES(GTK2, gtk+-2.0, HAVE_GTK_20=yes, HAVE_GTK_20=no)
281
fi
282
if test "x$HAVE_GTK_20" = "xyes"; then
283
  HAVE_GTK=yes
284
fi
285
GTK_CFLAGS=$GTK2_CFLAGS
286
GTK_LIBS=$GTK2_LIBS
287
AC_SUBST(GTK_LIBS)
288
AC_SUBST(GTK_CFLAGS)
289
AC_SUBST(HAVE_GTK)
290
AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
291
292
dnl = Check for GStreamer ==================================================
293
294
GST_REQUIRED=0.10.0
295
GST_MAJORMINOR=0.10
296
AC_SUBST(GST_REQUIRED)
297
AC_SUBST(GST_MAJORMINOR)
298
299
dnl Gstreamer in Maemo
300
PKG_CHECK_MODULES(GST, \
301
  gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED
302
  gstreamer-plugins-base-$GST_MAJORMINOR  >= $GST_REQUIRED,
303
  HAVE_GST=yes,HAVE_GST=no)
304
305
dnl Check again in Ubuntu/Debian
306
if test "x$HAVE_GST" = "xno"; then
307
  PKG_CHECK_MODULES(GST, \
308
    gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED
309
    gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED,
310
    HAVE_GST=yes,HAVE_GST=no)
311
fi
312
313
dnl Give error and exit if we don't have GStreamer
314
if test "x$HAVE_GST" = "xno"; then
315
  AC_MSG_ERROR(you need gstreamer development packages installed !)
316
else
317
  GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_MAJORMINOR"
318
fi
319
320
dnl GST_LIBS="$GST_LIBS -lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR"
321
322
dnl make GST_CFLAGS and GST_LIBS available
323
AC_SUBST(GST_CFLAGS)
324
AC_SUBST(GST_LIBS)
325
326
dnl Required only to execute unit tests and examples
327
dnl if test "x$enable_tests" = "xyes"; then
328
dnl    AC_CHECK_LIB(gstxvimagesink, gst_video_sink_center_rect, [], AC_MSG_ERROR(No package 'gstreamer0.10-x' found))
329
dnl    AC_CHECK_LIB(gstximagesink, gst_ximage_buffer_get_type, [], AC_MSG_ERROR(No package 'gstreamer0.10-x' found))
330
dnl    AC_CHECK_LIB(gstxvimagesink, gst_video_sink_center_rect, [], AC_MSG_ERROR(No package 'gstreamer0.10-plugins-base' found))
331
332
dnl fi
333
334
dnl = Check for GStreamer Bad ===========================================
335
336
dnl Gstreamer bad in Maemo
337
PKG_CHECK_MODULES(GSTBAD, \
338
  gstreamer-plugins-bad-0.10  >= $GST_REQUIRED,
339
  HAVE_GSTBAD=yes,HAVE_GSTBAD=no)
340
341
dnl Give error and exit if we don't have GStreamer Bad
342
dnl FIXME: In the future we should enable conditional compilation
343
if test "xHAVE_GSTBAD" = "xno"; then
344
  AC_MSG_ERROR(you need gstreamer plugins bad development package installed !)
345
fi
346
347
AC_SUBST(GSTBAD_CFLAGS)
348
AC_SUBST(GSTBAD_LIBS)
349
350
dnl Gstreamer video in Maemo ==============================================
351
352
GST_VIDEO_REQUIRED=0.10
353
354
PKG_CHECK_MODULES(GST_VIDEO, [gstreamer-video-0.10  >= $GST_VIDEO_REQUIRED])
355
356
AC_SUBST(GST_VIDEO_CFLAGS)
357
AC_SUBST(GST_VIDEO_LIBS)
358
359
dnl = GTK Doc check ========================================================
360
361
GTK_DOC_CHECK([1.6])
362
363
if test "x$enable_gtk_doc" = "xyes"; then
364
  AC_DEFINE(BUILD_REFERENCE, [1], [We want to build reference])
365
  BUILD_GTK_DOC=yes
366
else
367
  BUILD_GTK_DOC=no
368
fi
369
AM_CONDITIONAL(BUILD_GTK_DOC, test "x$BUILD_GTK_DOC" = "xyes")
370
371
dnl = REBUILD of generated source code files ===============================
372
373
# Disable rebuild of glib-mkenum -generated source code:
374
AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)
375
376
# define a MAINT-like variable REBUILD which is set if Perl
377
# is found, so autogenerated sources can be rebuilt
378
AC_CHECK_PROGS(PERL, perl5 perl)
379
380
REBUILD=\#
381
if test "x$enable_rebuilds" = "xyes" && \
382
     test -n "$PERL" && \
383
     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
384
  REBUILD=
385
fi
386
AC_SUBST(REBUILD)
387
388
dnl = Check and X11 support (c unit test) =================================
389
390
BUILD_TESTS=no
391
if test "x$enable_tests" = "xyes"; then
392
   PKG_CHECK_MODULES(CHECK, check , HAVE_CHECK="yes", HAVE_CHECK="no")
393
   if test "x$HAVE_CHECK" = "xyes"; then
394
      HAVE_X11=no
395
      PKG_CHECK_MODULES(X11, x11 >= 1.1.1, HAVE_X11=yes, HAVE_X11=no)
396
      if test "x$HAVE_X11" = "xyes"; then
397
         if test "x$HAVE_GTK" = "xyes"; then
398
            BUILD_TESTS=yes
399
         else
400
            AC_MSG_ERROR(you need Gtk+ development packages installed to build unit tests!)
401
         fi
402
403
      AC_SUBST(X11_CFLAGS)
404
      AC_SUBST(X11_LIBS)
405
      else
406
         AC_MSG_ERROR(you need X11 development packages installed to build unit tests!)
407
      fi
408
409
   AC_SUBST(CHECK_CFLAGS)
410
   AC_SUBST(CHECK_LIBS)
411
   else
412
      AC_MSG_ERROR(you need check development packages installed to build unit tests!)
413
   fi
414
fi
415
AM_CONDITIONAL(BUILD_TESTS, test "x$BUILD_TESTS" = "xyes")
416
417
418
dnl = Examples support ====================================================
419
420
BUILD_EXAMPLES=no
421
if test "x$enable_examples" = "xyes"; then
422
   if test "x$HAVE_GTK" = "xyes"; then
423
      BUILD_EXAMPLES=yes
424
   else
425
      AC_MSG_ERROR(you need Gtk+ development packages installed to build examples!)
426
   fi
427
fi
428
AM_CONDITIONAL(BUILD_EXAMPLES, test "x$BUILD_EXAMPLES" = "xyes")
429
430
dnl = Config file support =================================================
431
432
AC_ARG_ENABLE(config-file,[--enable-config-file lets user tweak config file],,enable_config_file=no)
433
if test "x$enable_config_file" = "xyes"; then
434
   AC_DEFINE([USE_CONFIG_FILE],[1],[Defined if config file enabled])
435
   AC_SUBST(USE_CONFIG_FILE)
436
fi
437
438
dnl ========================================================================
439
440
AC_SUBST(GCC_FLAGS)
441
442
GDIGICAM_CFLAGS="$GLIB_CFLAGS $GOBJECT_CFLAGS $GST_CFLAGS $GDKPIXBUF_CFLAGS $CHECK_CFLAGS"
443
GDIGICAM_LIBS="$GLIB_LIBS $GOBJECT_LIBS $GST_LIBS $GDKPIXBUF_LIBS $CHECK_LIBS"
444
445
AC_SUBST(GDIGICAM_CFLAGS)
446
AC_SUBST(GDIGICAM_LIBS)
447
448
AC_OUTPUT([
449
        Makefile
450
        debian/libgdigicam0.install
451
        debian/libgdigicam-dev.install
452
        debian/libgdigicam-doc.install
453
        debian/libgdigicam-gst-camerabin0.install
454
        debian/libgdigicam-gst-camerabin-dev.install
455
        debian/libgdigicam-gst-camerabin-doc.install
456
        doc/Makefile
457
        doc/reference/Makefile
458
        doc/reference/version.xml
459
        doc/reference/gst-camerabin/Makefile
460
        doc/reference/gst-camerabin/version.xml
461
        examples/Makefile
462
        ext/Makefile
463
        ext/gst-camerabin/Makefile
464
        ext/gst-camerabin/gdigicam-gst-camerabin.pc
465
	ext/gst-camerabin/data/Makefile
466
        src/Makefile
467
        src/gdigicam-version.h
468
        tests/Makefile
469
        tests/gst-camerabin/Makefile
470
        gdigicam.pc
471
])
472
473
dnl ========================================================================
474
475
echo ""
476
echo "                  GDigicam $VERSION"
477
echo "                 ==================="
478
echo ""
479
dnl echo "     source code location:   ${srcdir}"
480
echo "                   prefix:   ${prefix}"
481
dnl echo "                 data dir:   ${DATA_DIR}"
482
dnl echo "               config dir:   ${CONFIG_DIR}"
483
echo "                 compiler:   ${CC}"
484
echo "                 platform:   ${with_platform}"
485
echo ""
486
echo "           Target library:   ${gdigicamlib}"
487
echo "            Ext libraries:   ${gdigicamgstcamerabinlib}"
488
echo "  Performance measurement:   ${enable_performance}"
489
echo "                Debugging:   ${with_debug}"
490
echo "             Optimization:   ${with_opt}"
491
echo "                  Logging:   ${with_log}"
492
echo "            Documentation:   ${enable_gtk_doc}"
493
echo "             Unit testing:   ${BUILD_TESTS}"
494
echo "                 Coverage:   ${enable_coverage}"
495
echo "                 Examples:   ${BUILD_EXAMPLES}"
496
echo "       Configuration file:   ${enable_config_file}"
497
echo ""