Aegisub/aegisub/configure.in

1108 lines
30 KiB
Plaintext
Raw Normal View History

AC_PREREQ(2.57)
######################
# aegisub version info
######################
# MAKE SURE YOU UPDATE THE VERSION INFO BELOW WHEN YOU SET THIS TO '1'
m4_define([aegisub_FINAL_RELEASE], [0])
m4_define([aegisub_version_major], [3])
m4_define([aegisub_version_minor], [0])
m4_define([aegisub_version_revision], [0])
m4_define([aegisub_version], [aegisub_version_major.aegisub_version_minor.aegisub_version_revision])
m4_define([aegisub_version_data], [aegisub_version_major.aegisub_version_minor])
###################
# Required packages
###################
m4_define([lua_auto4_required_version], [5.1])
m4_define([portaudio_required_version], [19])
m4_define([pulseaudio_required_version], [0.5])
m4_define([curl_required_version], [7.18.2])
m4_define([fontconfig_required_version], [2.4])
m4_define([freetype_required_version], [9.7.0])
m4_define([pkgconfig_required_version], [0.20])
m4_define([wx_required_version], [2.9.2])
m4_define([libass_required_version], [0.9.7])
m4_define([ffms_required_version], [2.15])
m4_define([fftw_required_version], [3.3])
#######
# Setup
#######
AC_INIT([Aegisub], [aegisub_version],, [aegisub])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADER([acconf.h])
AC_GNU_SOURCE
AC_CANONICAL_HOST
###########################
# Check target architecture
###########################
AC_MSG_CHECKING([for target architecture])
case x"$target" in
xNONE | x)
target_or_host="$host" ;;
*)
target_or_host="$target" ;;
esac
AC_MSG_RESULT([$target_or_host])
build_darwin="no"
build_linux="no"
build_bsd="no"
build_default="no"
case "$target_or_host" in
*-*-darwin*)
build_darwin="yes"
;;
*-*-linux*)
build_linux="yes"
;;
*-*-*bsd*)
build_bsd="yes"
ICONV_CFLAGS="-I/usr/local/include"
ICONV_LDFLAGS="-L/usr/local/lib -liconv"
;;
*)
build_default="yes"
;;
esac
case "$target_or_host" in
ppc-*-* | powerpc-*)
arch_ppc="yes"
arch_bundle="ppc"
;;
i*86-*-*)
arch_x86="yes"
arch_bundle="intel"
;;
x86_64-*-*)
arch_x86="yes"
arch_x86_64="yes"
;;
*)
;;
esac
if test "$build_darwin" = "yes"; then
if test "$arch_x86" = "yes"; then
DARWIN_ARCH="intel"
elif test "$arch_ppc" = "yes"; then
DARWIN_ARCH="ppc"
fi
AC_SUBST(DARWIN_ARCH)
fi
# Used for universalchardet.
AC_AGI_MDCPUCFG($target_or_host)
AC_SUBST(build_bsd)
AC_SUBST(build_linux)
AC_SUBST(build_darwin)
AC_SUBST(build_default)
# Handle endianess.
AC_C_BIGENDIAN(
AC_DEFINE([HAVE_BIG_ENDIAN], [1], [Big Endian]),
AC_DEFINE([HAVE_LITTLE_ENDIAN], [1], [Little Endian]),
AC_DEFINE([HAVE_DYNAMIC_ENDIAN], [1], [Unknown endian]),
AC_DEFINE([HAVE_UNIVERSAL_ENDIAN], [1], [Universal Endian (MAC Universal PPC/Intel Binaries, uses HAVE_DYNAMIC_ENDIAN)])
)
########################
# Configurable variables
########################
# These cannot be set before AC_INIT()
AEGISUB_VERSION_MAJOR=aegisub_version_major
AEGISUB_VERSION_MINOR=aegisub_version_minor
AEGISUB_VERSION=aegisub_version
# Used for gettext.
AEGISUB_VERSION_DATA=aegisub_version_data
# Suffix used for data paths.
AC_DEFINE_UNQUOTED(AEGISUB_VERSION_DATA, ["$AEGISUB_VERSION_DATA"], [Data path suffix.])
AC_SUBST(AEGISUB_VERSION_DATA)
# Name of aegisub binary.
AEGISUB_COMMAND="aegisub-$AEGISUB_VERSION_MAJOR.$AEGISUB_VERSION_MINOR"
AC_SUBST(AEGISUB_COMMAND)
# Handle location of desktop files: http://freedesktop.org/wiki/Specifications/desktop-entry-spec
AC_ARG_WITH(desktop-dir, [ --with-desktop-dir=PATH desktop file locations
(default: PREFIX/share/applications)])
if ! test -z "$with_desktop_dir" ; then
P_DESKTOP=$with_desktop_dir
else
P_DESKTOP="$datarootdir/applications"
fi
AC_SUBST(P_DESKTOP)
# Handle location of icons: http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
AC_ARG_WITH(icon-dir, [ --with-icon-dir=PATH icon locations (default: PREFIX/share/icons)])
if ! test -z "$with_icon_dir" ; then
P_ICON=$with_icon_dir
else
P_ICON="$datarootdir/icons"
fi
AC_SUBST(P_ICON)
# Install prefix
# If a user doesn't supply --prefix then it is set to NONE so we
# set it to $ac_default_prefix if it hasn't been supplied.
if test "$prefix" = "NONE"; then
prefix="$ac_default_prefix"
fi
# Install prefix used by wxStandardPaths::SetInstallPrefix.
AC_DEFINE_UNQUOTED([INSTALL_PREFIX], ["$prefix"], [Default install prefix, or --prefix.])
# Build credit
AC_ARG_WITH(build-credit, [ --with-build-credit=NAME
Build credit shown in the program title.], [use_build_credit="yes"])
AC_MSG_CHECKING([whether BUILD_CREDIT has been set])
if test "$use_build_credit" = "yes"; then
if test "$with_build_credit" = "yes" || test -z "$with_build_credit"; then
AC_MSG_FAILURE([You must set a value eg --with-build-credit=<username>])
else
AC_MSG_RESULT([yes ($with_build_credit)])
AC_DEFINE_UNQUOTED([BUILD_CREDIT], ["$with_build_credit"], [Build credit supplied in application title using --with-build-credit=])
fi
else
AC_MSG_RESULT([no])
fi
####################
# Check for programs
####################
CHECK_GNU_MAKE
AC_PROG_CC
AC_PROG_CXX
AC_LANG(C++)
AM_PROG_CC_C_O
# This is reported to be required on Ubuntu, I haven't had time to check.
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])
AC_PROG_INSTALL
AC_PROG_RANLIB
PKG_PROG_PKG_CONFIG([pkgconfig_required_version])
#################
# Developers only
#################
AM_MAINTAINER_MODE
# XXX: This needs to be fixed to handle mixed revisions properly
# There is probably a better way to handle it as well...
AC_MSG_CHECKING([for svn version])
if test -d "$srcdir/.svn"; then
SVN_REVISION=`svnversion $srcdir | sed "s/\(^@<:@0-9@:>@*\).*/\1/"`
`echo $SVN_REVISION > $srcdir/svn_revision`
AC_MSG_RESULT([$SVN_REVISION from "svnversion $srcdir"])
elif test -f "$srcdir/svn_revision"; then
SVN_REVISION=`cat $srcdir/svn_revision`
AC_MSG_RESULT([$SVN_REVISION from "$srcdir/svn_revision"])
else
AC_MSG_RESULT([not found])
AC_MSG_FAILURE([unable to get SVN Revision from $srcdir/svn_revision or 'svnversion $srcdir'])
fi
# This is required in order for the config file to work correctly.
AC_DEFINE_UNQUOTED([BUILD_SVN_REVISION], [$SVN_REVISION], [SVN Revision number, used for config.dat and verison.cpp])
# Release information.
if test "aegisub_FINAL_RELEASE" = "1"; then
AC_DEFINE([FINAL_RELEASE], [aegisub_FINAL_RELEASE], [This is only set to 1 for a RELEASE VERSION.])
BUNDLE_STRING="Aegisub"
DMG_STRING="Aegisub-${PACKAGE_VERSION}-${arch_bundle}"
else
PACKAGE_STRING="${PACKAGE_STRING}-dev-r${SVN_REVISION}"
PACKAGE_VERSION="${PACKAGE_VERSION}-dev-r${SVN_REVISION}"
VERSION="${VERSION}-dev-r${SVN_REVISION}"
BUNDLE_STRING="Aegisub-${PACKAGE_VERSION}"
DMG_STRING="Aegisub-${PACKAGE_VERSION}-${arch_bundle}"
fi
# Used in version.cpp
AC_MSG_CHECKING([for build date])
BUILD_DATE=`date "+%Y-%m-%d %H:%M %Z"`
AC_MSG_RESULT($BUILD_DATE)
AC_SUBST(SVN_REVISION)
AC_SUBST(BUILD_DATE)
AC_SUBST(BUNDLE_STRING)
AC_SUBST(DMG_STRING)
###################################################
# Check for pthreads and setup variables / compiler
###################################################
ACX_PTHREAD([], [AC_MSG_FAILURE([You must have working pthreads.])])
CC="$PTHREAD_CC";
AC_AGI_COMPILE([pthread_rwlock_*], [pthread_rwlock], [$PTHREAD_CFLAGS], [$PTHREAD_LIBS],[
#include <pthread.h>
#define _XOPEN_SOURCE 500
int main(void) {
pthread_rwlock_t l; pthread_rwlock_init(&l, NULL);
pthread_rwlock_rdlock(&l);
return 0;
}])
if test "$agi_cv_with_pthread_rwlock" = "yes"; then
AC_DEFINE(HAVE_RWLOCK,1,[define if the compiler implements pthread_rwlock_*])
fi
######################
# Check compiler flags
######################
AC_ARG_ENABLE(compiler-flags, [ --disable-compiler-flags
Disable *all* additional compiler flags. (default=no)])
if test "$enable_compiler_flags" != "no"; then
AC_C_FLAG([-Wall])
AC_C_FLAG([-Wextra],[AC_C_FLAG([-W])])
AC_C_FLAG([-Wno-unused-parameter])
AC_C_FLAG([-std=gnu99])
AC_C_FLAG([-pipe])
AC_CXX_FLAG([-Wall])
AC_CXX_FLAG([-Wextra],[AC_CXX_FLAG([-W])])
AC_CXX_FLAG([-Wno-unused-parameter])
AC_CXX_FLAG([-Wno-long-long])
AC_CXX_FLAG([-fno-strict-aliasing])
AC_CXX_FLAG([-pipe])
# -O* messes with debugging.
if test "$enable_debug" = "yes"; then
opt_flag="-O0"
else
opt_flag="-O2"
fi
AC_C_FLAG([$opt_flag])
AC_CXX_FLAG([$opt_flag])
fi
##########################
# Check for X include/lib.
##########################
AC_PATH_XTRA
if test "$no_x" = "yes" && test "$build_darwin" != "yes"; then
AC_MSG_FAILURE([You must have a working copy of X installed.])
fi
######################################
# Check Headers / Features / Libraries
######################################
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
AC_CHECK_LIB([m], [main])
AC_AGI_COMPILE([pragma once], [pragma_once], [], [],[
#pragma once
int main(void) {}
])
if test "$agi_cv_pragma_once" = "no"; then
AC_MSG_FAILURE([Aegisub requires #pragma once to work correctly.])
fi
AC_CHECK_HEADER([wchar.h],,[AC_MSG_FAILURE([aegisub requires wide character support])])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_SIZEOF([time_t])
##############################
# Program Support and Features
##############################
#########
## OpenGL
#########
AX_CHECK_GL
if test -z "$GL_LIBS"; then
AC_MSG_FAILURE([aegisub requires GL support.])
fi
AC_SUBST(GL_CFLAGS)
AC_SUBST(GL_LIBS)
#######
## cURL
#######
PKG_CHECK_MODULES(LIBCURL, libcurl >= curl_required_version,,
[AC_MSG_FAILURE([aegisub requires >= cURL curl_required_version])])
AC_AGI_COMPILE([cURL], [curl], [$LIBCURL_CFLAGS], [$LIBCURL_LIBS],[
#include <curl/curl.h>
int main(void) {
CURL *handle = curl_easy_init();
}])
if test "$agi_cv_with_curl" = "no"; then
AC_MSG_FAILURE([Please install a working cURL library.])
fi
###########
## Freetype
###########
PKG_CHECK_MODULES(FREETYPE, freetype2 >= freetype_required_version,
AC_DEFINE(WITH_FREETYPE2, 1, [Enable FreeType 2 support.]),
[AC_MSG_FAILURE([aegisub requires >= FreeType2 freetype_required_version])])
AC_AGI_COMPILE([Freetype], [freetype], [$FREETYPE_CFLAGS], [$FREETYPE_LIBS],[
#include <ft2build.h>
#include FT_FREETYPE_H
int main(void) {
FT_Library ft;
if (FT_Init_FreeType(&ft)) { return 1; }
return 0;
}])
if test "$agi_cv_with_freetype" = "no"; then
AC_MSG_FAILURE([Please install a working Freetype library.])
fi
#############
## Fontconfig
#############
PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= fontconfig_required_version)
AC_AGI_COMPILE([FontConfig], [fontconfig], [$FONTCONFIG_CFLAGS], [$FONTCONFIG_LIBS],[
#include <fontconfig/fontconfig.h>
int main(void) {
int fc = FcInit();
FcConfig* config;
config = FcConfigGetCurrent();
if ((!config) || (!fc)) { return 1;}
return 0;
}])
if test "$agi_cv_with_fontconfig" = "no"; then
AC_MSG_FAILURE([Please install a working Fontconfig library.])
fi
AC_DEFINE(WITH_FONTCONFIG, 1, [Enable FontConfig support.])
AC_SUBST(FONTCONFIG_CFLAGS)
AC_SUBST(FONTCONFIG_LIBS)
########
## iconv
########
AC_ARG_VAR([ICONV_CFLAGS], [CFLAGS to use for iconv (default: CPPFLAGS)])
AC_ARG_VAR([ICONV_LDFLAGS], [LDFLAGS to use for iconv (default: LDFLAGS -liconv)])
if test -z "$ICONV_LDFLAGS"; then
if test "$build_linux" = "yes"; then
ICONV_LDFLAGS="$LDFLAGS"
else
ICONV_LDFLAGS="$LDFLAGS -liconv";
fi
fi
if test -z "$ICONV_CFLAGS"; then
ICONV_CFLAGS="$CPPFLAGS";
fi
AC_AGI_COMPILE([iconv], [iconv], [$ICONV_CFLAGS], [$ICONV_LDFLAGS],[
#include <iconv.h>
int main(void) {
iconv_t ic;
ic = iconv_open ("UTF-8", "UTF-8");
if (!ic) return 1;
return 0;
} ])
AC_SUBST(ICONV_LDFLAGS)
AC_SUBST(ICONV_CFLAGS)
if test "$agi_cv_with_iconv" = "no" ; then
AC_MSG_FAILURE([Please install a working iconv library.])
fi
if test "$agi_cv_with_iconv" = "yes"; then
AC_AGI_COMPILE([iconv (const)], [iconv_const], [$ICONV_CFLAGS], [$ICONV_LDFLAGS],[
#include <iconv.h>
int main(void) {
iconv_t cd = iconv_open("UTF-16", "UTF-8");
const char *in = "in";
char *out = new char();
size_t res, inbytesleft, outbytesleft;
res = iconv(cd, &in, &inbytesleft, &out, &outbytesleft);
return 0;
} ])
if test "$agi_cv_with_iconv_const" = "yes"; then
AC_DEFINE(AGI_ICONV_CONST, 1, [Enable if your version if iconv is const (annoying!)])
fi
fi
###############
# Audio Players
###############
#######
## ALSA
#######
AC_ARG_WITH(alsa, [ --without-alsa build without ALSA audio provider. (default: auto)], alsa_disabled="(disabled)")
AC_ARG_VAR([ALSA_CFLAGS], [CFLAGS to use for ALSA (default: CPPFLAGS)])
AC_ARG_VAR([ALSA_LDFLAGS], [LDFLAGS to use for ALSA (default: -lasound -lrt)])
if test -z "$ALSA_LDFLAGS"; then
ALSA_LDFLAGS="-lasound -lrt";
fi
if test -z "$ALSA_CFLAGS"; then
ALSA_CFLAGS="$CPPFLAGS";
fi
if test "$with_alsa" != "no"; then
aegisub_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$ALSA_LDFLAGS"
AC_CHECK_LIB([asound], [snd_pcm_open], [ALSA_LDFLAGS="-lasound -lrt"; with_alsa="yes"], [with_alsa="no"])
LDFLAGS="$aegisub_save_LDFLAGS"
fi
if test "$with_alsa" != "no"; then
AC_DEFINE(WITH_ALSA, 1, [Enable ALSA Support])
found_audio_player="yes"
fi
AC_SUBST(with_alsa)
AC_SUBST(ALSA_LDFLAGS)
############
## PortAudio
############
AC_ARG_WITH(portaudio,[ --without-portaudio build without PortAudio v19 audio provider.
(default: auto)], pulseaudio_disabled="(disabled)")
if test "$with_portaudio" != "no"; then
PKG_CHECK_MODULES(PORTAUDIO, portaudio-2.0 >= portaudio_required_version, [with_portaudio="yes"], [with_portaudio="no"])
fi
if test "$with_portaudio" != "no"; then
AC_AGI_COMPILE([PortAudio], [portaudio], [$PORTAUDIO_CFLAGS], [$PORTAUDIO_LIBS],[
#include <portaudio.h>
int main(void) {
PaError err = Pa_Initialize();
if (err != paNoError) return 1;
return 0;
} ])
fi
if test "$agi_cv_with_portaudio" = "no" && test "$with_portaudio" = "yes"; then
AC_MSG_WARN([PortAudio detected, but it doesn't work...])
with_portaudio="no"
fi
if test "$agi_cv_with_portaudio" = "yes" && test "$with_portaudio" = "yes"; then
AC_DEFINE(WITH_PORTAUDIO, 1, [Enable PortAudio v19 support])
found_audio_player="yes"
fi
AC_SUBST(with_portaudio)
#############
## PulseAudio
#############
AC_ARG_WITH(pulseaudio,[ --without-pulseaudio build without PulseAudio audio provider.
(default: auto)], pulseaudio_disabled="(disabled)")
if test "$with_pulseaudio" != "no"; then
PKG_CHECK_MODULES(LIBPULSE, libpulse >= pulseaudio_required_version, [with_pulseaudio="yes"], [with_pulseaudio="no"])
fi
if test "$with_pulseaudio" != "no"; then
AC_AGI_COMPILE([PuleseAudio], [pulseaudio], [$LIBPULSE_CFLAGS], [$LIBPULSE_LIBS],[
#include <pulse/pulseaudio.h>
int main(void) {
pa_threaded_mainloop *mainloop = pa_threaded_mainloop_new();
if (!mainloop) return 1;
return 0;
} ])
fi
if test "$agi_cv_with_pulseaudio" = "no" && test "$with_pulseaudio" = "yes"; then
AC_MSG_WARN([PulseAudio detected, but it doesn't work...])
with_pulseaudio="no"
fi
if test "$agi_cv_with_pulseaudio" = "yes" && test "$with_pulseaudio" = "yes"; then
AC_DEFINE(WITH_PULSEAUDIO, 1, [Enable PulseAudio support])
found_audio_player="yes"
fi
AC_SUBST(with_pulseaudio)
#########
## OpenAL
#########
AC_ARG_WITH(openal,[ --without-openal build without OpenAL audio provider.
(default: auto)], openal_disabled="(disabled)")
if test "$build_darwin" = "yes"; then
OPENAL_LIBS="-framework OpenAL"
OPENAL_CFLAGS=""
AC_SUBST(OPENAL_LIBS)
AC_SUBST(OPENAL_CFLAGS)
with_openal="yes"
elif test "$with_openal" != "no"; then
PKG_CHECK_MODULES(OPENAL, openal >= 0.0.8, [with_openal=yes], [with_openal=no])
fi
if test "$with_openal" != "no"; then
AC_AGI_COMPILE([OpenAL], [openal], [$OPENAL_CFLAGS], [$OPENAL_LIBS],[
#if defined(__APPLE__)
#include <OpenAL/AL.h>
#include <OpenAL/ALC.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#endif
int main(void) {
ALCdevice *device = alcOpenDevice(0);
if (!device) return 1;
ALCcontext *context = alcCreateContext(device, 0);
if (!context) return 1;
return 0;
} ])
fi
if test "$agi_cv_with_openal" = "no" && test "$with_openal" = "yes"; then
AC_MSG_WARN([OpenAL detected, but it doesn't work...])
with_openal="no"
fi
if test "$agi_cv_with_openal" = "yes" && test "$with_openal" = "yes"; then
found_audio_player="yes"
AC_DEFINE(WITH_OPENAL, 1, [Enable OpenAL support])
fi
AC_SUBST(with_openal)
######
## OSS
######
AC_ARG_WITH(oss,[ --without-oss build without OSS audio provider.
(default: auto)], oss_disabled="(disabled)")
if test "$with_oss" != "no"; then
if test -f "/etc/oss.conf"; then
. /etc/oss.conf
CPPFLAGS="$CPPFLAGS -I${OSSLIBDIR}/include/sys"
fi
AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [with_oss="yes"], [with_oss="no"])
# XXX: maybe check if OSS works
fi
if test "$with_oss" != "no"; then
found_audio_player="yes"
AC_DEFINE(WITH_OSS, 1, [Enable OSS support])
fi
AC_SUBST(with_oss)
###################
# FFTW
###################
AC_ARG_WITH(fftw,[ --without-fftw build without fftw support (default: auto)], fftw_disabled="(disabled)")
if test "$with_fftw" != "no"; then
PKG_CHECK_MODULES(FFTW3, fftw3 >= fftw_required_version, [with_fftw="yes"], [with_fftw="no"])
fi
if test "$with_fftw" != "no"; then
AC_DEFINE(WITH_FFTW, 1, [Enable fftw support])
fi
AC_SUBST(with_fftw)
#########################
# Video / Audio Providers
#########################
AC_ARG_WITH(ffms,[ --without-ffms build without ffms2 A/V provider. (default: auto)], ffms_disabled="(disabled)")
if test "$with_ffms" != "no"; then
PKG_CHECK_MODULES(FFMS, ffms2 >= ffms_required_version, [with_ffms="yes"], [with_ffms="no"])
fi
if test "$with_ffms" != "no"; then
AC_DEFINE(WITH_FFMPEGSOURCE, 1, [Enable FFMS2 support])
fi
AC_SUBST(with_ffms)
###################
# Subtitle Provider
###################
AC_ARG_WITH(libass,[ --without-libass build without libass support (default: auto)], libass_disabled="(disabled)")
if test "$with_libass" != "no"; then
PKG_CHECK_MODULES(LIBASS, libass >= libass_required_version, [with_libass="yes"], [with_libass="no"])
fi
if test "$with_libass" != "no"; then
AC_DEFINE(WITH_LIBASS, 1, [Enable libass support])
fi
AC_SUBST(with_libass)
###########
## Hunspell
###########
AC_ARG_WITH(hunspell, [ --without-hunspell build without hunspell support (default: auto)], hunspell_disabled="(disabled)")
if test "$with_hunspell" != "no"; then
PKG_CHECK_MODULES(HUNSPELL, hunspell >= 1.2.0, [with_hunspell="yes"], [with_hunspell="no"])
AC_AGI_COMPILE([Hunspell], [hunspell], [$HUNSPELL_CFLAGS], [$HUNSPELL_LIBS],[
#include <hunspell.hxx>
int main(void) {
return !(new Hunspell(".", "."));
} ])
fi
if test "$agi_cv_with_hunspell" = "no" && test "$with_hunspell" = "yes"; then
AC_MSG_WARN([Hunspell detected, but it doesn't work...])
with_hunspell="no"
fi
if test "$agi_cv_with_hunspell" = "yes" && test "$with_hunspell" = "yes"; then
AC_DEFINE(WITH_HUNSPELL, 1, [Enable Hunspell support.])
fi
AC_SUBST(with_hunspell)
############
# Automation
############
AC_ARG_WITH(lua,
[ --without-lua build without lua 5.1 (auto4)], [lua51_disabled="(disabled)"])
AC_ARG_VAR([LUA_CFLAGS], [CFLAGS to use for LUA 5.1 (default: autodetect)])
AC_ARG_VAR([LUA_LDFLAGS], [LDFLAGS to use for LUA 5.1 (default: autodetect)])
AC_ARG_VAR([LUA_LIBDIR], [Location of LUA 5.1 library. (default: none)])
if test -z "$LUA_CFLAGS"; then
AGI_FIND_HEADER([LUA], [lua.hpp], [/usr/include/lua5.1 /usr/include/lua51 /usr/local/include/lua51 /usr/local/include/lua5.1 /usr/include /usr/local/include])
fi
if test -z "$LUA_LDFLAGS"; then
AGI_FIND_LIB([LUA], [lua51 lua-5.1 lua5.1 lua], [$LUA_LIBDIR])
fi
aegisub_save_LIBS="$LIBS"
LIBS="$LUA_LDFLAGS"
if test "$with_lua" != no; then
AC_AGI_COMPILE([Lua 5.1 (auto4)], [lua], [$LUA_CFLAGS], [],[
#include <lua.hpp>
int main () {
lua_State *L = luaL_newstate();
lua_pushstring(L, "test");
int res = lua_objlen(L, -1) == 4;
lua_close(L);
return !res;
}])
fi
LIBS="$aegisub_save_LIBS"
if test "$agi_cv_with_lua" = "yes"; then
with_auto4_lua="yes"
AC_DEFINE(WITH_AUTO4_LUA, 1, [Enable Automation (auto4), requires lua])
else
with_auto4_lua="no"
fi
AC_SUBST(with_auto4_lua)
AC_SUBST(LUA_CFLAGS)
AC_SUBST(LUA_LDFLAGS)
################
# Widget support
################
WX_CONFIG_OPTIONS
WX_STANDARD_OPTIONS([debug])
WX_DEBUG=$DEBUG
WX_UNICODE=$UNICODE
WX_CONFIG_CHECK([wx_required_version],,,[std,gl,stc],[$WXCONFIG_FLAGS])
if test "$have_wxconfig" = "no"; then
AC_MSG_FAILURE([wxWidgets detection failed, please set --with-wx* or add the libraries to your LDFLAGS, CXX/CFLAGS.])
fi
AC_ARG_ENABLE(slow-wx-checks, [ --disable-slow-wx-checks
Disable slow-running checks for wx components.])
if test "$enable_slow_wx_checks" != "no"; then
AC_AGI_LINK([wxWidgets OpenGL support], [wxopengl], [wx/glcanvas.h], [$GL_CFLAGS $WX_CFLAGS], [$GL_LIBS $WX_LIBS],[
#include <wx/glcanvas.h>
int main(void) {
wxGLCanvas *canvas;
wxGLContext *context;
return 0;
} ])
AC_AGI_LINK([wxWidgets StyledTextCtrl support], [wxstc], [wx/stc/stc.h], [$WX_CFLAGS], [$WX_LIBS],[
#include <wx/stc/stc.h>
int main(void) {
wxStyledTextCtrl *canvas;
return 0;
} ])
fi
if test "$with_agi_cv_wxopengl" = "no"; then
AC_MSG_FAILURE([wxWidgets OpenGL support missing])
fi
if test "$with_agi_cv_wxstc" = "no"; then
AC_MSG_FAILURE([wxWidgets StyledTextCtrl support missing])
fi
############################
# Precompiled Header Support
# Only works with gcc!
############################
AC_MSG_CHECKING([whether to use precompiled headers])
AC_ARG_ENABLE(gcc-prec, [ --disable-gcc-prec disable GCC precompiled headers])
if test "$enable_gcc_prec" != "no"; then
enable_gcc_prec="yes"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(enable_gcc_prec)
######################################################
# Debugging support
# This is added last so it doesn't slow down configure
# If you want it earlier add it to your CXXFLAGS.
######################################################
AC_ARG_VAR([DEBUG_FLAGS], [Debug flag to use with --enable-debug (default: -g)])
AC_MSG_CHECKING([whether to turn on debugging])
AC_ARG_ENABLE(debug, [ --enable-debug enable debugging (default=no)])
if test "$enable_debug" = "yes"; then
if test -z "$DEBUG_FLAGS"; then
DEBUG_FLAGS="-g";
fi
AC_MSG_RESULT([yes ($DEBUG_FLAGS)])
CPPFLAGS="$DEBUG_FLAGS $CPPFLAGS"
msg_debug="($DEBUG_FLAGS)"
# This turns on some internal (to aegisub) debugging features.
# A debug version of wxWidgets is required.
if $WX_CONFIG_PATH --debug; then
AC_CXX_FLAG([-D_DEBUG])
fi
else
enable_debug="no"
AC_MSG_RESULT([no])
fi
AC_SUBST(DEBUG_FLAGS)
if test "$enable_debug" = "yes"; then
PACKAGE_DEBUG="-debug"
fi
AC_SUBST(PACKAGE_DEBUG)
AC_MSG_CHECKING([whether to use exception handling in debug mode])
AC_ARG_ENABLE(debug-exceptions, [ --enable-debug-exceptions
enable exception handling in debug mode (default=no)])
if test "$enable_debug_exceptions" = "yes"; then
AC_DEFINE(WITH_EXCEPTIONS, 1, [Enable exception handling in debug mode. (--enable-debug) This is always enabled when debug mode is off.])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
###########
# Profiling
###########
AC_ARG_VAR([PROFILE_FLAGS], [Profile flag(s) to use with --enable-profile (default: -pg)])
AC_MSG_CHECKING([whether to turn on profiling])
AC_ARG_ENABLE(profile, [ --enable-profile enable profiling (default=no)])
if test "$enable_profile" = "yes"; then
if test -z "$PROFILE_FLAGS"; then
PROFILE_FLAGS="-pg";
fi
AC_MSG_RESULT([yes ($PROFILE_FLAGS)])
CPPFLAGS="$PROFILE_FLAGS $CPPFLAGS"
else
enable_profile="no"
AC_MSG_RESULT([no])
fi
######
# gcov
######
AC_ARG_VAR([GCOV_CFLAGS], [gcov cflag(s) to use with --enable-gcov (default: -ftest-coverage -fprofile-arcs)])
AC_ARG_VAR([GCOV_LDFLAGS], [gcov ldflag(s) to use with --enable-gcov (default: -lgcov)])
AC_MSG_CHECKING([whether to turn on gcov])
AC_ARG_ENABLE(gcov, [ --enable-gcov enable gcov (default=no)])
if test "$enable_gcov" = "yes"; then
if test -z "$GCOV_CFLAGS"; then
GCOV_CFLAGS="-fprofile-arcs -ftest-coverage";
fi
if test -z "$GCOV_LDFLAGS"; then
GCOV_LDFLAGS="-lgcov";
fi
AC_MSG_RESULT([yes ($GCOV_FLAGS)])
CFLAGS="$CFLAGS $GCOV_CFLAGS"
LDFLAGS="$LDFLAGS $GCOV_LDFLAGS"
CPPFLAGS="$CPPFLAGS $GCOV_CFLAGS"
else
enable_gcov="no"
AC_MSG_RESULT([no])
fi
################
# Electric Fence
################
AC_ARG_VAR([EFENCE_LDFLAGS], [Electric Fence ldflag(s) to use with --enable-profile (default: -lefence)])
AC_MSG_CHECKING([whether to turn on Electric Fence])
AC_ARG_ENABLE(efence, [ --enable-efence enable Electric Fence (default=no)])
if test "$enable_efence" = "yes"; then
if test -z "$EFENCE_LDFLAGS"; then
EFENCE_LDFLAGS="-lefence";
fi
AC_MSG_RESULT([yes ($EFENCE_LDFLAGS)])
else
enable_efence="no"
AC_MSG_RESULT([no])
fi
AC_SUBST(EFENCE_LDFLAGS)
##########
# ccmalloc
##########
AC_ARG_VAR([CCMALLOC_LIBS], [ccmalloc libs(s) to use with --enable-ccmalloc (default: $prefix/lib/ccmalloc-c++.o)])
AC_ARG_VAR([CCMALLOC_LDFLAGS], [ccmalloc ldflag(s) to use with --enable-ccmalloc (default: -lccmalloc)])
AC_MSG_CHECKING([whether to turn on ccmalloc])
AC_ARG_ENABLE(ccmalloc, [ --enable-ccmalloc enable ccmalloc (default=no)])
if test "$enable_ccmalloc" = "yes"; then
if test -z "$CCMALLOC_LIBS"; then
CCMALLOC_LIBS="$prefix/lib/ccmalloc-c++.o";
fi
if test -z "$CCMALLOC_LDFLAGS"; then
CCMALLOC_LDFLAGS="-lccmalloc";
fi
AC_MSG_RESULT([yes ($CCMALLOC_LIBS $CCMALLOC_LDFLAGS)])
else
enable_ccmalloc="no"
AC_MSG_RESULT([no])
fi
AC_SUBST(CCMALLOC_LDFLAGS)
AC_SUBST(CCMALLOC_LIBS)
if test "$enable_efence" = "yes" && test "$enable_ccmalloc" = "yes"; then
AC_MSG_FAILURE([Please enable Electric Fence _or_ ccmalloc otherwise strange things will happen.])
fi
########
# ccache
########
AC_MSG_CHECKING([whether to enable ccache])
AC_ARG_ENABLE(ccache, [ --enable-ccache enable ccache (default=no)])
if test "$enable_ccache" = "yes"; then
AC_MSG_RESULT([yes])
else
enable_ccache="no"
AC_MSG_RESULT([no])
fi
AC_SUBST(enable_ccache)
##############################
# Internationalisation support
##############################
AM_GNU_GETTEXT([external])
if test "$build_darwin" = "yes"; then
GETTEXT_PACKAGE="aegisub"
else
GETTEXT_PACKAGE="aegisub${AEGISUB_VERSION_MAJOR}${AEGISUB_VERSION_MINOR}"
fi
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
[The basename for our gettext translation domains.])
####################################################################
# Default settings for Providers/Players
# * This is done at the end to preserve sanity rather than littering
# it above.
####################################################################
AC_ARG_WITH(player-audio, [ --with-player-audio=(alsa|openal|portaudio|pulseaudio)
Default Audio Player (default: Linux/ALSA,
Darwin/OpenAL, 1:*/OSS, 2:*/PortAudio.])
# Default audio player.
if ! test -z "$with_player_audio"; then
default_player_audio="$with_player_audio"
else
if test "$build_linux" = "yes" && test "$with_alsa" = "yes"; then
default_player_audio="alsa"
elif test "$build_darwin" = "yes" && test "$with_openal" = "yes"; then
default_player_audio="openal"
elif test "$with_portaudio" = "yes"; then
default_player_audio="portaudio"
elif test "$with_oss" = "yes"; then
default_player_audio="oss"
elif test "$with_pulseaudio" = "yes"; then
default_player_audio="pulseaudio"
fi
fi
AC_DEFINE_UNQUOTED([DEFAULT_PLAYER_AUDIO], ["$default_player_audio"], [Default audio player.])
# Set some friendly strings if some of the above aren't detected.
if test -z "$default_player_audio"; then
default_player_audio="NONE"
fi
###############
# Misc settings
###############
AC_SUBST(found_audio_player)
# Files that need substitution.
AC_CONFIG_FILES([
desktop/aegisub.desktop
tools/osx-bundle.sed
Makefile.inc
])
AC_OUTPUT
if test -z "$found_audio_player"; then
AC_MSG_NOTICE([
***********************************************************************
* No supported audio player interface was found on your system.
* If you want audio support in Aegisub you need to install one of
* these libraries:
* - PulseAudio
* * http://pulseaudio.org/
* - ALSA (Linux only)
* * http://www.alsa-project.org/
* - PortAudio (version 19 only)
* * http://www.portaudio.com/
***********************************************************************
])
fi
if test "$with_ffms" != "yes"; then
AC_MSG_NOTICE([
***********************************************************************
* No supported video/audio reader interface was found on your system.
* You will not be able to open any video or audio files in Aegisub
* unless you install a supported video/audio provider.
* You will however still be able to open "dummy" video, ie. a blank,
* virtual video clip with subtitles overlaid.
* Currently we only support one video/audio provider on non-Windows
* systems:
* - FFMS2
* * http://code.google.com/p/ffmpegsource/
***********************************************************************
])
fi
AC_MSG_RESULT([
Configure settings
Install prefix: $prefix
SVN Revision: $SVN_REVISION
Debug $enable_debug $msg_debug
CXXFLAGS $CXXFLAGS
CPPFLAGS $CPPFLAGS
LDFLAGS $LDFLAGS
Default Settings
Audio Player: $default_player_audio
Scripting Engines
auto4 Lua: $with_auto4_lua $lua51_disabled
Audio Players
ALSA: $with_alsa $alsa_disabled
OpenAL: $with_openal $openal_disabled
OSS: $with_oss $oss_disabled
PortAudio: $with_portaudio $portaudio_disabled
PulseAudio: $with_pulseaudio $pulseaudio_disabled
A/V Providers
FFMS2: $with_ffms $ffms_disabled
Subtitle Providers:
libass $with_libass $libass_disabled
Misc Packages
Hunspell: $with_hunspell $with_hunspell_version $hunspell_disabled
FFTW3: $with_fftw $fftw_disabled
]);