Diablo-D3's autoconf rework
This commit is contained in:
@@ -15,13 +15,22 @@ dnl See also: remarks supplied in the debug checking area below
|
||||
|
||||
AC_INIT(init.asm)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
ISODATE=`date +%Y-%m-%d`
|
||||
AC_SUBST(ISODATE)
|
||||
VERSION=1.36
|
||||
AC_SUBST(VERSION)
|
||||
AC_ARG_WITH(nasm-prefix,[ --with-nasm-prefix=PFX Prefix where nasm is installed (optional)], nasm_prefix="$withval", nasm_prefix="")
|
||||
|
||||
dnl -- Where is our compiler, and who are we compiling for?
|
||||
CFLAGS="-pipe -I. -Wall"
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_PROG_CC
|
||||
AC_PATH_PROG(NASMPATH,nasm,[AC_MSG_ERROR(nasm 0.98 is required)])
|
||||
AC_CHECK_TOOL(NASMPATH,nasm,"no",[$nasm_prefix:$PATH])
|
||||
if test x$nasmpath = xno; then
|
||||
AC_MSG_ERROR(You need NASM installed to compile ZSNES)
|
||||
fi
|
||||
NFLAGS="$NFLAGS -w-orphan-labels"
|
||||
AC_PROG_INSTALL
|
||||
AC_CANONICAL_SYSTEM
|
||||
case "$target" in
|
||||
*-*-linux*)
|
||||
CFLAGS="$CFLAGS -D__LINUX__"
|
||||
@@ -44,87 +53,50 @@ case "$target" in
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Checks for X.
|
||||
|
||||
dnl -- Do we have X, and where is it? Needed for Mesa Checking
|
||||
|
||||
AC_PATH_X
|
||||
CFLAGS="$CFLAGS -I$x_includes"
|
||||
LDFLAGS="$LDFLAGS -L$x_libraries"
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
dnl -- Where is libSDL and zlib, and do we want/have libPNG and OpenGL support?
|
||||
|
||||
AM_PATH_SDL(1.2.0,,[AC_MSG_ERROR(SDL >= 1.2.0 is required)])
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
LDFLAGS="$LDFLAGS $SDL_LIBS"
|
||||
AM_PATH_ZLIB(1.1.0,,[AC_MSG_ERROR(ZLIB >= 1.1.0 is required)])
|
||||
AM_PATH_LIBPNG(1.0.0,,)
|
||||
|
||||
AC_MSG_CHECKING(for zlib)
|
||||
with_zlib=no
|
||||
AC_TRY_COMPILE([
|
||||
#include <zlib.h>
|
||||
/* Doesnt ac-try-compile ROCK? */
|
||||
],[
|
||||
],[
|
||||
with_zlib=yes
|
||||
])
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS $ZLIB_CFLAGS $LIBPNG_CFLAGS"
|
||||
LDFLAGS="$LDFLAGS $SDL_LIBS $ZLIB_LIBS $LIBPNG_LIBS"
|
||||
|
||||
if test x$with_zlib = xyes; then
|
||||
LDFLAGS="$LDFLAGS -lz"
|
||||
AC_MSG_RESULT(yes)
|
||||
if test x$with_libpng != xyes; then
|
||||
CFLAGS="$CFLAGS -DNO_PNG"
|
||||
NFLAGS="$NFLAGS -DNO_PNG"
|
||||
fi
|
||||
|
||||
dnl -- opengl stuff
|
||||
AC_ARG_ENABLE(opengl,[ --disable-opengl Build without opengl support],,enable_opengl=yes)
|
||||
AC_ARG_WITH(opengl-prefix,[ --with-opengl-prefix=PFX Prefix where opengl is installed (optional)], opengl_prefix="$withval", opengl_prefix="")
|
||||
|
||||
if test x$enable_opengl != xno; then
|
||||
AC_PATH_X
|
||||
CFLAGS="$CFLAGS -I$opengl_prefix/includes -I$x_includes"
|
||||
LDFLAGS="$LDFLAGS -L$opengl_prefix/lib -L$x_libraries"
|
||||
AC_CHECK_LIB(GL, glGetError,found_opengl="yes",,)
|
||||
if test x$found_opengl = xyes; then
|
||||
echo checking for OpenGL... yes
|
||||
LDFLAGS="$LDFLAGS -lGL"
|
||||
CFLAGS="$CFLAGS -D__OPENGL__"
|
||||
NFLAGS="$NFLAGS -D__OPENGL__"
|
||||
GL_DRAW="\${WINDIR}/gl_draw.o"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR(zlib is required)
|
||||
echo checking for OpenGL... no
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(opengl,[ --without-opengl Build without OpenGL support ],with_opengl=$withval)
|
||||
AC_MSG_CHECKING(for OpenGL support)
|
||||
if test x$with_opengl != xno; then
|
||||
with_opengl=no
|
||||
AC_TRY_COMPILE([
|
||||
#include <GL/gl.h>
|
||||
/* Doesnt ac-try-compile ROCK? */
|
||||
],[
|
||||
],[
|
||||
with_opengl=yes
|
||||
])
|
||||
AC_MSG_RESULT($with_opengl)
|
||||
if test x$with_opengl = xyes; then
|
||||
LDFLAGS="$LDFLAGS -lGL"
|
||||
CFLAGS="$CFLAGS -D__OPENGL__"
|
||||
NFLAGS="$NFLAGS -D__OPENGL__"
|
||||
GL_DRAW="\${WINDIR}/gl_draw.o"
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(disabled by user)
|
||||
echo checking for OpenGL... disabled by user
|
||||
fi
|
||||
dnl --
|
||||
|
||||
|
||||
|
||||
AC_ARG_WITH(png, [ --without-png Build without PNG screenshot support ],with_png=$withval)
|
||||
AC_MSG_CHECKING(for libPNG support)
|
||||
if test x$with_png != xno; then
|
||||
with_png=no
|
||||
AC_TRY_COMPILE([
|
||||
#include <png.h>
|
||||
/* Doesnt ac-try-compile ROCK? */
|
||||
],[
|
||||
],[
|
||||
with_png=yes
|
||||
])
|
||||
AC_MSG_RESULT($with_png)
|
||||
if test x$with_png = xyes; then
|
||||
LDFLAGS="$LDFLAGS -lpng"
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(disabled by user)
|
||||
fi
|
||||
if test x$with_png != xyes; then
|
||||
CFLAGS="$CFLAGS -DNO_PNG"
|
||||
NFLAGS="$NFLAGS -DNO_PNG"
|
||||
fi
|
||||
dnl -- Various debug and optimization option checks
|
||||
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug Build GDB Friendly binary (zsnes-debug) ],debug=yes)
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug Build GDB Friendly binary (zsnesd) ],debug=yes)
|
||||
AC_MSG_CHECKING(if you want gdb friendly executable)
|
||||
if test x$debug = xyes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
@@ -143,7 +115,7 @@ else
|
||||
dnl zsnes more easily deal with small instruction caches, and more
|
||||
dnl effectivly use branch prediction.
|
||||
|
||||
CFLAGS="$CFLAGS -Os -ffast-math -fomit-frame-pointer -fschedule-insns2 -s"
|
||||
CFLAGS="$CFLAGS -Os -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop -ffast-math -fomit-frame-pointer -fstrength-reduce -fthread-jumps -fschedule-insns2 -s"
|
||||
ZSNESEXE="zsnes"
|
||||
fi
|
||||
|
||||
@@ -173,22 +145,40 @@ else
|
||||
fi
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/ioctl.h unistd.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
AC_HEADER_TIME
|
||||
AC_CHECK_HEADERS(sys/time.h)
|
||||
AC_HEADER_MAJOR
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_SUBST(ZSNESEXE)
|
||||
AC_SUBST(GL_DRAW)
|
||||
AC_SUBST(NFLAGS)
|
||||
AC_SUBST(NASMPATH)
|
||||
AC_OUTPUT(Makefile)
|
||||
echo
|
||||
echo You may now run make to compile $ZSNESEXE
|
||||
echo Make sure you use GNU make when compiling.
|
||||
echo
|
||||
echo
|
||||
echo ZSNES v$VERSION
|
||||
echo
|
||||
echo "SDL support Version `$SDL_CONFIG --version`"
|
||||
echo "NASM support `nasm -r`"
|
||||
echo "ZLib support Version $ZLIB_VERSION"
|
||||
if test "$with_libpng" = "yes"; then
|
||||
echo "PNG support (png screenshots) Yes, version $LIBPNG_VERSION"
|
||||
elif test "$enable_libpng" = "no"; then
|
||||
echo "PNG support Disabled by user"
|
||||
else
|
||||
echo "PNG support Disabled, library not found"
|
||||
fi
|
||||
if test "$found_opengl" = "yes"; then
|
||||
echo "OpenGL support Yes"
|
||||
elif test "$enable_opengl" = "no"; then
|
||||
echo "OpenGL support Disabled by user"
|
||||
else
|
||||
echo "OpenGL support Disabled, library not found"
|
||||
fi
|
||||
echo
|
||||
echo The binary will be installed in $prefix/bin
|
||||
echo
|
||||
echo Configure complete, now type \'make\' and pray.
|
||||
echo
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user