Add Tizen packaging
[platform/upstream/lightmediascanner.git] / configure.ac
index 143fa13..9238ae5 100644 (file)
@@ -1,12 +1,13 @@
-AC_INIT(lightmediascanner, 0.4.3.0, lms-devel@garage.maemo.org)
-AC_PREREQ(2.52)
+AC_INIT(lightmediascanner, 0.5.1, https://github.com/profusion/lightmediascanner/)
+AC_PREREQ(2.60)
 AC_CONFIG_SRCDIR(configure.ac)
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 AC_ISC_POSIX
 
-AM_INIT_AUTOMAKE(1.6 dist-bzip2)
+AM_INIT_AUTOMAKE(foreign 1.11 silent-rules subdir-objects dist-bzip2)
 AM_CONFIG_HEADER(config.h)
+AC_USE_SYSTEM_EXTENSIONS
 AC_CONFIG_MACRO_DIR([m4])
 _XTERM_COLORS
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -18,7 +19,7 @@ AC_HEADER_STDC
 AC_C_CONST
 
 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
-AC_PROG_LIBTOOL
+LT_INIT([disable-static])
 
 VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
 VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
@@ -41,40 +42,38 @@ PKG_CHECK_MODULES(SQLITE3, [sqlite3 >= 3.3])
 
 # plugins checks
 
-AM_CONDITIONAL(HAVE_VORBIS, false)
 AM_CONDITIONAL(USE_TREMOR, false)
 define([CHECK_MODULE_OGG],
 [
-        AC_CHECK_HEADERS(tremor/ivorbiscodec.h tremor/ivorbisfile.h, HAVE_IVORBIS_HEADERS=yes, HAVE_IVORBIS_HEADERS=no)
-        if test "x$HAVE_IVORBIS_HEADERS" = "xyes"; then
-            AC_CHECK_LIB(vorbisidec, ogg_sync_bufferin, HAVE_IVORBIS_LIBS=yes, HAVE_IVORBIS_LIBS=no)
-        fi
-
-        AM_CONDITIONAL(USE_TREMOR, test "x$HAVE_IVORBIS_LIBS" = "xyes")
-        if test "x$HAVE_IVORBIS_LIBS" = "xyes"; then
-            AC_DEFINE(USE_TREMOR, 1, Define if libvorbisidec (aka tremor) support is enabled)
-            VORBIS_LIBS="-lvorbisidec"
-            AC_SUBST(VORBIS_LIBS)
-        else
-            AC_LMS_CHECK_PKG(VORBIS, vorbis, [], [OGG=false])
+        AC_LMS_CHECK_PKG(VORBIS, vorbis, [], [OGG=false])
+        if test "x$HAVE_VOBIS" = "xno"; then
+            AC_LMS_CHECK_PKG(VORBIS, vorbisdec, [USE_TREMOR=true], [OGG=false])
         fi
+       AC_LMS_CHECK_PKG(THEORADEC, theoradec, [], [OGG=false])
 ])
 
 AM_CONDITIONAL(HAVE_MP4V2, false)
 define([CHECK_MODULE_MP4],
 [
-        AC_CHECK_HEADERS(mp4.h, HAVE_MP4_HEADERS=yes, HAVE_MP4_HEADERS=no)
         AC_CHECK_HEADERS(mp4v2/mp4v2.h, HAVE_MP4V2_HEADERS=yes, HAVE_MP4V2_HEADERS=no)
-        if test "x$HAVE_MP4_HEADERS" = "xyes" -o "x$HAVE_MP4V2_HEADERS" = "xyes"; then
+        if test "x$HAVE_MP4V2_HEADERS" = "xyes"; then
             AC_CHECK_LIB(mp4v2, MP4Read, [MP4=true], [MP4=false])
             MP4V2_LIBS="-lmp4v2"
             AC_SUBST(MP4V2_LIBS)
-            if test "x$HAVE_MP4V2_HEADERS" = "xyes"; then
-               AC_DEFINE(HAVE_MP4V2, 1, Define if mp4v2.h is present)
-            fi
-            if test "x$HAVE_MP4_HEADERS" = "xyes"; then
-               AC_DEFINE(HAVE_MP4, 1, Define if mp4.h is present)
-            fi
+
+            # strict about new 2.0 api
+            AC_MSG_CHECKING([mp4v2 2.0 API (MP4Read and MP4Close)])
+            AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+               [[#include <mp4v2/mp4v2.h>]],
+               [[MP4FileHandle fh = MP4Read("/tmp");
+                 MP4Close(fh, 0);
+               ]])],
+               [
+                  MP4=true
+                  AC_MSG_RESULT([yes])
+               ], [
+                  MP4=false
+                  AC_MSG_RESULT([no])])
         else
             MP4=false
         fi
@@ -86,6 +85,23 @@ define([CHECK_MODULE_FLAC],
         AC_LMS_CHECK_PKG(FLAC, flac, [], [FLAC=false])
 ])
 
+AM_CONDITIONAL(HAVE_GENERIC, false)
+define([CHECK_MODULE_GENERIC],
+[
+        AC_LMS_CHECK_PKG(GENERIC, [libavcodec libavformat], [], [GENERIC=false])
+])
+
+AC_ARG_ENABLE([magic],
+        [AC_HELP_STRING([--disable-magic],
+                [Disable mime computation with libmagic. @<:@default=enable@:>@])],
+        [enable_magic=${enableval}], [enable_magic=yes])
+
+if test "$enable_magic" = "yes"; then
+   AC_CHECK_HEADERS([magic.h], [], [AC_MSG_ERROR([libmagic magic.h header file not found])])
+   AC_CHECK_LIB([magic], [magic_open], [AC_SUBST([LIBMAGIC], [-lmagic])],
+                [AC_MSG_ERROR([libmagic library or magic_open function not found])])
+fi
+
 # plugins declarations
 AC_LMS_OPTIONAL_MODULE([dummy], true)
 AC_LMS_OPTIONAL_MODULE([jpeg], true)
@@ -100,29 +116,95 @@ AC_LMS_OPTIONAL_MODULE([rm], true)
 AC_LMS_OPTIONAL_MODULE([mp4], true, [CHECK_MODULE_MP4])
 AC_LMS_OPTIONAL_MODULE([id3], true)
 AC_LMS_OPTIONAL_MODULE([flac], true, [CHECK_MODULE_FLAC])
+AC_LMS_OPTIONAL_MODULE([wave], true)
+AC_LMS_OPTIONAL_MODULE([generic], true, [CHECK_MODULE_GENERIC])
+
+
+AC_ARG_ENABLE([daemon],
+        [AC_HELP_STRING([--disable-daemon],
+                [Disable DBus scanner daemon. @<:@default=enable@:>@])],
+        [build_daemon=${enableval}], [build_daemon=yes])
+
+dbusservicedir="${datadir}/dbus-1/services"
+AC_ARG_WITH([dbus-services],
+        [AC_HELP_STRING([--with-dbus-services=DBUS_SERVICES],
+                [Specify a directory to store dbus service files.])],
+        [dbusservicedir=$withval])
+AC_SUBST(dbusservicedir)
+
+dbusdir=""
+if test "$build_daemon" = "yes"; then
+        PKG_CHECK_MODULES(GIO, [gio-2.0 >= 2.32])
+fi
+AM_CONDITIONAL([BUILD_DAEMON], [test "$build_daemon" = "yes"])
+
+
+#####################################################################
+# Default CFLAGS and LDFLAGS
+#####################################################################
+
+CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\
+                      -pipe \
+                      -DANOTHER_BRICK_IN_THE \
+                      -Wall \
+                      -W \
+                      -Wextra \
+                      -Wno-inline \
+                      -Wvla \
+                      -Wundef \
+                      -Wformat=2 \
+                      -Wlogical-op \
+                      -Wsign-compare \
+                      -Wformat-security \
+                      -Wmissing-include-dirs \
+                      -Wformat-nonliteral \
+                      -Wold-style-definition \
+                      -Wpointer-arith \
+                      -Winit-self \
+                      -Wdeclaration-after-statement \
+                      -Wfloat-equal \
+                      -Wmissing-prototypes \
+                      -Wstrict-prototypes \
+                      -Wredundant-decls \
+                      -Wmissing-declarations \
+                      -Wmissing-noreturn \
+                      -Wshadow \
+                      -Wendif-labels \
+                      -Wstrict-aliasing=2 \
+                      -Wwrite-strings \
+                      -Wno-long-long \
+                      -Wno-overlength-strings \
+                      -Wno-unused-parameter \
+                      -Wno-missing-field-initializers \
+                      -Wno-unused-result \
+                      -Wnested-externs \
+                      -Wchar-subscripts \
+                      -Wtype-limits \
+                      -Wuninitialized \
+                      -fno-common \
+                      -fdiagnostics-show-option \
+                      -fvisibility=hidden \
+                      -ffunction-sections \
+                      -fdata-sections])
+AC_SUBST([WARNINGFLAGS], $with_cflags)
+
+
+CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \
+                      -Wl,--as-needed \
+                      -Wl,--gc-sections])
+AC_SUBST([GCLDFLAGS], $with_ldflags)
+
 
 AC_OUTPUT([
 lightmediascanner.pc
 lightmediascanner.spec
+org.lightmediascanner.service
 Makefile
 m4/Makefile
 src/Makefile
 src/bin/Makefile
 src/lib/Makefile
 src/plugins/Makefile
-src/plugins/dummy/Makefile
-src/plugins/jpeg/Makefile
-src/plugins/png/Makefile
-src/plugins/video-dummy/Makefile
-src/plugins/audio-dummy/Makefile
-src/plugins/m3u/Makefile
-src/plugins/ogg/Makefile
-src/plugins/pls/Makefile
-src/plugins/asf/Makefile
-src/plugins/rm/Makefile
-src/plugins/mp4/Makefile
-src/plugins/id3/Makefile
-src/plugins/flac/Makefile
 ])
 
 
@@ -152,3 +234,5 @@ Summary:
 SUMMARY_EOF
 
 echo -e " * modules........: $MODS $UNUSED_MODS"
+echo -e " * daemon.........: ${build_daemon}"
+echo -e " * use libmagic...: ${enable_magic}"