SHARE
TWEET

Untitled

a guest Aug 25th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dnl --- Package name is first argument to AC_INIT
  2. dnl --- Release version is second argument to AC_INIT
  3.  
  4. AC_INIT(desmume, [svn])
  5.  
  6. dnl -- find host architecture for some os specific libraries
  7. AC_CANONICAL_HOST
  8. case $host in
  9.   *linux*) desmume_arch=linux;;
  10.   *mingw*) desmume_arch=windows;;
  11.   *darwin*) desmume_arch=linux;;
  12.   *bsd*) desmume_arch=linux;;
  13. esac
  14. AC_SUBST(desmume_arch)
  15.  
  16. AM_INIT_AUTOMAKE([1.10 subdir-objects tar-pax])
  17.  
  18. dnl -- make sure we have a c++ compiler
  19. AC_PROG_CXX
  20.  
  21. dnl -- use ranlib for libraries
  22. AC_PROG_RANLIB
  23.  
  24. dnl -- check for endianess
  25. AC_C_BIGENDIAN
  26.  
  27. dnl -- since svn 1.7 theres only a single .svn folder in the root dir of the checkout
  28. dnl -- depending on what was checked out that might be .svn or ../.svn
  29. REVISION=0
  30. SVN=`which svn 2>/dev/null`
  31. if ( test -d .svn || test -d ../.svn ; ) && test "x${SVN}" != "x" -a -x "${SVN}" ; then
  32.   REVISION=`$SVN info|grep 'Last Changed Rev'|cut -d' ' -f4`
  33.   echo "$REVISION"
  34. fi
  35. AC_DEFINE_UNQUOTED([SVN_REV], [$REVISION], [subversion revision number])
  36. AC_DEFINE_UNQUOTED([SVN_REV_STR], ["$REVISION"], [subversion revision number string])
  37.  
  38. dnl - Check for intltool/gettext macros
  39. IT_PROG_INTLTOOL
  40.  
  41. dnl - Check for zlib
  42. 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.])])
  43.  
  44. dnl - Check for zziplib
  45. AC_CHECK_LIB(zzip, zzip_open, [
  46.     LIBS="-lzzip $LIBS"
  47.     AC_DEFINE([HAVE_LIBZZIP])
  48.     AC_MSG_CHECKING([[whether zzip use void * as second parameter]])
  49.     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <zzip/lib.h>]], [[
  50.         void * v;
  51.         zzip_read(NULL, v, 0);]])],
  52.         AC_MSG_RESULT(yes),
  53.         AC_DEFINE([ZZIP_OLD_READ])
  54.         AC_MSG_RESULT(no))
  55. ])
  56.  
  57. dnl - Check for SDL
  58. AC_PATH_PROGS(SDLCONFIG, [sdl-config sdl11-config])
  59. if test ! "x$SDLCONFIG" = "x" ; then
  60.   SDL_CFLAGS=`$SDLCONFIG --cflags`
  61.   SDL_LIBS=`$SDLCONFIG --libs`
  62.   AC_SUBST(SDL_CFLAGS)
  63.   AC_SUBST(SDL_LIBS)
  64. else
  65.   AC_MSG_ERROR([sdl is required to build desmume])
  66. fi
  67.  
  68. dnl - Check for the OpenGL includes
  69. AC_CHECK_HEADERS([GL/gl.h],
  70.          [AC_CHECK_HEADERS([GL/glu.h], [have_gl_h=yes LIBS="$LIBS -lGL -lGLU"], [have_gl_h=no])],
  71.          [have_gl_h=no])
  72. if test "have_gl_h" = "no" ; then
  73.     AC_MSG_WARN([Building without GL support because of missing headers.])
  74. fi
  75. AM_CONDITIONAL([HAVE_GL], [test "${have_gl_h}" = "yes"])
  76.  
  77. dnl - if --enable-osmesa is used, check for it
  78. AC_ARG_ENABLE([osmesa],
  79.                [AC_HELP_STRING([--enable-osmesa], [use off-screen mesa])],
  80.                [osmesa=$enableval],
  81.                [osmesa=no])
  82.  
  83. dnl - GLX is the default renderer
  84. AC_ARG_ENABLE([glx],
  85.                [AC_HELP_STRING([--enable-glx], [use hw accelerated rendering])],
  86.                [glx=$enableval],
  87.                [glx=yes])
  88.  
  89. if test "x$osmesa" = "xyes" ; then
  90.     AC_CHECK_LIB(dl, main)
  91.     AC_CHECK_LIB([GL], main)
  92.     AC_CHECK_LIB(OSMesa, main,[
  93.         useosmesa=yes
  94.         AC_DEFINE(HAVE_LIBOSMESA)
  95.         OSMESA_LIBS="-lOSMesa"
  96.         AC_SUBST(OSMESA_LIBS)
  97.     ])
  98. else
  99.   if test "x$glx" = "xyes" ; then
  100.     AC_CHECK_LIB(dl, main)
  101.     AC_CHECK_LIB([GL], main)
  102.     AC_CHECK_HEADERS([GL/glx.h], [
  103.       useglx=yes
  104.       AC_DEFINE(HAVE_GL_GLX)
  105.       GLX_LIBS="-lX11"
  106.       AC_SUBST(GLX_LIBS)
  107.     ])
  108.   fi
  109. fi
  110. AM_CONDITIONAL([HAVE_LIBOSMESA],  [test "${useosmesa}" = "yes"])
  111. AM_CONDITIONAL([HAVE_GL_GLX],     [test "${useglx}" = "yes"])
  112.  
  113. dnl - make the usage of libagg for HUD rendering configurable
  114. AC_ARG_ENABLE([hud],
  115.               [AC_HELP_STRING([--enable-hud], [Enable HUD rendering, requires libagg])],
  116.               [libagg=yes])
  117.  
  118. HAVE_OPENAL=no
  119. dnl - openal support
  120. AC_ARG_ENABLE(openal,
  121.           [AC_HELP_STRING(--enable-openal, enable experimental OpenAL microphone input)],
  122.           [openal=yes])
  123.  
  124. if test "x$openal" = "xyes" ; then
  125.     AC_CHECK_LIB([openal], [main],[
  126.                 HAVE_OPENAL=yes
  127.         LIBS="$LIBS -lopenal"
  128.     ])
  129. fi
  130. AM_CONDITIONAL([HAVE_OPENAL], [test "${HAVE_OPENAL}" = "yes"])
  131.  
  132. dnl - Check for GTK and/or libglade
  133. FOUND_GLIB=no
  134. HAVE_ALSA=no
  135. GLIB_VER=2.8
  136. GTK_VER=2.14
  137.  
  138. PKG_CHECK_MODULES(GLIB,
  139.                   glib-2.0 >= $GLIB_VER,
  140.                   FOUND_GLIB=yes,
  141.                   FOUND_GLIB=no)
  142.  
  143. PKG_CHECK_MODULES(GTK,
  144.                   gtk+-2.0 >= $GTK_VER,
  145.                   HAVE_GTK=yes,
  146.                   HAVE_GTK=no)
  147. AC_SUBST(GTK_CFLAGS)
  148. AC_SUBST(GTK_LIBS)
  149.  
  150.  
  151. PKG_CHECK_MODULES(GTHREAD,
  152.                   "gthread-2.0",
  153.                   HAVE_GTHREAD=yes,
  154.                   HAVE_GTHREAD=no)
  155. AC_SUBST(GTHREAD_CFLAGS)
  156. AC_SUBST(GTHREAD_LIBS)
  157.  
  158. AC_ARG_ENABLE([glade],
  159.                [AC_HELP_STRING([--enable-glade], [enable glade frontend])],
  160.                [glade=$enableval],
  161.                [glade=no])
  162.  
  163. if test "x$glade" = "xyes" ; then
  164.     PKG_CHECK_MODULES(LIBGLADE,
  165.                       "libglade-2.0",
  166.                       HAVE_LIBGLADE=yes,
  167.                       HAVE_LIBGLADE=no)
  168.     AC_SUBST(LIBGLADE_CFLAGS)
  169.     AC_SUBST(LIBGLADE_LIBS)
  170.  
  171.     dnl uninstalled glade ui dir
  172.     AC_DEFINE_UNQUOTED(GLADEUI_UNINSTALLED_DIR,"`pwd`/src/gtk-glade/glade/",[path to glade ui dir])
  173.     AC_SUBST(GLADEUI_UNINSTALLED_DIR)
  174.  
  175.     PKG_CHECK_MODULES(GTKGLEXT,
  176.                       "gtkglext-1.0",
  177.                       AC_DEFINE([GTKGLEXT_AVAILABLE], [1])
  178.                       [])
  179.     AC_SUBST(GTKGLEXT_CFLAGS)
  180.     AC_SUBST(GTKGLEXT_LIBS)
  181. fi
  182.  
  183. AC_PATH_PROG(UPDATEDESKTOP, [update-desktop-database])
  184.  
  185. # Need check for both lua and lua5.1 to run on debian, see mysql bug #29945
  186. PKG_CHECK_MODULES(LUA,
  187.                   lua >= 5.1,
  188.                   HAVE_LUA=yes,
  189.                   HAVE_LUA=no)
  190. PKG_CHECK_MODULES(LUA,
  191.                   lua5.1 >= 5.1,
  192.                   HAVE_LUA=yes,
  193.                   HAVE_LUA=no)
  194. AC_SUBST(LUA_CFLAGS)
  195. AC_SUBST(LUA_LIBS)
  196. dnl -- force lua disabled
  197. AM_CONDITIONAL([HAVE_LUA], [test "${HAVE_LUA}x" = "yes"])
  198.  
  199. if test ! "x$HAVE_OPENAL" = "xyes" ; then
  200.   PKG_CHECK_MODULES(ALSA, alsa >= 1.0, HAVE_ALSA=yes, HAVE_ALSA=no)
  201.   AC_SUBST(ALSA_CFLAGS)
  202.   AC_SUBST(ALSA_LIBS)
  203. fi
  204. AM_CONDITIONAL([HAVE_ALSA], [test "${HAVE_ALSA}" = "yes"])
  205.  
  206. PKG_CHECK_MODULES(LIBAGG, libagg >= 2.5.0, FOUND_LIBAGG=yes, FOUND_LIBAGG=no)
  207. AM_CONDITIONAL([HAVE_LIBAGG], [test "x$libagg" = "xyes" -a "${FOUND_LIBAGG}" = "yes"])
  208. if test "x$libagg" = "xyes" ; then
  209.    if test "x$FOUND_LIBAGG" = "xyes" ; then
  210.        AC_SUBST(LIBAGG_CFLAGS)
  211.        AC_SUBST(LIBAGG_LIBS)
  212.        AC_DEFINE([HAVE_LIBAGG])
  213.    else
  214.        AC_MSG_ERROR([HUD rendering enabled, but libagg not found])
  215.    fi
  216. fi
  217.  
  218. PKG_CHECK_MODULES(LIBSOUNDTOUCH, soundtouch >= 1.5.0, HAVE_LIBSOUNDTOUCH=yes, HAVE_LIBSOUNDTOUCH=no)
  219. AC_SUBST(LIBSOUNDTOUCH_CFLAGS)
  220. AC_SUBST(LIBSOUNDTOUCH_LIBS)
  221. AM_CONDITIONAL([HAVE_LIBSOUNDTOUCH], [test "${HAVE_LIBSOUNDTOUCH}" = "yes"])
  222. if test "x$HAVE_LIBSOUNDTOUCH" = "xyes"; then
  223.    AC_DEFINE([HAVE_LIBSOUNDTOUCH])
  224. else
  225.    AC_MSG_WARN([SoundTouch library not found, pcsx2 resampler will be disabled])
  226. fi
  227.  
  228. if test "x$HAVE_ALSA" = "xno"; then
  229.    if test "x$HAVE_OPENAL" = "xno"; then
  230.       AC_DEFINE([FAKE_MIC])
  231.    fi
  232. fi
  233.  
  234. dnl - Determine which UIs to build and if po/ should be included
  235. PO_DIR="po"
  236. PO_MAKEFILE="po/Makefile.in"
  237. UI_DIR="cli $UI_DIR"
  238. if test "x$HAVE_GTK" = "xyes"; then
  239.   UI_DIR="gtk $UI_DIR"
  240. fi
  241.  
  242. if test "x$HAVE_LIBGLADE" = "xyes"; then
  243.     UI_DIR="gtk-glade $UI_DIR"
  244.  
  245.     dnl -- localization for gtk-glade UI
  246.     GETTEXT_PACKAGE=desmume
  247.     AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define to the gettext package name])
  248.     AC_SUBST(GETTEXT_PACKAGE)
  249.     ALL_LINGUAS="fr nb pt_BR sv zh_CN zh_TW"
  250.     AM_GLIB_GNU_GETTEXT
  251. fi
  252.  
  253. dnl - jit support
  254. case $host_cpu in
  255.   x86|x86_64|i386|i486|i586|i686)
  256.     HAVE_JIT=yes
  257.     AC_DEFINE(HAVE_JIT)
  258.     ;;
  259. esac
  260. AM_CONDITIONAL([HAVE_JIT], [test "x$HAVE_JIT" = "xyes"])
  261.  
  262. dnl - wifi support
  263. AC_ARG_ENABLE(wifi,
  264.           [AC_HELP_STRING(--enable-wifi, enable experimental wifi comm support)],
  265.           [
  266.         AC_CHECK_LIB(pcap, main,[
  267.           AC_DEFINE(EXPERIMENTAL_WIFI_COMM)
  268.           LIBS="$LIBS -lpcap"],
  269.           [AC_MSG_WARN([pcap library not found, wifi will not work])])
  270.           ])
  271.  
  272. dnl Set compiler library flags per host architecture
  273. case $host in
  274.   *mingw*)
  275.     LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -lopengl32 -lws2_32 -mwindows"
  276.     UI_DIR="windows"
  277.     ;;
  278.   *darwin*)
  279.     dnl - openal is required on mac os x and we are not able to figure out if it's installed or not
  280.     AC_DEFINE(HAVE_OPENAL)
  281.     LIBS="$LIBS -framework OpenGL -framework OpenAL"
  282.     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/OpenAL.framework/Headers"
  283.     AC_SUBST(CPPFLAGS)
  284.     dnl - extra hackery needed for X includes
  285.     AC_PATH_XTRA
  286.     ;;
  287. esac
  288.  
  289. # Detect the host platform and architecture and feed them to the compiler as
  290. # defines
  291. AS_CASE([$host],
  292.         [*linux*], [AC_DEFINE(HOST_LINUX)],
  293.         [*bsd*]  , [AC_DEFINE(HOST_BSD)],
  294.         [*mingw*], [AC_DEFINE(HOST_WINDOWS)],
  295.         [*darwin*],[AC_DEFINE(HOST_DARWIN)],
  296.         [AC_DEFINE(HOST_UNK)]
  297. )
  298.  
  299. AS_CASE([$host_cpu],
  300.         [x86_64], [AC_DEFINE(HOST_64)],
  301.         [amd64],  [AC_DEFINE(HOST_64)],
  302.         [AC_DEFINE(HOST_32)]
  303. )
  304.  
  305. AC_SUBST(UI_DIR)
  306. AC_SUBST(PO_DIR)
  307.  
  308. dnl - Gdb stub
  309. AC_ARG_ENABLE(gdb-stub,
  310.               [AC_HELP_STRING(--enable-gdb-stub, enable gdb stub)],
  311.               [
  312.             AC_DEFINE(GDB_STUB)
  313.             wantgdbstub=yes
  314.         ])
  315. AM_CONDITIONAL([HAVE_GDB_STUB], [test "${wantgdbstub}" = "yes"])
  316.  
  317. dnl - Compiler warnings
  318.  
  319. # for developer use, enable lots of compile warnings,
  320. # but don't require this generally, because some system's
  321. # header files (BSD) can't handle it
  322. #
  323. # NB: must add -Werror after AC_PROG_CC, etc., so do this last
  324. AC_ARG_ENABLE(hardcore,
  325.               [AC_HELP_STRING(--enable-hardcore, turn on -W -Wall -Werror)],
  326.               [case "${enableval}" in
  327.                 yes) ENABLE_HARDCORE=1 ;;
  328.                 no) ENABLE_HARDCORE=0 ;;
  329.                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-hardcore) ;;              esac],
  330.               [ENABLE_HARDCORE=0])
  331.  
  332. if test "x[$]ENABLE_HARDCORE" = "x1"; then
  333.   AC_MSG_WARN(enable hardcore compile warnings)
  334.   if test "x$CXX" = "x"; then
  335.     dnl - only valid for C with newer gcc's
  336.     CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
  337.   fi
  338.    dnl - -Wshadow
  339.    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 -Wredundant-decls -Wformat-nonliteral -Wformat-security -Winit-self -Wno-reorder"
  340. fi
  341.  
  342. dnl - Enable debug mode
  343. AC_ARG_ENABLE(debug,
  344.               AC_HELP_STRING(--enable-debug, enable debug information),
  345.               AC_DEFINE(DEBUG))
  346. AC_ARG_ENABLE(gpu-debug,
  347.               AC_HELP_STRING(--enable-gpu-debug, enable gpu debug information),
  348.               AC_DEFINE(GPUDEBUG))
  349. AC_ARG_ENABLE(div-debug,
  350.               AC_HELP_STRING(--enable-div-debug, enable div debug information),
  351.               AC_DEFINE(DIVDEBUG))
  352. AC_ARG_ENABLE(sqrt-debug,
  353.               AC_HELP_STRING(--enable-sqrt-debug, enable sqrt debug information),
  354.               AC_DEFINE(SQRTDEBUG))
  355. AC_ARG_ENABLE(dma-debug,
  356.               AC_HELP_STRING(--enable-dma-debug, enable dma debug information),
  357.               AC_DEFINE(DMADEBUG))
  358.  
  359. dnl - Enable memory profiling (disabled)
  360. dnl - AC_ARG_ENABLE(memory-profiling,
  361. dnl -              AC_HELP_STRING(--enable-memory-profiling, enable memory profiling information),
  362. dnl -              AC_DEFINE(PROFILE_MEMORY_ACCESS))
  363.  
  364. dnl -- set maintainer mode
  365. AM_MAINTAINER_MODE
  366. AC_SUBST(USE_MAINTAINER_MODE)
  367.  
  368.  
  369. dnl --- Finally, output all the makefiles
  370. AC_CONFIG_FILES([Makefile
  371.                  ${PO_MAKEFILE}
  372.                  src/Makefile
  373.                  src/cli/Makefile
  374.                  src/cli/doc/Makefile
  375.                  src/gtk/Makefile
  376.                  src/gtk/doc/Makefile
  377.                  src/gtk-glade/Makefile
  378.                  src/gtk-glade/doc/Makefile
  379.          src/gdbstub/Makefile
  380.          autopackage/default.apspec
  381. ])
  382. AC_OUTPUT
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top