dnl =======================================================
dnl FILE: ./admin/configure.in.min
dnl =======================================================

dnl    This file is part of the KDE libraries/packages
dnl    Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
 
dnl    This file is free software; you can redistribute it and/or
dnl    modify it under the terms of the GNU Library General Public
dnl    License as published by the Free Software Foundation; either
dnl    version 2 of the License, or (at your option) any later version.
 
dnl    This library is distributed in the hope that it will be useful,
dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl    Library General Public License for more details.
 
dnl    You should have received a copy of the GNU Library General Public License
dnl    along with this library; see the file COPYING.LIB.  If not, write to
dnl    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl    Boston, MA 02110-1301, USA.

# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas

dnl Process this file with autoconf to produce a configure script.

AC_INIT(acinclude.m4) dnl a source file from your sub dir

dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)

dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH

dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_SYSTEM 
dnl Perform program name transformation
AC_ARG_PROGRAM

dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(multimedia, "3.5.9") dnl searches for some needed programs

KDE_SET_PREFIX

dnl generate the config header
AM_CONFIG_HEADER(config.h) dnl at the distribution this done

dnl Checks for programs.
AC_CHECK_COMPILERS
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL

dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files
AM_KDE_WITH_NLS

KDE_USE_QT(3.3)
AC_PATH_KDE
dnl =======================================================
dnl FILE: configure.in.in
dnl =======================================================

#MIN_CONFIG(3.3)
CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"

if test "$build_arts" = "yes"; then
    AC_DEFINE(USE_ARTS, 1, [If we use arts volume])
    LIB_ARTS="-lartskde"
    AC_SUBST(LIB_ARTS)
fi

KDE_INIT_DOXYGEN([The API Reference], [Version $VERSION])

dnl =======================================================
dnl FILE: ./amarok/configure.in.in
dnl =======================================================


###############################################################################
# BEGIN PKG-CONFIG CHECK
###############################################################################

AC_ARG_VAR(PKGCONFIGFOUND, [Path to pkg-config])
AC_CHECK_PROG(PKGCONFIGFOUND, pkg-config,[yes])

###############################################################################
# END PKG-CONFIG CHECK
###############################################################################



###############################################################################
# BEGIN TAGLIB CHECK
###############################################################################

PKG_CHECK_MODULES([TAGLIB], [taglib >= 1.5], [taglib_15_found=yes], [PKG_CHECK_MODULES([TAGLIB], [taglib >= 1.4])])

AM_CONDITIONAL([TAGLIB_15_FOUND], [test "x$taglib_15_found" = "xyes"])
AC_SUBST(TAGLIB_CFLAGS)
AC_SUBST(TAGLIB_LIBS)

if test "x$taglib_15_found" = "xyes"; then
	AC_DEFINE([TAGLIB_15], 1, [Taglib 1.5 or later found, disabling duplicate metadata plugins])
fi

###############################################################################
# END TAGLIB CHECK
###############################################################################



###############################################################################
# BEGIN GSTREAMER-0.10 CHECK
###############################################################################

#AC_ARG_WITH(gstreamer10,
#    AC_HELP_STRING([--with-gstreamer10],[build Amarok with GStreamer 0.10-engine]),
#    [build_gstreamer10=$withval],
#    [build_gstreamer10=no]
#)
#
#if test "$build_gstreamer10" != "no"; then
#    if test "$PKGCONFIGFOUND" = "yes" ; then
#        # check for GStreamer
#        dnl Now we're ready to ask for gstreamer libs and cflags
#        dnl And we can also ask for the right version of gstreamer
#        have_gst10=no
#
#        GST10_MAJORMINOR=0.10
#        GST10_REQ=0.10.0
#
#        PKG_CHECK_MODULES(GST10, gstreamer-$GST10_MAJORMINOR >= $GST10_REQ gstreamer-base-$GST10_MAJORMINOR,
#            have_gst10=yes,have_gst10=no)
#
#        dnl Give error if we don't have gstreamer
#        if test "x$have_gst10" = "xno"; then
#            LIB_GST10=""
#            CFLAGS_GST10=""
#        else
#            LIB_GST10=$GST10_LIBS
#            CFLAGS_GST10=$GST10_CFLAGS
#            AC_SUBST(LIB_GST10)
#            AC_SUBST(CFLAGS_GST10)
#            AC_SUBST(GST10_MAJORMINOR)
#            AC_DEFINE(HAVE_GSTREAMER10, 1, [have GStreamer10])
#        fi
#    fi
#fi
#
#AM_CONDITIONAL(with_gst10, [test x$have_gst10 = xyes])

###############################################################################
# END GSTREAMER-0.10 CHECK
###############################################################################



###############################################################################
# BEGIN XINE CHECK
###############################################################################

AC_ARG_WITH(xine,
    AC_HELP_STRING([--without-xine],[build Amarok without xine-engine]),
    [build_xine=$withval],
    [build_xine=yes]
)

if test "$build_xine" != "no"; then
    PKG_CHECK_MODULES([XINE], [libxine >= 1.0.2], , [build_xine=no])
fi

AM_CONDITIONAL(with_xine, test x$build_xine = xyes)
AC_SUBST(XINE_CFLAGS)
AC_SUBST(XINE_LIBS)

###############################################################################
# END XINE CHECK
###############################################################################



###############################################################################
# BEGIN AKODE CHECK
###############################################################################

#AC_ARG_WITH(akode,
#    AC_HELP_STRING([--without-akode],[build Amarok without akode-engine]),
#    [build_akode=$withval],
#    [build_akode=yes]
#)
#
#if test "$build_akode" != "no"; then
#
#    AC_CHECK_PROG(AKODE_CONFIG, akode-config, yes)
#
#    if test x$AKODE_CONFIG = xyes ; then
#        AC_DEFINE(HAVE_AKODE, 1, [have aKode])
#        CFLAGS_AKODE=[`akode-config --cflags`]
#        LIBS_AKODE=[`akode-config --libs`]
#
#        akode_version=`akode-config --version`
#        akode_version=VERSION_TO_NUMBER(echo $akode_version)
#        akode_version_min="2.0.0"
#        akode_version_min=VERSION_TO_NUMBER(echo $akode_version_min)
#
#        AC_MSG_CHECKING([for akode-lib version >= 2.0])
#
#        if test $akode_version -eq $akode_version_min \
#             -o $akode_version -gt $akode_version_min; then
#
#            echo "yes"
#
#        else
#            echo "no"
#
#            build_akode=no
#        fi
#    else
#        build_akode=no
#    fi
#fi
#
#AM_CONDITIONAL(with_akode, test x$build_akode = xyes)
#AC_SUBST(CFLAGS_AKODE)
#AC_SUBST(LIBS_AKODE)

###############################################################################
# END AKODE CHECK
###############################################################################



###############################################################################
# BEGIN NMM CHECK
###############################################################################

AC_ARG_WITH(nmm,
    AC_HELP_STRING([--with-nmm],[build Amarok with NMM-engine]),
    [build_nmm=$withval],
    [build_nmm=no]
)

AC_ARG_WITH(nmm-dir,
    AC_HELP_STRING([--with-nmm-dir],[path to the NMM [default=/usr/local]]),
    [nmm_dir="$withval"],
    [nmm_dir=/usr/local]
)

if test "$build_nmm" != "no"; then

    CFLAGS_NMM="-I$nmm_dir/include"
    LDFLAGS_NMM="-L$nmm_dir/lib"
    AC_DEFINE(HAVE_NMM, 1, [have NMM])
fi

AM_CONDITIONAL(with_nmm, test x$build_nmm = xyes)
AC_SUBST(CFLAGS_NMM)
AC_SUBST(LDFLAGS_NMM)

###############################################################################
# END NMM CHECK
###############################################################################



###############################################################################
# BEGIN MAS CHECK
###############################################################################

#AC_ARG_WITH(mas,
#    AC_HELP_STRING([--with-mas],[build Amarok with MAS-engine]),
#    [build_mas=$withval],
#    [build_mas=no]
#)
#
#
#if test "$build_mas" != "no"; then
#
#    AC_PATH_PROG(MAS_CONFIG, mas-config, no)
#
#    if test $MAS_CONFIG = "no"
#    then
#        amarok_warning_mas_notfound=yes
#    echo "amarok_warning_mas_notfound: $amarok_warning_mas_notfound"
#        build_mas=no
#    else
#        AC_DEFINE(HAVE_MAS, 1, [have MAS])
#
#        CFLAGS_MAS=[`$MAS_CONFIG --cflags`]
#        LIBS_MAS=[`$MAS_CONFIG --libs`]
#
#        build_mas=yes
#    fi
#fi
#
#AM_CONDITIONAL(with_mas, test x$build_mas = xyes)
#AC_SUBST(CFLAGS_MAS)
#AC_SUBST(LIBS_MAS)

###############################################################################
# END MAS CHECK
###############################################################################



###############################################################################
# BEGIN HELIX CHECK
###############################################################################

AC_ARG_WITH(helix,
    AC_HELP_STRING([--with-helix],[build Amarok with Helix-engine]),
    [build_helix=$withval],
    [build_helix=no]
)

if test "$build_helix" != "no"; then
    AC_MSG_CHECKING([for RealPlayer or HelixPlayer])

    if test "$build_helix" = "yes"; then
        HXPLAY=`type -p hxplay`
    RPLAY=`type -p realplay`
    if test "$RPLAY" != "" -a -x "$RPLAY"; then
        HELIX_LINK=`readlink -f $RPLAY`
        HELIX_LINK=`dirname $HELIX_LINK`
        HELIX_LIBS=`unset CDPATH; cd $HELIX_LINK && pwd`
        if test -e "$HELIX_LIBS/common/clntcore.so"; then
        AC_MSG_RESULT([found RealPlayer in $HELIX_LIBS])
        build_helix=$HELIX_LIBS
        fi
    elif test "$HXPLAY" != "" -a -x "$HXPLAY"; then
        HELIX_LINK=`readlink -f $HXPLAY`
        HELIX_LINK=`dirname $HELIX_LINK`
        HELIX_LIBS=`unset CDPATH; cd $HELIX_LINK && pwd`
        if test -e "$HELIX_LIBS/common/clntcore.so"; then
        AC_MSG_RESULT([found HelixPlayer in $HELIX_LIBS])
        build_helix=$HELIX_LIBS
        fi
    fi
    else
        if test -n "$build_helix" -a -d "$build_helix"; then
          HELIX_LIBS=`unset CDPATH; cd $build_helix && pwd`
        else
          HELIX_LIBS="$build_helix"
        fi
    build_helix=$HELIX_LIBS
        AC_MSG_RESULT([using $HELIX_LIBS])
    fi

    AC_DEFINE(HAVE_HELIX, 1, [have HELIX])
    if test "$build_helix" = "yes"; then
        HELIX_LIBS="/usr/local/RealPlayer"
        AC_MSG_RESULT(["not found, using default dir"])
    fi
    AC_DEFINE_UNQUOTED(HELIX_LIBS, "${HELIX_LIBS}", [location of helix libs])
    if test "$PKGCONFIGFOUND" = "yes" ; then
    PKG_CHECK_MODULES([ALSALIB], alsa, have_alsa=yes,have_alsa=no)
    if test "$have_alsa" = "yes" ; then
        AC_DEFINE(USE_HELIX_ALSA, 1, [support ALSA in the helix-engine])
    fi
    fi
fi

AM_CONDITIONAL(with_helix, test x$build_helix != xno)

###############################################################################
# END HELIX CHECK
###############################################################################

###############################################################################
# BEGIN yauap CHECK
###############################################################################

AC_ARG_WITH(yauap,
    AC_HELP_STRING([--with-yauap],[build Amarok with yauap-engine]),
    [build_yauap=$withval],
    [build_yauap=no]
)

if test "$build_yauap" != "no"; then
    if test "$PKGCONFIGFOUND" = "yes" ; then
        # check for dbus-glib
        have_yauap=no

        PKG_CHECK_MODULES(DBUS, dbus-1,
            have_yauap=yes,have_yauap=no)


        dnl Give error if we don't have gstreamer
        if test "x$have_yauap" = "xno"; then
            LIB_YAUAP=""
            CFLAGS_YAUAP=""
        else
            LIB_YAUAP="$DBUS_LIBS -ldbus-qt-1"
            CFLAGS_YAUAP="$DBUS_CFLAGS"
            AC_SUBST(LIB_YAUAP)
            AC_SUBST(CFLAGS_YAUAP)
            AC_DEFINE(HAVE_YAUAP, 1, [have yauap])
        fi
    fi
fi

AM_CONDITIONAL(with_yauap, [test x$have_yauap = xyes])

###############################################################################
# END yauap CHECK
###############################################################################



###############################################################################
# BEGIN stdint.h CHECK
###############################################################################

AC_CHECK_HEADER(stdint.h)

###############################################################################
# END stdint.h CHECK
###############################################################################


###############################################################################
# BEGIN fabsf CHECK
###############################################################################

AC_CHECK_DECLS([fabsf],,,[#include <math.h>])
if test "$ac_cv_have_decl_fabsf" = "yes"; then
    AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
            [[#include <math.h>]],
            [[return (int)fabsf(1.f);]])],
        [AC_DEFINE(HAVE_FABSF, 1, [have fabsf])])
fi

###############################################################################
# END fabsf CHECK
###############################################################################





###############################################################################
# BEGIN INOTIFY CHECK
###############################################################################

AC_CHECK_HEADERS(linux/inotify.h)

if test x"$ac_cv_header_linux_inotify_h" = x"yes"; then
    AC_DEFINE(HAVE_INOTIFY, 1, [have inotify])
fi

###############################################################################
# END INOTIFY CHECK
###############################################################################



###############################################################################
# BEGIN QT OPENGL CHECK
###############################################################################

AC_ARG_WITH(opengl,
    AC_HELP_STRING([--without-opengl],[build Amarok without OpenGL support]),
    [build_opengl=$withval],
    [build_opengl=yes]
)

if test "$build_opengl" != "no"; then
    AC_MSG_CHECKING(for Qt with OpenGL support)
    AC_CACHE_VAL(ac_cv_kde_qt_has_opengl,
    [
    AC_LANG_SAVE
    AC_LANG_CPLUSPLUS

    save_CXXFLAGS="$CXXFLAGS"
    save_LIBS="$LIBS"
    save_LDFLAGS="$LDFLAGS"

    CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
    LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
    LIBS="$LIBS $LIBQT $KDE_MT_LIBS"

    AC_TRY_LINK([
    #include <qgl.h>
    ],
    [
    (void)new QGLWidget((QWidget*)0, "qgl");
    ],
    ac_cv_kde_qt_has_opengl=yes,
    ac_cv_kde_qt_has_opengl=no)

    CXXFLAGS="$save_CXXFLAGS"
    LIBS="$save_LIBS"
    LDFLAGS="$save_LDFLAGS"
    AC_LANG_RESTORE
    ])
    AC_MSG_RESULT($ac_cv_kde_qt_has_opengl)

    if test x$ac_cv_kde_qt_has_opengl = xyes; then
    AC_DEFINE(HAVE_QGLWIDGET, 1, [have Qt with OpenGL support])
    gl_libs="-lGL"
    else
    gl_libs=""
    fi

    AC_SUBST(gl_libs)
fi

###############################################################################
# END QT OPENGL CHECK
###############################################################################



###############################################################################
# BEGIN SQLITE CHECK
###############################################################################

LIB_SQLITE=""

AC_ARG_WITH(included-sqlite,
    AC_HELP_STRING([--without-included-sqlite],[build Amarok using system sqlite library]),
    [included_sqlite=$withval],
    [included_sqlite=yes]
)

if test x$included_sqlite = xno; then
    if test x$PKGCONFIGFOUND = xyes; then
        PKG_CHECK_MODULES(SQLITE, sqlite3 >= 3.0, have_sqlite=yes,have_sqlite=no)

        if test x$have_sqlite = xyes; then
            ## AC_DEFINE(HAVE_SQLITE, 1, [have SQLite database library])
            LIB_SQLITE=`pkg-config --libs sqlite3`
        else
            # We don't support not having sqlite anymore
            DO_NOT_COMPILE="$DO_NOT_COMPILE amarok"
            no_amarok=yes
        fi
    fi
fi

AC_SUBST(LIB_SQLITE)
AM_CONDITIONAL(with_included_sqlite, [test x$included_sqlite = xyes])


# Determine pointer size for sqlite

KDE_CHECK_TYPES
AC_DEFINE(SQLITE_PTR_SZ, SIZEOF_CHAR_P, [Determine pointer size for SQLite])

###############################################################################
# END SQLITE CHECK
###############################################################################



###############################################################################
# BEGIN MYSQL CHECK
###############################################################################

AC_ARG_ENABLE(mysql,
    AC_HELP_STRING([--enable-mysql],[build Amarok with MySQL support]),
    [enable_mysql=$enableval],
    [enable_mysql=no]
)

if test "$enable_mysql" = "yes"; then

    AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, yes)

    if test x$MYSQL_CONFIG = xyes; then
        AC_DEFINE(USE_MYSQL, 1, [MySql database support enabled])

        mysql_includes=`mysql_config --cflags`
        mysql_libs=`mysql_config --libs`
    else
        amarok_warning_mysql_notfound=yes
        enable_mysql=no
    fi

fi

AM_CONDITIONAL(enable_mysql, test x$enable_mysql = xyes)
AC_SUBST(mysql_includes)
AC_SUBST(mysql_libs)

###############################################################################
# END MYSQL CHECK
###############################################################################



###############################################################################
# BEGIN POSTGRESQL CHECK
###############################################################################

AC_ARG_ENABLE(postgresql,
    AC_HELP_STRING([--enable-postgresql],[build Amarok with PostgreSQL support]),
    [enable_postgresql=$enableval],
    [enable_postgresql=no]
)

if test "$enable_postgresql" = "yes"; then

    AC_CHECK_PROG(POSTGRESQL_CONFIG, pg_config, yes)

    if test x$POSTGRESQL_CONFIG = xyes; then
        AC_DEFINE(USE_POSTGRESQL, 1, [Postgresql database support enabled])

        postgresql_includes=-I`pg_config --includedir`
        postgresql_libs="-L`pg_config --libdir` -lpq"
    else
        amarok_warning_postgresql_notfound=yes
        enable_postgresql=no
    fi

fi

AM_CONDITIONAL(enable_postgresql, test x$enable_postgresql = xyes)
AC_SUBST(postgresql_includes)
AC_SUBST(postgresql_libs)

###############################################################################
# END POSTGRESQL CHECK
###############################################################################



###############################################################################
# BEGIN LIBVISUAL CHECK
###############################################################################

AC_ARG_WITH(libvisual,
    AC_HELP_STRING([--without-libvisual],[build Amarok without libvisual support]),
    [with_libvisual=$withval],
    [with_libvisual=yes]
)

if test "$with_libvisual" = "yes"; then
    ## libvisual plugin depends on sdl
    AC_CHECK_PROG(SDL_CONFIG, sdl-config, yes)

    if test x$SDL_CONFIG = xyes; then
        sdl_cflags=`sdl-config --cflags`
        sdl_libs=`sdl-config --libs`
    fi

    AC_SUBST(sdl_cflags)
    AC_SUBST(sdl_libs)

    if test x$PKGCONFIGFOUND = xyes -a x$SDL_CONFIG = xyes; then

        PKG_CHECK_MODULES(LIBVISUAL, libvisual-0.4 >= 0.4.0, [build_libvisual="yes"], [build_libvisual="no"])

        AC_SUBST(LIBVISUAL_LIBS)
        AC_SUBST(LIBVISUAL_CFLAGS)

        if test x$build_libvisual = xyes; then
            AC_DEFINE(HAVE_LIBVISUAL, 1, [have LIBVISUAL])
        fi
    fi
fi

AM_CONDITIONAL(with_libvisual, test x$build_libvisual = xyes)

###############################################################################
# END LIBVISUAL CHECK
###############################################################################



###############################################################################
# BEGIN TUNEPIMP CHECK
###############################################################################

AC_ARG_WITH(musicbrainz,
    AC_HELP_STRING([--without-musicbrainz],[build Amarok without MusicBrainz support]),
    [with_musicbrainz=$withval],
    [with_musicbrainz=yes]
)

if test "$with_musicbrainz" = "yes"; then
    AC_CHECK_HEADER(tunepimp-0.5/tp_c.h, [build_musicbrainz="yes"],
      [AC_CHECK_HEADER(tunepimp/tp_c.h, [build_musicbrainz="yes"],
        [build_musicbrainz="no"])])
fi

if test "$build_musicbrainz" = "yes"; then
    AC_CHECK_LIB(tunepimp, tr_GetPUID,
      AC_DEFINE(HAVE_TUNEPIMP, 5, [have MusicBrainz 0.5.x]),
        AC_CHECK_LIB(tunepimp, tp_SetFileNameEncoding,
        AC_DEFINE(HAVE_TUNEPIMP, 4, [have MusicBrainz 0.4.x]),
        AC_DEFINE(HAVE_TUNEPIMP, 1, [have MusicBrainz])))
    LIB_TUNEPIMP="-ltunepimp"
    have_tunepimp=yes
else
    AC_DEFINE(HAVE_TUNEPIMP, 0, [have TunePimp])
    LIB_TUNEPIMP=""
    have_tunepimp=no
fi

AC_SUBST(LIB_TUNEPIMP)

###############################################################################
# END TUNEPIMP CHECK
###############################################################################



###############################################################################
# BEGIN AMAZON CHECK
###############################################################################

AC_ARG_ENABLE(amazon,
    AC_HELP_STRING([--disable-amazon],[disable Amazon cover download support [default=enable]]),
    [enable_amazon=$enableval],
    [enable_amazon=yes]
)

if test "$enable_amazon" != "no"; then
    AC_DEFINE(AMAZON_SUPPORT, 1, [Amazon cover download support enabled])
fi

###############################################################################
# END AMAZON CHECK
###############################################################################



###############################################################################
# BEGIN SCHED_SETAFFINITY BUGGY GLIBC CHECK
###############################################################################

AC_MSG_CHECKING([if sched_setaffinity should be enabled])

AC_LANG_SAVE
AC_LANG_CPLUSPLUS

amarok_glibcsched_works=no

AC_TRY_COMPILE([
    #include <sched.h>
],
[
    cpu_set_t mask;
    CPU_ZERO( &mask );
    CPU_SET( 0, &mask );
    sched_setaffinity( 0, sizeof(mask), &mask );
],
    amarok_sched_3params=yes,
    amarok_sched_3params=no
)

if test "x$amarok_sched_3params" = "xyes"; then
    AC_DEFINE(SCHEDAFFINITY_SUPPORT, 1, [sched_setaffinity works correctly])
    AC_DEFINE(SCHEDAFFINITY_3PARAMS, 1, [sched_setaffinity takes three params])
    amarok_glibcsched_works=yes
fi

if test "x$amarok_sched_3params" = "xno"; then
    AC_TRY_COMPILE([
    #include <sched.h>
    ],
    [
        cpu_set_t mask;
        CPU_ZERO( &mask );
        CPU_SET( 0, &mask );
        sched_setaffinity( 0, &mask );
    ],
        amarok_sched_2params=yes,
        amarok_sched_2params=no
    )
    if test "x$amarok_sched_2params" = "xyes"; then
        AC_DEFINE(SCHEDAFFINITY_SUPPORT, 1, [sched_setaffinity works correctly])
        amarok_glibcsched_works=yes
    fi
fi

AC_LANG_RESTORE

AC_MSG_RESULT($amarok_glibcsched_works)

###############################################################################
# END SCHED_SETAFFINITY BUGGY GLIBC CHECK
###############################################################################



###############################################################################
# BEGIN KDEBASE CHECK
###############################################################################

KDE_CHECK_HEADER(konqsidebarplugin.h, have_konqsidebar=yes, have_konqsidebar=no)
KDE_CHECK_LIB(konqsidebarplugin, _init, have_konqsidebar=$have_konqsidebar, have_konqsidebar=no)

AM_CONDITIONAL(with_konqsidebar, [test x$have_konqsidebar = xyes])

###############################################################################
# END KDEBASE CHECK
###############################################################################



###############################################################################
# BEGIN NJB CHECK
###############################################################################
### mediabrowser.cpp can use libnjb if available

AC_ARG_WITH(libnjb,
    AC_HELP_STRING([--with-libnjb],[build Amarok with Nomad Jukebox support from libnjb]),
    [build_libnjb=$withval],
    [build_libnjb=yes]
)

if test "$build_libnjb" != "no"; then
    if test "$PKGCONFIGFOUND" = "yes" ; then

        # check for libnjb
        have_libnjb=no

        PKG_CHECK_MODULES(LIBNJB, libnjb, have_libnjb=yes,have_libnjb=no)
        if test "x$have_libnjb" != "xno"; then
            AC_DEFINE(HAVE_LIBNJB, 1, [have libnjb])
        fi
    fi
fi

AM_CONDITIONAL(with_libnjb, [test x$have_libnjb = xyes])

###############################################################################
# END NJB CHECK
###############################################################################



###############################################################################
# BEGIN MTP CHECK
###############################################################################
### mediabrowser.cpp can use libmtp if available

AC_ARG_WITH(libmtp,
    AC_HELP_STRING([--with-libmtp],[build Amarok with support for MTP devices]),
    [build_libmtp=$withval],
    [build_libmtp=yes]
)
if test "$build_libmtp" != "no"; then
    if test "$PKGCONFIGFOUND" = "yes" ; then
        PKG_CHECK_MODULES(LIBMTP, libmtp >= 0.1.1,
        [
            have_libmtp=yes
        ],
        [
            have_libmtp=no
        ])
    fi

    if test "x$have_libmtp" != "xno"; then
        AC_DEFINE(HAVE_LIBMTP, 1, [have libmtp])
    fi
fi

AM_CONDITIONAL(with_libmtp, [test x$have_libmtp = xyes])

###############################################################################
# END MTP CHECK
###############################################################################

###############################################################################
# BEGIN RIO KARMA CHECK
###############################################################################
### mediabrowser.cpp can use libkarma if available

AC_ARG_WITH(libkarma,
    AC_HELP_STRING([--with-libkarma],[build Amarok with Rio Karma support]),
    [build_libkarma=$withval],
    [build_libkarma=yes]
)

if test "$build_libkarma" != "no"; then
    AC_CHECK_HEADERS([libkarma/lkarma.h], [have_libkarma=yes], [], [])
    AC_CHECK_HEADERS([usb.h], [have_usb=yes], [], [])

    if test "$have_libkarma" = "yes"; then
        AC_DEFINE(HAVE_LIBKARMA, 1, [have libkarma])
    else
        AC_MSG_RESULT($have_libkarma)
        have_libkarma=no
    fi
fi

AM_CONDITIONAL(with_libkarma, [test x$have_libkarma = xyes])

###############################################################################
# END RIO KARMA CHECK
###############################################################################

###############################################################################
# BEGIN IFP CHECK
###############################################################################
### mediabrowser.cpp can use libifp if available

AC_ARG_WITH(ifp,
    AC_HELP_STRING([--with-ifp],[build Amarok with ifp support]),
    [build_ifp=$withval],
    [build_ifp=yes]
)

if test "$build_ifp" != "no"; then

    AC_CHECK_HEADERS([ifp.h], [have_ifp=yes], [], [])
    AC_CHECK_HEADERS([usb.h], [have_usb=yes], [], [])

    if test "$have_ifp" = "yes"; then
        AC_DEFINE(HAVE_IFP, 1, [have ifp])
        IFP_LIBS="-lifp -lusb"
    else
        AC_MSG_RESULT($have_ifp)
        have_ifp=no
    fi

fi

AC_SUBST(IFP_INCLUDES)
AC_SUBST(IFP_LIBS)

AM_CONDITIONAL(with_ifp, [test x$have_ifp = xyes])

###############################################################################
# END IFP CHECK
###############################################################################



###############################################################################
# BEGIN LIBGPOD CHECK
###############################################################################

AC_ARG_WITH(libgpod,
    AC_HELP_STRING([--with-libgpod],[build Amarok with iPod support from libgpod]),
    [build_libgpod=$withval],
    [build_libgpod=yes]
)

if test "$build_libgpod" != "no"; then
    if test "$PKGCONFIGFOUND" = "yes" ; then

        # check for libgpod
        have_libgpod=no

        PKG_CHECK_MODULES(LIBGPOD, libgpod-1.0, have_libgpod=yes,have_libgpod=no)

        if test "x$have_libgpod" = "xyes"; then
            ac_cppflags_save=$CPPFLAGS
            ac_cflags_save=$CFLAGS
            ac_libs_save=$LIBS
            CPPFLAGS="$CPPFLAGS $LIBGPOD_INCLUDES"
            CFLAGS="$CFLAGS $LIBGPOD_CFLAGS"
            LIBS="$LIBS $LIBGPOD_LIBS"

            AC_CHECK_FUNCS(itdb_track_set_thumbnails, , have_libgpod_042=no)
            AC_CHECK_FUNCS(itdb_get_mountpoint, , have_libgpod_042=no)
            AC_CHECK_FUNCS(itdb_device_get_ipod_info, , have_libgpod_042=no)

            AC_CHECK_MEMBER(struct _Itdb_Track.movie_flag,
                  [AC_DEFINE(HAVE_ITDB_MOVIE_FLAG, 1, [have libgpod movie flag])],
                  have_libgpod_042=no,
                  [#include <gpod/itdb.h>])

            AC_CHECK_MEMBER(struct _Itdb_Track.skip_when_shuffling,
                  [AC_DEFINE(HAVE_ITDB_SKIP_SHUFFLE_FLAG, 1, [have libgpod skip when shuffling flag])],
                  have_libgpod_042=no,
                  [#include <gpod/itdb.h>])

            AC_CHECK_MEMBER(struct _Itdb_Track.mark_unplayed,
                  [AC_DEFINE(HAVE_ITDB_MARK_UNPLAYED, 1, [have libgpod mark played flag])],
                  have_libgpod_042=no,
                  [#include <gpod/itdb.h>])

            AC_CHECK_MEMBER(struct _Itdb_Track.mediatype,
                  [AC_DEFINE(HAVE_ITDB_MEDIATYPE, 1, [have libgpod mediatype flag])],
                  have_libgpod_042=no,
                  [#include <gpod/itdb.h>])

            AC_CHECK_DECL(ITDB_IPOD_MODEL_TOUCH_BLACK,
                  [AC_DEFINE(HAVE_LIBGPOD_060, 1, [have at least libgpod 0.6.0])],
                  have_libgpod_060=no,
                  [#include <gpod/itdb.h>])

            CPPFLAGS=$ac_cppflags_save
            CFLAGS=$ac_cflags_save
            LIBS=$ac_libs_save
        fi

        if test "x$have_libgpod_042" = "xno"; then
            have_libgpod=no
            AC_MSG_RESULT(Your libgpod version is too old: at least 0.4.2 is required)
        fi

        if test "x$have_libgpod" != "xno"; then
            AC_DEFINE(HAVE_LIBGPOD, 1, [have libgpod])
        fi
    fi
fi

AM_CONDITIONAL(with_libgpod, [test x$have_libgpod = xyes])

###############################################################################
# END LIBGPOD CHECK
###############################################################################



###############################################################################
# BEGIN statvfs(2) CHECK
###############################################################################

AC_CHECK_FUNCS(statvfs)

###############################################################################
# END statvfs(2) CHECK
###############################################################################



###############################################################################
# BEGIN MP4V2 CHECK
###############################################################################
# m4a/aac tag reading and writing needs libmp4v2 from faad2 or better mpeg4ip

AC_ARG_WITH(mp4v2,
    AC_HELP_STRING([--with-mp4v2],[build Amarok with M4A/AAC tag support from mp4v2/faad2]),
    [have_mp4v2=$withval],
    [have_mp4v2=no]
)

AC_ARG_WITH(mp4v2-dir,
    AC_HELP_STRING([--with-mp4v2-dir],[path to mp4v2  [default=/usr]]),
    [mp4v2_dir="$withval"],
    [mp4v2_dir=/usr]
)

if test "$have_mp4v2" != "no"; then
    AC_LANG_SAVE
    AC_LANG_CPLUSPLUS
    ac_cxxflags_save=$CXXFLAGS
    CXXFLAGS="$CXXFLAGS -I$mp4v2_dir/include"
    ac_ldflags_save=$LDFLAGS
    LDFLAGS="$LDFLAGS -L$mp4v2_dir/lib"

    # not even everyone using faad2 has <systems.h>
    if ! test -f config.h; then
        echo "#include \"confdefs.h\"" > config.h
    fi
    ac_cppflags_save=$CPPFLAGS
    CPPFLAGS="$CPPFLAGS -I."
    AC_CHECK_HEADERS(systems.h)
    AC_CHECK_HEADERS([mp4.h], [have_mp4_h=yes], [],
        [#ifdef HAVE_SYSTEMS_H
         # include <systems.h>
         #endif
        ])

    AC_CHECK_LIB( mp4v2, MP4Read, have_mp4v2=yes, have_mp4v2=no )

    if test "$have_mp4v2" = "yes" -a "$have_mp4_h" = "yes"; then
        AC_DEFINE(HAVE_MP4V2, 1, [have mp4v2])
        MP4V2_INCLUDES="-I$mp4v2_dir/include"
        MP4V2_LIBS="-L$mp4v2_dir/lib -lmp4v2"
    else
        have_mp4v2=no
    fi

    CPPFLAGS=$ac_cppflags_save
    CXXFLAGS=$ac_cxxflags_save
    LDFLAGS=$ac_ldflags_save
    AC_LANG_RESTORE
fi

AC_SUBST(MP4V2_INCLUDES)
AC_SUBST(MP4V2_LIBS)

AM_CONDITIONAL(with_mp4v2, [test x$have_mp4v2 != xno ])

###############################################################################
# END MP4V2 CHECK
###############################################################################



###############################################################################
# BEGIN DAAP KDE 3.4 CHECK
###############################################################################

daapsave_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $all_includes"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS

AC_MSG_CHECKING([if KDE is at least 3.4 for DAAP support])
AC_COMPILE_IFELSE([
#include <kdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 4, 0 ) )
#error KDE 3.4
#endif
],
    have_trinity4="yes"
    DNSSD_LIBS=$LIB_KDNSSD
#    echo "yes"
,
    have_trinity4="no"
    DNSSD_LIBS=""
#    echo "no"
)
CXXFLAGS="$daapsave_CXXFLAGS"
AC_LANG_RESTORE
AC_SUBST(DNSSD_LIBS)
AM_CONDITIONAL(atleast_trinity4, [test x$have_trinity4 != xno ])
AC_MSG_RESULT($have_trinity4)

###############################################################################
# END DAAP KDE 3.4 CHECK
###############################################################################



###############################################################################
# BEGIN OPTIONAL DAAP SUPPORT
###############################################################################

AC_ARG_WITH(daap,
    AC_HELP_STRING([--without-daap],[build Amarok without support for DAAP]),
    [have_daap=$withval],
    [have_daap=yes]
)

AM_CONDITIONAL(with_daap, [test x$have_daap = xyes])

###############################################################################
# END OPTIONAL DAAP SUPPORT
###############################################################################



###############################################################################
# BEGIN DAAP TYPE CHECKS
###############################################################################

AC_CHECK_TYPES([uint8_t, u_int8_t, uint16_t, u_int16_t, uint32_t, u_int32_t, uint64_t, u_int64_t])

###############################################################################
# END DAAP TYPE CHECKS
###############################################################################



###############################################################################
# BEGIN DAAP MONGREL RUBY VARIABLE
###############################################################################

AC_PATH_PROG(RUBY, ruby, no)

ruby_includes=[`$RUBY -rrbconfig -e 'puts Config.expand( Config::MAKEFILE_CONFIG["archdir"] )'`]
ruby_ldflags=[`$RUBY -rrbconfig -e 'puts Config.expand( Config::MAKEFILE_CONFIG["LIBRUBYARG_SHARED"] )'`]

AC_SUBST(ruby_includes)
AC_SUBST(ruby_ldflags)
OLDCFLAGS="$CFLAGS"
CFLAGS="-I$ruby_includes -Wall"
OLDCPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I$ruby_includes" #no I don't know why CPPFLAGS is used
AC_CHECK_HEADERS([ruby.h], [have_ruby_h=yes], [have_ruby_h=no]) #used in ruby check below
CFLAGS="$OLDCFLAGS"
CPPFLAGS="$OLDCPPFLAGS"

###############################################################################
# END DAAP MONGREL RUBY VARIABLE
###############################################################################



###############################################################################
# BEGIN RUBY CHECK
###############################################################################
## TODO: Check version number >= 1.8

if test "x$RUBY" = "xno" -o "x$have_ruby_h" = "xno"; then
    amarok_error_noruby=yes
    DO_NOT_COMPILE="$DO_NOT_COMPILE amarok"
    no_amarok=yes
fi

###############################################################################
# END RUBY CHECK
###############################################################################


###############################################################################
# BEGIN DO_NOT_COMPILE CHECK
###############################################################################

if test x$build_xine = xno -a x$build_helix = xno; then

    DO_NOT_COMPILE="$DO_NOT_COMPILE amarok"
    no_engine=yes

fi

###############################################################################
# END DO_NOT_COMPILE CHECK
###############################################################################

KDE_CREATE_SUBDIRSLIST
AM_CONDITIONAL(amarok_SUBDIR_included, test "x$amarok_SUBDIR_included" = xyes)
AM_CONDITIONAL(doc_SUBDIR_included, test "x$doc_SUBDIR_included" = xyes)
AM_CONDITIONAL(po_SUBDIR_included, test "x$po_SUBDIR_included" = xyes)
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ amarok/Makefile ])
AC_CONFIG_FILES([ amarok/src/Makefile ])
AC_CONFIG_FILES([ amarok/src/amarokcore/Makefile ])
AC_CONFIG_FILES([ amarok/src/analyzers/Makefile ])
AC_CONFIG_FILES([ amarok/src/collectionscanner/Makefile ])
AC_CONFIG_FILES([ amarok/src/data/Makefile ])
AC_CONFIG_FILES([ amarok/src/device/Makefile ])
AC_CONFIG_FILES([ amarok/src/device/massstorage/Makefile ])
AC_CONFIG_FILES([ amarok/src/device/nfs/Makefile ])
AC_CONFIG_FILES([ amarok/src/device/smb/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/akode/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/helix/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/helix/config/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/helix/helix-sp/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/kdemm/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/mas/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/nmm/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/nmm/icons/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/void/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/xine/Makefile ])
AC_CONFIG_FILES([ amarok/src/engine/yauap/Makefile ])
AC_CONFIG_FILES([ amarok/src/images/Makefile ])
AC_CONFIG_FILES([ amarok/src/images/icons/Makefile ])
AC_CONFIG_FILES([ amarok/src/konquisidebar/Makefile ])
AC_CONFIG_FILES([ amarok/src/loader/Makefile ])
AC_CONFIG_FILES([ amarok/src/magnatunebrowser/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/daap/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/daap/daapreader/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/daap/daapreader/authentication/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/daap/mongrel/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/daap/mongrel/http11/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/daap/mongrel/lib/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/daap/mongrel/lib/mongrel/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/daap/mongrel/lib/rbconfig/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/daap/mongrel/lib/rubygems/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/generic/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/ifp/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/ipod/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/mtp/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/njb/Makefile ])
AC_CONFIG_FILES([ amarok/src/mediadevice/riokarma/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/aac/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/asf/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/audible/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/m4a/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/mp4/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/rmff/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/speex/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/trueaudio/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/wav/Makefile ])
AC_CONFIG_FILES([ amarok/src/metadata/wavpack/Makefile ])
AC_CONFIG_FILES([ amarok/src/plugin/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/common/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/graphequalizer/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/lyrics_astraweb/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/lyrics_lyrc/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/playlist2html/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/ruby_debug/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/score_default/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/score_impulsive/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/templates/Makefile ])
AC_CONFIG_FILES([ amarok/src/scripts/webcontrol/Makefile ])
AC_CONFIG_FILES([ amarok/src/sqlite/Makefile ])
AC_CONFIG_FILES([ amarok/src/statusbar/Makefile ])
AC_CONFIG_FILES([ amarok/src/themes/Makefile ])
AC_CONFIG_FILES([ amarok/src/themes/example/Makefile ])
AC_CONFIG_FILES([ amarok/src/themes/reinhardt/Makefile ])
AC_CONFIG_FILES([ amarok/src/themes/reinhardt/images/Makefile ])
AC_CONFIG_FILES([ amarok/src/vis/Makefile ])
AC_CONFIG_FILES([ amarok/src/vis/libvisual/Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ doc/amarok/Makefile ])
AC_CONFIG_FILES([ doc/da/Makefile ])
AC_CONFIG_FILES([ doc/de/Makefile ])
AC_CONFIG_FILES([ doc/es/Makefile ])
AC_CONFIG_FILES([ doc/et/Makefile ])
AC_CONFIG_FILES([ doc/fr/Makefile ])
AC_CONFIG_FILES([ doc/it/Makefile ])
AC_CONFIG_FILES([ doc/nl/Makefile ])
AC_CONFIG_FILES([ doc/pl/Makefile ])
AC_CONFIG_FILES([ doc/pt/Makefile ])
AC_CONFIG_FILES([ doc/pt_BR/Makefile ])
AC_CONFIG_FILES([ doc/ru/Makefile ])
AC_CONFIG_FILES([ doc/sv/Makefile ])
AC_CONFIG_FILES([ po/Makefile ])
AC_CONFIG_FILES([ po/af/Makefile ])
AC_CONFIG_FILES([ po/ar/Makefile ])
AC_CONFIG_FILES([ po/az/Makefile ])
AC_CONFIG_FILES([ po/be/Makefile ])
AC_CONFIG_FILES([ po/bg/Makefile ])
AC_CONFIG_FILES([ po/bn/Makefile ])
AC_CONFIG_FILES([ po/br/Makefile ])
AC_CONFIG_FILES([ po/ca/Makefile ])
AC_CONFIG_FILES([ po/cs/Makefile ])
AC_CONFIG_FILES([ po/cy/Makefile ])
AC_CONFIG_FILES([ po/da/Makefile ])
AC_CONFIG_FILES([ po/de/Makefile ])
AC_CONFIG_FILES([ po/el/Makefile ])
AC_CONFIG_FILES([ po/en_GB/Makefile ])
AC_CONFIG_FILES([ po/eo/Makefile ])
AC_CONFIG_FILES([ po/es/Makefile ])
AC_CONFIG_FILES([ po/et/Makefile ])
AC_CONFIG_FILES([ po/eu/Makefile ])
AC_CONFIG_FILES([ po/fa/Makefile ])
AC_CONFIG_FILES([ po/fi/Makefile ])
AC_CONFIG_FILES([ po/fr/Makefile ])
AC_CONFIG_FILES([ po/ga/Makefile ])
AC_CONFIG_FILES([ po/gl/Makefile ])
AC_CONFIG_FILES([ po/he/Makefile ])
AC_CONFIG_FILES([ po/hi/Makefile ])
AC_CONFIG_FILES([ po/hu/Makefile ])
AC_CONFIG_FILES([ po/id/Makefile ])
AC_CONFIG_FILES([ po/is/Makefile ])
AC_CONFIG_FILES([ po/it/Makefile ])
AC_CONFIG_FILES([ po/ja/Makefile ])
AC_CONFIG_FILES([ po/ka/Makefile ])
AC_CONFIG_FILES([ po/km/Makefile ])
AC_CONFIG_FILES([ po/ko/Makefile ])
AC_CONFIG_FILES([ po/ku/Makefile ])
AC_CONFIG_FILES([ po/lo/Makefile ])
AC_CONFIG_FILES([ po/lt/Makefile ])
AC_CONFIG_FILES([ po/mk/Makefile ])
AC_CONFIG_FILES([ po/ms/Makefile ])
AC_CONFIG_FILES([ po/nb/Makefile ])
AC_CONFIG_FILES([ po/nds/Makefile ])
AC_CONFIG_FILES([ po/ne/Makefile ])
AC_CONFIG_FILES([ po/nl/Makefile ])
AC_CONFIG_FILES([ po/nn/Makefile ])
AC_CONFIG_FILES([ po/pa/Makefile ])
AC_CONFIG_FILES([ po/pl/Makefile ])
AC_CONFIG_FILES([ po/pt/Makefile ])
AC_CONFIG_FILES([ po/pt_BR/Makefile ])
AC_CONFIG_FILES([ po/ro/Makefile ])
AC_CONFIG_FILES([ po/ru/Makefile ])
AC_CONFIG_FILES([ po/rw/Makefile ])
AC_CONFIG_FILES([ po/se/Makefile ])
AC_CONFIG_FILES([ po/sk/Makefile ])
AC_CONFIG_FILES([ po/sl/Makefile ])
AC_CONFIG_FILES([ po/sq/Makefile ])
AC_CONFIG_FILES([ po/sr/Makefile ])
AC_CONFIG_FILES([ po/sr@Latn/Makefile ])
AC_CONFIG_FILES([ po/ss/Makefile ])
AC_CONFIG_FILES([ po/sv/Makefile ])
AC_CONFIG_FILES([ po/ta/Makefile ])
AC_CONFIG_FILES([ po/tg/Makefile ])
AC_CONFIG_FILES([ po/th/Makefile ])
AC_CONFIG_FILES([ po/tr/Makefile ])
AC_CONFIG_FILES([ po/uk/Makefile ])
AC_CONFIG_FILES([ po/uz/Makefile ])
AC_CONFIG_FILES([ po/uz@cyrillic/Makefile ])
AC_CONFIG_FILES([ po/zh_CN/Makefile ])
AC_CONFIG_FILES([ po/zh_TW/Makefile ])
AC_OUTPUT
# configure.in.bot
# This file is used for printing important messages at the end of configure

echo ""

if test x$amarok_error_notaglib = xyes; then
    echo " ========================"
    echo " ===  Amarok - ERROR  =========================================================="
    echo " ========================"
    echo " ="
    echo " = Amarok cannot be built because, either the TagLib library is not installed,"
    echo " = or if relevant, the taglib-devel package is not installed."
    echo " = TagLib can be obtained from: http://ktown.kde.org/~wheeler/taglib/"
    echo " ="
fi

if test x$amarok_error_taglibold = xyes; then
    echo " ========================"
    echo " ===  Amarok - ERROR  =========================================================="
    echo " ========================"
    echo " ="
    echo " = Amarok cannot be built because your TagLib version is too old. Please obtain"
    echo " = the version $TAGLIB_REQ_VERSION from:"
    echo " = http://ktown.kde.org/~wheeler/taglib/"
    echo " ="
fi

if test x$amarok_error_noruby = xyes; then
    echo " =========================="
    echo " ===  Amarok - ERROR  =========================================================="
    echo " =========================="
    echo " ="
    echo " = The Ruby programming language is not installed. Please obtain Ruby"
    echo " = (version 1.8 or later) from http://ruby-lang.org, or install a distribution"
    echo " = package. To build Amarok requires the Ruby header files as well, which some"
    echo " = distributions package separately."
    echo " ="
fi

if test x$amarok_warning_xineold = xyes; then
    echo " =========================="
    echo " ===  Amarok - WARNING  ========================================================"
    echo " =========================="
    echo " ="
    echo " = Amarok requires xine-lib version: 1.0-rc4"
    echo " = Amarok will still be built, but you must use another sound-engine."
    echo " ="
fi

if test x$PKGCONFIGFOUND != xyes; then
    echo " =========================="
    echo " ===  Amarok - WARNING  ========================================================"
    echo " =========================="
    echo " ="
    echo " = pkg-config could not be found, this means some optional components (eg the"
    echo " = GStreamer-engine) cannot be built."
    echo " = See README for help with this issue."
    echo " ="
fi

#if test x$amarok_warning_mas_notfound = xyes; then
#    echo " =========================="
#    echo " ===  Amarok - WARNING  ========================================================"
#    echo " =========================="
#    echo " ="
#    echo " = mas-config could not be found, this means that MAS-engine"
#    echo " = cannot be built."
#    echo " ="
#fi

if test x$build_xine = xno; then
    echo " =========================="
    echo " ===  Amarok - WARNING  ========================================================"
    echo " =========================="
    echo " ="
    echo " = The recommended xine-engine will not be built. If you want to use the"
    echo " = powerful xine multimedia framework with Amarok, please download xine-lib"
    echo " = version $xine_version_min or higher from http://xinehq.de/"
    echo " ="
fi

if test x$have_gst_plugins = xno -a x$have_gst = xyes; then
    echo " =========================="
    echo " ===  Amarok - WARNING  ========================================================"
    echo " =========================="
    echo " ="
    echo " = No GStreamer plugins were detected!"
    echo " = Without plugins you will not be able to play any media using the"
    echo " = GStreamer-engine! You need at least the MP3 plugin and a sink plugin, (eg."
    echo " = ALSAsink). Please refer to http://gstreamer.freedesktop.org/"
    echo " = NOTE: you will still be able to play media with another engine plugin."
    echo " ="
fi

if test x$included_sqlite = xno; then
  if test x$have_sqlite = xyes; then
    echo " =========================="
    echo " ===  Amarok - WARNING  ========================================================"
    echo " =========================="
    echo " ="
    echo " = You have passed the --without-included-sqlite option to configure, which"
    echo " = means that SQLite will be dynamically linked instead of statically linked."
    echo " = IMPORTANT: you must ensure the libsqlite.so library in your system is"
    echo " = threadsafe!!! Amarok will not be stable otherwise."
    echo " ="
  else
    echo " ========================"
    echo " ===  Amarok - ERROR  =========================================================="
    echo " ========================"
    echo " ="
    echo " = You have passed the --without-included-sqlite option to configure, but"
    echo " = the development files for SQLite could not be found. Please make sure you"
    echo " = have the relevant package installed or, even better, use the included"
    echo " = sqlite (unless you *really* know what you're doing, of course)."
    echo " ="
  fi
fi

if test x$amarok_warning_mysql_notfound = xyes; then
    echo " =========================="
    echo " ===  Amarok - WARNING  ========================================================"
    echo " =========================="
    echo " ="
    echo " = mysql_config could not be found, this means that support for MySql"
    echo " = will be disabled."
    echo " ="
fi

if test x$amarok_warning_postgresql_notfound = xyes; then
    echo " =========================="
    echo " ===  Amarok - WARNING  ========================================================"
    echo " =========================="
    echo " ="
    echo " = pg_config could not be found, this means that support for Postgresql"
    echo " = will be disabled."
    echo " ="
fi

if test x$no_engine = xyes; then
    all_tests=bad
    echo " =================================="
    echo " ===  AMAROK WILL NOT BE BUILT  ================================================"
    echo " =================================="
    echo " ="
    echo " = No suitable multimedia framework was detected. You need to install at least"
    echo " = the Xine or Helix framework as detailed in the Amarok README."
    echo " ="
fi

if test x$no_amarok = xyes; then
    all_tests=bad
    echo " =================================="
    echo " ===  AMAROK WILL NOT BE BUILT  ================================================"
    echo " =================================="
    echo " ="
    echo " = Some mandatory dependencies are either not installed or not installed"
    echo " = correctly. See the Amarok README for help with this issue. Further assistance"
    echo " = can be found at http://amarok.kde.org or in amarok on irc.freenode.net."
    echo " = You will still be able to build other modules from extragear/multimedia."
    echo " ="

else

    echo " =========================="
    echo " ===  Amarok - PLUGINS  ========================================================"
    echo " =========================="


    echo " ="
    echo " = The following extra functionality will NOT be included:"


#    if test x$build_akode != xyes; then
#        echo " =   - aKode-engine"
#    fi

#    if test x$have_gst10 != xyes; then
#        echo " =   - GStreamer0.10-engine"
#    fi

    if test x$build_xine != xyes; then
        echo " =   - xine-engine"
    fi

    if test x$build_nmm != xyes; then
        echo " =   - NMM-engine"
    fi

#    if test x$build_mas != xyes; then
#        echo " =   - MAS-engine"
#    fi

    if test x$build_helix = xno; then
        echo " =   - Helix-engine"
    fi

    if test x$build_yauap = xno; then
        echo " =   - yauap-engine"
    fi

    if test x$build_libvisual != xyes; then
        echo " =   - libvisual Support"
    fi

    if test x$enable_mysql != xyes; then
        echo " =   - MySql Support"
    fi

    if test x$enable_postgresql != xyes; then
        echo " =   - Postgresql Support"
    fi

    if test x$have_konqsidebar != xyes; then
        echo " =   - Konqueror Sidebar"
    fi

    if test x$have_tunepimp != xyes; then
        echo " =   - MusicBrainz Support"
    fi

    if test x$have_mp4v2 != xyes; then
        echo " =   - MP4/AAC Tag Write Support"
    fi

    if test x$have_libgpod != xyes; then
        if test x$have_libgpod_042 != xno; then
            echo " =   - iPod Support"
        else
            echo " =   - iPod Support (at least libgpod 0.4.2 is required)"
        fi
    fi

    if test x$have_ifp != xyes; then
        echo " =   - iRiver iFP Support"
    fi

    if test x$have_libnjb != xyes; then
        echo " =   - Creative Nomad Jukebox Support"
    fi

    if test x$have_libmtp != xyes; then
        echo " =   - MTP Device Support"
    fi

    if test x$have_libkarma != xyes; then
        echo " =   - Rio Karma Support"
    fi

    if test x$have_daap != xyes; then
        echo " =   - DAAP Music Sharing Support"
    fi
    
    echo " ="
    echo " = The following extra functionality will be included:"


#    if test x$build_akode = xyes; then
#        echo " =   + aKode-engine"
#    fi

#    if test x$have_gst10 = xyes; then
#        echo " =   + GStreamer0.10-engine"
#    fi

    if test x$build_xine = xyes; then
        echo " =   + xine-engine"
    fi

    if test x$build_nmm = xyes; then
        echo " =   + NMM-engine"
    fi

#    if test x$build_mas = xyes; then
#        echo " =   + MAS-engine"
#    fi

    if test x$build_helix != xno; then
        echo " =   + Helix-engine"
    fi

    if test x$build_yauap != xno; then
        echo " =   + yauap-engine"
    fi

    if test x$build_libvisual = xyes; then
        echo " =   + libvisual Support"
    fi

    if test x$enable_mysql = xyes; then
        echo " =   + MySql Support"
    fi

    if test x$enable_postgresql = xyes; then
        echo " =   + Postgresql Support"
    fi

    if test x$have_konqsidebar = xyes; then
        echo " =   + Konqueror Sidebar"
    fi

    if test x$have_tunepimp = xyes; then
        echo " =   + MusicBrainz Support"
    fi

    if test x$have_mp4v2 = xyes; then
        echo " =   + MP4/AAC Tag Write Support"
    fi

    if test x$have_libgpod = xyes; then
        echo " =   + iPod Support"
    fi

    if test x$have_ifp = xyes; then
        echo " =   + iRiver iFP Support"
    fi

    if test x$have_libnjb = xyes; then
        echo " =   + Creative Nomad Jukebox Support"
    fi

    if test x$have_libmtp = xyes; then
        echo " =   + MTP Device Support"
    fi
    
    if test x$have_libkarma = xyes; then
        echo " =   + Rio Karma Support"
    fi

    if test x$have_daap = xyes; then
        echo " =   + DAAP Music Sharing Support"
    fi
    
   echo " ="
fi

echo " ==============================================================================="
dnl Put here things to be done at the very end - telling users
dnl about additional packages to install. Better yet is giving
dnl each project / subdr its own configure.in.bot.

# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure
if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then
  # And if so, warn when they don't match
  if test "$kde_libs_prefix" != "$given_prefix"; then
    # And if kde doesn't know about the prefix yet
    echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null
    if test $? -ne 0; then
      echo ""
      echo "Warning: you chose to install this package in $given_prefix,"
      echo "but KDE was found in $kde_libs_prefix."
      echo "For this to work, you will need to tell KDE about the new prefix, by ensuring"
      echo "that KDEDIRS contains it, e.g. export KDEDIRS=$given_prefix:$kde_libs_prefix"
      echo "Then restart KDE."
      echo ""
    fi
  fi
fi

if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then
  echo ""
  echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility"
  echo "was not included. Therefore, GCC symbol visibility support remains disabled."
  echo ""
  echo "For better performance, consider including the Qt visibility supporting patch"
  echo "located at:"
  echo ""
  echo "http://bugs.kde.org/show_bug.cgi?id=109386"
  echo ""
  echo "and recompile all of Qt and KDE. Note, this is entirely optional and"
  echo "everything will continue to work just fine without it."
  echo ""
fi

if test "$all_tests" = "bad"; then
  if test ! "$cache_file" = "/dev/null"; then
    echo ""
    echo "Please remove the file $cache_file after changing your setup"
    echo "so that configure will find the changes next time."
    echo ""
  fi
else
  echo ""
  echo "Good - your configure finished. Start make now"
  echo ""
fi
