243 lines
6.2 KiB
Text
243 lines
6.2 KiB
Text
|
|
AC_INIT(configure.in)
|
|
AC_PREREQ([2.50])
|
|
dnl AC_CANONICAL_TARGET
|
|
|
|
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
|
|
|
AC_CHECK_HEADERS(zlib.h,, AC_MSG_ERROR(could not find zlib.h))
|
|
AC_CHECK_HEADERS(png.h,, AC_MSG_ERROR(could not find png.h))
|
|
|
|
EXE=
|
|
OUTFILE="\$(TOPDIR)/freecraft\$(EXE)"
|
|
OE=o
|
|
OBJDIR=obj
|
|
if test "`uname -a | grep -is cygwin`" -o "`uname -a | grep -is mingw`"; then
|
|
WIN32=1
|
|
EXE=.exe
|
|
OUTFILE="\$(TOPDIR)/freecraft\$(EXE)"
|
|
ARCH=win32
|
|
OBJDIR=winobj
|
|
PLATFORM="-DUSE_WIN32"
|
|
elif test "`uname -a | grep -is bsd`"; then
|
|
ARCH=bsd
|
|
PLATFORM="-DBSD"
|
|
elif test "`uname -a | grep -is beos`"; then
|
|
ARCH=beos
|
|
PLATFORM="-DUSE_BEOS"
|
|
else
|
|
ARCH=linux
|
|
fi
|
|
|
|
AC_ARG_ENABLE(win32,
|
|
[ --enable-win32 Force win32 (default: no)])
|
|
if test "$enable_win32" = "yes"; then
|
|
WIN32=1
|
|
EXE=.exe
|
|
OUTFILE="\$(TOPDIR)/freecraft\$(EXE)"
|
|
ARCH=win32
|
|
OBJDIR=winobj
|
|
PLATFORM="-DUSE_WIN32"
|
|
PATH="/usr/local/cross/bin:$PATH"
|
|
fi
|
|
AC_SUBST(EXE)
|
|
AC_SUBST(OUTFILE)
|
|
AC_SUBST(ARCH)
|
|
AC_SUBST(OE)
|
|
AC_SUBST(OBJDIR)
|
|
AC_SUBST(PLATFORM)
|
|
|
|
AC_ARG_ENABLE(static,
|
|
[ --enable-static Compile a static binary (default: no)])
|
|
if test "$enable_static" != "yes"; then
|
|
STATIC_LDFLAGS=
|
|
else
|
|
STATIC_LDFLAGS="-static"
|
|
fi
|
|
AC_SUBST(STATIC_LDFLAGS)
|
|
|
|
AC_ARG_ENABLE(profile,
|
|
[ --enable-profile Enable profiling support, implies --enable-debug (default: no)])
|
|
if test "$enable_profile" != "yes"; then
|
|
PROFILE_CFLAGS=""
|
|
else
|
|
PROFILE_CFLAGS="-pg"
|
|
fi
|
|
AC_SUBST(PROFILE_CFLAGS)
|
|
|
|
AC_ARG_ENABLE(debug,
|
|
[ --enable-debug [Enable debug, implies --disable-optimization (default: no)]])
|
|
if test "$enable_debug" != "yes" -a "$enable_profile" != "yes"; then
|
|
DEBUG_CFLAGS="-O2 -pipe -fsigned-char -fomit-frame-pointer -fconserve-space -fexpensive-optimizations -ffast-math"
|
|
else
|
|
DEBUG_CFLAGS="-g -O1 -fsigned-char -Wall -Werror -DDEBUG"
|
|
fi
|
|
AC_SUBST(DEBUG_CFLAGS)
|
|
|
|
dnl AC_ARG_ENABLE(optimization,
|
|
dnl [ --enable-optimization [Enable detection of optimization flags (default: no)]])
|
|
dnl FIXME: todo
|
|
|
|
AC_ARG_WITH(client,
|
|
[ --with-client=sdl,x11,svgalib
|
|
[Select which client (default: sdl)]])
|
|
THREAD_LIBS=
|
|
if test "$with_client" = "x11"; then
|
|
AC_CHECK_HEADERS(X11/Xlib.h,, AC_MSG_ERROR(could not find X11/Xlib.h))
|
|
VIDEO_CFLAGS="-DUSE_X11"
|
|
VIDEO_LIBS="-lXext -lX11 -L/usr/X11R6/lib -I/usr/X11R6/include"
|
|
if test "$PLATFORM" = "-DBSD"; then
|
|
THREAD_LIBS="-pthread"
|
|
else
|
|
THREAD_LIBS="-lpthread"
|
|
fi
|
|
elif test "$with_client" = "svgalib"; then
|
|
VIDEO_CFLAGS="-DUSE_SVGALIB"
|
|
VIDEO_LIBS="-lvga"
|
|
else
|
|
AC_CHECK_HEADERS(SDL/SDL.h,, AC_MSG_ERROR(could not find SDL/SDL.h))
|
|
VIDEO_CFLAGS="-DUSE_SDL -DUSE_SDLA `sdl-config --cflags`"
|
|
if test "$enable_static" != "yes"; then
|
|
VIDEO_LIBS="`sdl-config --libs`"
|
|
else
|
|
VIDEO_LIBS="`sdl-config --static-libs`"
|
|
fi
|
|
if test "$WIN32" = "1"; then
|
|
if test "`uname -a | grep -is cygwin`"; then
|
|
VIDEO_LIBS="$VIDEO_LIBS -lwsock32 -lws2_32"
|
|
else
|
|
VIDEO_LIBS="$VIDEO_LIBS -lwsock32 -lws2_32 -lmingwex -lgmon"
|
|
fi
|
|
fi
|
|
fi
|
|
AC_SUBST(VIDEO_CFLAGS)
|
|
AC_SUBST(VIDEO_LIBS)
|
|
AC_SUBST(THREAD_LIBS)
|
|
|
|
dnl --- CHECK FOR BZIP2 --------
|
|
AC_ARG_WITH(bzip2,
|
|
[ --with-bzip2 [Use bzip2 (default: enabled)]], BZIP2="$with_bzip2",)
|
|
if test "$BZIP2" != "no"; then
|
|
BZ2_CFLAGS="-DUSE_BZ2LIB"
|
|
BZ2_LIBS="-lbz2"
|
|
else
|
|
BZ2_CFLAGS=""
|
|
BZ2_LIBS=""
|
|
fi
|
|
AC_SUBST(BZ2_CFLAGS)
|
|
AC_SUBST(BZ2_LIBS)
|
|
dnl ----------------------------
|
|
|
|
dnl --- CHECK FOR ZZIPLIB ------
|
|
AC_ARG_WITH(zziplib,
|
|
[ --with-zziplib [Use zziplib (default: disabled)]], ZZIPLIB="$with_zziplib")
|
|
if test "$ZZIPLIB" != "yes"; then
|
|
ZZIPLIB_CFLAGS=""
|
|
ZZIPLIB_LIBS=""
|
|
else
|
|
ZZIPLIB_CFLAGS="-DUSE_ZZIPLIB"
|
|
ZZIPLIB_LIBS="-lzzip"
|
|
fi
|
|
AC_SUBST(ZZIPLIB_CFLAGS)
|
|
AC_SUBST(ZZIPLIB_LIBS)
|
|
dnl ----------------------------
|
|
|
|
dnl --- CHECK FOR WITH SOUND ---
|
|
AC_ARG_WITH(sound,
|
|
[ --with-sound [Use sound (default: yes)]], SOUND="$with_sound")
|
|
SOUND_CFLAGS=
|
|
if test "$SOUND" != "no"; then
|
|
SOUND_CFLAGS="-DWITH_SOUND"
|
|
fi
|
|
AC_SUBST(SOUND_CFLAGS)
|
|
dnl ----------------------------
|
|
|
|
dnl --- CHECK FOR OGG VORBIS ---
|
|
AC_ARG_WITH(ogg,
|
|
[ --with-ogg [Use ogg (default: autodetect)]], OGG="$with_ogg")
|
|
OGG_CFLAGS=
|
|
OGG_LIBS=
|
|
if test "$OGG" != "no"; then
|
|
OGG="yes"
|
|
AC_CHECK_HEADERS(ogg/ogg.h,, OGG=no)
|
|
AC_CHECK_HEADERS(vorbis/vorbisfile.h,, OGG=no)
|
|
if test "$OGG" != "no"; then
|
|
OGG_CFLAGS="-DUSE_OGG"
|
|
OGG_LIBS="-lvorbisfile -lvorbis -logg"
|
|
fi
|
|
fi
|
|
AC_SUBST(OGG_CFLAGS)
|
|
AC_SUBST(OGG_LIBS)
|
|
dnl ----------------------------
|
|
|
|
dnl --- CHECK FOR MAD LIB ------
|
|
AC_ARG_WITH(mad,
|
|
[ --with-mad [Use mad mp3 (default: autodetect)]], MAD="$with_mad")
|
|
MAD_CFLAGS=
|
|
MAD_LIBS=
|
|
if test "$MAD" != "no"; then
|
|
AC_CHECK_HEADERS(mad.h, MAD=yes, MAD=no)
|
|
if test "$MAD" != "no"; then
|
|
MAD_CFLAGS="-DUSE_MAD"
|
|
MAD_LIBS="-lmad"
|
|
fi
|
|
fi
|
|
AC_SUBST(MAD_CFLAGS)
|
|
AC_SUBST(MAD_LIBS)
|
|
dnl ----------------------------
|
|
|
|
dnl --- CHECK FOR FLAC LIB -----
|
|
AC_ARG_WITH(flac,
|
|
[ --with-flac [Use FLAC (default: autodetect)]], FLAC="$with_flac")
|
|
FLAC_CFLAGS=
|
|
FLAC_LIBS=
|
|
if test "$FLAC" != "no"; then
|
|
AC_CHECK_HEADERS(FLAC/all.h, FLAC=yes, FLAC=no)
|
|
if test "$FLAC" != "no"; then
|
|
FLAC_CFLAGS="-DUSE_FLAC"
|
|
FLAC_LIBS="-lFLAC"
|
|
fi
|
|
fi
|
|
AC_SUBST(FLAC_CFLAGS)
|
|
AC_SUBST(FLAC_LIBS)
|
|
dnl ----------------------------
|
|
|
|
dnl --- CHECK FOR CDAUDIO ------
|
|
AC_ARG_WITH(cdaudio,
|
|
[ --with-cdaudio=libcda,sdlcd,cdda,no
|
|
[Enable CD Audio support (default: platform-dependant)]], CDAUDIO="$with_cdaudio")
|
|
if test "$CDAUDIO" = "sdl"; then
|
|
CDAUDIO_CFLAGS="`sdl-config --cflags`"
|
|
if test "$enable_static" != "yes"; then
|
|
CDAUDIO_LIBS="`sdl-config --libs`"
|
|
else
|
|
CDAUDIO_LIBS="`sdl-config --static-libs`"
|
|
fi
|
|
elif test "$CDAUDIO" = "no" -o "$PLATFORM" = "-DBSD"; then
|
|
CDAUDIO_CFLAGS=""
|
|
CDAUDIO_LIBS=""
|
|
elif test "$CDAUDIO" = "cdda"; then
|
|
CDAUDIO_CFLAGS="-DUSE_CDDA"
|
|
CDAUDIO_LIBS=""
|
|
else
|
|
CDAUDIO_CFLAGS="-DUSE_LIBCDA"
|
|
CDAUDIO_LIBS=""
|
|
fi
|
|
AC_SUBST(CDAUDIO_CFLAGS)
|
|
AC_SUBST(CDAUDIO_LIBS)
|
|
dnl ----------------------------
|
|
|
|
if test "$prefix" = "NONE"; then
|
|
PREFIX=/usr/local
|
|
else
|
|
PREFIX="$prefix"
|
|
fi
|
|
AC_SUBST(PREFIX)
|
|
|
|
if test "$WIN32" = "1"; then
|
|
touch Rules.make
|
|
AC_CONFIG_FILES(Rules.make.WIN32:Rules.make.in)
|
|
else
|
|
AC_CONFIG_FILES(Rules.make)
|
|
fi
|
|
AC_OUTPUT
|