2003-02-20 00:38:59 +00:00
|
|
|
# only tested with autoconf 2.57
|
|
|
|
|
AC_PREREQ(2.53)
|
|
|
|
|
AC_INIT(src/StepMania.cpp)
|
|
|
|
|
AC_CONFIG_AUX_DIR(autoconf)
|
|
|
|
|
AC_CANONICAL_TARGET
|
|
|
|
|
|
|
|
|
|
AM_INIT_AUTOMAKE(StepMania, 3.001)
|
|
|
|
|
AM_CONFIG_HEADER(src/config.h)
|
2003-12-24 04:28:20 +00:00
|
|
|
AM_MAINTAINER_MODE
|
2003-02-20 00:38:59 +00:00
|
|
|
|
2003-05-05 06:27:53 +00:00
|
|
|
# We don't want PROG_CC/CXX default settings, but don't ignore explicit settings.
|
|
|
|
|
test -z "$CFLAGS" && DEFAULT_CFLAGS=yes
|
|
|
|
|
test -z "$CXXFLAGS" && DEFAULT_CXXFLAGS=yes
|
|
|
|
|
test -z "$LDFLAGS" && DEFAULT_LDFLAGS=yes
|
|
|
|
|
|
|
|
|
|
AC_PROG_CC
|
|
|
|
|
AC_PROG_CXX
|
2004-03-20 21:47:09 +00:00
|
|
|
AC_PROG_RANLIB
|
2003-05-05 06:27:53 +00:00
|
|
|
|
2003-09-19 00:54:38 +00:00
|
|
|
test "$DEFAULT_CFLAGS" = "yes" && CFLAGS="-Wall -W -Wno-unused -Wno-switch"
|
|
|
|
|
test "$DEFAULT_CXXFLAGS" = "yes" && CXXFLAGS="-Wall -W -Wno-unused -Wno-switch"
|
2003-05-05 06:27:53 +00:00
|
|
|
test "$DEFAULT_LDFLAGS" = "yes" && LDFLAGS=""
|
|
|
|
|
|
2003-10-22 21:32:22 +00:00
|
|
|
compile=release
|
2003-10-06 05:02:59 +00:00
|
|
|
AC_ARG_WITH(debug, AC_HELP_STRING([--with-debug], [Enable debug mode]), with_debug=$withval, with_debug=no)
|
2003-10-22 21:32:22 +00:00
|
|
|
AC_ARG_WITH(fast-compile, AC_HELP_STRING([--with-fast-compile], [Enable fast compile]), with_fast_compile=$withval, with_fast_compile=no)
|
2003-10-06 05:02:59 +00:00
|
|
|
if test "$with_debug" = "yes"; then
|
2003-10-22 21:32:22 +00:00
|
|
|
compile=debug
|
|
|
|
|
fi
|
|
|
|
|
if test "$with_fast_compile" = "yes"; then
|
|
|
|
|
compile=fast
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
case $compile in
|
|
|
|
|
release)
|
2003-10-06 05:02:59 +00:00
|
|
|
test "$DEFAULT_CFLAGS" = "yes" && CFLAGS="$CFLAGS -O3"
|
|
|
|
|
test "$DEFAULT_CXXFLAGS" = "yes" && CXXFLAGS="$CXXFLAGS -O3"
|
2003-10-22 21:32:22 +00:00
|
|
|
;;
|
|
|
|
|
debug)
|
|
|
|
|
test "$DEFAULT_CFLAGS" = "yes" && CFLAGS="$CFLAGS -g"
|
|
|
|
|
test "$DEFAULT_CXXFLAGS" = "yes" && CXXFLAGS="$CXXFLAGS -g"
|
|
|
|
|
;;
|
|
|
|
|
fast)
|
|
|
|
|
test "$DEFAULT_CFLAGS" = "yes" && CFLAGS="$CFLAGS -O2 -fno-inline"
|
|
|
|
|
test "$DEFAULT_CXXFLAGS" = "yes" && CXXFLAGS="$CXXFLAGS -O2 -fno-inline"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
2004-06-15 05:13:01 +00:00
|
|
|
# Define UNIX for all Unix-like systems. Don't define it for cross-compiling to
|
|
|
|
|
# non-Unix-like systems. (-DUNIX selects the archutils and ArchHooks to use; if
|
|
|
|
|
# your platform doesn't use the Unix ones, you probably don't want to define UNIX.)
|
|
|
|
|
case $host in
|
|
|
|
|
*-linux-*)
|
|
|
|
|
AC_DEFINE(LINUX, 1, [Linux])
|
|
|
|
|
AC_DEFINE(UNIX, 1, [Unix])
|
|
|
|
|
linux=yes
|
|
|
|
|
unix=yes
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*)
|
|
|
|
|
AC_DEFINE(UNIX, 1, [Unix])
|
|
|
|
|
unix=yes
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
AM_CONDITIONAL(UNIX, test "$unix" = "yes" )
|
|
|
|
|
AM_CONDITIONAL(LINUX, test "$linux" = "yes" )
|
|
|
|
|
|
|
|
|
|
# Define macros for individual CPU types, for a few bits of inline assembly.
|
|
|
|
|
# This is for major, compatible CPU classes--"CPU_X86" includes P2, P3, P4,
|
|
|
|
|
# AMD, etc. If you need CPU-specific assembly, check at runtime--don't create
|
|
|
|
|
# separate binaries for each CPU if the binaries themselves are otherwise
|
|
|
|
|
# compatible.
|
|
|
|
|
case $host in
|
|
|
|
|
i?86-*)
|
|
|
|
|
AC_DEFINE(CPU_X86, 1, [x86])
|
|
|
|
|
;;
|
2004-06-15 22:44:00 +00:00
|
|
|
x86_64-*)
|
|
|
|
|
AC_DEFINE(CPU_X86_64, 1, [x86-64])
|
|
|
|
|
;;
|
2004-06-15 05:13:01 +00:00
|
|
|
powerpc-*)
|
|
|
|
|
AC_DEFINE(CPU_PPC, 1, [PPC])
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
2004-06-12 07:57:34 +00:00
|
|
|
AC_C_BIGENDIAN(
|
|
|
|
|
AC_DEFINE(ENDIAN_BIG, 1, [Big endian]),
|
|
|
|
|
AC_DEFINE(ENDIAN_LITTLE, 1, [Little endian]),
|
|
|
|
|
AC_MSG_ERROR([Can't determine endianness]) )
|
|
|
|
|
|
2003-10-22 21:32:22 +00:00
|
|
|
AC_ARG_WITH(prof, AC_HELP_STRING([--with-prof], [Enable profiling]), with_prof=$withval, with_prof=no)
|
|
|
|
|
if test "$with_prof" = "yes"; then
|
|
|
|
|
test "$DEFAULT_CFLAGS" = "yes" && CFLAGS="$CFLAGS -pg"
|
|
|
|
|
test "$DEFAULT_CXXFLAGS" = "yes" && CXXFLAGS="$CXXFLAGS -pg"
|
|
|
|
|
test "$DEFAULT_LDFLAGS" = "yes" && LDFLAGS="$LDFLAGS -pg"
|
2003-10-06 05:02:59 +00:00
|
|
|
fi
|
|
|
|
|
|
2004-03-15 02:26:34 +00:00
|
|
|
SM_X_WITH_OPENGL
|
2003-02-20 00:38:59 +00:00
|
|
|
|
2005-06-02 23:17:34 +00:00
|
|
|
AC_ARG_ENABLE(sdl, AC_HELP_STRING([--enable-sdl], [Enable SDL support]), enable_sdl=$enableval, enable_sdl=no)
|
|
|
|
|
if test "$enable_sdl" = "yes"; then
|
|
|
|
|
AM_PATH_SDL(1.2.6,have_sdl=yes,have_sdl=no)
|
|
|
|
|
fi
|
2004-06-14 04:12:19 +00:00
|
|
|
AM_CONDITIONAL(HAVE_SDL, test "$have_sdl" = "yes")
|
|
|
|
|
if test "$have_sdl" = "yes"; then
|
|
|
|
|
AC_DEFINE(HAVE_SDL, 1, [SDL is available])
|
|
|
|
|
fi
|
2004-03-25 00:37:40 +00:00
|
|
|
|
2003-07-22 01:31:47 +00:00
|
|
|
# sdl-config puts -L/usr/lib in the library search path, which reorders things
|
|
|
|
|
# in a way that breaks some configurations.
|
2003-09-16 19:24:17 +00:00
|
|
|
# Does this still need to be in?
|
2003-09-16 22:26:17 +00:00
|
|
|
# not sure
|
|
|
|
|
# SDL_LIBS="`echo $SDL_LIBS | sed 's_-L/usr/lib/\?[[ $]]__'`"
|
2003-07-22 01:31:47 +00:00
|
|
|
|
2004-05-17 02:03:28 +00:00
|
|
|
have_libpng=yes
|
2004-06-11 01:41:17 +00:00
|
|
|
AC_CHECK_LIB(png, png_create_read_struct, [x=y], have_libpng=no, [-lz -lm]) # x=y to stop autoconf from messing with LIBS
|
2004-05-17 02:03:28 +00:00
|
|
|
AC_CHECK_HEADER(png.h, , have_libpng=no)
|
|
|
|
|
if test "$have_libpng" = "no"; then
|
|
|
|
|
echo
|
|
|
|
|
echo "*** libpng is required to build StepMania; please make sure that"
|
|
|
|
|
echo "*** it is installed to continue the build process."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2004-07-15 20:32:47 +00:00
|
|
|
LIBS="$LIBS -lpng -lz -lm"
|
2004-05-17 02:03:28 +00:00
|
|
|
|
2004-06-09 07:08:42 +00:00
|
|
|
AC_ARG_WITH(jpeg, AC_HELP_STRING([--without-jpeg], [Disable JPEG support]), with_jpeg=$withval, with_jpeg=yes)
|
|
|
|
|
|
2004-06-11 01:41:17 +00:00
|
|
|
if test "$with_jpeg" = "yes"; then
|
|
|
|
|
have_libjpeg=yes
|
2004-07-15 20:26:06 +00:00
|
|
|
AC_CHECK_LIB(jpeg, jpeg_read_scanlines, [x=y], have_libjpeg=no) # x=y to stop autoconf from messing with LIBS
|
2004-06-11 01:41:17 +00:00
|
|
|
AC_CHECK_HEADER(jpeglib.h, , have_libjpeg=no)
|
|
|
|
|
|
|
|
|
|
if test "$have_libjpeg" = "no"; then
|
|
|
|
|
# Require JPEG by default, so people don't compile without it
|
|
|
|
|
# by accident and then come asking us why files won't load.
|
2004-06-09 07:08:42 +00:00
|
|
|
AC_MSG_ERROR(
|
|
|
|
|
[libjpeg is required to build StepMania; please make sure that it is installed
|
|
|
|
|
to continue the build process. If you really want to compile without JPEG
|
|
|
|
|
support, pass the "--without-jpeg" flag to configure.])
|
|
|
|
|
fi
|
2004-06-11 01:41:17 +00:00
|
|
|
have_libjpeg=
|
|
|
|
|
|
2004-06-09 07:08:42 +00:00
|
|
|
LIBS="$LIBS -ljpeg"
|
2004-06-11 01:41:17 +00:00
|
|
|
else
|
|
|
|
|
AC_DEFINE(NO_JPEG_SUPPORT, 1, [JPEG support not available])
|
2004-02-13 10:42:22 +00:00
|
|
|
fi
|
|
|
|
|
|
2004-06-15 02:14:34 +00:00
|
|
|
AC_ARG_WITH(network, AC_HELP_STRING([--without-network], [Disable networking]), with_network=$withval, with_network=yes)
|
|
|
|
|
if test "$with_network" = "no"; then
|
|
|
|
|
AC_DEFINE(WITHOUT_NETWORKING, 1, [Networking support not available])
|
|
|
|
|
fi
|
|
|
|
|
AM_CONDITIONAL(WITHOUT_NETWORKING, test "$with_network" = "no")
|
|
|
|
|
|
2004-02-14 22:05:47 +00:00
|
|
|
SM_LUA
|
2003-12-10 08:14:48 +00:00
|
|
|
SM_ZLIB
|
2003-09-20 20:03:44 +00:00
|
|
|
SM_AUDIO
|
2004-09-09 02:25:28 +00:00
|
|
|
SM_TLS
|
2003-02-20 00:38:59 +00:00
|
|
|
|
2003-08-29 04:34:10 +00:00
|
|
|
AC_SEARCH_LIBS(avcodec_init, [avcodec], have_libavcodec=yes, have_libavcodec=no)
|
|
|
|
|
AC_SEARCH_LIBS(guess_format, [avformat], have_libavformat=yes, have_libavformat=no)
|
|
|
|
|
|
2003-11-03 21:17:45 +00:00
|
|
|
if test "$have_libavcodec" = "yes"; then
|
2004-08-06 23:58:54 +00:00
|
|
|
AC_MSG_CHECKING([for libavcodec >= 0.4.9])
|
2003-11-03 21:17:45 +00:00
|
|
|
AC_TRY_RUN([
|
|
|
|
|
#include <ffmpeg/avcodec.h>
|
|
|
|
|
int main()
|
|
|
|
|
{
|
2004-08-06 23:58:54 +00:00
|
|
|
return ( LIBAVCODEC_VERSION_INT < 0x000409 )? 1:0;
|
2003-11-03 21:17:45 +00:00
|
|
|
}
|
|
|
|
|
],,have_libavcodec=no,)
|
2004-04-01 10:21:08 +00:00
|
|
|
AC_MSG_RESULT($have_libavcodec)
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test "$have_libavformat" = "yes"; then
|
2004-08-06 23:58:54 +00:00
|
|
|
AC_MSG_CHECKING([for libavformat >= 0.4.9])
|
2004-04-01 10:21:08 +00:00
|
|
|
AC_TRY_RUN([
|
|
|
|
|
#include <ffmpeg/avformat.h>
|
|
|
|
|
int main()
|
|
|
|
|
{
|
2004-08-06 23:58:54 +00:00
|
|
|
return ( LIBAVFORMAT_VERSION_INT < 0x000409 )? 1:0;
|
2004-04-01 10:21:08 +00:00
|
|
|
}
|
|
|
|
|
],,have_libavformat=no,)
|
2003-11-03 21:17:45 +00:00
|
|
|
AC_MSG_RESULT($have_libavformat)
|
|
|
|
|
fi
|
|
|
|
|
|
2003-09-02 04:01:01 +00:00
|
|
|
have_ffmpeg=no
|
2003-08-29 04:34:10 +00:00
|
|
|
if test "$have_libavformat" = "yes" -a "$have_libavcodec" = "yes"; then
|
2003-09-02 04:01:01 +00:00
|
|
|
have_ffmpeg=yes
|
|
|
|
|
AC_DEFINE(HAVE_FFMPEG, 1, [FMPEG support available])
|
2003-08-29 04:34:10 +00:00
|
|
|
fi
|
2004-05-06 07:19:24 +00:00
|
|
|
AM_CONDITIONAL(HAVE_FFMPEG, test "$have_ffmpeg" = "yes")
|
2003-08-29 04:34:10 +00:00
|
|
|
|
2003-07-27 07:42:40 +00:00
|
|
|
SM_CHECK_CRASH_HANDLER
|
2003-02-20 00:38:59 +00:00
|
|
|
|
2003-07-06 22:13:56 +00:00
|
|
|
AM_PATH_ALSA(0.9.0,AC_DEFINE([HAVE_ALSA],1,[Define presence of ALSA]),alsa=false)
|
|
|
|
|
|
2004-11-04 23:47:48 +00:00
|
|
|
AM_ICONV
|
|
|
|
|
|
2003-07-24 06:05:52 +00:00
|
|
|
AC_ARG_ENABLE(gtk2, AC_HELP_STRING([--disable-gtk2], [Disable GTK support]), enable_gtk2=$enableval, enable_gtk2=yes)
|
2003-07-06 22:13:56 +00:00
|
|
|
|
|
|
|
|
if test x$enable_gtk2 = xyes; then
|
2003-07-24 06:05:52 +00:00
|
|
|
AM_PATH_GTK_2_0(2.0.0,AC_DEFINE([HAVE_GTK],1,[Define presence of GTK]),enable_gtk2=no)
|
2003-07-06 22:13:56 +00:00
|
|
|
fi
|
|
|
|
|
|
2004-04-02 20:49:10 +00:00
|
|
|
AC_CHECK_HEADER(sys/soundcard.h, [AC_DEFINE(HAVE_OSS, 1, [OSS support available])])
|
2004-05-06 09:25:15 +00:00
|
|
|
AC_CHECK_DECL(OSS_GETVERSION, AC_DEFINE([HAVE_OSS_GETVERSION],1,[OSS_GETVERSION is defined]), , [#include <sys/soundcard.h>])
|
2004-04-03 02:41:51 +00:00
|
|
|
AC_ARG_ENABLE(force-oss, AC_HELP_STRING([--enable-force-oss], [Force OSS]), force_oss=$enableval, force_oss=no)
|
2004-01-19 22:18:31 +00:00
|
|
|
AC_CHECK_HEADER(stdint.h, , [AC_DEFINE(MISSING_STDINT_H, 1, [stdint.h is missing])])
|
2004-06-13 07:34:20 +00:00
|
|
|
AC_CHECK_HEADERS([inttypes.h endian.h])
|
2003-09-02 19:28:43 +00:00
|
|
|
|
2004-01-20 00:09:12 +00:00
|
|
|
AC_MSG_CHECKING(if cstdlib breaks llabs)
|
|
|
|
|
AC_TRY_COMPILE( [#include <stdlib.h>
|
|
|
|
|
#include <cstdlib> ],
|
|
|
|
|
[int foo() { return llabs(1); }],
|
|
|
|
|
[AC_MSG_RESULT(no)],
|
|
|
|
|
[AC_MSG_RESULT(yes)
|
|
|
|
|
AC_DEFINE([NEED_CSTDLIB_WORKAROUND], 1, [cstdlib breaks llabs])]
|
|
|
|
|
)
|
|
|
|
|
|
2004-03-20 22:00:15 +00:00
|
|
|
AC_CHECK_LIB( pthread, pthread_create, AC_DEFINE([HAVE_LIBPTHREAD],1,[libpthread is available]) )
|
2004-03-20 21:47:09 +00:00
|
|
|
AC_CHECK_LIB( pthread, pthread_mutex_timedlock, AC_DEFINE([HAVE_PTHREAD_MUTEX_TIMEDLOCK],1,[pthreads has pthread_mutex_timedlock()]) )
|
2005-01-26 17:59:20 +00:00
|
|
|
AC_CHECK_LIB( pthread, pthread_cond_timedwait, AC_DEFINE([HAVE_PTHREAD_COND_TIMEDWAIT],1,[pthreads has pthread_cond_timedwait()]) )
|
2004-03-20 21:47:09 +00:00
|
|
|
|
2004-03-28 03:00:05 +00:00
|
|
|
# Always:
|
|
|
|
|
AC_DEFINE(_GNU_SOURCE, 1, [Use GNU extensions])
|
|
|
|
|
|
2003-07-06 22:13:56 +00:00
|
|
|
AM_CONDITIONAL(HAVE_ALSA, test x$alsa != xfalse )
|
2003-07-24 06:05:52 +00:00
|
|
|
AM_CONDITIONAL(HAVE_GTK, test "$enable_gtk2" != "no" )
|
2004-04-02 20:49:10 +00:00
|
|
|
AM_CONDITIONAL(HAVE_OSS, test x$ac_cv_header_sys_soundcard_h = xyes )
|
2003-07-27 07:42:40 +00:00
|
|
|
AM_CONDITIONAL(USE_CRASH_HANDLER, test "$use_crash_handler" = "yes" )
|
2003-05-01 09:52:53 +00:00
|
|
|
|
2004-04-02 20:49:10 +00:00
|
|
|
if test x$force_oss = xyes && test x$ac_cv_header_sys_soundcard_h = xyes; then
|
2004-04-01 10:21:08 +00:00
|
|
|
AC_DEFINE([FORCE_OSS], 1, [Force OSS Usage])
|
|
|
|
|
fi
|
|
|
|
|
|
2003-11-03 21:40:07 +00:00
|
|
|
AC_CHECK_DECL(powf, , AC_DEFINE([NEED_POWF],1,[Need powf]), [#include <math.h>])
|
|
|
|
|
AC_CHECK_DECL(sqrtf, , AC_DEFINE([NEED_SQRTF],1,[Need sqrtf]), [#include <math.h>])
|
|
|
|
|
AC_CHECK_DECL(sinf, , AC_DEFINE([NEED_SINF],1,[Need sinf]), [#include <math.h>])
|
|
|
|
|
AC_CHECK_DECL(tanf, , AC_DEFINE([NEED_COSF],1,[Need tanf]), [#include <math.h>])
|
|
|
|
|
AC_CHECK_DECL(cosf, , AC_DEFINE([NEED_TANF],1,[Need cosf]), [#include <math.h>])
|
|
|
|
|
AC_CHECK_DECL(acosf, , AC_DEFINE([NEED_ACOSF],1,[Need acosf]), [#include <math.h>])
|
|
|
|
|
AC_CHECK_DECL(roundf, , AC_DEFINE([NEED_ROUNDF],1,[Need roundf]), [#include <math.h>])
|
|
|
|
|
AC_CHECK_DECL(truncf, , AC_DEFINE([NEED_TRUNCF],1,[Need truncf]), [#include <math.h>])
|
|
|
|
|
|
|
|
|
|
# This doesn't work on glibc math functions:
|
|
|
|
|
# AC_CHECK_FUNCS([sqrtf sinf tanf cosf acosf roundf truncf])
|
2003-04-23 04:41:00 +00:00
|
|
|
|
2003-05-05 22:53:05 +00:00
|
|
|
AC_CHECK_DECLS([SIGPWR],,,[#include <signal.h>])
|
2003-05-05 22:21:06 +00:00
|
|
|
|
2004-02-18 01:19:01 +00:00
|
|
|
AC_ARG_ENABLE(tests, AC_HELP_STRING([--enable-tests], [Build test programs]), enable_tests=$enableval, enable_tests=no)
|
|
|
|
|
AM_CONDITIONAL(BUILD_TESTS, test "$enable_tests" = "yes" )
|
|
|
|
|
|
2004-02-11 05:44:59 +00:00
|
|
|
AC_CONFIG_FILES(Makefile)
|
|
|
|
|
AC_CONFIG_FILES(src/Makefile)
|
|
|
|
|
AC_OUTPUT
|