2006-11-22 18:57:04 +00:00
dnl --- Package name is first argument to AC_INIT
dnl --- Release version is second argument to AC_INIT
2006-04-06 20:41:56 +00:00
2009-01-23 14:21:28 +00:00
AC_INIT(desmume, [svn])
2006-04-06 20:41:56 +00:00
2006-11-22 18:57:04 +00:00
dnl -- find target architecture for some os specific libraries
AC_CANONICAL_TARGET
2006-06-07 22:00:48 +00:00
case $target in
2006-11-22 18:57:04 +00:00
*linux*) desmume_arch=linux;;
*mingw*) desmume_arch=windows;;
*darwin*) desmume_arch=linux;;
2006-11-30 22:19:57 +00:00
*bsd*) desmume_arch=linux;;
2006-06-07 22:00:48 +00:00
esac
AC_SUBST(desmume_arch)
2009-01-07 21:08:47 +00:00
AM_INIT_AUTOMAKE([1.10])
2007-06-29 08:51:17 +00:00
2008-09-08 08:06:35 +00:00
dnl -- make sure we have a c++ compiler
AC_PROG_CXX
2006-11-22 18:57:04 +00:00
dnl -- use ranlib for libraries
AC_PROG_RANLIB
2006-04-06 20:41:56 +00:00
2006-11-22 18:57:04 +00:00
dnl -- check for endianess
2006-04-06 20:41:56 +00:00
AC_C_BIGENDIAN
2006-11-22 18:57:04 +00:00
dnl --- Other prerequisites ---
2007-07-29 06:04:47 +00:00
dnl - Check for pkg-config macros
2007-06-29 08:51:17 +00:00
m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG])
2007-07-29 06:04:47 +00:00
dnl - Check for intltool/gettext macros
m4_ifdef([IT_PROG_INTLTOOL],[IT_PROG_INTLTOOL])
2006-11-22 18:57:04 +00:00
dnl - Check for zlib
2009-04-28 23:32:15 +00:00
AC_CHECK_LIB(z, gzopen, [], [AC_MSG_ERROR([zlib was not found, we can't go further. Please install it or specify the location where it's installed.])])
2006-11-22 18:57:04 +00:00
2007-01-07 21:38:23 +00:00
dnl - Check for zziplib
2009-04-30 19:31:35 +00:00
AC_CHECK_LIB(zzip, zzip_open, [
LIBS="-lzzip $LIBS"
AC_DEFINE([HAVE_LIBZZIP])
AC_MSG_CHECKING([[whether zzip use void * as second parameter]])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <zzip/lib.h>]], [[
void * v;
zzip_read(NULL, v, 0);]]),
AC_MSG_RESULT(yes),
AC_DEFINE([ZZIP_OLD_READ])
AC_MSG_RESULT(no))
])
2007-01-07 21:38:23 +00:00
2006-11-22 18:57:04 +00:00
dnl - Check for SDL
AC_PATH_PROGS(SDLCONFIG, [sdl-config sdl11-config])
if test ! "x$SDLCONFIG" = "x" ; then
SDL_CFLAGS=`$SDLCONFIG --cflags`
SDL_LIBS=`$SDLCONFIG --libs`
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
HAVE_SDL="yes"
else
HAVE_SDL="no"
fi
2007-04-17 16:52:20 +00:00
dnl - Check for the OpenGL includes
AC_CHECK_HEADERS([GL/gl.h])
AC_CHECK_HEADERS([GL/glu.h])
2009-01-03 23:37:26 +00:00
dnl - if --enable-osmesa is used, check for it
2009-03-27 12:50:47 +00:00
AC_ARG_ENABLE([osmesa],
[AC_HELP_STRING([--enable-osmesa], [use off-screen mesa])],
[osmesa=$enableval],
2009-04-23 20:15:37 +00:00
[osmesa=yes])
2009-03-27 12:50:47 +00:00
if test "x$osmesa" = "xyes" ; then
2009-04-11 19:54:40 +00:00
AC_CHECK_LIB(dl, main)
2009-04-26 06:46:31 +00:00
AC_CHECK_LIB([GL], main)
2009-03-27 12:50:47 +00:00
AC_CHECK_LIB(OSMesa, main,[
useosmesa=yes
AC_DEFINE(HAVE_LIBOSMESA)
LIBS="-lOSMesa $LIBS"
])
fi
2009-01-03 23:37:26 +00:00
2007-07-06 06:19:29 +00:00
dnl - Check for GTK and/or libglade
2008-11-02 21:45:51 +00:00
GLIB_VER=2.8
2008-11-04 22:03:26 +00:00
GTK_VER=2.6
2007-07-06 06:19:29 +00:00
AC_CHECK_TOOL(HAVE_PKG, pkg-config)
2007-07-17 05:15:07 +00:00
AC_PROVIDE_IFELSE([PKG_PROG_PKG_CONFIG], [
2007-07-06 06:19:29 +00:00
if test ! "x$HAVE_PKG" = "x" ; then
2008-11-02 21:45:51 +00:00
PKG_CHECK_MODULES(GLIB,
glib-2.0 >= $GLIB_VER,
HAVE_GLIB=yes,
HAVE_GLIB=no)
2007-07-06 06:19:29 +00:00
PKG_CHECK_MODULES(GTK,
2008-11-04 22:03:26 +00:00
gtk+-2.0 >= $GTK_VER,
2007-07-06 06:19:29 +00:00
HAVE_GTK=yes,
HAVE_GTK=no)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
PKG_CHECK_MODULES(GTKGLEXT,
"gtkglext-1.0",
HAVE_GTKGLEXT=yes,
HAVE_GTKGLEXT=no)
AC_SUBST(GTKGLEXT_CFLAGS)
AC_SUBST(GTKGLEXT_LIBS)
PKG_CHECK_MODULES(GTHREAD,
"gthread-2.0",
HAVE_GTHREAD=yes,
HAVE_GTHREAD=no)
AC_SUBST(GTHREAD_CFLAGS)
AC_SUBST(GTHREAD_LIBS)
PKG_CHECK_MODULES(LIBGLADE,
"libglade-2.0",
HAVE_LIBGLADE=yes,
HAVE_LIBGLADE=no)
AC_SUBST(LIBGLADE_CFLAGS)
AC_SUBST(LIBGLADE_LIBS)
dnl uninstalled glade ui dir
AC_DEFINE_UNQUOTED(GLADEUI_UNINSTALLED_DIR,"`pwd`/src/gtk-glade/glade/",[path to glade ui dir])
AC_SUBST(GLADEUI_UNINSTALLED_DIR)
fi
],[
echo "WARNING: pkg-config is not available therefore gtk and gtk-glade UIs are not available either."
])
dnl - If the gtkGLext package is available define the corresponding C macro
if test "x$HAVE_GTKGLEXT" = "xyes"; then
AC_DEFINE([GTKGLEXT_AVAILABLE], [1])
fi
2007-02-04 23:01:20 +00:00
2007-07-17 04:57:18 +00:00
dnl - Determine which UIs to build and if po/ should be included
PO_DIR=""
2007-07-17 05:24:00 +00:00
PO_FILES=""
PO_FILES_IN=""
2006-11-22 18:57:04 +00:00
if test "x$HAVE_SDL" = "xyes"; then
# SDL adds just a cli
UI_DIR="cli $UI_DIR"
if test "x$HAVE_GTK" = "xyes"; then
# GTK requires SDL
2007-01-04 00:03:52 +00:00
UI_DIR="gtk $UI_DIR"
2006-11-22 18:57:04 +00:00
fi
2007-01-05 01:12:31 +00:00
if test "x$HAVE_LIBGLADE" = "xyes"; then
2007-07-29 06:04:47 +00:00
AC_PROVIDE_IFELSE([IT_PROG_INTLTOOL],[
# libglade requires SDL too
UI_DIR="gtk-glade $UI_DIR"
dnl -- localization for gtk-glade UI
GETTEXT_PACKAGE=desmume
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define to the gettext package name])
AC_SUBST(GETTEXT_PACKAGE)
2007-09-15 06:22:38 +00:00
ALL_LINGUAS="fr pt_BR"
2007-07-29 06:04:47 +00:00
AM_GLIB_GNU_GETTEXT
PO_DIR="po"
PO_FILES="intltool-extract intltool-merge intltool-update"
PO_FILES_IN="intltool-extract.in intltool-merge.in intltool-update.in"
PO_MAKEFILE="po/Makefile.in"
],[
echo "WARNING: intltool and/or gettext are not available therefore the gtk-glade interface won't be installed. The gtk-glade UI requires intltool and gettext."
])
2007-01-05 01:12:31 +00:00
fi
2006-11-22 18:57:04 +00:00
fi
2006-04-06 20:41:56 +00:00
2007-07-04 00:38:38 +00:00
dnl Set compiler library flags per target.
2006-04-06 21:22:22 +00:00
case $target in
2007-07-01 20:07:35 +00:00
*linux* | *bsd*)
2009-01-03 23:37:26 +00:00
LIBS="$LIBS -lGLU"
2007-07-01 19:26:24 +00:00
;;
2006-11-22 18:57:04 +00:00
*mingw*)
2007-06-25 03:17:09 +00:00
LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -lopengl32 -lws2_32 -mwindows"
2006-11-22 18:57:04 +00:00
UI_DIR="windows"
;;
2007-07-01 19:26:24 +00:00
*darwin*)
LIBS="$LIBS -framework OpenGL"
;;
2006-04-06 21:22:22 +00:00
esac
2006-04-06 20:41:56 +00:00
2006-11-22 18:57:04 +00:00
AC_SUBST(UI_DIR)
2007-07-17 04:57:18 +00:00
AC_SUBST(PO_DIR)
2007-07-17 05:24:00 +00:00
AC_SUBST(PO_FILES)
AC_SUBST(PO_FILES_IN)
2006-11-22 18:57:04 +00:00
2008-10-18 07:49:51 +00:00
dnl - Gdb stub
AC_ARG_ENABLE(gdb-stub,
[AC_HELP_STRING(--enable-gdb-stub, enable gdb stub)],
2008-11-28 22:57:28 +00:00
[
AC_DEFINE(GDB_STUB)
wantgdbstub=yes
])
AM_CONDITIONAL([HAVE_GDB_STUB], [test "${wantgdbstub}" = "yes"])
2008-10-18 07:49:51 +00:00
2006-11-22 18:57:04 +00:00
dnl - Compiler warnings
# for developer use, enable lots of compile warnings,
# but don't require this generally, because some system's
# header files (BSD) can't handle it
#
# NB: must add -Werror after AC_PROG_CC, etc., so do this last
AC_ARG_ENABLE(hardcore,
2008-10-18 07:49:51 +00:00
[AC_HELP_STRING(--enable-hardcore, turn on -W -Wall -Werror)],
2006-11-22 18:57:04 +00:00
[case "${enableval}" in
yes) ENABLE_HARDCORE=1 ;;
no) ENABLE_HARDCORE=0 ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-hardcore) ;; esac],
[ENABLE_HARDCORE=0])
if test "x[$]ENABLE_HARDCORE" = "x1"; then
AC_MSG_WARN(enable hardcore compile warnings)
if test "x$CXX" = "x"; then
dnl - only valid for C with newer gcc's
CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
fi
2009-04-28 19:25:04 +00:00
CPPFLAGS="[$]CPPFLAGS -Wall -Wextra -D_FORTIFY_SOURCE=2 -Wno-missing-field-initializers -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -Wmissing-declarations -Wundef -Wmissing-noreturn -Wshadow -Wredundant-decls -Wformat-nonliteral -Wformat-security -Winit-self"
2006-11-22 18:57:04 +00:00
fi
dnl - Enable debug mode
AC_ARG_ENABLE(debug,
AC_HELP_STRING(--enable-debug, enable debug information),
AC_DEFINE(DEBUG))
2008-11-28 23:26:26 +00:00
AC_ARG_ENABLE(gpu-debug,
AC_HELP_STRING(--enable-gpu-debug, enable gpu debug information),
AC_DEFINE(GPUDEBUG))
AC_ARG_ENABLE(div-debug,
AC_HELP_STRING(--enable-div-debug, enable div debug information),
AC_DEFINE(DIVDEBUG))
AC_ARG_ENABLE(sqrt-debug,
AC_HELP_STRING(--enable-sqrt-debug, enable sqrt debug information),
AC_DEFINE(SQRTDEBUG))
AC_ARG_ENABLE(dma-debug,
AC_HELP_STRING(--enable-dma-debug, enable dma debug information),
AC_DEFINE(DMADEBUG))
2006-11-22 18:57:04 +00:00
2008-11-23 14:52:43 +00:00
dnl - Enable memory profiling
AC_ARG_ENABLE(memory-profiling,
AC_HELP_STRING(--enable-memory-profiling, enable memory profiling information),
AC_DEFINE(PROFILE_MEMORY_ACCESS))
2006-11-22 18:57:04 +00:00
dnl -- set maintainer mode
AM_MAINTAINER_MODE
AC_SUBST(USE_MAINTAINER_MODE)
2006-05-02 15:10:27 +00:00
2006-11-22 18:57:04 +00:00
dnl --- Finally, output all the makefiles
2006-04-06 20:41:56 +00:00
AC_CONFIG_FILES([Makefile
2007-07-17 06:13:00 +00:00
${PO_MAKEFILE}
2006-11-22 18:57:04 +00:00
src/Makefile
src/cli/Makefile
2008-12-22 23:53:34 +00:00
src/cli/doc/Makefile
2007-08-11 23:45:06 +00:00
src/cocoa/Makefile
2006-11-22 18:57:04 +00:00
src/gtk/Makefile
2008-12-22 23:53:34 +00:00
src/gtk/doc/Makefile
2007-01-05 01:12:31 +00:00
src/gtk-glade/Makefile
2008-12-22 23:53:34 +00:00
src/gtk-glade/doc/Makefile
2006-11-22 18:57:04 +00:00
src/windows/Makefile
2007-06-07 10:00:52 +00:00
src/gdbstub/Makefile
2006-12-23 21:26:21 +00:00
autopackage/default.apspec
2006-04-06 20:41:56 +00:00
])
AC_OUTPUT