1 dnl Macros needed for VLC
4 dnl ===========================================================================
5 dnl Macros to add plugins or builtins and handle their flags
6 m4_pattern_allow([^PKG_CONFIG(_LIBDIR)?$])
9 AC_DEFUN([VLC_ADD_PLUGIN], [
10 m4_foreach_w([element], [$1], [
11 [PLUGINS="${PLUGINS} ]element["]
12 AC_SUBST([LTLIB]element, [lib]element[_plugin.la])
16 dnl Special cases: vlc, pics, plugins, save
17 AC_DEFUN([VLC_ADD_CPPFLAGS], [
18 m4_foreach_w([element], [$1], [
19 [eval "CPPFLAGS_]element[="'"$'"{CPPFLAGS_]element[} $2"'"']
20 [am_modules_with_cppflags="${am_modules_with_cppflags} ]element["]
24 AC_DEFUN([VLC_ADD_CFLAGS], [
25 m4_foreach_w([element], [$1], [
26 [eval "CFLAGS_]element[="'"$'"{CFLAGS_]element[} $2"'"']
27 [am_modules_with_cflags="${am_modules_with_cflags} ]element["]
31 AC_DEFUN([VLC_ADD_CXXFLAGS], [
32 m4_foreach_w([element], [$1], [
33 [eval "CXXFLAGS_]element[="'"$'"{CXXFLAGS_]element[} $2"'"']
34 [am_modules_with_cxxflags="${am_modules_with_cxxflags} ]element["]
38 AC_DEFUN([VLC_ADD_OBJCFLAGS], [
39 m4_foreach_w([element], [$1], [
40 [eval "OBJCFLAGS_]element[="'"$'"{OBJCFLAGS_]element[} $2"'"']
41 [am_modules_with_objcflags="${am_modules_with_objcflags} ]element["]
45 AC_DEFUN([VLC_ADD_LDFLAGS], [
46 m4_foreach_w([element], [$1], [
47 [eval "LDFLAGS_]element[="'"$2 $'"{LDFLAGS_]element[}"'"']
48 [am_modules_with_ldflags="${am_modules_with_ldflags} ]element["]
52 AC_DEFUN([VLC_ADD_LIBS], [
53 m4_foreach_w([element], [$1], [
54 [eval "LIBS_]element[="'"'"$2 "'$'"{LIBS_]element[}"'"']
55 [am_modules_with_libs="${am_modules_with_libs} ]element["]
59 dnl ===========================================================================
60 dnl Macros to save and restore default flags
62 AC_DEFUN([VLC_SAVE_FLAGS], [
63 CPPFLAGS_save="${CPPFLAGS}"
64 CFLAGS_save="${CFLAGS}"
65 CXXFLAGS_save="${CXXFLAGS}"
66 OBJCFLAGS_save="${OBJCFLAGS}"
67 LDFLAGS_save="${LDFLAGS}"
71 AC_DEFUN([VLC_RESTORE_FLAGS], [
72 CPPFLAGS="${CPPFLAGS_save}"
73 CFLAGS="${CFLAGS_save}"
74 CXXFLAGS="${CXXFLAGS_save}"
75 OBJCFLAGS="${OBJCFLAGS_save}"
76 LDFLAGS="${LDFLAGS_save}"
80 dnl ===========================================================================
81 dnl Helper macro to generate the vlc-config.in file
83 AC_DEFUN([VLC_OUTPUT_VLC_CONFIG_IN], [
85 AC_MSG_RESULT(configure: creating ./vlc-config.in)
87 am_all_modules="`for x in ${am_modules_with_cppflags} ${am_modules_with_cflags} ${am_modules_with_cxxflags} ${am_modules_with_objcflags} ${am_modules_with_ldflags} ${am_modules_with_libs}; do echo $x; done | sort | uniq`"
90 sed -ne '/#@1@#/q;p' < "${srcdir}/vlc-config.in.in" \
92 -e "s/@optim@/${enable_optimizations}/" \
93 -e "s/@PLUGINS@/${PLUGINS}/" \
94 -e "s/@BUILTINS@/${BUILTINS}/" \
95 -e "s/@CFLAGS_TUNING@/${CFLAGS_TUNING}/" \
99 for x in `echo ${am_all_modules}`
102 if test "`eval echo @'$'CPPFLAGS_${x}@`" != "@@"; then
103 echo " cppflags=\"\${cppflags} `eval echo '$'CPPFLAGS_${x}`\""
105 if test "`eval echo @'$'CFLAGS_${x}@`" != "@@"; then
106 echo " cflags=\"\${cflags} `eval echo '$'CFLAGS_${x}`\""
108 if test "`eval echo @'$'CXXFLAGS_${x}@`" != "@@"; then
109 echo " cxxflags=\"\${cxxflags} `eval echo '$'CXXFLAGS_${x}`\""
111 if test "`eval echo @'$'OBJCFLAGS_${x}@`" != "@@"; then
112 echo " objcflags=\"\${objcflags} `eval echo '$'OBJCFLAGS_${x}`\""
114 if test "`eval echo @'$'LDFLAGS_${x}@`" != "@@"; then
115 echo " ldflags=\"\${ldflags} `eval echo '$'LDFLAGS_${x}`\""
117 if test "`eval echo @'$'LIBS_${x}@`" != "@@"; then
118 echo " libs=\"\${libs} `eval echo '$'LIBS_${x}`\""
121 ] done >> vlc-config.in
123 dnl '/#@1@#/,${/#@.@#/d;p}' won't work on OS X
124 sed -ne '/#@1@#/,$p' < "${srcdir}/vlc-config.in.in" \
125 | sed -e '/#@.@#/d' >> vlc-config.in
128 dnl ===========================================================================
129 dnl Macros for shared object handling (TODO)
131 AC_DEFUN([VLC_LIBRARY_SUFFIX], [
132 AC_MSG_CHECKING(for shared objects suffix)
137 *mingw32* | *cygwin* | *wince* | *mingwce* | *os2*)
147 AC_MSG_RESULT(${LIBEXT})
148 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])