autoconf / automake

Originally committed to SVN as r240.
This commit is contained in:
David Lamparter 2006-03-25 16:14:24 +00:00
parent d45fb68058
commit 4036f73e43
9 changed files with 312 additions and 0 deletions

91
core/Makefile.am Normal file
View File

@ -0,0 +1,91 @@
AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = res.rc $(srcdir)/*.h
SUFFIXES = .c .cpp .rc
SUBDIRS = ac bitmaps posix
bin_PROGRAMS = aegisub
AM_CPPFLAGS = -Iposix -include posix/defines.h
LDADD = posix/libposix.a
aegisub_SOURCES = about.cpp \
aegisublocale.cpp \
ass_dialogue.cpp \
ass_entry.cpp \
ass_export_filter.cpp \
ass_exporter.cpp \
ass_file.cpp \
ass_override.cpp \
ass_style.cpp \
ass_style_storage.cpp \
ass_time.cpp \
audio_box.cpp \
audio_display.cpp \
audio_karaoke.cpp \
audio_player.cpp \
audio_player_portaudio.cpp \
audio_provider.cpp \
audio_provider_hd.cpp \
audio_provider_ram.cpp \
automation.cpp \
automation_filter.cpp \
automation_gui.cpp \
avisynth_wrap.cpp \
base_grid.cpp \
colorspace.cpp \
dialog_colorpicker.cpp \
dialog_export.cpp \
dialog_hotkeys.cpp \
dialog_jumpto.cpp \
dialog_progress.cpp \
dialog_properties.cpp \
dialog_resample.cpp \
dialog_search_replace.cpp \
dialog_selection.cpp \
dialog_shift_times.cpp \
dialog_spellcheck.cpp \
dialog_style_editor.cpp \
dialog_style_manager.cpp \
dialog_styling_assistant.cpp \
dialog_timing_processor.cpp \
dialog_translation.cpp \
drop.cpp \
export_clean_info.cpp \
export_fixstyle.cpp \
export_framerate.cpp \
fft.cpp \
fonts_collector.cpp \
frame_main.cpp \
frame_main_events.cpp \
hilimod_textctrl.cpp \
hotkeys.cpp \
main.cpp \
mkv_wrap.cpp \
options.cpp \
splash.cpp \
static_bmp.cpp \
string_codec.cpp \
subs_edit_box.cpp \
subs_grid.cpp \
subtitle_format.cpp \
subtitle_format_ass.cpp \
subtitle_format_srt.cpp \
subtitle_format_txt.cpp \
text_file_reader.cpp \
text_file_writer.cpp \
timeedit_ctrl.cpp \
tip.cpp \
toggle_bitmap.cpp \
utils.cpp \
validators.cpp \
variable_data.cpp \
vfr.cpp \
video_box.cpp \
video_display.cpp \
video_provider.cpp \
video_provider_lavc.cpp \
video_slider.cpp \
video_zoom.cpp \
yatta_wrap.cpp \
MatroskaParser.c

1
core/ac/Makefile.am Normal file
View File

@ -0,0 +1 @@
extra_DIST=compile config.guess config.sub depcomp install-sh missing mkinstalldirs

4
core/autogen.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
aclocal && autoheader && automake -a && autoconf && echo "'configure' script created successfully."

14
core/bitmaps/Makefile.am Normal file
View File

@ -0,0 +1,14 @@
EXTRA_DIST = genxpm.sh $(srcdir)/*.bmp $(srcdir)/*.ico
CLEANFILES = Makefile.bitmaps *.xpm
.PHONY: all-bitmaps
Makefile.bitmaps: $(srcdir)/genxpm.sh $(top_srcdir)/res.rc
/bin/sh $^ $(srcdir) >$@
all: all-bitmaps
all-bitmaps: Makefile.bitmaps
make -f Makefile.bitmaps all

32
core/bitmaps/genxpm.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
RESFILE="$1"
SRCDIR="$2"
cd "$SRCDIR"
cat <<EOF
all: bmp2xpm wxicon_xpm.xpm
.PHONY: all bmp2xpm
srcdir=${SRCDIR}
wxicon_xpm.xpm: \$(srcdir)/icon.ico
convert \$(srcdir)/'icon.ico[2]' wxicon_xpm.xpm
EOF
XPMNAMES=""
for I in *.bmp
do
DNAME="`grep "bitmaps/$I" $RESFILE | cut -d ' ' -f 1`"
echo -e "${DNAME}_xpm.xpm: \$(srcdir)/$I
\tconvert \$(srcdir)/$I ${DNAME}_xpm.xpm
"
XPMNAMES="${XPMNAMES} ${DNAME}_xpm.xpm"
done
echo "bmp2xpm: $XPMNAMES"

123
core/configure.ac Normal file
View File

@ -0,0 +1,123 @@
AC_PREREQ(2.57)
AC_INIT(aegisub, 1.10)
AC_CONFIG_AUX_DIR(ac)
AM_INIT_AUTOMAKE
AC_CONFIG_HEADER([posix/acconf.h])
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.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_C_FLAG([-pthread])
AC_CXX_FLAG([-pthread])
AC_CHECK_LIB([pthread], [pthread_join])
AC_CHECK_HEADERS([wchar.h],,[
AC_MSG_FAILURE([aegisub needs wide character support, find a wchar.h])
])
PKG_CHECK_MODULES([FREETYPE], freetype2 >= 9.8.3,, [
AC_MSG_FAILURE([aegisub needs FreeType2, go install it])
])
WXCONFIG=wx-config
AC_ARG_WITH(wx-config,
AC_HELP_STRING([--with-wx-config=FILE], [Use specific wx-config script to determine wxWidgets configuration. [[wx-config]]]),
[
if test "$withval" != "yes" -a "$withval" != ""; then
WXCONFIG=$withval
fi
])
AC_MSG_CHECKING([wxWidgets version])
if wxversion=`$WXCONFIG --version`; then
AC_MSG_RESULT([$wxversion])
else
AC_MSG_RESULT([not found])
AC_MSG_ERROR([wxWidgets is required. Try --with-wx-config.])
fi
CXXFLAGS="$CXXFLAGS `$WXCONFIG --cxxflags | sed -e 's/-fno-exceptions//'`"
LIBS="$LIBS `$WXCONFIG --libs`"
AC_CHECK_LIB([m], [main])
AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIB([lua], [lua_call],, [AC_MSG_ERROR([lua not found.])])
AC_CHECK_LIB([lualib], [lua_tostring],, [AC_MSG_ERROR([lualib not found.])])
AC_CHECK_LIB([portaudio], [Pa_Initialize],, [AC_MSG_ERROR([portaudio not found.])])
AC_CHECK_LIB([avcodec], [avcodec_init],, [AC_MSG_ERROR([libavcodec (ffmpeg) not found.])])
AC_CHECK_LIB([avformat], [av_frac_init],, [AC_MSG_ERROR([libavformat (ffmpeg) not found or too old.])])
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
AC_PROG_INSTALL
AC_MSG_CHECKING([[whether preprocessor supports #pragma once]])
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([[#pragma once]])],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PRAGMA_ONCE], [1], [Preprocessor support for #pragma once])
],
[AC_MSG_RESULT([no])])
AC_C_FLAG([-Wall])
AC_C_FLAG([-Wextra],[AC_C_FLAG([-W])])
AC_C_FLAG([-Wno-unused-parameter])
AC_C_FLAG([-std=gnu99])
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([-std=c++98])
AC_PATH_XTRA
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_OUTPUT([
Makefile
ac/Makefile
posix/Makefile
bitmaps/Makefile
])

9
core/posix/Makefile.am Normal file
View File

@ -0,0 +1,9 @@
noinst_LIBRARIES = libposix.a
nodist_libposix_a_SOURCES = res.cpp
CLEANFILES = res.cpp res.h
EXTRA_DIST = genres.sh defines.h
res.h: $(srcdir)/genres.sh $(top_srcdir)/res.rc
/bin/sh $^
res.cpp: res.h

22
core/posix/defines.h Normal file
View File

@ -0,0 +1,22 @@
#pragma once
#ifndef _DEFINES_H
#define _DEFINES_H
#define __AVISYNTH_H__
#define WX_PRECOMP
#include <stdint.h>
typedef int64_t __int64;
typedef uint64_t __uint64;
#define abs64 llabs
#define NO_SPELLCHECKER
#define NO_FEX
#define USE_LAVC
#include "res.h"
#endif /* _DEFINES_H */

16
core/posix/genres.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/sh
RESFILE="$1"
egrep -v "^(#|/|.$)" $RESFILE | cut -d ' ' -f 1 | (
echo "#define static" >&4
echo "#ifndef _RES_H" >&5
echo "#define _RES_H" >&5
while read NAME
do echo "extern char *${NAME}_xpm[];" >&5
echo "#include \"../bitmaps/${NAME}_xpm.xpm\"" >&4
done
echo "#endif /* _RES_H */" >&5
) 4>res.cpp 5>res.h