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_BUILTINS], [
10 BUILTINS="${BUILTINS} $1"
13 AC_DEFUN([VLC_ADD_PLUGIN], [
14 PLUGINS="${PLUGINS} $1"
15 AC_SUBST([LTLIB$1], ["lib$1_plugin.la"])
18 dnl Special cases: vlc, pics, plugins, save
19 AC_DEFUN([VLC_ADD_CPPFLAGS], [
20 for element in [$1]; do
21 eval "CPPFLAGS_${element}="'"$'"{CPPFLAGS_${element}} $2"'"'
22 am_modules_with_cppflags="${am_modules_with_cppflags} ${element}"
26 AC_DEFUN([VLC_ADD_CFLAGS], [
27 for element in [$1]; do
28 eval "CFLAGS_${element}="'"$'"{CFLAGS_${element}} $2"'"'
29 am_modules_with_cflags="${am_modules_with_cflags} ${element}"
33 AC_DEFUN([VLC_ADD_CXXFLAGS], [
34 for element in [$1]; do
35 eval "CXXFLAGS_${element}="'"$'"{CXXFLAGS_${element}} $2"'"'
36 am_modules_with_cxxflags="${am_modules_with_cxxflags} ${element}"
40 AC_DEFUN([VLC_ADD_OBJCFLAGS], [
41 for element in [$1]; do
42 eval "OBJCFLAGS_${element}="'"$'"{OBJCFLAGS_${element}} $2"'"'
43 am_modules_with_objcflags="${am_modules_with_objcflags} ${element}"
47 AC_DEFUN([VLC_ADD_LDFLAGS], [
48 for element in [$1]; do
49 eval "LDFLAGS_${element}="'"'"$2 "'$'"{LDFLAGS_${element}} "'"'
50 am_modules_with_ldflags="${am_modules_with_ldflags} ${element}"
54 AC_DEFUN([VLC_ADD_LIBS], [
55 for element in [$1]; do
56 eval "LIBS_${element}="'"'"$2 "'$'"{LIBS_${element}} "'"'
57 am_modules_with_libs="${am_modules_with_libs} ${element}"
61 AC_DEFUN([VLC_SET_CFLAGS_WERROR], [
62 for element in [$1]; do
63 eval "CFLAGS_WERROR_${element}="'"'"$2"'"'
64 am_modules_with_werror="${am_modules_with_werror} ${element}"
68 dnl ===========================================================================
69 dnl Macros to save and restore default flags
71 AC_DEFUN([VLC_SAVE_FLAGS], [
72 CPPFLAGS_save="${CPPFLAGS}"
73 CFLAGS_save="${CFLAGS}"
74 CXXFLAGS_save="${CXXFLAGS}"
75 OBJCFLAGS_save="${OBJCFLAGS}"
76 LDFLAGS_save="${LDFLAGS}"
80 AC_DEFUN([VLC_RESTORE_FLAGS], [
81 CPPFLAGS="${CPPFLAGS_save}"
82 CFLAGS="${CFLAGS_save}"
83 CXXFLAGS="${CXXFLAGS_save}"
84 OBJCFLAGS="${OBJCFLAGS_save}"
85 LDFLAGS="${LDFLAGS_save}"
89 dnl ===========================================================================
90 dnl Helper macro to generate the vlc-config.in file
92 AC_DEFUN([VLC_OUTPUT_VLC_CONFIG_IN], [
94 AC_MSG_RESULT(configure: creating ./vlc-config.in)
96 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} ${am_modules_with_werror}; do echo $x; done | sort | uniq`"
99 sed -ne '/#@1@#/q;p' < "${srcdir}/vlc-config.in.in" \
100 | sed -e "s/@gprof@/${enable_gprof}/" \
101 -e "s/@cprof@/${enable_cprof}/" \
102 -e "s/@optim@/${enable_optimizations}/" \
103 -e "s/@debug@/${enable_debug}/" \
104 -e "s/@release@/${enable_release}/" \
105 -e "s/@PLUGINS@/${PLUGINS}/" \
106 -e "s/@BUILTINS@/${BUILTINS}/" \
107 -e "s/@CFLAGS_TUNING@/${CFLAGS_TUNING}/" \
108 -e "s/@CFLAGS_OPTIM_SIZE@/${CFLAGS_OPTIM_SIZE}/" \
109 -e "s/@CFLAGS_OPTIM_SPEED@/${CFLAGS_OPTIM_SPEED}/" \
110 -e "s/@CFLAGS_OPTIM_NODEBUG@/${CFLAGS_OPTIM_NODEBUG}/" \
111 -e "s/@CFLAGS_NOOPTIM@/${CFLAGS_NOOPTIM}/" \
115 for x in `echo ${am_all_modules}`
118 if test "`eval echo @'$'CPPFLAGS_${x}@`" != "@@"; then
119 echo " cppflags=\"\${cppflags} `eval echo '$'CPPFLAGS_${x}`\""
121 if test "`eval echo @'$'CFLAGS_${x}@`" != "@@"; then
122 echo " cflags=\"\${cflags} `eval echo '$'CFLAGS_${x}`\""
124 if test "`eval echo @'$'CXXFLAGS_${x}@`" != "@@"; then
125 echo " cxxflags=\"\${cxxflags} `eval echo '$'CXXFLAGS_${x}`\""
126 if test "${x}" != "plugin" -a "${x}" != "builtin"; then
127 echo " linkage=\"c++\""
130 if test "`eval echo @'$'OBJCFLAGS_${x}@`" != "@@"; then
131 echo " objcflags=\"\${objcflags} `eval echo '$'OBJCFLAGS_${x}`\""
132 if test "${x}" != "plugin" -a "${x}" != "builtin"; then
133 echo " if test \"\${linkage}\" = \"c\"; then linkage=\"objc\"; fi"
136 if test "`eval echo @'$'LDFLAGS_${x}@`" != "@@"; then
137 echo " ldflags=\"\${ldflags} `eval echo '$'LDFLAGS_${x}`\""
139 if test "`eval echo @'$'LIBS_${x}@`" != "@@"; then
140 echo " libs=\"\${libs} `eval echo '$'LIBS_${x}`\""
142 if test "`eval echo @'$'CFLAGS_WERROR_${x}@`" != "@@"; then
143 echo " cflags_werror=\"`eval echo '$'CFLAGS_WERROR_${x}`\""
146 ] done >> vlc-config.in
148 dnl '/#@1@#/,${/#@.@#/d;p}' won't work on OS X
149 sed -ne '/#@1@#/,$p' < "${srcdir}/vlc-config.in.in" \
150 | sed -e '/#@.@#/d' >> vlc-config.in
153 dnl ===========================================================================
154 dnl Macros for shared object handling (TODO)
156 AC_DEFUN([VLC_LIBRARY_SUFFIX], [
157 AC_MSG_CHECKING(for shared objects suffix)
162 *mingw32* | *cygwin* | *wince* | *mingwce*)
172 AC_MSG_RESULT(${LIBEXT})
173 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])