Commit fe17002d authored by Sam Hocevar's avatar Sam Hocevar

* bootstrap:

    + New build system, using recursive makefiles. Due to the amount of code
      in VLC, this had become unavoidable.
    + Removed the check for OS X's stack size, since our automake targets are
      a lot less hungry now.
    + Ditto for Solaris's sed.
    + Since automake-1.6 is faster than 1.7, use it first if both are present.
  * m4/vlc.m4:
    + New AX_ADD_CPPFLAGS, AX_ADD_CFLAGS, AX_ADD_CXXFLAGS, AX_ADD_OBJCFLAGS
      and AX_ADD_LDFLAGS macros that do all the magic to detect possible
      modules and register their flags.
    + New AX_ADD_BUILTINS and AX_ADD_PLUGINS macros.
    + Some magic to generate vlc-config.
  * configure.ac:
    + Moved most code to the AX_ADD_* macros.
    + Explicitely added all target Makefiles.
  * modules/**/Modules.am:
    + Path to sources are now relative to Modules.am's directory level.
parent e3c317c2
......@@ -15,10 +15,11 @@ config.status
confdefs.h
conftest.cc
autom4te.cache
Makefile
Makefile.in
Makefile
Modules.am
build-stamp
configure-stamp
stamp-h*
aclocal.m4
vlc-debug.*
......
$Id: HACKING,v 1.7 2003/06/21 17:04:20 sam Exp $
$Id: HACKING,v 1.8 2003/06/27 13:50:07 sam Exp $
Hacking vlc
===========
......@@ -35,16 +35,19 @@ The bootstrap sequence
The bootstrap script does the following actions:
- browse the modules/ directory for all available modules. A module "foo"
exists if there is a Modules.am file in the modules/ directory which
defines SOURCES_foo.
- parse configure.ac for all Makefiles in the modules/ directory that need
to be generated, and look for available modules in the corresponding
Modules.am file. A module "foo" exists if there is a Modules.am file in
the modules/ directory which defines SOURCES_foo.
- create a top-level Modules.am file (which will be included by Makefile.am)
which contains additional build rules for modules, and includes all the
Modules.am files that were found in modules/
- create an m4/vlc.m4 from configure.ac, generating the AC_SUBST and
AM_CONDITIONAL rules that will be needed by configure.ac.
- create an m4/private.m4 from configure.ac, generating m4 macros that will
be needed by configure.ac.
- create a Makefile.am file for each Modules.am file found in modules/ .
- run autopoint (previously gettextize) to create an intl/ directory,
needed when libgettext is not available.
......
......@@ -7,7 +7,7 @@ NULL =
# SUBDIRS stores the directories where a "make" is required when building
# something. DIST_SUBDIRS stores the directories where nothing is built but
# which have makefiles with distribution information.
SUBDIRS = po intl m4 share
SUBDIRS = intl . share po m4
DIST_SUBDIRS = $(SUBDIRS) modules src debian doc ipkg lib autotools
EXTRA_DIST = \
......@@ -20,25 +20,15 @@ EXTRA_DIST = \
install-win32 \
src/extras/COPYING \
toolbox \
vlc-config.in.in \
vlc.ebuild \
vlc.spec \
vlc.spec.redhat \
$(NULL)
MOSTLYCLEANFILES =
BUILT_SOURCES =
SUFFIXES =
# List of programs, libraries and headers that need to be built and/or
# distributed. Initialized to empty because we'll use += later.
bin_PROGRAMS =
lib_LIBRARIES =
libvlc_LIBRARIES =
noinst_LIBRARIES =
noinst_HEADERS =
# Tell aclocal to use -I m4. Wonder if it really works.
ACLOCAL_AMFLAGS = -I m4
......@@ -46,103 +36,8 @@ ACLOCAL_AMFLAGS = -I m4
# because old versions of automake don't support them in configure.ac.
AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects
###############################################################################
# Compilation flags for debug mode, profiling, and others
###############################################################################
# Standard flags used everywhere to build things in the distribution. Some
# of them are empty but might be extended later in the Makefile. *_default
# is the default flag list for all files in the distribution, for instance
# the vlc code. *_pic is for PIC code, such as the Mozilla plugin. *_plugin
# is for plugin code, *_builtin is for builtin code, and *_builtin_pic is
# for PIC builtin code, for instance builtin modules in the mozilla plugin.
CPPFLAGS_default = -I$(top_srcdir)/include
CFLAGS_default =
CXXFLAGS_default =
OBJCFLAGS_default =
LDFLAGS_default = $(LDFLAGS_gprof)
CPPFLAGS_pic = $(CPPFLAGS_default)
CFLAGS_pic = $(CFLAGS_default) @CFLAGS_pics@
CXXFLAGS_pic = $(CXXFLAGS_default) @CFLAGS_pics@
OBJCFLAGS_pic = $(OBJCFLAGS_default) @CFLAGS_pics@
LDFLAGS_pic = $(LDFLAGS_default)
CPPFLAGS_plugin = $(CPPFLAGS_default) -D__VLC__ -D__PLUGIN__
CFLAGS_plugin = $(CFLAGS_default) @CFLAGS_plugins@
CXXFLAGS_plugin = $(CXXFLAGS_default) @CFLAGS_plugins@
OBJCFLAGS_plugin = $(OBJCFLAGS_default) @CFLAGS_plugins@
LDFLAGS_plugin = @LDFLAGS_plugins@
CPPFLAGS_builtin = $(CPPFLAGS_default) -D__VLC__ -D__BUILTIN__
CFLAGS_builtin = $(CFLAGS_default) @CFLAGS_builtins@
CXXFLAGS_builtin = $(CXXFLAGS_default) @CFLAGS_builtins@
OBJCFLAGS_builtin = $(OBJCFLAGS_default) @CFLAGS_builtins@
LDFLAGS_builtin =
L_builtin =
CPPFLAGS_builtin_pic = $(CPPFLAGS_builtin) $(CPPFLAGS_pic)
CFLAGS_builtin_pic = $(CFLAGS_builtin) $(CFLAGS_pic)
CXXFLAGS_builtin_pic = $(CXXFLAGS_builtin) $(CXXFLAGS_pic)
OBJCFLAGS_builtin_pic = $(OBJCFLAGS_builtin) $(OBJCFLAGS_pic)
LDFLAGS_builtin_pic = $(LDFLAGS_builtin) $(LDFLAGS_pic)
L_builtin_pic =
# On Linux and Solaris, activate 64-bit off_t (by default under BSD)
CPPFLAGS_default += -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE
CPPFLAGS_default += -D_REENTRANT -D_THREAD_SAFE
CPPFLAGS_default += -D_GNU_SOURCE
# Gettext support
CPPFLAGS_default += -DLOCALEDIR=\"$(datadir)/locale\"
# Data and plugin location
CPPFLAGS_default += -DDATA_PATH=\"@prefix@/share/vlc\"
CPPFLAGS_default += -DPLUGIN_PATH=\"@prefix@/lib/vlc\"
# Conditional flags that get added to *FLAGS_default
if RELEASE
CPPFLAGS_release = -DHAVE_RELEASE
endif
if DEBUG
CPPFLAGS_debug = -DDEBUG
CFLAGS_debug = -g
endif
if GPROF
CPPFLAGS_gprof = -DGPROF
CFLAGS_gprof = -pg
LDFLAGS_gprof = -pg
endif
if CPROF
CPPFLAGS_cprof = -DCPROF
CFLAGS_cprof = -finstrument-functions
endif
if OPTIM
CFLAGS_optim = @CFLAGS_OPTIM@ @CFLAGS_TUNING@
if DEBUG
else
if GPROF
else
if CPROF
else
CFLAGS_nodebug = @CFLAGS_OPTIM_NODEBUG@
endif
endif
endif
else
# !OPTIM
CFLAGS_optim = @CFLAGS_NOOPTIM@
endif
CPPFLAGS_default += $(CPPFLAGS_release) \
$(CPPFLAGS_debug) $(CPPFLAGS_gprof) $(CPPFLAGS_cprof)
CFLAGS_default += $(CFLAGS_optim) $(CFLAGS_nodebug) \
$(CFLAGS_debug) $(CFLAGS_gprof) $(CFLAGS_cprof)
CXXFLAGS_default += $(CFLAGS_optim) $(CFLAGS_nodebug) \
$(CFLAGS_debug) $(CFLAGS_gprof) $(CFLAGS_cprof)
OBJCFLAGS_default += $(CFLAGS_optim) $(CFLAGS_nodebug) \
$(CFLAGS_debug) $(CFLAGS_gprof) $(CFLAGS_cprof)
# Don't forget to build plugins
all: plugins
###############################################################################
# Headers
......@@ -166,7 +61,7 @@ dist_pkginclude_HEADERS = \
include/vlc/intf.h \
$(NULL)
noinst_HEADERS += $(HEADERS_include) $(HEADERS_include_built)
noinst_HEADERS = $(HEADERS_include) $(HEADERS_include_built)
HEADERS_include = \
include/aout_internal.h \
......@@ -215,13 +110,13 @@ HEADERS_include_built = \
$(NULL)
include/vlc_symbols.h: Makefile $(HEADERS_include)
cd $(srcdir) && ./toolbox --update-includes $(BUILTINS)
cd $(srcdir) && $(srcdir)/toolbox --update-includes
src/misc/modules_plugin.h: Makefile src/misc/modules_plugin.h.in $(HEADERS_include)
cd $(srcdir) && ./toolbox --update-includes $(BUILTINS)
cd $(srcdir) && $(srcdir)/toolbox --update-includes
src/misc/modules_builtin.h: Makefile src/misc/modules_builtin.h.in
cd $(srcdir) && ./toolbox --update-includes $(BUILTINS)
cd $(srcdir) && $(srcdir)/toolbox --update-includes
# These dependencies are mandatory
$(SOURCES): include/vlc_symbols.h
......@@ -325,18 +220,18 @@ dist-hook:
bin_SCRIPTS = vlc-config
lib_LIBRARIES += lib/libvlc.a $(LIBRARIES_libvlc_pic)
lib_LIBRARIES = lib/libvlc.a $(LIBRARIES_libvlc_pic)
lib_libvlc_a_SOURCES = $(SOURCES_libvlc)
dist_lib_libvlc_a_SOURCES = src/misc/modules_plugin.h
lib_libvlc_a_CFLAGS = $(CPPFLAGS_default) -D__VLC__ $(CFLAGS_default) @CFLAGS_vlc@
lib_libvlc_a_CXXFLAGS = $(CPPFLAGS_default) -D__VLC__ $(CXXFLAGS_default)
lib_libvlc_a_OBJCFLAGS = $(CPPFLAGS_default) -D__VLC__ $(OBJCFLAGS_default)
lib_libvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
lib_libvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
lib_libvlc_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
lib_libvlc_pic_a_SOURCES = $(SOURCES_libvlc)
lib_libvlc_pic_a_CFLAGS = $(CPPFLAGS_pic) -D__VLC__ $(CFLAGS_pic) @CFLAGS_vlc@
lib_libvlc_pic_a_CXXFLAGS = $(CPPFLAGS_pic) -D__VLC__ $(CXXFLAGS_pic)
lib_libvlc_pic_a_OBJCFLAGS = $(CPPFLAGS_pic) -D__VLC__ $(OBJCFLAGS_pic)
lib_libvlc_pic_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc pic`
lib_libvlc_pic_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc pic`
lib_libvlc_pic_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc pic`
if HAVE_BEOS
OPT_SOURCES_libvlc_beos = $(SOURCES_libvlc_beos)
......@@ -445,32 +340,25 @@ SOURCES_libvlc = \
# Building vlc
###############################################################################
bin_PROGRAMS += vlc
bin_PROGRAMS = vlc
vlc_SOURCES = src/vlc.c
# @AUTOMAKE_SUCKS@ gets expanded to $(L_builtin) $(LDFLAGS_builtin)
# but we don't write it directly, otherwise automake will go amok and eat all
# the memory because of its 2^N crap algorithm. So we fool him. Nuahaha.
vlc_LDADD = lib/libvlc.a $(LDFLAGS_vlc) \
$(DATA_win32_rc) $(LIB_intl) @AUTOMAKE_SUCKS@
vlc_CFLAGS = $(CPPFLAGS_default) $(CFLAGS_default)
vlc_LDFLAGS = `$(VLC_CONFIG) --libs vlc builtin`
vlc_LDADD = lib/libvlc.a $(DATA_win32_rc) $(LIB_intl)
vlc_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
# We use DEPENDENCIES_vlc instead of vlc_DEPENDENCIES because of an
# old automake-1.5 bug (automake/279).
DEPENDENCIES_vlc = lib/libvlc.a $(L_builtin) $(DATA_win32_rc) $(LIB_intl)
DEPENDENCIES_vlc = lib/libvlc.a $(DATA_win32_rc) $(LIB_intl) builtins
vlc$(EXEEXT): $(vlc_OBJECTS) $(DEPENDENCIES_vlc)
@rm -f $(srcdir)/vlc$(EXEEXT)
if HAVE_BEOS
$(CXXLINK) $(vlc_LDFLAGS) $(vlc_OBJECTS) $(vlc_LDADD) $(LIBS)
else
if HAVE_DARWIN
$(CXXLINK) $(vlc_LDFLAGS) $(vlc_OBJECTS) $(vlc_LDADD) $(LIBS)
else
$(LINK) $(vlc_LDFLAGS) $(vlc_OBJECTS) $(vlc_LDADD) $(LIBS)
endif
endif
case `$(VLC_CONFIG) --linkage vlc builtin` in \
c++) $(CXXLINK) $(vlc_OBJECTS) $(vlc_LDADD) $(vlc_LDFLAGS) $(LIBS) ;; \
objc) $(OBJCLINK) $(vlc_OBJECTS) $(vlc_LDADD) $(vlc_LDFLAGS) $(LIBS) ;; \
c|*) $(LINK) $(vlc_OBJECTS) $(vlc_LDADD) $(vlc_LDFLAGS) $(LIBS) ;; \
esac
if HAVE_BEOS
xres -o $@ $(srcdir)/share/vlc_beos.rsrc
......@@ -483,28 +371,34 @@ if HAVE_BEOS
done
endif
# Install the symlinks
# Install the modules and the symlinks
install-exec-local:
for i in dummy `$(srcdir)/vlc-config --target plugin` ; do if test "x$$i" != "xdummy" ; then \
$(INSTALL) -m 755 "$$i$(LIBEXT)" "$(DESTDIR)$(libdir)/vlc/`echo $$i | cut -f2 -d/`/" ; \
fi ; done
for i in dummy `$(srcdir)/vlc-config --target builtin` `$(srcdir)/vlc-config --target builtin pic` ; do if test "x$$i" != "xdummy" ; then \
$(INSTALL) -m 644 "$$i" "$(DESTDIR)$(libdir)/vlc/" ; \
fi ; done
for i in dummy $(ALIASES) ; do if test "x$$i" != "xdummy" ; then \
rm -f $(DESTDIR)$(bindir)/$$i && \
ln -s vlc $(DESTDIR)$(bindir)/$$i ; \
rm -f "$(DESTDIR)$(bindir)/$$i" && \
ln -s vlc "$(DESTDIR)$(bindir)/$$i" ; \
fi ; done
if HAVE_DARWIN
# Create the MacOS X app
vlc_app_DATA = VLC.app
vlc_appdir = $(bindir)
VLC.app: vlc $(PLUGIN_FILES)
VLC.app: vlc plugins
rm -Rf VLC.app
cd $(srcdir)/extras/MacOSX && pbxbuild -target vlc | grep -v '^\([ \t]\|$$\)'
cp -r $(srcdir)/extras/MacOSX/build/vlc.bundle $(srcdir)/VLC.app
$(INSTALL) -d $(srcdir)/VLC.app/Contents/MacOS
$(INSTALL) vlc $(srcdir)/VLC.app/Contents/MacOS/VLC
$(INSTALL) -d $(srcdir)/VLC.app/Contents/MacOS/modules
for i in dummy $(PLUGIN_FILES) ; do if test "x$$i" != "xdummy" ; then \
$(INSTALL) $(srcdir)/$$i \
$(srcdir)/VLC.app/Contents/MacOS/modules/ ; \
fi ; done
for i in dummy `$(srcdir)/vlc-config --target plugin` ; do \
if test "x$$i" != "xdummy" ; then $(INSTALL) $(srcdir)/$$i$(LIBEXT) \
$(srcdir)/VLC.app/Contents/MacOS/modules/ ; \
fi ; done
$(INSTALL) -d $(srcdir)/VLC.app/Contents/MacOS/share
$(INSTALL) -m 644 $(srcdir)/share/*.psf $(srcdir)/share/*.rle \
$(srcdir)/VLC.app/Contents/MacOS/share
......@@ -528,6 +422,18 @@ share/vlc_win32_rc.$(OBJEXT): share/vlc_win32_rc.rc
$(WINDRES) --include-dir $(srcdir)/share -i $< -o $@
endif
###############################################################################
# Building modules
###############################################################################
plugins: FORCE
$(MAKE) `$(VLC_CONFIG) --target plugin` FORCE
builtins: FORCE
$(MAKE) `$(VLC_CONFIG) --target builtin` FORCE
builtins_pic: FORCE
$(MAKE) `$(VLC_CONFIG) --target builtin pic` FORCE
###############################################################################
# Building architecture-specific binary packages
###############################################################################
......@@ -555,9 +461,10 @@ package-win32:
unix2dos $(srcdir)/tmp/$${file}.txt ; done
mkdir $(srcdir)/tmp/plugins
for i in dummy $(PLUGIN_FILES) ; do if test "x$$i" != "xdummy" ; then \
$(INSTALL) $(srcdir)/$$i $(srcdir)/tmp/plugins/ ; \
fi ; done
for i in dummy `$(srcdir)/vlc-config --target plugin` ; do \
if test "x$$i" != "xdummy" ; then \
$(INSTALL) $(srcdir)/$$i$(LIBEXT) $(srcdir)/tmp/plugins/ ; \
fi ; done
for i in dummy $(srcdir)/tmp/plugins/*$(LIBEXT) ; \
do if test $$i != dummy ; then $(STRIP) $$i ; fi ; done
......@@ -652,9 +559,9 @@ package-macosx:
# Building the Mozilla plugin
###############################################################################
noinst_LIBRARIES += $(noinst_LIBRARIES_mozilla)
noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
MOSTLYCLEANFILES += $(LIBRARIES_mozilla)
MOSTLYCLEANFILES = $(LIBRARIES_mozilla)
EXTRA_DIST += $(SOURCES_mozilla) mozilla/vlcintf.idl
......@@ -695,13 +602,11 @@ noinst_LIBRARIES_mozilla = mozilla/libplugin.a
endif
mozilla_libplugin_a_SOURCES = $(SOURCES_mozilla)
mozilla_libplugin_a_CFLAGS = $(CPPFLAGS_pic) $(CFLAGS_pic) \
$(CPPFLAGS_mozilla) $(CFLAGS_mozilla) \
mozilla_libplugin_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla pic` \
$(CPPFLAGS_mozilla_EXTRA)
mozilla_libplugin_a_CXXFLAGS = $(CPPFLAGS_pic) $(CXXFLAGS_pic) \
$(CPPFLAGS_mozilla) $(CXXFLAGS_mozilla) \
mozilla_libplugin_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla pic` \
$(CPPFLAGS_mozilla_EXTRA)
mozilla_libplugin_a_DEPENDENCIES = lib/libvlc_pic.a $(L_builtin_pic) $(DATA_npvlc_rc)
mozilla_libplugin_a_DEPENDENCIES = lib/libvlc_pic.a $(DATA_npvlc_rc) builtins_pic
BUILT_SOURCES_mozilla = mozilla/vlcintf.h
$(SOURCES_mozilla): mozilla/vlcintf.h
......@@ -709,11 +614,10 @@ $(SOURCES_mozilla): mozilla/vlcintf.h
mozilla_plugin_DATA = $(LIBRARIES_mozilla)
mozilla_plugindir = $(libdir)/mozilla/plugins
$(LIBRARIES_mozilla): $(mozilla_libplugin_a_OBJECTS) \
$(mozilla_libplugin_a_DEPENDENCIES) \
$(L_builtin_pic)
$(mozilla_libplugin_a_DEPENDENCIES)
$(CXXLINK) $(mozilla_libplugin_a_OBJECTS) $(DATA_npvlc_rc) \
lib/libvlc_pic.a $(L_builtin_pic) -shared $(LDFLAGS) \
$(LDFLAGS_vlc) $(LDFLAGS_mozilla) $(LDFLAGS_builtin_pic)
lib/libvlc_pic.a -shared \
`$(VLC_CONFIG) --libs vlc mozilla builtin pic`
mozilla_vlcintf_xpt_DATA = mozilla/vlcintf.xpt
mozilla_vlcintf_xptdir = $(libdir)/mozilla/components
......@@ -737,11 +641,6 @@ endif
###############################################################################
# Modules
###############################################################################
MOSTLYCLEANFILES += $(PLUGIN_FILES)
PLUGIN_FILES =
libvlcdir = $(libdir)/vlc
include Modules.am
###############################################################################
......
#! /bin/sh
## bootstrap file for the VLC media player
## $Id: bootstrap,v 1.51 2003/06/23 10:21:25 sam Exp $
## $Id: bootstrap,v 1.52 2003/06/27 13:50:07 sam Exp $
##
## Authors: Samuel Hocevar <sam@zoy.org>
## Authors: Sam Hocevar <sam@zoy.org>
if test x$# != x0; then
echo "Usage: ./bootstrap"
echo " Calls automake, autoconf, autoheader, autopoint and other auto* to build"
echo " Makefiles."
if test "$#" != "0"; then
echo "Usage: $0"
echo " Calls automake, autoconf, autoheader, autopoint and other auto* to generate"
echo " m4 macros and prepare Makefiles."
exit 1
fi
......@@ -23,147 +23,203 @@ export CYGWIN
##
## Naively assume our system doesn't suck. Unfortunately it seldom doesn't.
##
SEDSUCKS=no
PERLSUCKS=no
AUTOMAKESUCKS=no
INSTALLSUCKS=no
##
## Check that our tools don't suck
##
if test ! 20000 -eq `perl -e 'printf "%s\n","a"x20000' | sed -e 's/.//' 2>/dev/null | wc -c`
then
SEDSUCKS=yes
fi
# Mac OS X stacksize sucks
if test x`uname -s` = xDarwin; then ulimit -s 20000; fi
##
## Generate the modules makefile, by parsing modules/**/Modules.am
##
printf "generating Modules.am and vlc.m4"
printf "generating modules/**/Makefile.am and m4/private.m4"
# Prepare Modules.am and m4/vlc.m4
# Prepare Modules.am and m4/private.m4
rm -f Modules.am && echo > Modules.am
rm -f m4/vlc.m4 && cat > m4/vlc.m4 << EOF
rm -f m4/private.m4 && cat > m4/private.m4 << EOF
dnl Private VLC macros - generated by bootstrap
dnl The required AM_CONDITIONAL an AC_SUBST calls
AC_DEFUN([VLC_VARIABLES], [
EOF
ALL_FLAGS="`sed -n -e '/^[^=A-Z]*[A-Z]*FLAGS_[^=]*=/s/[^=A-Z]*\([A-Z]*FLAGS_[^=]*=\).*/\1/p' < configure.ac | sort | uniq`"
rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
dnl The required AM_CONDITIONAL calls
dnl XXX: too many conditionals make the build very slow, disabled them
AC_DEFUN([AX_VLC_CONDITIONALS], [
EOF
rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
dnl The required AC_SUBST calls
AC_DEFUN([AX_VLC_SUBSTS], [
EOF
rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
dnl The required AC_OUTPUT calls
dnl XXX: this feature is only supported starting from automake-1.7
AC_DEFUN([AX_VLC_MAKEFILES], [AC_OUTPUT([
EOF
rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
dnl Helper macro for vlc-config generation
AC_DEFUN([AX_VLC_CONFIG_HELPER], [
cat >> vlc-config.in << BLAH
EOF
modules=""
for mf in `sed -ne 's@[^a-z]*\([^ ]*\)am.*@modules/\1am@p' < modules/Makefile.am`
do
printf "."
dir=`echo ${mf} | sed -e 's@\(.*\)/.*@\1@'`
topdir=`echo ${dir} | cut -f2 -d/`
sym=`echo ${dir} | sed -e 'y@/@_@'`
cat >> Modules.am << EOF
# Directory ${dir}
count=0
include ${dir}/Modules.am
rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
# Autogenerated by bootstrap - DO NOT EDIT
EXTRA_DIST = LIST
SUBDIRS = .
DIST_SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
EOF
for dir in `sed -ne 's,\(modules/.*\)/Makefile,\1,p' configure.ac`
do
printf "."
mf="${dir}/Modules.am"
basedir="`echo ${dir} | cut -f2 -d/`"
# automake will not recurse for make dist if we don't define SUBDIRS = .
subdirs="`sed -ne 's,'${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
#parent=`echo ${dir} | sed -e 's@[^/]*@..@g'`
#echo " ${dir}/Makefile" >> m4/private.m4-tmp3
rm -f ${dir}/Makefile.am && cat > ${dir}/Makefile.am << EOF
# Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
NULL =
libvlc_LIBRARIES =
noinst_LIBRARIES =
noinst_HEADERS =
EXTRA_DIST = Modules.am
BUILT_SOURCES =
SUBDIRS = .
DIST_SUBDIRS = ${subdirs}
libvlcdir = \$(libdir)/vlc/${basedir}
include Modules.am
EOF
sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | while read mod
for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
do
LINKER="LINK"
if echo "$ALL_FLAGS" | grep '^CPPFLAGS_'${mod}'=$' >/dev/null 2>&1; then
echo "AC_SUBST(CPPFLAGS_${mod})" >> m4/vlc.m4; fi
if echo "$ALL_FLAGS" | grep '^CFLAGS_'${mod}'=$' >/dev/null 2>&1; then
echo "AC_SUBST(CFLAGS_${mod})" >> m4/vlc.m4; fi
if echo "$ALL_FLAGS" | grep '^CXXFLAGS_'${mod}'=$' >/dev/null 2>&1; then
LINKER="CXXLINK"
echo "AC_SUBST(CXXFLAGS_${mod})" >> m4/vlc.m4; fi
if echo "$ALL_FLAGS" | grep '^OBJCFLAGS_'${mod}'=$' >/dev/null 2>&1; then
LINKER="OBJCLINK"
echo "AC_SUBST(OBJCFLAGS_${mod})" >> m4/vlc.m4; fi
if echo "$ALL_FLAGS" | grep '^LDFLAGS_'${mod}'=$' >/dev/null 2>&1; then
echo "AC_SUBST(LDFLAGS_${mod})" >> m4/vlc.m4; fi
count="`expr ${count} + 1`"
if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
PRIVATE='#'; else
PRIVATE=''; fi
if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
NODIST=''; else
NODIST='#'; fi
cat >> m4/vlc.m4 << EOF
AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
# cat >> m4/private.m4-tmp1 << EOF
#dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
#dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
#EOF
cat >> Modules.am << EOF
${dir}/lib${mod}_plugin: ${dir}/lib${mod}_plugin\$(LIBEXT)
${dir}/lib${mod}_plugin\$(LIBEXT): include/vlc_symbols.h FORCE
cd ${dir} && \$(MAKE) lib${mod}_plugin\$(LIBEXT)
${dir}/lib${mod}.a: include/vlc_symbols.h FORCE
cd ${dir} && \$(MAKE) lib${mod}.a
${dir}/lib${mod}_pic.a: include/vlc_symbols.h FORCE
cd ${dir} && \$(MAKE) lib${mod}_pic.a
EOF
cat >> m4/private.m4-tmp4 << EOF
${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
EOF
# Generation of Modules.am
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Generation of modules/**/Makefile.am
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
# S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
# the resulting file size.
# - *_CFLAGS, *_CXXFLAGS etc. include *_CPPFLAGS because per-object CPPFLAGS
# does not seem to work properly with any automake version I tested.
cat >> Modules.am << EOF
# - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
# work properly with any automake version I tested.
cat >> ${dir}/Makefile.am << EOF
# The ${mod} plugin
if ${mod}_p
if UNTRUE
L_${mod}_p = ${dir}/lib${mod}_plugin.a
endif
D_${mod}_p = ${dir}/lib${mod}_plugin\$(LIBEXT)
${NODIST}B_${mod}_p = \$(nodist_SOURCES_${mod})
endif
if ${mod}_b
L_${mod}_b = ${dir}/lib${mod}.a
F_${mod}_b = \$(LDFLAGS_${mod})
if BUILD_MOZILLA
L_${mod}_pic = ${dir}/lib${mod}_pic.a
endif
${NODIST}B_${mod}_b = \$(nodist_SOURCES_${mod})
L${count}p = lib${mod}_plugin.a
D${count}p = lib${mod}_plugin\$(LIBEXT)
L${count}b = lib${mod}.a
L${count}pic = lib${mod}_pic.a
EOF
if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
B${count}p = \$(nodist_SOURCES_${mod})
B${count}b = \$(nodist_SOURCES_${mod})
EOF
fi
cat >> ${dir}/Makefile.am << EOF
endif
L_builtin += \$(L_${mod}_b)
L_builtin_pic += \$(L_${mod}_pic)
LDFLAGS_builtin += \$(F_${mod}_b)
${PRIVATE}BUILT_SOURCES += \$(B_${mod}_p) \$(B_${mod}_b)
PLUGIN_FILES += \$(D_${mod}_p)
${PRIVATE}${sym}_lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
${NODIST}${PRIVATE}nodist_${sym}_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
${sym}_lib${mod}_plugin_a_CPPFLAGS = \$(CPPFLAGS_plugin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
${sym}_lib${mod}_plugin_a_CFLAGS = \$(CFLAGS_plugin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
${sym}_lib${mod}_plugin_a_CXXFLAGS = \$(CXXFLAGS_plugin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
${sym}_lib${mod}_plugin_a_OBJCFLAGS = \$(OBJCFLAGS_plugin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
${NODIST}nodist_${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
${sym}_lib${mod}_pic_a_CPPFLAGS = \$(CPPFLAGS_builtin_pic) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
${sym}_lib${mod}_pic_a_CFLAGS = \$(CFLAGS_builtin_pic) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
${sym}_lib${mod}_pic_a_CXXFLAGS = \$(CXXFLAGS_builtin_pic) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
${sym}_lib${mod}_pic_a_OBJCFLAGS = \$(OBJCFLAGS_builtin_pic) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
${NODIST}nodist_${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
${sym}_lib${mod}_a_CPPFLAGS = \$(CPPFLAGS_builtin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
${sym}_lib${mod}_a_CFLAGS = \$(CFLAGS_builtin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
${sym}_lib${mod}_a_CXXFLAGS = \$(CXXFLAGS_builtin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
${sym}_lib${mod}_a_OBJCFLAGS = \$(OBJCFLAGS_builtin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
libvlc_LIBRARIES += \$(L_${mod}_b) \$(L_${mod}_pic)
lib${mod}_DATA = \$(D_${mod}_p)
EOF
if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
${PRIVATE}BUILT_SOURCES += \$(B${count}p) \$(B${count}b)
EOF
fi
cat >> ${dir}/Makefile.am << EOF
${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
EOF
if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
EOF
fi
cat >> ${dir}/Makefile.am << EOF
lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
EOF
if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
EOF
fi
cat >> ${dir}/Makefile.am << EOF
lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
EOF
if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
EOF
fi
cat >> ${dir}/Makefile.am << EOF
lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
libvlc_LIBRARIES += \$(L${count}b) \$(L${count}pic)
lib${mod}_DATA = \$(D${count}p)
lib${mod}dir = \$(libdir)/vlc/${topdir}
${PRIVATE}noinst_LIBRARIES += \$(L_${mod}_p)
${PRIVATE}${dir}/lib${mod}_plugin\$(LIBEXT): \$(${sym}_lib${mod}_plugin_a_OBJECTS)
${PRIVATE} \$(${LINKER}) \$(${sym}_lib${mod}_plugin_a_OBJECTS) \$(LDFLAGS_plugins) \$(LDFLAGS_${mod})
${PRIVATE}noinst_LIBRARIES += \$(L${count}p)
${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
${PRIVATE} case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
${PRIVATE} c++) \$(CXXLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
${PRIVATE} objc) \$(OBJCLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
${PRIVATE} c|*) \$(LINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
${PRIVATE} esac