-
Notifications
You must be signed in to change notification settings - Fork 31
/
autogen-common.sh
executable file
·30 lines (23 loc) · 1.03 KB
/
autogen-common.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
M4_DIR=m4
# find plugins Makefile templates
find plugins -name Makefile.am | sed 's|.am$||g' > $M4_DIR/plugin-makefiles.m4
# create plugin list
(cd ./plugins && find . -maxdepth 1 -type d | grep -v '^\.$' | grep -v '\./\.' | sed 's|\./||g' | xargs echo) > $M4_DIR/plugin-list.m4
# create conditionals for builtin plugins
(for plugin in `cat $M4_DIR/plugin-list.m4`; do
u=`echo $plugin | tr '[:lower:]' '[:upper:]'`
echo 'AM_CONDITIONAL(['$u'_BUILTIN], test "$enable_'$plugin'_builtin" = "yes")'
done) > $M4_DIR/plugin-builtin.m4
# create plugin configuration
find plugins -name plugin.m4 | xargs cat > $M4_DIR/plugin-configure.m4
#to debug if plugin configuration code misbehaves (instead of the above line):
#rm plugin-configure.m4
#for f in $(find plugins -name plugin.m4); do
# echo "AC_MSG_RESULT([plugin: $f])" >> plugin-configure.m4
# cat $f >> plugin-configure.m4
#done
# find extra m4 files provided by plugins and symlink them
for f in ` find ./plugins -name '*.m4' | grep -v 'plugin\.m4'`; do
ln -sf $f $M4_DIR/
done