AC_INIT(yabause, 0.9.2) AC_CANONICAL_HOST AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(yabause, 0.9.2) AC_PROG_RANLIB AC_PROG_CC AC_PROG_INSTALL AC_LANG(C) AC_C_BIGENDIAN case $target in *darwin*) OLDLDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -framework SDL" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ int t(void) { return 0; } ]],[[ int foo = t(); ]])],[AC_DEFINE(HAVE_LIBSDL) SDL_LIBS="-framework SDL"], []) LDFLAGS="$OLDLDFLAGS" ;; *) AC_PATH_PROGS(HAVE_LIBSDL, [sdl-config sdl11-config]) if test ! x$HAVE_LIBSDL = x ; then SDL_CFLAGS=`$HAVE_LIBSDL --cflags` SDL_LIBS=`$HAVE_LIBSDL --libs` AC_DEFINE(HAVE_LIBSDL) fi ;; esac CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" use_opengl=yes AC_ARG_WITH(opengl, AC_HELP_STRING(--without-opengl, don't use OpenGL), [use_opengl=$withval]) case $target in *darwin*) yabause_arch=macosx;; *linux*) yabause_arch=linux;; *cygwin*) yabause_arch=windows;; *mingw32*) AC_CHECK_HEADERS("wnaspi32.h", [], [], [#include ]) yabause_arch=windows ;; *freebsd*) yabause_arch=freebsd;; *netbsd* | *openbsd*) yabause_arch=netbsd;; *) yabause_arch=".";; esac AC_SUBST(yabause_arch) case $target in *darwin*) YAB_LIBS="$YAB_LIBS -framework IOKit -framework Carbon -framework AGL -framework OpenGL" AC_DEFINE(HAVE_LIBGL) yabause_yui="carbon" CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" ;; *cygwin*) YAB_LIBS="$YAB_LIBS -lopengl32 -lglut32" AC_DEFINE(_WIN32_IE, 0x0400) AC_DEFINE(HAVE_LIBGL) yabause_yui="." ;; *mingw32*) YAB_LIBS="$YAB_LIBS -lopengl32 -lglut32" AC_DEFINE(_WIN32_IE, 0x0400) AC_DEFINE(HAVE_LIBGL) yabause_yui="windows" ;; *linux* | *bsd*) yabause_yui="." AC_CHECK_TOOL(HAVE_PKG, pkg-config) if test ! x$HAVE_PKG = x ; then if test x$use_opengl = xyes ; then if `$HAVE_PKG gtkglext-1.0` ; then yabause_yui="gtk" GTK_CFLAGS=`$HAVE_PKG gtkglext-1.0 --cflags` GTK_LIBS=`$HAVE_PKG gtkglext-1.0 --libs` AC_PATH_XTRA LIBS="$LIBS $X_LIBS" CFLAGS="$CFLAGS $X_CFLAGS" AC_CHECK_LIB(GL, glEnable, [ LIBS="$LIBS -lGL" AC_DEFINE(HAVE_LIBGL) ],, $LIBS) AC_CHECK_LIB(glut, glutGetModifiers,[ LIBS="$LIBS -lglut" AC_DEFINE(HAVE_LIBGLUT)],, $LIBS) else AC_MSG_ERROR([cannot use OpenGL if gtkglext is not installed (either install it or pass --without-opengl to configure)]) fi else if `$HAVE_PKG gtk+-2.0` ; then yabause_yui="gtk" GTK_CFLAGS=`$HAVE_PKG gtk+-2.0 --cflags` GTK_LIBS=`$HAVE_PKG gtk+-2.0 --libs` fi fi fi YAB_CFLAGS="$CFLAGS $GTK_CFLAGS" YAB_LIBS="$LIBS $GTK_LIBS" AC_SUBST(YAB_CFLAGS) AC_SUBST(YAB_LIBS) ;; *) AC_CHECK_LIB(GL, glEnable, [], [AC_MSG_ERROR("You need to install OpenGL") ], $YAB_LIBS) AC_CHECK_LIB(glut, glutGetModifiers, [], [], $YAB_LIBS) yabause_yui="." ;; esac AC_SUBST(yabause_yui) AC_MSG_CHECKING([[whether the compiled supports c99 variadic macros]]) AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#define MACRO(...) puts(__VA_ARGS__)]], [[MACRO("foo");]]), AC_DEFINE(HAVE_C99_VARIADIC_MACROS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) compile_c68k=yes AC_ARG_WITH(c68k, AC_HELP_STRING(--without-c68k, don't compile C68k), [compile_c68k=$withval]) if test x$compile_c68k = xyes ; then AC_DEFINE(HAVE_C68K) fi AM_CONDITIONAL(COMPILE_C68K, test x$compile_c68k = xyes) AC_ARG_ENABLE(debug, AC_HELP_STRING(--enable-debug, enable general debug information) , AC_DEFINE(DEBUG)) AC_ARG_ENABLE(vdp1-debug, AC_HELP_STRING(--enable-vdp1-debug, enable vdp1 debug information) , AC_DEFINE(VDP1_DEBUG)) AC_ARG_ENABLE(vdp2-debug, AC_HELP_STRING(--enable-vdp2-debug, enable vdp2 debug information) , AC_DEFINE(VDP2_DEBUG)) AC_ARG_ENABLE(cd-debug, AC_HELP_STRING(--enable-cd-debug, enable cdblock debug information) , AC_DEFINE(CDDEBUG)) AC_ARG_ENABLE(smpc-debug, AC_HELP_STRING(--enable-smpc-debug, enable smpc debug information) , AC_DEFINE(SMPC_DEBUG)) AC_ARG_ENABLE(scsp-debug, AC_HELP_STRING(--enable-scsp-debug, enable scsp debug information) , AC_DEFINE(SCSP_DEBUG)) AC_ARG_ENABLE(newperinterface, AC_HELP_STRING(--enable-newperinterface, use new controls interface) , AC_DEFINE(USENEWPERINTERFACE)) AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile src/c68k/Makefile src/carbon/Makefile src/dreamcast/Makefile src/gtk/Makefile src/windows/Makefile autopackage/default.apspec ]) AM_CONDITIONAL([YUI_IS_CARBON], [test ${yabause_yui} = "carbon"]) AM_CONDITIONAL([YUI_IS_DREAMCAST], [test ${yabause_yui} = "dreamcast"]) AM_CONDITIONAL([YUI_IS_GTK], [test ${yabause_yui} = "gtk"]) AM_CONDITIONAL([YUI_IS_WINDOWS], [test ${yabause_yui} = "windows"]) AM_CONDITIONAL([ARCH_IS_FREEBSD], [test ${yabause_arch} = "freebsd"]) AM_CONDITIONAL([ARCH_IS_LINUX], [test ${yabause_arch} = "linux"]) AM_CONDITIONAL([ARCH_IS_MACOSX], [test ${yabause_arch} = "macosx"]) AM_CONDITIONAL([ARCH_IS_NETBSD], [test ${yabause_arch} = "netbsd"]) AM_CONDITIONAL([ARCH_IS_WINDOWS], [test ${yabause_arch} = "windows"]) AC_OUTPUT