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., 59 Temple Place - Suite 330,
dnl    Boston, MA 02111-1307, 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(digikam, 0.6.2) 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)
AC_PATH_KDE
dnl =======================================================
dnl FILE: configure.in.in
dnl =======================================================

#MIN_CONFIG(3)

dnl PACKAGE set before

dnl ------------------------------------------------------------
dnl libraries needed
dnl ------------------------------------------------------------


#---------------------------------------------------------
# gphoto2 detection
#---------------------------------------------------------

dnl Check for gPhoto2 configuration

AC_PATH_PROG(GPHOTO_CONFIG,gphoto2-config)
AC_PATH_PROG(GPHOTO_PORT_CONFIG,gphoto2-port-config)
if test -n "${GPHOTO_CONFIG}"; then
  GPHOTO_CFLAGS="`$GPHOTO_CONFIG --cflags`"
  AC_SUBST(GPHOTO_CFLAGS)
  LIB_GPHOTO="`$GPHOTO_CONFIG --libs` `$GPHOTO_PORT_CONFIG --libs`"
  AC_SUBST(LIB_GPHOTO)
else
  AC_MSG_ERROR([
***
*** gPhoto2 is required. Available from gPhoto's Sourceforge CVS.
*** Check http://www.gphoto.org/download.html for details
***])
  exit 1
fi


CXXFLAGS="$CXXFLAGS -DQT_CLEAN_NAMESPACE"
dnl =======================================================
dnl FILE: ./utilities/configure.in.in
dnl =======================================================

#---------------------------------------------------------
# imlib-detection from kuickshow
#---------------------------------------------------------
# checking for Imlib...

AC_DEFUN(KDE_FIND_IMLIB_CONFIG,
   [AC_MSG_CHECKING([for imlib-config])

imlib_config_given=NO
ac_imlib_config=""

AC_ARG_WITH(imlib-config,
        [  --with-imlib-config     directory where \"imlib-config\" lies ],
        [  ac_imlib_config="$withval/imlib-config"
           imlib_config_given=yes
        ])

if test "$imlib_config_given" = "yes"; then
  if test ! -r $ac_imlib_config; then
    AC_MSG_RESULT(wrong file specified)
    ac_imlib_config=""
  else
    IMLIB_CFLAGS=`$ac_imlib_config --cflags`
    LIB_IMLIB=`$ac_imlib_config --libs`
    AC_SUBST(LIB_IMLIB)
    AC_SUBST(IMLIB_CFLAGS)
    AC_MSG_RESULT($ac_imlib_config)
  fi
else
  ac_imlib_config=`which imlib-config 2>/dev/null`
  if test -z "$ac_imlib_config"; then
    AC_MSG_RESULT(no)
  else
    dummy=`echo "$ac_imlib_config" | grep '/imlib-config'`
    if test -z "$dummy"; then
      AC_MSG_RESULT(no)
      ac_imlib_config=""
    else
      LIB_IMLIB=`$ac_imlib_config --libs`
      IMLIB_CFLAGS=`$ac_imlib_config --cflags`
      imlib_config=`echo "$LIB_IMLIB" | grep lImlib`
      if test -z "$imlib_config"; then
        AC_MSG_RESULT(no)
        ac_imlib_config=""
      else
        AC_SUBST(LIB_IMLIB)
        AC_SUBST(IMLIB_CFLAGS)
        AC_MSG_RESULT($ac_imlib_config)
      fi
    fi
  fi
fi

])

dnl Check if Imlib is installed properly
KDE_FIND_IMLIB_CONFIG

if test -z "$ac_imlib_config"; then
 AC_MSG_ERROR([You need to install Imlib 1.x, e.g. http://freshmeat.net/redir/imlib/4385/url_tgz/imlib-1.9.10.tar.gz if your distributor doesn't have a package])
 exit 1
fi

#---------------------------------------------------------
# libexif detection
#---------------------------------------------------------

PKG_CHECK_MODULES(LIBEXIF, libexif >= 0.5.7)
AC_SUBST(LIBEXIF_LIBS)
AC_SUBST(LIBEXIF_CFLAGS)
KDE_CREATE_SUBDIRSLIST
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ digikam/Makefile ])
AC_CONFIG_FILES([ digikam/pics/Makefile ])
AC_CONFIG_FILES([ digikamcameraclient/Makefile ])
AC_CONFIG_FILES([ digikamcameraclient/cameraui/Makefile ])
AC_CONFIG_FILES([ digikamcameraclient/cameraui/icons/Makefile ])
AC_CONFIG_FILES([ digikamcameraclient/pics/Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ doc/cs/Makefile ])
AC_CONFIG_FILES([ doc/da/Makefile ])
AC_CONFIG_FILES([ doc/de/Makefile ])
AC_CONFIG_FILES([ doc/en/Makefile ])
AC_CONFIG_FILES([ doc/es/Makefile ])
AC_CONFIG_FILES([ doc/fr/Makefile ])
AC_CONFIG_FILES([ doc/hu/Makefile ])
AC_CONFIG_FILES([ doc/it/Makefile ])
AC_CONFIG_FILES([ doc/man/Makefile ])
AC_CONFIG_FILES([ doc/nl/Makefile ])
AC_CONFIG_FILES([ doc/pl/Makefile ])
AC_CONFIG_FILES([ interfaces/Makefile ])
AC_CONFIG_FILES([ kioslave/Makefile ])
AC_CONFIG_FILES([ po/Makefile ])
AC_CONFIG_FILES([ utilities/Makefile ])
AC_CONFIG_FILES([ utilities/imageviewer/Makefile ])
AC_CONFIG_FILES([ utilities/kexif/Makefile ])
AC_CONFIG_FILES([ utilities/setup/Makefile ])
AC_CONFIG_FILES([ utilities/splashscreen/Makefile ])
AC_OUTPUT
# 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 "$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
