Commit 6aa5b046 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

_Experimental_ *optional* libtool support (--enable-libtool)

Should work fine (ie. better than --enable-shared-libvlc) on Linux,
should work on Mac OS X (except for packaging), while shared libvlc doesn't.

Won't work on Win32 with the current Win32 contrib. Stick to static libvlc or
use --enable-shared-libvlc for now.
parent ad2d545a
......@@ -221,27 +221,32 @@ if HAVE_WINCE
vlc_WORKAROUNDLDFLAGS = $(LIB_libvlc)
endif
vlc_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
vlc_LDFLAGS = $(LDFLAGS_libvlc) $(vlc_WORKAROUNDLDFLAGS) $(INCLUDED_LIBINTL)
vlc_LDADD = $(DATA_win32_rc)
# We use DEPENDENCIES_vlc instead of vlc_DEPENDENCIES because of an
# old automake-1.5 bug (automake/279).
DEPENDENCIES_vlc = $(LIB_libvlc) $(DATA_win32_rc)
vlc_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
if USE_LIBTOOL
vlc_LDFLAGS = `$(VLC_CONFIG) --libs vlc`
LIB_libvlc = src/libvlc.la
LIBVLC = $(LIB_libvlc)
else
if BUILD_SHARED
vlc_LDFLAGS += `$(VLC_CONFIG) --libs vlc` -Wl,-rpath $(libdir) -L$(top_builddir)/src -lvlc
vlc_LDFLAGS = `$(VLC_CONFIG) --libs vlc` -Wl,-rpath $(libdir) -L$(top_builddir)/src -lvlc
if HAVE_WIN32
LIB_libvlc = src/libvlc.dll.a
else
LIB_libvlc = src/libvlc$(LIBEXT)
endif
LIBVLC =
else
vlc_LDFLAGS += `$(VLC_CONFIG) --libs vlc builtin`
vlc_LDADD += $(LIB_libvlc)
vlc_LDFLAGS = $(vlc_WORKAROUNDLFDLAGS) `$(VLC_CONFIG) --libs vlc builtin`
LIB_libvlc = src/libvlc.a
LIBVLC = $(LIB_libvlc)
DEPENDENCIES_vlc += stamp-builtin
endif
endif
vlc_LDADD = $(DATA_win32_rc) $(LIBVLC) $(INCLUDED_LIBINTL)
vlc$(EXEEXT): $(vlc_OBJECTS) $(DEPENDENCIES_vlc)
@rm -f vlc$(EXEEXT)
......@@ -280,7 +285,7 @@ vlc-bundle: vlc
find $(top_builddir)/vlc-bundle -type f -exec mimeset -f "{}" \;
endif
# Install the symlinks and shared libvlc
# Install the symlinks
install-exec-local:
for i in "" $(ALIASES) ; do if test -n "$$i" ; then \
rm -f "$(DESTDIR)$(bindir)/$$i" && \
......
......@@ -3,7 +3,7 @@
## bootstrap file for the VLC media player
## $Id$
##
## Copyright (C) 2005 the VideoLAN team
## Copyright (C) 2005-2006 the VideoLAN team
##
## Initial author: Sam Hocevar <sam@zoy.org>
......@@ -80,7 +80,21 @@ fi
if test "${amvers}" = "none"; then
set +x
echo "you need automake version 1.5 or later"
echo "$0: you need automake version 1.5 or later"
exit 1
fi
# Check for libtool
libtoolize="no"
if glibtoolize --version >/dev/null 2>&1; then
libtoolize="glibtoolize"
elif libtoolize --version >/dev/null 2>&1; then
libtoolize="libtoolize"
fi
if test "$libtoolize" = "no"; then
set +x
echo "$0: you need libtool"
exit 1
fi
......@@ -180,10 +194,11 @@ do
subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
extra_libs=""
extra_ltlibs=""
for mod in $mods
do
extra_libs="${extra_libs} lib${mod}_plugin.a"
extra_libs="${extra_libs} lib${mod}.a lib${mod}_pic.a"
extra_libs="${extra_libs} lib${mod}_plugin.a lib${mod}.a lib${mod}_pic.a"
extra_ltlibs="${extra_ltlibs} lib${mod}_plugin.la lib${mod}.la"
done
rm -f "${makf}" && cat > "${makf}" << EOF
......@@ -194,9 +209,7 @@ basedir = ${basedir}
mods = ${mods}
NULL =
libvlc_LIBRARIES =
noinst_LIBRARIES =
noinst_HEADERS =
libvlc_LTLIBRARIES =
EXTRA_DIST = Modules.am
BUILT_SOURCES =
SUBDIRS = ${subdirs}
......@@ -205,8 +218,12 @@ SUFFIXES = _plugin\$(LIBEXT) _plugin.a
libvlcdir = \$(libdir)/vlc/\$(basedir)
EXTRA_LIBRARIES = ${extra_libs}
EXTRA_LTLIBRARIES = ${extra_ltlibs}
include Modules.am
LTLIBVLC = \$(top_builddir)/src/libvlc.la
if BUILD_SHARED
LIBVLC = \$(top_builddir)/src/libvlc\$(LIBEXT)
if HAVE_WIN32
......@@ -224,12 +241,20 @@ all: all-modules
# Find out which modules were enabled and tell make to build them
all-modules:
if USE_LIBTOOL
@set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
if test "\$(plugin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list plugin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_plugin.la;; esac; done; fi; \\
if test "\$(builtin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}.la;; esac; done; fi; \\
\`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
test -z "\$\$fail"
else
@set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
if test "\$(plugin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list plugin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_plugin\$(LIBEXT);; esac; done; fi; \\
if test "\$(builtin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}.a;; esac; done; fi; \\
if test "\$(pic)" = "pic"; then z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_pic.a;; esac; done; fi; \\
\`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
test -z "\$\$fail"
endif
# Build a plugin with the adequate linker and linker's flags
_plugin.a_plugin\$(LIBEXT):
......@@ -254,6 +279,13 @@ mostlyclean-local:
### automake creates libvlcdir after running install-*-local
### so we have to create it ourselves first
install-exec-local: all-modules
if USE_LIBTOOL
@if test -z "\$(libvlc_LTLIBRARIES)"; then \
z=\$\$(\$(VLC_CONFIG) --list plugin); \
m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
\$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" install ; \
fi
else
mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
@z=\$\$(\$(VLC_CONFIG) --list plugin); \
for mod in \$(mods); do \
......@@ -284,8 +316,16 @@ if BUILD_MOZILLA
esac; \
done
endif
endif
uninstall-local:
if USE_LIBTOOL
@if test -z "\$(libvlc_LTLIBRARIES)"; then \
z=\$\$(\$(VLC_CONFIG) --list plugin); \
m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
\$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" uninstall ; \
fi
else
@z=\$\$(\$(VLC_CONFIG) --list plugin); \
for mod in \$(mods); do \
case "\$\$z " \
......@@ -315,6 +355,7 @@ if BUILD_MOZILLA
esac; \
done
endif
endif
EOF
for mod in $mods
......@@ -349,15 +390,23 @@ EOF
fi
cat >> "${makf}" << EOF
lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
EOF
if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
EOF
fi
cat >> "${makf}" << 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}_plugin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
lib${mod}_plugin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
lib${mod}_plugin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
lib${mod}_plugin_la_LDFLAGS = \`\$(VLC_CONFIG) --libs plugin ${mod}\` \\
-rpath '\$(libvlcdir)' -module -shrext \$(LIBEXT)
lib${mod}_plugin_la_LIBADD = \$(LTLIBVLC)
lib${mod}_pic_a_SOURCES = \$(SOURCES_${mod})
EOF
......@@ -370,16 +419,22 @@ 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})
lib${mod}_a_SOURCES = \$(SOURCES_${mod})
lib${mod}_la_SOURCES = \$(SOURCES_${mod})
EOF
if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
nodist_lib${mod}_la_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
EOF
fi
cat >> "${makf}" << 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}\`
lib${mod}_la_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
lib${mod}_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
lib${mod}_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
lib${mod}_la_LDFLAGS = \`\$(VLC_CONFIG) --libs ${mod}\` -static
EOF
done
......@@ -436,6 +491,13 @@ if [ "$GETTEXT" != "yes" ]; then
printf "" > ABOUT-NLS
fi
# Libtoolize directory
${libtoolize} --copy --force
if test -f "ltmain.sh"; then
echo "$0: working around a minor libtool issue"
mv ltmain.sh autotools/
fi
# Do the rest
${autopoint} -f
${aclocal} ${ACLOCAL_ARGS}
......
dnl Autoconf settings for vlc
dnl $Id$
AC_INIT(vlc,0.8.5-svn)
VERSION_MAJOR="0"
......@@ -74,9 +73,15 @@ AC_CHECK_TOOL(STRIP, strip, :)
AC_CHECK_TOOL(AR, ar, :)
AC_CHECK_TOOL(LD, ld, :)
dnl Sam, if you think I didn't see that... --Meuuh
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_ARG_ENABLE(libtool,
[ --enable-libtool use libtool (default disabled, EXPERIMENTAL)],
[],[enable_libtool="no"])
AM_CONDITIONAL(USE_LIBTOOL, [test "${enable_libtool}" != "no"])
dnl Check for compiler properties
AC_C_CONST
......@@ -290,7 +295,11 @@ AM_GNU_GETTEXT
if test "${nls_cv_force_use_gnu_gettext}" = "yes"; then
AC_DEFINE(HAVE_INCLUDED_GETTEXT, 1, Define if we use the local libintl)
INCLUDES="${INCLUDES} -I\$(top_builddir)/intl"
INCLUDED_LIBINTL="${LIBINTL}"
AS_IF([test "${enable_libtool}" != "no"], [
INCLUDED_LIBINTL="${LTLIBINTL}"
],[
INCLUDED_LIBINTL="${LIBINTL}"
])
else
VLC_ADD_LDFLAGS([vlc],[${LIBINTL}])
INCLUDED_LIBINTL=
......@@ -306,7 +315,11 @@ AS_IF([test "$am_cv_func_iconv" != "yes"],
[AC_MSG_ERROR([libiconv is needed for VLC to work properly])])
fi
VLC_ADD_CFLAGS([vlc],[${INCICONV}])
VLC_ADD_LDFLAGS([vlc],[${LIBICONV}])
AS_IF([test "${enable_libtool}" != "no"], [
VLC_ADD_LDFLAGS([vlc],[${LIBICONV}])
],[
VLC_ADD_LDFLAGS([vlc],[${LTLIBICONV}])
])
dnl Check for the need to include the mingwex lib for mingw32
if test "${SYS}" = "mingw32"
......@@ -365,6 +378,7 @@ VLC_LIBRARY_SUFFIX
VLC_SYMBOL_PREFIX
AC_SUBST(SYMPREF)
AS_IF([test "${enable_libtool}" = "no"], [
case "${SYS}" in
mingw32|cygwin)
VLC_ADD_CFLAGS([pic plugin mozilla activex],[${CFLAGS_mingw32_special}])
......@@ -380,6 +394,7 @@ case "${SYS}" in
VLC_ADD_LDFLAGS([plugin mozilla],[-fpic -fPIC])
;;
esac
])
dnl The -DSYS_FOO flag
CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CPPFLAGS="${CPPFLAGS_save}"
......@@ -945,10 +960,10 @@ AC_CACHE_CHECK([if \$CC accepts -mdynamic-no-pic],
[ac_cv_c_dynamic_no_pic],
[CFLAGS="${CFLAGS_save} -mdynamic-no-pic"
AC_TRY_COMPILE([],,ac_cv_c_dynamic_no_pic=yes, ac_cv_c_dynamic_no_pic=no)])
if test "${ac_cv_c_dynamic_no_pic}" != "no"; then
AS_IF([test "${enable_libtool}" = "no" && test "${ac_cv_c_dynamic_no_pic}" != "no"], [
VLC_ADD_CFLAGS([builtin],[-mdynamic-no-pic])
VLC_ADD_CFLAGS([libvlc],[-mdynamic-no-pic])
fi
])
dnl Check for Darwin plugin linking flags
AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error],
......@@ -1374,7 +1389,9 @@ dnl
build_pic=no
AC_ARG_ENABLE(shared-libvlc,
[ --enable-shared-libvlc shared libvlc (default disabled EXPERIMENTAL)])
AS_IF([test "${enable_libtool}" != "no" && test "${enable_shared_libvlc}"], [
AC_MSG_ERROR([--enable-shared-libvlc and --enable-libtool are mutually exclusive])
])
dnl
dnl Stream output
......
......@@ -18,4 +18,4 @@ SOURCES_motiondetect = motiondetect.c
SOURCES_rv32 = rv32.c
SOURCES_osdmenu = osdmenu.c
SOURCES_magnify = magnify.c
noinst_HEADERS += filter_common.h
noinst_HEADERS = filter_common.h
......@@ -10,7 +10,7 @@ EXTRA_DIST = extras/COPYING misc/modules_builtin.h.in
BUILT_SOURCES = $(DISTCLEANFILES) $(CLEANFILES)
DISTCLEANFILES = stamp-api
CLEANFILES = misc/modules_builtin.h misc/version.c
MOSTLYCLEANFILES = $(DATA_noinst_libvlc)
MOSTLYCLEANFILES = $(DATA_noinst_libvlc) stamp-builtins
TOOLBOX = srcdir=$(top_srcdir) builddir=$(top_builddir) $(top_srcdir)/toolbox
......@@ -119,10 +119,19 @@ misc/version.c: FORCE
# shared object, which will make builtins fairly redumdant. Until then, we
# need this workaround.
stamp-builtins:
if USE_LIBTOOL
@for c in `$(VLC_CONFIG) --libs builtin`; do \
case $$c in \
../modules/*.a) echo $$c ;; \
esac ; \
done | \
sed -e 's/^\(.*\)\/\([^\/]*\)\.a$$/cd \1 \&\& $(MAKE) \2/g' | \
while read cmd; do echo $$cmd$$ext; eval "($$cmd$$ext)" || exit $$? ; done
sed -e 's/^\(.*\)\/\([^\/]*\)\.a$$/cd \1 \&\& $(MAKE) \2.la/g' | \
while read cmd; do echo $$cmd; eval "($$cmd)" || exit $$? ; done
endif
if BUILD_SHARED
do_builtins = builtins
builtins:
@if test "$(pic)" = "pic"; then ext="_pic.a"; else ext=".a"; fi ; \
for c in `$(VLC_CONFIG) --libs builtin`; do \
case $$c in \
......@@ -131,9 +140,8 @@ builtins:
done | \
sed -e 's/^\(.*\)\/\([^\/]*\)\.a$$/cd \1 \&\& $(MAKE) \2/g' | \
while read cmd; do echo $$cmd$$ext; eval "($$cmd$$ext)" || exit $$? ; done
.PHONY: builtins
endif
touch $@
###############################################################################
# Building libvlc
......@@ -164,6 +172,15 @@ libvlc_pic_a_CFLAGS = `$(VLC_CONFIG) --cflags vlc pic`
libvlc_pic_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc pic`
libvlc_pic_a_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc pic`
libvlc_la_SOURCES = $(SOURCES_libvlc)
libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags vlc`
libvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags vlc`
libvlc_la_OBJCFLAGS = `$(VLC_CONFIG) --objcflags vlc`
libvlc_la_LDFLAGS = `$(VLC_CONFIG) --libs vlc builtin|sed -e 's/\.a /.la /g'` \
-avoid-version -no-undefined
libvlc_la_DEPENDENCIES = stamp-builtins
if HAVE_BEOS
OPT_SOURCES_libvlc_beos = $(SOURCES_libvlc_beos)
endif
......@@ -184,6 +201,9 @@ OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt)
endif
# Build libvlc as a shared library
if USE_LIBTOOL
lib_LTLIBRARIES = libvlc.la
endif
if BUILD_SHARED
DATA_noinst_libvlc = libvlc$(LIBEXT)
if HAVE_WIN32
......@@ -194,7 +214,7 @@ OBJECTS_libvlc_so = $(libvlc_pic_a_OBJECTS)
endif
endif
libvlc$(LIBEXT): $(OBJECTS_libvlc_so) $(do_builtins)
libvlc$(LIBEXT): $(OBJECTS_libvlc_so) stamp-builtins
@ldfl="`$(VLC_CONFIG) --libs plugin vlc builtin $(pic)` $(INCLUDED_LIBINTL)" ; \
case `$(VLC_CONFIG) --linkage vlc builtin` in \
c++) ld="$(CXXLINK)" ;; \
......@@ -339,13 +359,15 @@ SOURCES_libvlc = \
$(OPT_SOURCES_libvlc_getopt) \
$(NULL)
# Install the symlinks and shared libvlc
if !USE_LIBTOOL
# Install shared libvlc
install-exec-local:
test -z "$(DATA_noinst_libvlc)" || $(INSTALL_PROGRAM) "$(DATA_noinst_libvlc)" "$(DESTDIR)$(libdir)"
# the opposite of install-{data,exec}-local
uninstall-local:
test -z "$(DATA_noinst_libvlc)" || rm -f "$(DESTDIR)$(libdir)/$(DATA_noinst_libvlc)"
endif
###############################################################################
# Stamp rules
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment