#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(TA3D, 0.1.2, zuzuf86@hotmail.com)
AM_INIT_AUTOMAKE
AC_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([src/ta3d.cpp])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_MAKE_SET

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lGL':
AC_CHECK_LIB([GL], [main])
# FIXME: Replace `main' with a function in `-lGLU':
AC_CHECK_LIB([GLU], [main])
# FIXME: Replace `main' with a function in `-lz':
AC_CHECK_LIB([z], [main])

LIBS="$LIBS `allegro-config --libs` -lagl"

AC_ARG_WITH(use_mp3,
	[AC_HELP_STRING([--with-use_mp3],[active les fonctions mp3(AllegroMp3 requis) et permet d'indiquer le chemin vers libalmp3.a])],
	[
		if test "x$withval" = "xno"; then
		   USE_MP3=false ;
		else
		   USE_MP3=true ;
		   LIBS="${withval} $LIBS"
		fi
	], [USE_MP3=false])
AC_DEFINE_UNQUOTED(USE_MP3, ${USE_MP3}, [Utilisation de AllegroMP3])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([string.h])

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

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([select sqrt strcasecmp strdup strstr])

AC_CONFIG_FILES([
	Makefile
	src/Makefile])
./img.sh
AC_OUTPUT
