Newer
Older
monitord / lame-3.97 / .svn / text-base / configure.in.svn-base
@root root on 23 Jan 2012 30 KB Migration from SVN revision 455
dnl $Id: configure.in,v 1.115 2005/09/04 19:11:58 aleidinger Exp $
dnl
dnl
dnl don't forget to set ASM_FOR_ARCH to a space delimited list of
dnl processor architectures, for which assembler routines exist
dnl
dnl
dnl Exported and configured variables:
dnl CC
dnl CFLAGS
dnl LDFLAGS
dnl LDADD
dnl NASM

dnl extra vars for frontend:
dnl FRONTEND_LDFLAGS
dnl FRONTEND_CFLAGS
dnl FRONTEND_LDADD

AC_PREREQ(2.53)
AC_INIT(lame,3.97,lame-dev@lists.sf.net)
AC_CONFIG_SRCDIR([libmp3lame/lame.c])

dnl check system
AC_CANONICAL_HOST

dnl automake
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AM_MAKE_INCLUDE

dnl check environment
AC_AIX
AC_ISC_POSIX
AC_MINIX
case $host_os in
  *cygwin* ) CYGWIN=yes;;
         * ) CYGWIN=no;;
esac

dnl libtool
# AC_DISABLE_SHARED
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
CFLAGS="${ac_save_CFLAGS}"

# increase this when the shared lib becomes totally incompatible
LIB_MAJOR_VERSION=0

# increase this when changes are made, but they are upward compatible
# to previous versions
LIB_MINOR_VERSION=0

dnl # work around for a bug, don't know where it is exactly
if test "${ac_cv_cygwin}" = "yes"; then
	if test "${CC}" != "gcc"; then
		AC_MSG_ERROR([Please use]
			[   CC=gcc ./configure]
			[Abort this configure run and add "CC=gcc" or you will]
			[see errors and no lame.exe will be build.])
	fi
fi

dnl check programs
AM_PROG_CC_STDC

dnl more automake stuff
AM_C_PROTOTYPES

AC_CHECK_HEADER(dmalloc.h)
if test "${ac_cv_header_dmalloc_h}" = "yes"; then
	AM_WITH_DMALLOC
fi

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS( \
		 errno.h \
		 fcntl.h \
		 limits.h \
		 stdint.h \
		 string.h \
		 sys/soundcard.h \
		 sys/time.h \
		 unistd.h \
		 linux/soundcard.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
if test ${cross_compiling} = "no"; then
	AC_C_BIGENDIAN
fi

if test "${GCC}" = "yes"; then
	AC_MSG_CHECKING(version of GCC)
	GCC_version=`${CC} --version | sed -n '1s/^[[^ ]]* (.*) //;s/ .*$//;1p'`
	AC_MSG_RESULT(${GCC_version})
fi

AC_SYS_LARGEFILE

AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(unsigned short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)

AC_C_LONG_DOUBLE
if test "${ac_cv_c_have_long_double}" = "yes" ; then
	AC_CHECK_SIZEOF(long double)
fi

AC_CHECK_TYPES([uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t])

AH_VERBATIM([HAVE_UINT8_T],
[/* add uint8_t type */
#undef HAVE_UINT8_T
#ifndef HAVE_UINT8_T
	typedef unsigned char uint8_t;
#endif])

AH_VERBATIM([HAVE_INT8_T],
[/* add int8_t type */
#undef HAVE_INT8_T
#ifndef HAVE_INT8_T
	typedef char int8_t;
#endif])

AH_VERBATIM([HAVE_UINT16_T],
[/* add uint16_t type */
#undef HAVE_UINT16_T
#ifndef HAVE_UINT16_T
	typedef unsigned short uint16_t;
#endif])

AH_VERBATIM([HAVE_INT16_T],
[/* add int16_t type */
#undef HAVE_INT16_T
#ifndef HAVE_INT16_T
	typedef short int16_t;
#endif])

if test "${ac_cv_sizeof_unsigned_short}" = "4"; then
	AC_DEFINE(A_UINT32_T,unsigned short)
else
	if test "${ac_cv_sizeof_unsigned_int}" = "4"; then
		AC_DEFINE(A_UINT32_T,unsigned int)
	else
		if test "${ac_cv_sizeof_unsigned_long}" = "4"; then
			AC_DEFINE(A_UINT32_T,unsigned long)
		else
			AC_MSG_ERROR([CHECK_TYPE_uint32_t - please report to lame-dev@lists.sourceforge.net])
		fi
	fi
fi

AH_VERBATIM([HAVE_UINT32_T],
[/* add uint32_t type */
#undef HAVE_UINT32_T
#ifndef HAVE_UINT32_T
#undef A_UINT32_T
	typedef A_UINT32_T uint32_t;
#endif])

if test "${ac_cv_sizeof_short}" = "4"; then
	AC_DEFINE(A_INT32_T,short)
else
	if test "${ac_cv_sizeof_int}" = "4"; then
		AC_DEFINE(A_INT32_T,int)
	else
		if test "${ac_cv_sizeof_long}" = "4"; then
			AC_DEFINE(A_INT32_T,long)
		else
			AC_MSG_ERROR([CHECK_TYPE_int32_t - please report to lame-dev@lists.sourceforge.net])
		fi
	fi
fi

AH_VERBATIM([HAVE_INT32_T],
[/* add int32_t type */
#undef HAVE_INT32_T
#ifndef HAVE_INT32_T
#undef A_INT32_T
	typedef A_INT32_T int32_t;
#endif])

if test "${ac_cv_sizeof_unsigned_int}" = "8"; then
	AC_DEFINE(A_UINT64_T,unsigned int)
else
	if test "${ac_cv_sizeof_unsigned_long}" = "8"; then
		AC_DEFINE(A_UINT64_T,unsigned long)
	else
		if test "${ac_cv_sizeof_unsigned_long_long}" = "8"; then
			AC_DEFINE(A_UINT64_T,unsigned long long)
		else
			AC_MSG_ERROR([CHECK_TYPE_uint64_t - please report to lame-dev@lists.sourceforge.net])
		fi
	fi
fi

AH_VERBATIM([HAVE_UINT64_T],
[/* add uint64_t type */
#undef HAVE_UINT64_T
#ifndef HAVE_UINT64_T
#undef A_UINT64_T
	typedef A_UINT64_T uint64_t;
#endif])

if test "${ac_cv_sizeof_int}" = "8"; then
	AC_DEFINE(A_INT64_T,int)
else
	if test "${ac_cv_sizeof_long}" = "8"; then
		AC_DEFINE(A_INT64_T,long)
	else
		if test "${ac_cv_sizeof_long_long}" = "8"; then
			AC_DEFINE(A_INT64_T,long long)
		else
			AC_MSG_ERROR([CHECK_TYPE_int64_t - please report to lame-dev@lists.sourceforge.net])
		fi
	fi
fi

AH_VERBATIM([HAVE_INT64_T],
[/* add int64_t type */
#undef HAVE_INT64_T
#ifndef HAVE_INT64_T
#undef A_INT64_T
	typedef A_INT64_T int64_t;
#endif])

alex_IEEE854_FLOAT80
if test "${alex_cv_ieee854_float80}" = "yes" ; then
	if test "${ac_cv_c_long_double}" = "yes" ; then
		AC_CHECK_TYPES(ieee854_float80_t, long double)
		AH_VERBATIM([HAVE_IEEE854_FLOAT80_T],
[/* add ieee854_float80_t type */
#undef HAVE_IEEE854_FLOAT80_T
#ifndef HAVE_IEEE854_FLOAT80_T
	typedef long double ieee854_float80_t;
#endif])

		AC_DEFINE(HAVE_IEEE854_FLOAT80, 1, [system has 80 bit floats])
	fi
fi
AC_CHECK_TYPES([ieee754_float64_t, ieee754_float32_t])

AH_VERBATIM([HAVE_IEEE754_FLOAT64_T],
[/* add ieee754_float64_t type */
#undef HAVE_IEEE754_FLOAT64_T
#ifndef HAVE_IEEE754_FLOAT64_T
	typedef double ieee754_float64_t;
#endif])

AH_VERBATIM([HAVE_IEEE754_FLOAT32_T],
[/* add ieee754_float32_t type */
#undef HAVE_IEEE754_FLOAT32_T
#ifndef HAVE_IEEE754_FLOAT32_T
	typedef float ieee754_float32_t;
#endif])

AC_DEFINE(LAME_LIBRARY_BUILD, 1, [requested by Frank, seems to be temporary needed for a smooth transition])


if test ${cross_compiling} = "yes"; then
	AC_MSG_WARN([]
  [**************************************************************************]
  [*                                                                        *]
  [* You are cross compiling:                                               *]
  [*   - I did not have a change to determine                               *]
  [*     + the size of:                                                     *]
  [*       - short                                                          *]
  [*       - unsigned short                                                 *]
  [*       - int                                                            *]
  [*       - unsigned int                                                   *]
  [*       - long                                                           *]
  [*       - unsigned long                                                  *]
  [*       - float                                                          *]
  [*       - double                                                         *]
  [*       - long double                                                    *]
  [*     + the endianess of the system                                      *]
  [*   - You have to provide appropriate defines for them in config.h, e.g. *]
  [*     + define SIZEOF_SHORT to 2 if the size of a short is 2             *]
  [*     + define WORDS_BIGENDIAN if your system is a big endian system     *]
  [*                                                                        *]
  [**************************************************************************])
fi

AC_TYPE_SIZE_T
AC_HEADER_TIME

dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(gettimeofday strtol)

if test "X${ac_cv_func_strtol}" != "Xyes"; then
	AC_MSG_ERROR([function strtol is mandatory])
fi

dnl Check if we have winsock, if so, we are on a mingw system
dnl and need libwsock32
SOCKETFUNCTION=YES
AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCKET], [], [winsock])
		LIBS="$LIBS -lwsock32"])  
if test $ac_cv_header_winsock2_h = no; then
	AC_CHECK_FUNCS(socket)
	if test $ac_cv_func_socket = no; then
		# maybe it is in libsocket
		AC_CHECK_LIB(socket, socket, [AC_DEFINE(HAVE_SOCKET)
			LIBS="$LIBS -lsocket"])

		if test "X${ac_cv_lib_socket_socket}" != "Xyes"; then
			SOCKETFUNCTION=NO
		else
			case ${host_os} in
			*solaris*)
				LIBS="$LIBS -lnsl"
				;;
			esac
		fi
	fi
fi


dnl Initialize configuration variables for the Makefile
CFLAGS=${CFLAGS}
CONFIG_DEFS=${CONFIG_DEFS}
NASM=
INCLUDES="-I\$(top_srcdir)/include -I\$(srcdir)"
FRONTEND_LDFLAGS=
FRONTEND_CFLAGS=
LIB_SOURCES=
MAKEDEP="-M"
RM_F="rm -f"

AC_ARG_ENABLE(nasm,
  [  --enable-nasm              Allow the use of nasm if available],
  ASM_FOR_ARCH="i386", ASM_FOR_ARCH="")

dnl Checks for libraries.

AC_CHECK_HEADERS(termcap.h)
AC_CHECK_HEADERS(ncurses/termcap.h)
AC_CHECK_LIB(termcap, initscr, HAVE_TERMCAP="termcap")
AC_CHECK_LIB(curses, initscr, HAVE_TERMCAP="curses")
AC_CHECK_LIB(ncurses, initscr, HAVE_TERMCAP="ncurses")
 
dnl math lib
AC_CHECK_LIB(m, cos, USE_LIBM="-lm")
dnl free fast math library
AC_CHECK_LIB(ffm, cos, USE_LIBM="-lffm -lm")
dnl Compaq fast math library.
AC_CHECK_LIB(cpml, cos, USE_LIBM="-lcpml")
CONFIG_MATH_LIB="${USE_LIBM}"

AC_CHECK_LIB(sndfile, sf_open_read, HAVE_SNDFILE="yes")


dnl configure use of features

AM_PATH_GTK(1.2.0, HAVE_GTK="yes", HAVE_GTK="no")
if test "${HAVE_GTK}" = "yes"; then
	AC_DEFINE(HAVE_GTK, 1, have working GTK)
fi


dnl ElectricFence malloc debugging
AC_MSG_CHECKING(use of ElectricFence malloc debugging)
AC_ARG_ENABLE(efence,
  [  --enable-efence            Use ElectricFence for malloc debugging],
  CONFIG_EFENCE="${enableval}", CONFIG_EFENCE="no")

case "${CONFIG_EFENCE}" in
yes)
	AC_CHECK_LIB(efence, EF_Print, HAVE_EFENCE="-lefence")
	if test "x${HAVE_EFENCE}" != "x-lefence"; then
		AC_MSG_RESULT(yes, but libefence not found)
	else
		LDADD="${LDADD} ${HAVE_EFENCE}"
		AC_DEFINE(HAVE_EFENCE, 1, we link against libefence)
		AC_MSG_RESULT(${CONFIG_EFENCE})
	fi
	;;
no)
	AC_MSG_RESULT(${CONFIG_EFENCE})
	;;
*)
	AC_MSG_ERROR(bad value »${CONFIG_EFENCE}« for efence option)
	;;
esac


dnl libsndfile
AC_MSG_CHECKING(use of file io)
WARNING=
AC_ARG_WITH(fileio, 
  [  --with-fileio=lame         Use lame's internal file io routines [default]]
  [             =sndfile      Use Erik de Castro Lopo's libsndfile]
  [                           (no stdin possible currently)],
  CONFIG_FILEIO="${withval}", CONFIG_FILEIO="lame")
AC_ARG_WITH(sndfile-prefix,
  [  --with-sndfile-prefix=DIR  Alternate location for libsndfile],
  CONFIG_SNDFILE_PREFIX="${withval}", CONFIG_SNDFILE_PREFIX="")
if test "${CONFIG_FILEIO}" = "sndfile" ; then
  if test "x${CONFIG_SNDFILE_PREFIX}" != "x" ; then 
    # look for sndfile lib. This overrides any standard location
    LA_SEARCH_LIB(SNDFILE_LIB_LOC, SNDFILE_INC_LOC, \
      libsndfile.a, sndfile.h, $CONFIG_SNDFILE_PREFIX) 
    if test "x${SNDFILE_LIB_LOC}" != "x" ; then
      HAVE_SNDFILE="yes"
      FRONTEND_LDFLAGS="-L${SNDFILE_LIB_LOC} ${FRONTEND_LDFLAGS}"
      INCLUDES="-I${SNDFILE_INC_LOC} ${INCLUDES}"
    else
      WARNING="sndfile lib not found in specified prefix."
    fi
  fi
  if test "${HAVE_SNDFILE}" = "yes" ; then
    FRONTEND_LDADD="-lsndfile ${FRONTEND_LDADD}"
    AC_DEFINE(LIBSNDFILE, 1, build with libsndfile support)
  else
    # default
    CONFIG_FILEIO="lame"
    WARNING="${WARNING} Could not find any sndfile lib on system."
  fi
else
  CONFIG_FILEIO="lame"
fi 
AC_MSG_RESULT(${CONFIG_FILEIO})
if test "x${WARNING}" != "x" ; then
  AC_MSG_WARN($WARNING)
fi


dnl check if we should remove hooks for analyzer code in library
dnl default library must include these hooks
AC_MSG_CHECKING(use of analyzer hooks)
AC_ARG_ENABLE(analyzer-hooks,
  [  --disable-analyzer-hooks   Exclude analyzer hooks],
  CONFIG_ANALYZER="${enableval}", CONFIG_ANALYZER="yes")

case "${CONFIG_ANALYZER}" in
yes)
	;;
no)
	AC_DEFINE(NOANALYSIS, 1, build without hooks for analyzer)
	;;
*)
	AC_MSG_ERROR(bad value »${CONFIG_ANALYZER}« for analyzer-hooks option)
	;;
esac
AC_MSG_RESULT($CONFIG_ANALYZER)


dnl mpg123 decoder
AC_MSG_CHECKING(use of mpg123 decoder)
AC_ARG_ENABLE(decoder, 
  [  --disable-decoder          Exclude mpg123 decoder],
  CONFIG_DECODER="${enableval}", CONFIG_DECODER="yes")
AC_ARG_ENABLE(decode-layer1, 
  [  --enable-decode-layer1     Include layer1 decoding [default=no]],
  CONFIG_DECODER_L1="${enableval}", CONFIG_DECODER_L1="no")
AC_ARG_ENABLE(decode-layer2, 
  [  --disable-decode-layer2    Exclude layer2 decoding],
  CONFIG_DECODER_L2="${enableval}", CONFIG_DECODER_L2="yes")

AM_CONDITIONAL(LIB_WITH_DECODER, test "x${CONFIG_DECODER}" = "xyes")

if test "${CONFIG_DECODER}" != "no" ; then
	CONFIG_DECODER="yes (Layer"
	AC_DEFINE(HAVE_MPGLIB, 1, build with mpglib support)
	AC_DEFINE(DECODE_ON_THE_FLY, 1, allow to compute a more accurate replaygain value)
  
	if test "${CONFIG_DECODER_L1}" != "no"; then
		CONFIG_DECODER="${CONFIG_DECODER} 1,"
		AC_DEFINE(USE_LAYER_1, 1, build with layer 1 decoding)
	fi
	if test "${CONFIG_DECODER_L2}" != "no"; then
		CONFIG_DECODER="${CONFIG_DECODER} 2,"
		AC_DEFINE(USE_LAYER_2, 1, build with layer 2 decoding)
	fi
	CONFIG_DECODER="${CONFIG_DECODER} 3)"
fi
AC_MSG_RESULT($CONFIG_DECODER)


AC_MSG_CHECKING(if the lame frontend should be build)
AC_ARG_ENABLE(frontend,
  [  --disable-frontend         Do not build the lame executable [default=build]],
    WITH_FRONTEND="${enableval}", WITH_FRONTEND=yes)
if test "x${WITH_FRONTEND}" = "xyes"; then
	WITH_FRONTEND=lame${ac_exeext}
	AC_MSG_RESULT(yes)
else
	WITH_FRONTEND=
	AC_MSG_RESULT(no)
fi



AC_MSG_CHECKING(if mp3x is requested)
AC_ARG_ENABLE(mp3x,
  [  --enable-mp3x              Build GTK frame analyzer [default=no]],
    WITH_MP3X="${enableval}", WITH_MP3X=no)
if test "x${WITH_MP3X}" = "xyes"; then
	WITH_MP3X=mp3x${ac_exeext}
	AC_MSG_RESULT(yes)
else
	WITH_MP3X=
	AC_MSG_RESULT(no)
fi

if test "${HAVE_GTK}" = "no"; then
	if test "x${WITH_MP3X}" = "xmp3x"; then
		AC_MSG_WARN(can't build mp3x, no GTK installed)
		WITH_MP3X=
	fi
	if test "x${CONFIG_ANALYZER}" != "xyes"; then
		AC_MSG_WARN(can't build mp3x because of disabled analyzer hooks)
		WITH_MP3X=
	fi
fi

AC_MSG_CHECKING(if mp3rtp is requested)
AC_ARG_ENABLE(mp3rtp,
  [  --enable-mp3rtp            Build mp3rtp [default=no]],
    WITH_MP3RTP="${enableval}", WITH_MP3RTP=no)
if test "x${WITH_MP3RTP}" = "xyes"; then
	if test ${SOCKETFUNCTION} = NO; then
		AC_MSG_ERROR([function socket is mandatory for mp3rtp])
	fi
	WITH_MP3RTP=mp3rtp${ac_exeext}
	AC_MSG_RESULT(yes)
else
	WITH_MP3RTP=
	AC_MSG_RESULT(no)
fi


#
# this is from vorbis
#
dnl check GLIBC
case $host in 
*86-*-linux*)
	# glibc < 2.1.3 has a serious FP bug in the math inline header
	# that will cripple Vorbis.  Look to see if the magic FP stack
	# clobber is missing in the mathinline header, thus indicating
	# the buggy version

	AC_EGREP_CPP(log10.*fldlg2.*fxch,[
		#define __LIBC_INTERNAL_MATH_INLINES 1
	     	#define __OPTIMIZE__
		#include <math.h>
		],bad=maybe,bad=no)

	AC_MSG_CHECKING(glibc mathinline bug)
	if test ${bad} = "maybe" ;then
	      AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
				[
				#define __LIBC_INTERNAL_MATH_INLINES 1
			     	#define __OPTIMIZE__
				#include <math.h>
				],bad=no,bad=yes)
	fi
	AC_MSG_RESULT(${bad})
	if test ${bad} = "yes" ;then
 AC_MSG_WARN([                                                        ])
 AC_MSG_WARN([********************************************************])
 AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
 AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
 AC_MSG_WARN([* all floating point code, not only LAME, but all code *])
 AC_MSG_WARN([* built on this machine. Upgrading to glibc 2.1.3 is   *])
 AC_MSG_WARN([* strongly urged to correct the problem.               *])
 AC_MSG_WARN([*Note: that upgrading glibc will not fix any previously*])
 AC_MSG_WARN([* built programs; this is a compile-time bug.          *])
 AC_MSG_WARN([* To work around the problem for this build of LAME,   *])
 AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
 AC_MSG_WARN([* hurt LAME performace but is necessary for LAME to    *])
 AC_MSG_WARN([* work correctly.  Once glibc is upgraded, rerun       *])
 AC_MSG_WARN([* configure and make to build with inlining.           *])
 AC_MSG_WARN([********************************************************])
 AC_MSG_WARN([                                                        ])

	AC_DEFINE(__NO_MATH_INLINES, 1, work around a glibc bug)
	fi;;
esac


dnl configure use of VBR bitrate histogram
dnl todo: always use yes as default, use simulation instead ?
AC_MSG_CHECKING(use of VBR bitrate histogram)
if test "x${HAVE_TERMCAP}" != "x"; then
  TERMCAP_DEFAULT="yes"
else
  TERMCAP_DEFAULT="no"
fi
AC_ARG_ENABLE(brhist, 
  [  --disable-brhist          Include the VBR bitrate histogram feature]
  [                           [default=yes]],
  CONFIG_BRHIST="${enableval}", CONFIG_BRHIST="yes")
if test "${CONFIG_BRHIST}" != "no" ; then
	AC_DEFINE(BRHIST, 1, enable VBR bitrate histogram)

	if test "${TERMCAP_DEFAULT}" = "yes" ; then
		FRONTEND_LDADD="-l${HAVE_TERMCAP} ${FRONTEND_LDADD}"
		CONFIG_BRHIST="yes, with ${HAVE_TERMCAP}"
		AC_DEFINE(HAVE_TERMCAP, 1, have termcap)
	else
		CONFIG_BRHIST="yes, simulated termcap"
	fi
fi
AC_MSG_RESULT(${CONFIG_BRHIST})
AM_CONDITIONAL(WITH_BRHIST, test "${CONFIG_BRHIST}" != "no")



dnl ### processor specific options ###
case $host_cpu in
*86)
	CPUTYPE="i386"

	# use internal knowledge of the IEEE 754 layout
	AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)
	AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
	;;
powerpc)
	CPUTYPE="no"

	# use internal knowledge of the IEEE 754 layout
	AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)

	# The following should not get enabled on a G5. HOWTO check for a G5?
	AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
	;;
*)
	CPUTYPE="no"
	;;
esac



AC_MSG_CHECKING(for FLOAT8 as float)
AC_ARG_ENABLE(all-float,
  [  --enable-all-float         Whether to make all floting point variables as float, not double]
  [                           [default=no]],   
    CONFIG_ALLFLOAT="${enableval}", CONFIG_ALLFLOAT="no")
case "${CONFIG_ALLFLOAT}" in
no)
	;;
yes)
	AC_DEFINE(FLOAT8, float, float instead of double)
	;;
*)
	AC_MSG_ERROR(bad value »${CONFIG_ALLFLOAT}« for all-float option)
	;;
esac
AC_MSG_RESULT(${CONFIG_ALLFLOAT})



AC_PATH_PROG(NASM, nasm, no)
case "${NASM}" in
no)
	;;
*)
	AC_MSG_CHECKING(for assembler routines for this processor type)
	for recurse_over in ${ASM_FOR_ARCH}
	do
		if test "${CPUTYPE}" = "${recurse_over}"; then
			include_asm_routines="yes"
		fi
	done
	if test "x${include_asm_routines}" = "xyes"; then
		AC_DEFINE(HAVE_NASM, 1, have nasm)
		AC_DEFINE(MMX_choose_table, 1, use MMX version of choose_table)
	else
		include_asm_routines="no"
		NASM="no"
	fi
	AC_MSG_RESULT(${include_asm_routines})
	;;
esac
AM_CONDITIONAL(HAVE_NASM, test "${NASM}" != "no")

case $host_os in
	*cygwin*|*mingw32*)
		CYGWIN=yes
		NASM_FORMAT="-f win32 -DWIN32"
		;;
	*)
		CYGWIN=no
		NASM_FORMAT="-f elf"
		;;
esac

#
# 'expopt' is used for "additional optimizations", not for optimizations which
# are marked as "experimental" in the guide for the compiler.
# They are "experimental" here in the LAME project (at least
# "--enable-expopt=full").
#
AC_MSG_CHECKING(for additional optimizations)
AC_ARG_ENABLE(expopt,
  [  --enable-expopt=full,norm  Whether to enable experimental optimizations]
  [                           [default=no]],   
    CONFIG_EXPOPT="${enableval}", CONFIG_EXPOPT="no")

if test "x$GCC" = "xyes"; then
	# gcc defaults. OS specific options go in versious sections below
	# from the gcc man pages:  "there is no reason to use -pedantic"
	if test "x${with_gnu_ld}" = "xyes"; then
		CFLAGS="-Wall -pipe ${CFLAGS}"
	else
		# some vendor ld's don't like '-pipe'
		CFLAGS="-Wall ${CFLAGS}"
	fi

	# GCC version specific generic options
	case "${GCC_version}" in
	2.96*)
        	# for buggy version of gcc shipped with RH7.1, back of on some
        	# optimizations
        	OPTIMIZATION="-O -fomit-frame-pointer -ffast-math \
			-funroll-loops"
		OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
			-fsched-interblock -fbranch-count-reg -fforce-addr \
			-fforce-mem"
        	;;
	3.0*)
		# -funroll-loops seems to produce buggy code with gcc 3.0.3
		OPTIMIZATION="-O -fomit-frame-pointer -ffast-math"
		OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
			-fbranch-count-reg -fforce-addr -fforce-mem"
		;;
	3.2*)
		# -fomit-frame-pointer seems to be buggy on cygwin
		case ${host_os} in
		*cygwin*)
			OMIT_FRAME_POINTER=
			;;
		*)
			OMIT_FRAME_POINTER=-fomit-frame-pointer
			;;
		esac

		OPTIMIZATION="-O ${OMIT_FRAME_POINTER} -ffast-math"
		OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
			-fbranch-count-reg -fforce-addr -fforce-mem"
		;;
	*)
		# default
		OPTIMIZATION="-O3 ${OMIT_FRAME_POINTER} -ffast-math \
			-funroll-loops"
		OPTIMIZATION_FULL="-fbranch-count-reg -fforce-addr -fforce-mem"
		;;
	esac


	# GCC version independend generic options
	OPTIMIZATION_NORM="-fschedule-insns2"


	# generic CPU specific options
	case ${host_cpu} in
	sparc)
		case "${GCC_version}" in
		3.0*)
			;;
		3.*)
			# doesn't work on 3.0.x, but on 3.[12] and
			# hopefully on every other release after that too
			if test -x /usr/bin/isalist; then
				/usr/bin/isalist | grep sparcv8plus \
					>/dev/null 2>&1 && \
					OPTIMIZATION="${OPTIMIZATION} \
						-mcpu=ultrasparc \
						-mtune=ultrasparc"
			fi
			;;
		esac
		;;
	*86)
		case "${GCC_version}" in
		3.*)
			OPTIMIZATION="${OPTIMIZATION} \
				-maccumulate-outgoing-args"
			;;
		esac
		;;
	esac


	case "${CONFIG_EXPOPT}" in
	no)
		# if someone supplies own CFLAGS, we don't add our own
		if test "x${ac_save_CFLAGS}" != "x"; then 
			OPTIMIZATION=""
		fi
		;;
	norm|yes)
		OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM}"
		;;
	full)
		OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM} \
			${OPTIMIZATION_FULL}"

		# some hardware dependend options
		case "${GCC_version}" in
		2.9*|3.*)
			# "new" GCC, use some "new" CPU specific optimizations
			case ${host_cpu} in
			*486)
				OPTIMIZATION="${OPTIMIZATION} -m486 \
					-mfancy-math-387"
				;;
			*586)
				OPTIMIZATION="${OPTIMIZATION} -mcpu=pentium \
					-march=pentium -mfancy-math-387"
				;;
			*686)
				OPTIMIZATION="${OPTIMIZATION} -mcpu=pentiumpro \
					-march=pentiumpro -mfancy-math-387 \
					-malign-double"
				;;
			*86)
				OPTIMIZATION="${OPTIMIZATION} -mfancy-math-387"
				;;
			alpha*)
				OPTIMIZATION="${OPTIMIZATION} -mfp-regs"
				AC_DEFINE(FLOAT, double, double is faster than float on Alpha)
				# add "-mcpu=21164a -Wa,-m21164a" to optimize
				# for 21164a (ev56) CPU
				;;
			*)
				OPTIMIZATION="${OPTIMIZATION} -fdelayed-branch"
				;;
			esac
			;;
		*)
			# no special optimization for other versions
			AC_MSG_WARN(LAME doesn't know about your version of gcc, please report it to lame-dev@lists.sourceforge.net. Please make sure you try the latest LAME version first!)
			;;
		esac
		;;
	*)
		AC_MSG_ERROR(bad value »${CONFIG_EXPOPT}« for expopt option)
		;;
	esac

	AC_MSG_RESULT(${CONFIG_EXPOPT})
else
	AC_MSG_RESULT(no)
fi





AC_MSG_CHECKING(for debug options)
AC_ARG_ENABLE(debug,
  [  --enable-debug=alot,norm   Enable debugging (disables optimizations)]
  [                           [default=no]],
    CONFIG_DEBUG="${enableval}", CONFIG_DEBUG="no")

if test "x$GCC" = "xyes"; then
	DEBUG_NORM_OPT="-O -g -Wall"
	DEBUG_ANOYING="-Wbad-function-cast -Wcast-align \
		-Wcast-qual -Wchar-subscripts -Wconversion \
		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
		-Wredundant-decls -Wshadow -Wstrict-prototypes \
		-Wwrite-strings -Winline \
		-Wformat -Wswitch -Waggregate-return -Wmissing-noreturn \
		-Wimplicit-int -fno-builtin"

	case "${CONFIG_DEBUG}" in
	no)
		AC_DEFINE(NDEBUG, 1, no debug build)
		;;
	norm|yes)
		AC_DEFINE(ABORTFP, 1, debug define)
		OPTIMIZATION="${DEBUG_NORM_OPT}"
		;;
	anoying)
		AC_DEFINE(ABORTFP, 1, debug define)
		OPTIMIZATION="${DEBUG_NORM_OPT} ${DEBUG_ANOYING}"
		;;
	alot)
		AC_DEFINE(ABORTFP, 1, debug define)
		AC_DEFINE(DEBUG, 1, alot of debug output)
		OPTIMIZATION="${DEBUG_NORM_OPT}"
		;;
	*)
		AC_MSG_ERROR(bad value »${CONFIG_DEBUG}« for debug option)
	esac

	AC_MSG_RESULT(${CONFIG_DEBUG})
else
	AC_MSG_RESULT(no)
fi



dnl ###  system specific options  ###

##########################################################################
# LINUX on Digital/Compaq Alpha CPUs
##########################################################################
case $host in
alpha*-*-linux*)

################################################################
#### Check if 'ccc' is in our path
################################################################
if test "`which ccc 2>/dev/null | grep -c ccc`" != "0" ; then
	# Compaq's C Compiler
	CC=ccc

################################################################
#### set 'OPTIMIZATION = -arch host -tune host' 
####              to generate/tune instructions for this machine
####     'OPTIMIZATION += -migrate -fast -inline speed -unroll 0' 
####              tweak to run as fast as possible :)
####     'OPTIMIZATION += -w0' 
####              set warning and linking flags
################################################################
	OPTIMIZATION="-arch host -tune host"
	OPTIMIZATION="-migrate -fast -inline speed -unroll 0 $OPTIMIZATION"
	OPTIMIZATION="-w0 $OPTIMIZATION"


################################################################
#### to debug, uncomment
################################################################
	# For Debugging
	#OPTIMIZATION="-g3 $OPTIMIZATION"

################################################################
#### define __DECALPHA__ (i was getting re-declaration warnings
####   in machine.h
################################################################
	# Define DEC Alpha
	AC_DEFINE(__DECALPHA__, 1, we're on DEC Alpha)
fi  #  gcc or ccc?
;; # alpha


##########################################################################
# SunOS
##########################################################################
sparc-*-sunos4*)
	if test CC = "cc"; then
		OPTIMIZATION="-O -xCC"
		MAKEDEP="-xM"
		# for gcc, use instead:
		#   CC="gcc"
		#   OPTIMIZATION="-O"
		#   MAKEDEP="-M"
AC_MSG_WARN([Please contact lame@lists.sourceforge.net with the output of the configure run and the file config.cache. Thank you for your cooperation.])
	fi
;; #SunOS

##########################################################################
# SGI
##########################################################################
*-sgi-irix*)
	if test CC = "cc"; then
		OPTIMIZATION="-O3 -woff all"
	fi
;; # SGI

##########################################################################
# Compaq Alpha running Dec Unix (OSF)
##########################################################################
alpha*-dec-osf*)
	if test CC = "cc"; then
		OPTIMIZATION="-fast -O3 -std -g3 -non_shared"
	fi
;; #OSF
esac

# todo: include the following tests in the case-list
UNAME=`uname`
ARCH=`uname -m`

###########################################################################
# MOSXS (Rhapsody PPC)
###########################################################################
if test "$UNAME" = "Rhapsody"; then
#   CC="cc"   # should be handled already by autoconf
   MAKEDEP="-make"
fi

###########################################################################
# MAC OSX  Darwin PPC
###########################################################################
if test "$UNAME" = "Darwin"; then
   MAKEDEP="-make"
   CFLAGS="$CFLAGS -fno-common"
fi


##########################################################################
# OS/2
##########################################################################
# Properly installed EMX runtime & development package is a prerequisite.
# tools I used: make 3.76.1, uname 1.12, sed 2.05, PD-ksh 5.2.13
#
##########################################################################
if test "$UNAME" = "OS/2"; then
   SHELL=sh
   #CC=gcc # should already be handled by configure

   # file extension should already be handled by automake (I don't know,
   # please  give feedback!
   #FILE_EXTENSION=".exe"

# Uncomment & inspect the GTK lines to use MP3x GTK frame analyzer.
# Properly installed XFree86/devlibs & GTK+ is a prerequisite.
# The following works for me using Xfree86/OS2 3.3.5 and GTK+ 1.2.3:
#   AC_DEFINE(HAVE_GTK, 1, have GTK)
#   AC_DEFINE(__ST_MT_ERRNO__, 1)
#   INCLUDES="-IC:/XFree86/include/gtk12 -IC:/XFree86/include/glib12 \
#             -IC:/XFree86/include $INCLUDES"
#   FRONTEND_LDFLAGS="-LC:/XFree86/lib -lgtk12 -lgdk12 -lgmodule -lglib12 \
#             -lXext -lX11 -lshm -lbsd -lsocket -lm $FRONTEND_LDFLAGS"
#   FRONTEND_CFLAGS="-Zmtd -Zsysv-signals -Zbin-files $FRONTEND_CFLAGS"
fi

###########################################################################
# AmigaOS
###########################################################################
# Type 'Make ARCH=PPC' for PowerUP and 'Make ARCH=WOS' for WarpOS
#
###########################################################################
if test "$UNAME" = "AmigaOS" ; then
	CC="gcc -noixemul"
	OPTIMIZATION="$OPTIMIZATION -m68020-60 -m68881"
	MAKEDEP="-MM"
	if test "$ARCH" = "WOS"; then
		CC="ppc-amigaos-gcc -warpup"
		OPTIMIZATION="$OPTIMIZATION -mmultiple -mcpu=603e"
		AR="ppc-amigaos-ar"
		RANLIB="ppc-amigaos-ranlib"
	fi
	if test "$ARCH",PPC; then
		CC="ppc-amigaos-gcc"
		OPTIMIZATION="$OPTIMIZATION -mmultiple -mcpu=603e"
		AR="ppc-amigaos-ar"
		RANLIB="ppc-amigaos-ranlib"
	fi
fi


CFLAGS="${OPTIMIZATION} ${CFLAGS}"
LDADD="${LDADD}"
FRONTEND_LDADD="${FRONTEND_LDADD} ${CONFIG_MATH_LIB}"


AC_SUBST(INCLUDES)

AC_SUBST(FRONTEND_LDFLAGS)
AC_SUBST(FRONTEND_CFLAGS)
AC_SUBST(FRONTEND_LDADD)
AC_SUBST(LDADD)

AC_SUBST(LIB_MAJOR_VERSION)
AC_SUBST(LIB_MINOR_VERSION)

AC_SUBST(NASM)
AC_SUBST(NASM_FORMAT)

AC_SUBST(MAKEDEP)
AC_SUBST(RM_F)

AC_SUBST(LIBTOOL_DEPS)

AC_SUBST(WITH_FRONTEND)
AC_SUBST(WITH_MP3X)
AC_SUBST(WITH_MP3RTP)

AC_SUBST(CPUTYPE)

AC_SUBST(CONFIG_DEFS)

AC_CONFIG_FILES([Makefile libmp3lame/Makefile libmp3lame/i386/Makefile frontend/Makefile mpglib/Makefile doc/Makefile doc/html/Makefile doc/man/Makefile include/Makefile Dll/Makefile misc/Makefile debian/Makefile dshow/Makefile ACM/Makefile ACM/ADbg/Makefile ACM/ddk/Makefile ACM/tinyxml/Makefile lame.spec mac/Makefile])
AC_OUTPUT