AC_PREREQ(2.59)
AC_INIT(panomatic, 1.0, [naouel@naouel.org])
AC_CANONICAL_TARGET
AC_CANONICAL_HOST
AC_CANONICAL_SYSTEM


AC_CONFIG_SRCDIR([panomatic/main.cpp])
AM_INIT_AUTOMAKE
#AC_CONFIG_HEADER([config.h])

AM_ACLOCAL_INCLUDE(m4)
AM_ACLOCAL_INCLUDE(zthread/share)


# Checks for programs.

#save cflags
SCFLAGS=$CFLAGS
SCPPFLAGS=$CPPFLAGS
SCXXFLAGS=$CXXFLAGS

AC_PROG_CXX AC_PROG_CC AC_PROG_RANLIB AC_LANG(C) AC_LANG(C++) 
AM_PROG_CC_C_O

#restore CFLAGS
CFLAGS=$SCFLAGS
CXXFLAGS=$SCXXFLAGS
CPPFLAGS=$SCPPFLAGS


AC_C_BIGENDIAN

LINKER_OPTIONS=""

# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([limits.h stdlib.h string.h unistd.h io.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T

AX_DETECT_PTHREAD
AX_BOOST_BASE([1.34.1])

#defines for libpng
AC_DEFINE([PNG_NO_ASSEMBLER_CODE], [], [Disables use of assembler code])

#CXXFLAGS= -O3 -fomit-frame-pointer -ffast-math -mfpmath=sse -mtune=

case "$target" in
*-*-mingw32*)
    dnl MingW32 should use native win32 threads
    ;;
*-apple-darwin*)
    dnl Use the Mac multiprocessing library
    LINKER_OPTIONS="-framework CoreServices"
    ;;
*)
    dnl Assume pthreads
    if test x"$PTHREAD_CFLAGS" != x; then
      COMPILER_OPTIONS="$PTHREAD_CFLAGS"
    fi
    if test x"$PTHREAD_LIBS" != x; then
      LINKER_OPTIONS="$PTHREAD_LIBS"
    fi
    ;;
esac

AC_SUBST(LINKER_OPTIONS)

AC_CONFIG_FILES([Makefile
		 zlib/src/Makefile
                 libpng/src/Makefile
                 libtiff/src/Makefile
		 libjpeg/src/Makefile
                 vigra/src/impex/Makefile
		 libsurf/Makefile
		 zthread/src/Makefile
 		 panomatic/Makefile
		])
AC_OUTPUT
