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

AC_INIT(configure.in)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(gnewtellium, 0.05b)
AM_CONFIG_HEADER(config.h)

AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC

AC_HEADER_STDC
AC_HEADER_DIRENT

AM_PATH_GTK(1.2.0, ,
            AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?))

dnl Set PACKAGE_DATA_DIR in config.h.
if test "x${datadir}" = 'x${prefix}/share'; then
  if test "x${prefix}" = "xNONE"; then
    AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}")
  else
    AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}")
  fi
else
  AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}")
fi

dnl Set PACKAGE_SOURCE_DIR in config.h.
packagesrcdir=`cd $srcdir && pwd`
AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}")

dnl The memory-debug configure option
AC_ARG_ENABLE(memory-debug, [  --enable-memory-debug   Enable memory debug/profiling options.])
if test -n "$enable_memory_debug"; then
   echo Enabling additional memory debuging code.
   AC_DEFINE_UNQUOTED(NEWTELLA_MEMORY_DEBUG, "1")
fi

dnl Configure OS specific build options
case "$target" in
*-*-solaris*)
	AC_DEFINE_UNQUOTED(SOLARIS, "1")
	;;
esac

AC_CHECK_FUNCS(inet_aton)
if test $ac_cv_func_inet_aton = no; then
	  # inet_aton is not in the default libraries.  See if it's in some other.
	for lib in resolv; do
		AC_CHECK_LIB($lib, inet_aton, [LIBS="$LIBS -l$lib"; break])
	done
fi

dnl Find the install location of the gnewtellium.xpm
dnl AC_DEFINE_UNQUOTED(GNEWTELLIUM_XPM, "")

dnl Use -Wall if we have gcc.
changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])dnl

AC_OUTPUT([
Makefile
src/Makefile
])

