-TUXBOX_APPS_LIB_CONFIG(FREETYPE,freetype-config)
-TUXBOX_APPS_LIB_PKGCONFIG(FRIBIDI,fribidi)
-TUXBOX_APPS_LIB_PKGCONFIG(ID3TAG,id3tag)
-TUXBOX_APPS_LIB_PKGCONFIG(MAD,mad)
-#TUXBOX_APPS_LIB_PKGCONFIG(PLUGINS,tuxbox-plugins)
-TUXBOX_APPS_LIB_PKGCONFIG(PNG,libpng)
-TUXBOX_APPS_LIB_PKGCONFIG(SIGC,sigc++-1.2)
-TUXBOX_APPS_LIB_PKGCONFIG(DVBSI,libdvbsi++)
-_TUXBOX_APPS_LIB_PKGCONFIG_OPTIONAL(GSTREAMER,gstreamer,HAVE_GSTREAMER)
-AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
-JPEG_LIBS="-ljpeg"
-AC_SUBST(JPEG_LIBS)
-
-if test "$withsdl" = "yes" ; then
- TUXBOX_APPS_LIB_CONFIG(SDL,sdl-config)
- AC_DEFINE_UNQUOTED([WITH_SDL],[$withsdl],[With SDL])
+AM_CONDITIONAL(HAVE_GIT_DIR, test -d "$srcdir/.git")
+AM_CONDITIONAL(HAVE_FAKE_GIT_DIR, test -f "$srcdir/.git/last_commit_info")
+
+PKG_CHECK_MODULES(BASE, [freetype2 fribidi gstreamer-0.10 gstreamer-pbutils-0.10 libdvbsi++ libpng libxml-2.0 sigc++-1.2])
+PKG_CHECK_MODULES(LIBDDVD, libdreamdvd, HAVE_LIBDDVD="yes", HAVE_LIBDDVD="no")
+AM_CONDITIONAL(HAVE_LIBDDVD, test "$HAVE_LIBDDVD" = "yes")
+
+AC_CHECK_LIB([dl], [dlopen], [LIBDL_LIBS="-ldl"], [AC_MSG_ERROR([Could not find libdl])])
+AC_SUBST(LIBDL_LIBS)
+AC_CHECK_LIB([jpeg], [jpeg_set_defaults], [LIBJPEG_LIBS="-ljpeg"], [AC_MSG_ERROR([Could not find libjpeg])])
+AC_SUBST(LIBJPEG_LIBS)
+AC_CHECK_LIB([ungif], [DGifOpen], [LIBGIF_LIBS="-lungif"], [AC_CHECK_LIB([gif], [DGifOpen], [LIBGIF_LIBS="-lgif"], [AC_MSG_ERROR([Could not find libgif or libungif])])])
+AC_SUBST(LIBGIF_LIBS)
+
+AC_LANG_PUSH([C++])
+AC_CHECK_LIB([xmlccwrap], [exit], [LIBXMLCCWRAP_LIBS="-lxmlccwrap"], [AC_MSG_ERROR([Could not find libxmlccwrap])])
+AC_SUBST(LIBXMLCCWRAP_LIBS)
+AC_LANG_POP
+
+AC_ARG_WITH(libsdl,
+ AS_HELP_STRING([--with-libsdl],[use libsdl, yes or no]),
+ [with_libsdl=$withval],[with_libsdl=no])
+if test "$with_libsdl" = "yes"; then
+ PKG_CHECK_MODULES(LIBSDL, sdl)
+fi
+AM_CONDITIONAL(HAVE_LIBSDL, test "$with_libsdl" = "yes")
+
+AC_ARG_WITH(libxine,
+ AS_HELP_STRING([--with-libxine],[use libxine, yes or no]),
+ [with_libxine=$withval],[with_libxine=no])
+if test "$with_libxine" = "yes"; then
+ PKG_CHECK_MODULES(LIBXINE, libxine)
+ AC_DEFINE([WITH_XINE],[1],[Define to 1 if you have libxine])
+fi
+AM_CONDITIONAL(HAVE_LIBXINE, test "$with_libxine" = "yes")
+
+AC_ARG_WITH(debug,
+ AS_HELP_STRING([--without-debug],[disable debugging code]),
+ [with_debug="$withval"],[with_debug="yes"])
+if test "$with_debug" = "yes"; then
+ DEBUG_CFLAGS="-ggdb3"
+ AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code])
+fi
+
+AC_ARG_WITH(memcheck,
+ AS_HELP_STRING([--with-memcheck],[enable memory leak checks]),
+ [with_memcheck="$withval"],[with_memcheck="no"])
+if test "$with_memcheck" = "yes"; then
+ AC_DEFINE([MEMLEAK_CHECK],[1],[Define to 1 to enable memory leak checks])
+fi
+
+AC_ARG_WITH(po,
+ AS_HELP_STRING([--with-po],[enable updating of po files]),
+ [with_po="$withval"],[with_po="no"])
+if test "$with_po" = "yes"; then
+ AC_PATH_PROG(MSGINIT, msginit)
+ AC_PATH_PROG(MSGMERGE, msgmerge)
+ AC_PATH_PROG(MSGUNIQ, msguniq)
+ AC_PATH_PROG(XGETTEXT, xgettext)
+ if test -z "$MSGINIT" -o -z "$MSGMERGE" -o -z "$MSGUNIQ" -o -z "$XGETTEXT"; then
+ AC_MSG_ERROR([Could not find required gettext tools])
+ fi