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 m4_foreach_w([element], [$1], [
15 [PLUGINS="${PLUGINS} ]element["]
16 AC_SUBST([LTLIB]element, [lib]element[_plugin.la])
20 dnl Special cases: vlc, pics, plugins, save
21 AC_DEFUN([VLC_ADD_CPPFLAGS], [
22 m4_foreach_w([element], [$1], [
23 [eval "CPPFLAGS_]element[="'"$'"{CPPFLAGS_]element[} $2"'"']
24 [am_modules_with_cppflags="${am_modules_with_cppflags} ]element["]
28 AC_DEFUN([VLC_ADD_CFLAGS], [
29 m4_foreach_w([element], [$1], [
30 [eval "CFLAGS_]element[="'"$'"{CFLAGS_]element[} $2"'"']
31 [am_modules_with_cflags="${am_modules_with_cflags} ]element["]
35 AC_DEFUN([VLC_ADD_CXXFLAGS], [
36 m4_foreach_w([element], [$1], [
37 [eval "CXXFLAGS_]element[="'"$'"{CXXFLAGS_]element[} $2"'"']
38 [am_modules_with_cxxflags="${am_modules_with_cxxflags} ]element["]
42 AC_DEFUN([VLC_ADD_OBJCFLAGS], [
43 m4_foreach_w([element], [$1], [
44 [eval "OBJCFLAGS_]element[="'"$'"{OBJCFLAGS_]element[} $2"'"']
45 [am_modules_with_objcflags="${am_modules_with_objcflags} ]element["]
49 AC_DEFUN([VLC_ADD_LDFLAGS], [
50 m4_foreach_w([element], [$1], [
51 [eval "LDFLAGS_]element[="'"$2 $'"{LDFLAGS_]element[}"'"']
52 [am_modules_with_ldflags="${am_modules_with_ldflags} ]element["]
56 AC_DEFUN([VLC_ADD_LIBS], [
57 m4_foreach_w([element], [$1], [
58 [eval "LIBS_]element[="'"'"$2 "'$'"{LIBS_]element[}"'"']
59 [am_modules_with_libs="${am_modules_with_libs} ]element["]
63 dnl ===========================================================================
64 dnl Macros to save and restore default flags
66 AC_DEFUN([VLC_SAVE_FLAGS], [
67 CPPFLAGS_save="${CPPFLAGS}"
68 CFLAGS_save="${CFLAGS}"
69 CXXFLAGS_save="${CXXFLAGS}"
70 OBJCFLAGS_save="${OBJCFLAGS}"
71 LDFLAGS_save="${LDFLAGS}"
75 AC_DEFUN([VLC_RESTORE_FLAGS], [
76 CPPFLAGS="${CPPFLAGS_save}"
77 CFLAGS="${CFLAGS_save}"
78 CXXFLAGS="${CXXFLAGS_save}"
79 OBJCFLAGS="${OBJCFLAGS_save}"
80 LDFLAGS="${LDFLAGS_save}"
84 dnl ===========================================================================
85 dnl Helper macro to generate the vlc-config.in file
87 AC_DEFUN([VLC_OUTPUT_VLC_CONFIG_IN], [
89 AC_MSG_RESULT(configure: creating ./vlc-config.in)
91 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`"
94 sed -ne '/#@1@#/q;p' < "${srcdir}/vlc-config.in.in" \
95 | sed -e "s/@gprof@/${enable_gprof}/" \
96 -e "s/@cprof@/${enable_cprof}/" \
97 -e "s/@optim@/${enable_optimizations}/" \
98 -e "s/@debug@/${enable_debug}/" \
99 -e "s/@PLUGINS@/${PLUGINS}/" \
100 -e "s/@BUILTINS@/${BUILTINS}/" \
101 -e "s/@CFLAGS_TUNING@/${CFLAGS_TUNING}/" \
102 -e "s/@CFLAGS_OPTIM_SIZE@/${CFLAGS_OPTIM_SIZE}/" \
103 -e "s/@CFLAGS_OPTIM_SPEED@/${CFLAGS_OPTIM_SPEED}/" \
104 -e "s/@CFLAGS_OPTIM_NODEBUG@/${CFLAGS_OPTIM_NODEBUG}/" \
105 -e "s/@CFLAGS_NOOPTIM@/${CFLAGS_NOOPTIM}/" \
109 for x in `echo ${am_all_modules}`
112 if test "`eval echo @'$'CPPFLAGS_${x}@`" != "@@"; then
113 echo " cppflags=\"\${cppflags} `eval echo '$'CPPFLAGS_${x}`\""
115 if test "`eval echo @'$'CFLAGS_${x}@`" != "@@"; then
116 echo " cflags=\"\${cflags} `eval echo '$'CFLAGS_${x}`\""
118 if test "`eval echo @'$'CXXFLAGS_${x}@`" != "@@"; then
119 echo " cxxflags=\"\${cxxflags} `eval echo '$'CXXFLAGS_${x}`\""
120 if test "${x}" != "plugin" -a "${x}" != "builtin"; then
121 echo " linkage=\"c++\""
124 if test "`eval echo @'$'OBJCFLAGS_${x}@`" != "@@"; then
125 echo " objcflags=\"\${objcflags} `eval echo '$'OBJCFLAGS_${x}`\""
126 if test "${x}" != "plugin" -a "${x}" != "builtin"; then
127 echo " if test \"\${linkage}\" = \"c\"; then linkage=\"objc\"; fi"
130 if test "`eval echo @'$'LDFLAGS_${x}@`" != "@@"; then
131 echo " ldflags=\"\${ldflags} `eval echo '$'LDFLAGS_${x}`\""
133 if test "`eval echo @'$'LIBS_${x}@`" != "@@"; then
134 echo " libs=\"\${libs} `eval echo '$'LIBS_${x}`\""
137 ] done >> vlc-config.in
139 dnl '/#@1@#/,${/#@.@#/d;p}' won't work on OS X
140 sed -ne '/#@1@#/,$p' < "${srcdir}/vlc-config.in.in" \
141 | sed -e '/#@.@#/d' >> vlc-config.in
144 dnl ===========================================================================
145 dnl Macros for shared object handling (TODO)
147 AC_DEFUN([VLC_LIBRARY_SUFFIX], [
148 AC_MSG_CHECKING(for shared objects suffix)
153 *mingw32* | *cygwin* | *wince* | *mingwce*)
163 AC_MSG_RESULT(${LIBEXT})
164 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])