configure.ac 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. dnl Initialise Autoconf
  2. AC_PREREQ([2.69])
  3. AC_INIT(
  4. [nestopia],
  5. [1.50-WIP])
  6. AC_CONFIG_SRCDIR([source])
  7. AC_LANG([C++])
  8. dnl ========================================================================
  9. dnl Check whether we want to set defaults for CXXFLAGS, CPPFLAGS and LDFLAGS
  10. dnl ========================================================================
  11. AC_MSG_CHECKING([whether configure should try to set CXXFLAGS/CPPFLAGS/LDFLAGS])
  12. AS_IF([test "x${CXXFLAGS+set}" = "xset" || test "x${CPPFLAGS+set}" = "xset" || test "x${LDFLAGS+set}" = "xset"],
  13. [enable_flags_setting=no],
  14. [enable_flags_setting=yes]
  15. )
  16. AC_MSG_RESULT([${enable_flags_setting}])
  17. AX_CHECK_ENABLE_DEBUG
  18. AS_IF([test "x${enable_debug}" = "xno"],
  19. [
  20. cxxflags_test="-O3"
  21. cppflags_test=""
  22. AC_CANONICAL_HOST
  23. AS_CASE([${host_os}],
  24. [darwin*],
  25. [ldflags_test="-Wl,-dead_strip_dylibs"],
  26. [linux*],
  27. [ldflags_test="-Wl,-O1 -Wl,--as-needed"]
  28. )
  29. ]
  30. )
  31. dnl =======================================
  32. dnl Check for standard headers and programs
  33. dnl =======================================
  34. AX_COMPILER_VENDOR
  35. AX_COMPILER_VERSION
  36. AC_PROG_SED
  37. AC_PROG_CXX
  38. dnl ==================================
  39. dnl Set CXXFLAGS, CPPFLAGS and LDFLAGS
  40. dnl ==================================
  41. AS_IF([test "x${enable_flags_setting}" = "xyes" && test "x${enable_debug}" = "xno"],
  42. [
  43. AX_APPEND_COMPILE_FLAGS([${cxxflags_test} -Wno-narrowing], [CXXFLAGS])
  44. CXXFLAGS=$( echo ${CXXFLAGS} | $SED -e 's/^ *//' -e 's/ *$//' )
  45. AX_APPEND_COMPILE_FLAGS([${cppflags_test}], [CPPFLAGS])
  46. CPPFLAGS=$( echo ${CPPFLAGS} | $SED -e 's/^ *//' -e 's/ *$//' )
  47. AX_APPEND_LINK_FLAGS([${ldflags_test}], [LDFLAGS])
  48. LDFLAGS=$( echo ${LDFLAGS} | $SED -e 's/^ *//' -e 's/ *$//' )
  49. ]
  50. )
  51. dnl ======================
  52. dnl Check for dependencies
  53. dnl ======================
  54. dnl zlib
  55. PKG_CHECK_MODULES([ZLIB], [zlib])
  56. dnl libarchive
  57. PKG_CHECK_MODULES([LIBARCHIVE], [libarchive])
  58. dnl SDL2
  59. PKG_CHECK_MODULES([SDL2], [sdl2])
  60. dnl LibEpoxy
  61. PKG_CHECK_MODULES([LIBEPOXY], [epoxy])
  62. dnl libao
  63. AC_ARG_WITH([ao],
  64. AS_HELP_STRING([--with-ao], [Build with libao audio support]))
  65. AS_IF([test "x$with_ao" = "xyes"], [
  66. PKG_CHECK_MODULES([LIBAO],[ao])
  67. ])
  68. AM_CONDITIONAL([ENABLE_LIBAO], [test "x$with_ao" = "xyes"])
  69. dnl JACK audio
  70. AC_ARG_WITH([jack],
  71. AS_HELP_STRING([--with-jack], [Build with JACK audio support]))
  72. AS_IF([test "x$with_jack" = "xyes"], [
  73. PKG_CHECK_MODULES([JACK],[jack])
  74. ])
  75. AM_CONDITIONAL([ENABLE_JACK], [test "x$with_jack" = "xyes"])
  76. dnl GTK3
  77. AC_ARG_ENABLE([gui],
  78. AS_HELP_STRING([--enable-gui], [Enable building GUI with GTK+3]))
  79. AS_IF([test "x$enable_gui" = "xyes"], [
  80. dnl GUI with GTK+3 requested
  81. PKG_CHECK_MODULES([GTK3], [gtk+-3.0])
  82. ])
  83. AM_CONDITIONAL([ENABLE_GUI], [test "x$enable_gui" = "xyes"])
  84. dnl full HTML suite
  85. AC_ARG_ENABLE([doc],
  86. AS_HELP_STRING([--enable-doc], [Install full HTML documentation]))
  87. AM_CONDITIONAL([ENABLE_FULL_HTML], [test "x$enable_doc" = "xyes"])
  88. dnl ===================
  89. dnl Initialise Automake
  90. dnl ===================
  91. AM_INIT_AUTOMAKE([1.15 foreign dist-bzip2 no-dist-gzip subdir-objects silent-rules])
  92. AM_SILENT_RULES([yes])
  93. dnl ========
  94. dnl Finalise
  95. dnl ========
  96. AC_CONFIG_FILES([Makefile])
  97. AC_OUTPUT
  98. dnl ============================
  99. dnl Report configuration to user
  100. dnl ============================
  101. AC_MSG_RESULT([
  102. ${PACKAGE_NAME} ${VERSION}
  103. Using ${ax_cv_cxx_compiler_vendor}, ${ax_cv_cxx_compiler_version}
  104. CXX: ${CXX}
  105. CXXFLAGS: ${CXXFLAGS}
  106. CPPFLAGS: ${CPPFLAGS}
  107. LDFLAGS: ${LDFLAGS}
  108. ])