diff --git a/desmume/configure.ac b/desmume/configure.ac index 40b35b4c4..412dcc398 100644 --- a/desmume/configure.ac +++ b/desmume/configure.ac @@ -1,81 +1,114 @@ -AC_INIT(desmume, 0.3.3) +dnl --- Package name is first argument to AC_INIT +dnl --- Release version is second argument to AC_INIT -AC_CANONICAL_HOST +AC_INIT(desmume, [0.3.3]) +AM_INIT_AUTOMAKE + +dnl -- find target architecture for some os specific libraries AC_CANONICAL_TARGET - case $target in - *linux*) desmume_arch=linux;; - *mingw*) desmume_arch=windows;; - *darwin*) desmume_arch=linux;; + *linux*) desmume_arch=linux;; + *mingw*) desmume_arch=windows;; + *darwin*) desmume_arch=linux;; esac AC_SUBST(desmume_arch) -AM_INIT_AUTOMAKE(desmume, 0.3.3) - -AC_PROG_CC +dnl -- make sure we have a C++ compiler AC_PROG_CXX -AC_PROG_INSTALL + +dnl -- use ranlib for libraries AC_PROG_RANLIB -AC_LANG(C++) - +dnl -- check for endianess AC_C_BIGENDIAN +dnl --- Other prerequisites --- + +dnl - Check for zlib AC_CHECK_LIB(z, gzopen) -AC_PATH_PROGS(HAVE_LIBSDL, [sdl-config sdl11-config]) + +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 + +dnl - Check for GTK +AC_CHECK_TOOL(HAVE_PKG, pkg-config) +if test ! "x$HAVE_PKG" = "x" ; then + PKG_CHECK_MODULES(GTK, + "gtk+-2.0", + HAVE_GTK=yes, + HAVE_GTK=no) + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) +fi + +dnl - Determine which UI's to build +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 + UI_DIR="gtk $UI_DIR" + fi +fi case $target in - *darwin*) - if test x$HAVE_LIBSDL = x ; then - AC_MSG_ERROR([You need to install SDL]) - else - SDL_CFLAGS=`$HAVE_LIBSDL --cflags` - SDL_LIBS=`$HAVE_LIBSDL --libs` - fi - AC_SUBST(SDL_CFLAGS) - AC_SUBST(SDL_LIBS) - - UI_DIR="cli" - AC_SUBST([UI_DIR]) - ;; - *linux*) - AC_CHECK_TOOL(HAVE_PKG, pkg-config) - - if test ! x$HAVE_PKG = x ; then - GTK_CFLAGS=`$HAVE_PKG gtk+-2.0 --cflags` - GTK_LIBS=`$HAVE_PKG gtk+-2.0 --libs` - fi - - if test x$HAVE_LIBSDL = x ; then - AC_MSG_ERROR([You need to install SDL]) - else - SDL_CFLAGS=`$HAVE_LIBSDL --cflags` - SDL_LIBS=`$HAVE_LIBSDL --libs` - GTK_CFLAGS="$GTK_CFLAGS $SDL_CFLAGS" - GTK_LIBS="$GTK_LIBS $SDL_LIBS" - fi - AC_SUBST(SDL_CFLAGS) - AC_SUBST(SDL_LIBS) - AC_SUBST(GTK_CFLAGS) - AC_SUBST(GTK_LIBS) - - UI_DIR="gtk cli" - AC_SUBST([UI_DIR]) - ;; - *mingw*) - LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -mwindows" - UI_DIR=windows - AC_SUBST([UI_DIR]) - ;; + *mingw*) + LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -mwindows" + UI_DIR="windows" + ;; esac -AC_ARG_ENABLE(debug, AC_HELP_STRING(--enable-debug, enable debug information), - AC_DEFINE(DEBUG)) +AC_SUBST(UI_DIR) + +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, + [ --enable-hardcore turn on -W -Wall -Werror], + [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 + CPPFLAGS="[$]CPPFLAGS -Werror -W -Wall -Wpointer-arith -Wcast-align -Wwrite-strings" +fi + +dnl - Enable debug mode +AC_ARG_ENABLE(debug, + AC_HELP_STRING(--enable-debug, enable debug information), + AC_DEFINE(DEBUG)) + +dnl -- set maintainer mode +AM_MAINTAINER_MODE +AC_SUBST(USE_MAINTAINER_MODE) + + +dnl --- Finally, output all the makefiles AC_CONFIG_FILES([Makefile - src/Makefile - src/cli/Makefile - src/gtk/Makefile - src/windows/Makefile + src/Makefile + src/cli/Makefile + src/gtk/Makefile + src/windows/Makefile ]) AC_OUTPUT diff --git a/desmume/src/gtk/Makefile.am b/desmume/src/gtk/Makefile.am index 696967526..8e06efaa7 100644 --- a/desmume/src/gtk/Makefile.am +++ b/desmume/src/gtk/Makefile.am @@ -1,4 +1,4 @@ bin_PROGRAMS = desmume desmume_SOURCES = main.c desmume.c dToolsList.c tools/ioregsView.c ../sndsdl.c -desmume_LDADD = ../libdesmume.a $(GTK_LIBS) -desmume_CFLAGS = $(GTK_CFLAGS) +desmume_LDADD = ../libdesmume.a $(SDL_LIBS) $(GTK_LIBS) +desmume_CFLAGS = $(SDL_CFLAGS) $(GTK_CFLAGS)