dnl $Id: configure.in.in 23641 2006-11-04 12:18:37Z benny $
dnl
dnl Copyright (c) 2002-2006
dnl         The Xfce development team. All rights reserved.
dnl
dnl Written for Xfce by Benedikt Meurer <benny@xfce.org>, Jasper
dnl Huijsmans <jasper@xfce.org> and Olivier Fourdan <fourdan@xfce.org>.
dnl

dnl ***************************
dnl *** Version information ***
dnl ***************************
m4_define([libxfce4util_verinfo], [4:0:0])
m4_define([libxfce4util_version_major], [4])
m4_define([libxfce4util_version_minor], [3])
m4_define([libxfce4util_version_micro], [99])
m4_define([libxfce4util_version_nano], [2])   dnl leave this empty to have no nano version
m4_define([libxfce4util_version_build], [r23720])
m4_define([libxfce4util_version_tag], [])
m4_define([libxfce4util_version], [libxfce4util_version_major().libxfce4util_version_minor().libxfce4util_version_micro()ifelse(libxfce4util_version_nano(), [], [], [.libxfce4util_version_nano()])ifelse(libxfce4util_version_tag(), [svn], [libxfce4util_version_tag()-libxfce4util_version_build()], [])])

dnl **************************************************************
dnl *** Overall Xfce version, modify this when making releases ***
dnl **************************************************************
m4_define([xfce_version_string], [4.3.99.2])


dnl # DO NOT MODIFY ANYTHING BELOW THIS LINE, UNLESS YOU KNOW WHAT
dnl # YOU ARE DOING.


dnl ********************************************
dnl *** Full debug support for SVN snapshots ***
dnl ********************************************
m4_define([libxfce4util_debug_default], [ifelse(libxfce4util_version_tag(), [svn], [full], [minimum])])

dnl ***************************
dnl *** Initialize autoconf ***
dnl ***************************
AC_COPYRIGHT([Copyright (c) 2002-2006
        The Xfce development team. All rights reserved.

Written for Xfce by Benedikt Meurer <benny@xfce.org>, Jasper
Huijsmans <jasper@xfce.org> and Olivier Fourdan <fourdan@xfce.org>.])
AC_INIT([libxfce4util], [libxfce4util_version()], [xfce4-dev@xfce.org])
AC_PREREQ([2.50])
AC_REVISION([$Id: configure.in.in 23641 2006-11-04 12:18:37Z benny $])

dnl ***************************
dnl *** Initialize automake ***
dnl ***************************
LIBXFCE4UTIL_VERSION=libxfce4util_version()
AM_INIT_AUTOMAKE([libxfce4util], [$LIBXFCE4UTIL_VERSION])
AM_CONFIG_HEADER([config.h])
AM_MAINTAINER_MODE

dnl **************************
dnl *** Libtool versioning ***
dnl **************************
LIBXFCE4UTIL_VERINFO=libxfce4util_verinfo()
AC_SUBST([LIBXFCE4UTIL_VERINFO])

dnl **********************************
dnl *** Subst overall Xfce version ***
dnl **********************************
AC_DEFINE([XFCE_VERSION_STRING], ["xfce_version_string"],
  [Overall XFce version])

dnl **********************************
dnl *** Subst libxfce4util version ***
dnl **********************************
LIBXFCE4UTIL_VERSION_MAJOR=libxfce4util_version_major()
LIBXFCE4UTIL_VERSION_MINOR=libxfce4util_version_minor()
LIBXFCE4UTIL_VERSION_MICRO=libxfce4util_version_micro()
AC_SUBST([LIBXFCE4UTIL_VERSION_MAJOR])
AC_SUBST([LIBXFCE4UTIL_VERSION_MINOR])
AC_SUBST([LIBXFCE4UTIL_VERSION_MICRO])

dnl *******************************
dnl *** Check for UNIX variants ***
dnl *******************************
AC_AIX()
AC_ISC_POSIX()
AC_MINIX()
AM_CONDITIONAL([HAVE_CYGWIN], [test "`uname | grep \"CYGWIN\"`" != ""])

dnl ********************************
dnl *** Check for basic programs ***
dnl ********************************
AC_PROG_CC()
AC_PROG_INSTALL()
AC_PROG_LIBTOOL()
AC_CHECK_PROGS([PERL], [perl5 perl])

dnl ***************************************
dnl *** Check for standard header files ***
dnl ***************************************
AC_HEADER_STDC()
AC_CHECK_HEADERS([err.h errno.h grp.h limits.h locale.h pwd.h \
                  sys/stat.h sys/types.h sys/utsname.h \
                  sys/wait.h time.h unistd.h])
AC_CHECK_FUNCS([gethostname getpwnam setenv setlocale strdup unsetenv])

dnl ******************************
dnl *** Check for i18n support ***
dnl ******************************
XDT_I18N([ca cs de dz fi fr gl he ja ka ko lt nl pl pt_BR uk])

dnl ******************************************************************************
dnl *** Check for GObject >= 2.6.0 installed (GObject in turn depends on GLib) ***
dnl ******************************************************************************
XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.6.0])

dnl *************************
dnl *** Check for gtk-doc ***
dnl *************************
GTK_DOC_CHECK([1.0])

dnl ****************************************************************************
dnl *** Check for a broken putenv(3) implementation that requires strings    ***
dnl *** to be malloc'd and not freed after a successfully call to putenv(3). ***
dnl *** Solaris is known to have such an implementation, also glibc seems to ***
dnl *** be hit by this problem.                                              ***
dnl ****************************************************************************
AC_MSG_CHECKING([whether putenv() implementation is broken])
AC_ARG_WITH([broken-putenv],
  [  --with-broken-putenv=[[auto/yes/no]] broken putenv(3) [default=auto]])
if test x"$with_broken_putenv" != x"yes" -a x"$with_broken_putenv" != x"no"; then
  AC_RUN_IFELSE([
  #include <stdlib.h>
  #include <string.h>
  int main(int argc, char *argv[])
  {
    char *buffer = (char *)malloc(8);
    strcpy(buffer, "foo=bar");
    putenv(buffer);
    strcpy(buffer, "foo=rab");
    return(strcmp(getenv("foo"), "bar") == 0 ? 0 : 1);
  }],
  [with_broken_putenv=no],
  [with_broken_putenv=yes])
fi
if test x"$with_broken_putenv" = x"yes"; then
  AC_DEFINE([HAVE_BROKEN_PUTENV], [1], [Define if putenv(3) is broken])
fi
AC_MSG_RESULT([$with_broken_putenv])

dnl ***********************************
dnl *** Check for debugging support ***
dnl ***********************************
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@], [Turn on debugging @<:@default=libxfce4util_debug_default@:>@]),
  [], [enable_debug=libxfce4util_debug_default])
AC_MSG_CHECKING([whether to enable debugging support])
if test x"$enable_debug" = x"yes" -o x"$enable_debug" = x"full"; then
  if test x"$GCC" = x"yes"; then
    CFLAGS="$CFLAGS -O0 -g3 -Werror -Wall"
  fi
else
  CFLAGS="$CFLAGS -DG_DISABLE_CAST_CHECKS"

  if test x"$enable_debug" = x"no"; then
    CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
  fi
fi
AC_MSG_RESULT([$enable_debug])

dnl **************************************
dnl *** Check for linker optimizations ***
dnl **************************************
AC_MSG_CHECKING([whether $LD accepts -O1])
case `$LD -O1 -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
  LDFLAGS="$LDFLAGS -Wl,-O1"
  AC_MSG_RESULT([yes])
  ;;
*)
  AC_MSG_RESULT([no])
  ;;
esac

dnl ****************************************
dnl *** Check for ELF visibility support ***
dnl ****************************************
AC_ARG_ENABLE([visibility], AC_HELP_STRING([--disable-visibility], [Don't use ELF visibility attributes]), [], [enable_visibility=yes])
have_gnuc_visibility=no
if test x"$enable_visibility" != x"no"; then
  dnl Check whether the compiler supports the visibility attribute
  save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS -Wall -Werror"
  AC_MSG_CHECKING([whether $CC supports the GNUC visibility attribute])
  AC_COMPILE_IFELSE(AC_LANG_SOURCE(
  [
    void __attribute__ ((visibility("default"))) test_default (void) {}
    void __attribute__ ((visibility("hidden"))) test_hidden (void) {}
    int main (int argc, char **argv) { test_default (); test_hidden (); return 0; }
  ]),
  [
    have_gnuc_visibility=yes
    AC_MSG_RESULT([yes])
  ],
  [
    AC_MSG_RESULT([no])
  ])
  CFLAGS="$save_CFLAGS"
fi
if test x"$have_gnuc_visibility" = x"yes"; then
  CPPFLAGS="$CPPFLAGS -DHAVE_GNUC_VISIBILITY"
fi
AM_CONDITIONAL([HAVE_GNUC_VISIBILITY], [test x"$have_gnuc_visibility" = x"yes"])

dnl *****************************
dnl *** Generate output files ***
dnl *****************************
AC_OUTPUT([
Makefile
docs/version.xml
docs/Makefile
libxfce4util.spec
libxfce4util/libxfce4util-1.0.pc
libxfce4util/libxfce4util-config.h
libxfce4util/Makefile
po/Makefile.in
xfce4-kiosk-query/Makefile
])
