More fixing of build system: Properly link GL framework on OS X (I hope.) FFmpeg is now optional. Check for a working pthreads. More detailed warnings when no audio players or video/audio providers are available.

Originally committed to SVN as r1127.
This commit is contained in:
Niels Martin Hansen 2007-04-24 00:52:49 +00:00
parent bd72e621b8
commit a278e4e4a3
3 changed files with 187 additions and 51 deletions

View file

@ -1,3 +1,34 @@
AC_DEFUN([AC_C_FLAG], [{
AC_LANG_PUSH(C)
ac_c_flag_save="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_MSG_CHECKING([[whether $CC supports $1]])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]])],
[AC_MSG_RESULT([yes])],
[
CFLAGS="$ac_c_flag_save"
AC_MSG_RESULT([no])
$2
])
AC_LANG_POP(C)
}])
AC_DEFUN([AC_CXX_FLAG], [{
AC_LANG_PUSH(C++)
ac_cxx_flag_save="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $1"
AC_MSG_CHECKING([[whether $CXX supports $1]])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]])],
[AC_MSG_RESULT([yes])],
[
CXXFLAGS="$ac_cxx_flag_save"
AC_MSG_RESULT([no])
$2
])
AC_LANG_POP(C++)
}])
##### http://autoconf-archive.cryp.to/acx_pthread.html
#
# SYNOPSIS
@ -422,3 +453,82 @@ AC_DEFUN([AX_LANG_COMPILER_MS],
[ax_compiler_ms=no])
ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms=$ax_compiler_ms
])])
##### http://autoconf-archive.cryp.to/check_gnu_make.html
#
# SYNOPSIS
#
# CHECK_GNU_MAKE()
#
# DESCRIPTION
#
# This macro searches for a GNU version of make. If a match is found,
# the makefile variable `ifGNUmake' is set to the empty string,
# otherwise it is set to "#". This is useful for including a special
# features in a Makefile, which cannot be handled by other versions
# of make. The variable _cv_gnu_make_command is set to the command to
# invoke GNU make if it exists, the empty string otherwise.
#
# Here is an example of its use:
#
# Makefile.in might contain:
#
# # A failsafe way of putting a dependency rule into a makefile
# $(DEPEND):
# $(CC) -MM $(srcdir)/*.c > $(DEPEND)
#
# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
# @ifGNUmake@ include $(DEPEND)
# @ifGNUmake@ endif
#
# Then configure.in would normally contain:
#
# CHECK_GNU_MAKE()
# AC_OUTPUT(Makefile)
#
# Then perhaps to cause gnu make to override any other make, we could
# do something like this (note that GNU make always looks for
# GNUmakefile first):
#
# if ! test x$_cv_gnu_make_command = x ; then
# mv Makefile GNUmakefile
# echo .DEFAULT: > Makefile ;
# echo \ $_cv_gnu_make_command \$@ >> Makefile;
# fi
#
# Then, if any (well almost any) other make is called, and GNU make
# also exists, then the other make wraps the GNU make.
#
# LAST MODIFICATION
#
# 2002-01-04
#
# COPYLEFT
#
# Copyright (c) 2002 John Darrington <j.darrington@elvis.murdoch.edu.au>
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
# the copyright notice and this notice are preserved.
AC_DEFUN(
[CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
_cv_gnu_make_command='' ;
dnl Search all the common names for GNU make
for a in "$MAKE" make gmake gnumake ; do
if test -z "$a" ; then continue ; fi ;
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
_cv_gnu_make_command=$a ;
break;
fi
done ;
) ;
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
if test "x$_cv_gnu_make_command" != "x" ; then
ifGNUmake='' ;
else
ifGNUmake='#' ;
AC_MSG_RESULT("Not found");
fi
AC_SUBST(ifGNUmake)
] )

View file

@ -12,7 +12,7 @@ REVISION := $(if $(SVNREV),-DBUILD_SVN_REVISION=$(SVNREV)) $(if $(DARCSREV),-DBU
BUILDINFO := -DBUILD_CREDIT="\"$(shell whoami)\"" $(REVISION)
AM_CPPFLAGST = -DAEGISUB -Iposix -include posix/defines.h $(BUILDINFO)
LDADD = posix/libposix.a ../lua51/src/liblua.a ../FexTrackerSource/libfex.a ../csri/lib/.libs/libcsri.a -lGL -lGLU
LDADD = posix/libposix.a ../lua51/src/liblua.a ../FexTrackerSource/libfex.a ../csri/lib/.libs/libcsri.a
if USE_LIBASS
LIBASS=subtitles_provider_libass.cpp
@ -31,7 +31,7 @@ LDADD += -lasound
endif
if HAVE_PULSEAUDIO
AUDIO_PLAYER += audio_player_pulse.cpp
LDADD += -lpulse -lpulse-simple
LDADD += -lpulse
endif
if HAVE_RUBY
@ -48,7 +48,18 @@ else
HUNSPELL=
endif
if HAVE_FFMPEG
FFMPEG=audio_provider_lavc.cpp lavc_file.cpp video_provider_lavc.cpp
else
FFMPEG=
endif
aegisub_SOURCES = \
$(AUDIO_PLAYER) \
$(AUTO4RUBY) \
$(HUNSPELL) \
$(LIBASS) \
$(FFMPEG) \
aegisublocale.cpp \
ass_attachment.cpp \
ass_dialogue.cpp \
@ -63,10 +74,8 @@ aegisub_SOURCES = \
audio_box.cpp \
audio_display.cpp \
audio_karaoke.cpp \
$(AUDIO_PLAYER) \
audio_provider.cpp \
audio_provider_hd.cpp \
audio_provider_lavc.cpp \
audio_provider_ram.cpp \
audio_provider_stream.cpp \
audio_spectrum.cpp \
@ -75,7 +84,6 @@ aegisub_SOURCES = \
auto4_lua_assfile.cpp \
auto4_lua_dialog.cpp \
auto4_auto3.cpp \
$(AUTO4RUBY) \
avisynth_wrap.cpp \
base_grid.cpp \
browse_button.cpp \
@ -123,14 +131,12 @@ aegisub_SOURCES = \
hotkeys.cpp \
idle_field_event.cpp \
kana_table.cpp \
lavc_file.cpp \
main.cpp \
md5.c \
mkv_wrap.cpp \
mythes.cxx \
options.cpp \
spellchecker.cpp \
$(HUNSPELL) \
static_bmp.cpp \
string_codec.cpp \
subs_edit_box.cpp \
@ -145,7 +151,6 @@ aegisub_SOURCES = \
subtitle_format_txt.cpp \
subtitles_provider.cpp \
subtitles_provider_csri.cpp \
$(LIBASS) \
text_file_reader.cpp \
text_file_writer.cpp \
thesaurus.cpp \
@ -165,7 +170,6 @@ aegisub_SOURCES = \
video_frame.cpp \
video_provider.cpp \
video_provider_dummy.cpp \
video_provider_lavc.cpp \
video_slider.cpp \
MatroskaParser.c

View file

@ -8,39 +8,9 @@ AC_GNU_SOURCE
AC_CANONICAL_HOST
AC_DEFUN([AC_C_FLAG], [{
AC_LANG_PUSH(C)
ac_c_flag_save="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_MSG_CHECKING([[whether $CC supports $1]])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]])],
[AC_MSG_RESULT([yes])],
[
CFLAGS="$ac_c_flag_save"
AC_MSG_RESULT([no])
$2
])
AC_LANG_POP(C)
}])
AC_DEFUN([AC_CXX_FLAG], [{
AC_LANG_PUSH(C++)
ac_cxx_flag_save="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $1"
AC_MSG_CHECKING([[whether $CXX supports $1]])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]])],
[AC_MSG_RESULT([yes])],
[
CXXFLAGS="$ac_cxx_flag_save"
AC_MSG_RESULT([no])
$2
])
AC_LANG_POP(C++)
}])
# Checks for programs.
dnl Checks for programs.
CHECK_GNU_MAKE
AC_PROG_CC
AC_PROG_CXX
AC_LANG(C++)
@ -62,23 +32,41 @@ fi
ACX_PTHREAD([], [
AC_MSG_FAILURE([Aegisub needs pthreads])
])
AC_MSG_CHECKING([whether pthreads works])
AC_COMPILE_IFELSE([
#include <stdlib.h>
#include <pthread.h>
int main() { return 0; }
], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
echo <<EOM
***********************************************************************
* Your pthreads installation seems to be broken.
* Apart from obviously being bad, this can cause strange detection
* errors as well.
* On some Linux distributions, this can be caused by having the package
* libpthread-dev installed. If you have this package, please uninstall
* it now.
***********************************************************************
EOM
AC_MSG_FAILURE([You need a working pthreads installation.])
])
AC_CHECK_LIB([asound], [snd_pcm_open], [found_audio=yes], [with_alsa=no])
AC_CHECK_LIB([portaudio], [Pa_Initialize], [found_audio=yes], [with_portaudio=no])
AC_CHECK_FUNCS([Pa_GetStreamTime])
PKG_CHECK_MODULES([LIBPULSE], libpulse >= 0.5,
[found_audio=yes],
[with_pulseaudio=no]
)
AC_CHECK_LIB([avcodec], [avcodec_init],, [AC_MSG_ERROR([avcodec not found.])])
AC_CHECK_LIB([avformat], [av_read_frame],, [AC_MSG_ERROR([avformat not found.])])
PKG_CHECK_MODULES([LIBPULSE], libpulse >= 0.5, [found_audio=yes], [with_pulseaudio=no])
AC_CHECK_LIB([avcodec], [avcodec_init],, [with_ffmpeg=no])
AC_CHECK_LIB([avformat], [av_read_frame],, [with_ffmpeg=no])
if test "$with_ffmpeg" != "no"; then
found_video_provider=yes
fi
AC_CHECK_LIB([hunspell], [main],, [with_hunspell=no])
AC_CHECK_LIB([ruby1.9], [ruby_init],, [with_ruby=no])
if test -z "$found_audio"; then
AC_MSG_WARN([No audio interface found, Aegisub will be built without Audio support!])
fi
AC_CHECK_HEADER([wchar.h],,[
AC_MSG_FAILURE([aegisub needs wide character support, find a wchar.h])
])
@ -219,6 +207,7 @@ AM_CONDITIONAL([HAVE_PORTAUDIO], [test "$with_portaudio" != "no"])
AM_CONDITIONAL([HAVE_PULSEAUDIO], [test "$with_pulseaudio" != "no"])
AM_CONDITIONAL([HAVE_HUNSPELL], [test "$with_hunspell" != "no"])
AM_CONDITIONAL([HAVE_RUBY], [test "$with_ruby" != "no"])
AM_CONDITIONAL([HAVE_FFMPEG], [test "$with_ffmpeg" != "no"])
AC_OUTPUT([
Makefile
@ -230,4 +219,37 @@ AC_OUTPUT([
aegisub/bitmaps/Makefile
])
if test -z "$found_audio"; then
echo <<EOM
***********************************************************************
* 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) (Currently broken)
* http://www.alsa-project.org/
* - PortAudio (version 18 only, version 19 is not compatible)
* http://www.portaudio.com/
***********************************************************************
EOM
fi
if test -z "$found_video_provider"; then
echo <<EOM
***********************************************************************
* 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:
* - FFmpeg (libavcodec + libavformat)
* http://ffmpeg.mplayerhq.hu/
***********************************************************************
EOM
fi