-
Notifications
You must be signed in to change notification settings - Fork 121
/
autogen.sh
executable file
·143 lines (124 loc) · 5.22 KB
/
autogen.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
if [ -z $LIBTOOLIZE ] ; then
LIBTOOLIZE=$(type -P libtoolize)
if [ -z $LIBTOOLIZE ] ; then
LIBTOOLIZE=$(type -P glibtoolize)
fi
fi
if [ -z $LIBTOOL ] ; then
LIBTOOL=$(type -P "${LIBTOOLIZE%???}")
fi
if [ -z $LIBTOOL ] || [ -z $LIBTOOLIZE ] ; then
echo "Unable to find working libtool. [$LIBTOOL][$LIBTOOLIZE]"
exit 1
fi
# Make a new Makefile.am in src
BASE_DIR=`pwd`
#cd $BASE_DIR/src/sst/elements
#echo "# Autogenerated by SST Autogen" > Makefile.am
#echo -n "SUBDIRS = " > Makefile.am
#
#FOUND_ONE_ELEMENT=0
#
#
#for elem_dir in `ls ./`; do
# if [ -d $elem_dir ]; then
# if [ -r $elem_dir/Makefile.am ]; then
# echo "Found: $elem_dir/Makefile.am"
# echo " \\" >> Makefile.am
# echo -n " $elem_dir" >> Makefile.am
# fi
#
# if [ $FOUND_ONE_ELEMENT -eq 0 ]; then
# sst_elements="$elem_dir"
# FOUND_ONE_ELEMENT=1
# else
# sst_elements="$sst_elements $elem_dir"
# fi
# fi
#done
#
#cd $BASE_DIR
echo "AC_DEFUN([SST_ELEMENT_CONFIG_OUTPUT], [" > config/sst_elements_config_output.m4
echo "dnl Automatically generated by SST configuration system" > config/sst_elements_include.m4
ignored_list=
added_make_list=
added_m4_list=
# Look at the the directories in the elements subdir
for file in `ls $BASE_DIR/src/sst/elements`; do
# Make sure file is actually a dir
if [ -d "$BASE_DIR/src/sst/elements/$file" ]; then
# Testing for .ignore and its associated .unignore settings
if test -f "$BASE_DIR/src/sst/elements/$file/.ignore" -a ! -f "$BASE_DIR/src/sst/elements/$file/.unignore" ; then
ignored_list="$ignored_list $file"
elif test -f "$BASE_DIR/src/sst/elements/$file/.ignore" && \
test -s $BASE_DIR/src/sst/elements/$file/.unignore && \
test -z "`grep $USER $$BASE_DIR/src/sst/elements/$file/.unignore`" ; then
ignored_list="$ignored_list $elemlib"
else
# See if we have a config.m4 in the element directory
if [ -r "$BASE_DIR/src/sst/elements/$file/configure.m4" ]; then
echo " SST_${file}_CONFIG([config_${file}=1],[config_${file}=0])" >> config/sst_elements_config_output.m4
echo " AS_IF([test \$config_${file} -eq 1], [active_element_libraries=\"\$active_element_libraries $file\"])" >> config/sst_elements_config_output.m4
echo "m4_include([src/sst/elements/$file/configure.m4])" >> config/sst_elements_include.m4
added_m4_list="$added_m4_list $file"
else
if [ -r "$BASE_DIR/src/sst/elements/$file/Makefile.am" ]; then
echo " active_element_libraries=\"\$active_element_libraries $file\"" >> config/sst_elements_config_output.m4
added_make_list="$added_make_list $file"
fi
fi
if [ -r "$BASE_DIR/src/sst/elements/$file/Makefile.am" ]; then
echo " AC_CONFIG_FILES([src/sst/elements/$file/Makefile])" >> config/sst_elements_config_output.m4
if [ ! -f "$BASE_DIR/src/sst/elements/$file/.nodist" ]; then
echo " dist_element_libraries=\"\$dist_element_libraries $file\"" >> config/sst_elements_config_output.m4
else
echo " AC_MSG_WARN([Element library ]$file[ will build, but will not be distributed.])" >> config/sst_elements_config_output.m4
echo
echo "***WARNING: Element library $file will build, but will not be distributed via make dist due to .nodist file in directory."
fi
fi
echo " " >> config/sst_elements_config_output.m4
fi
fi
done
echo ' SST_ACTIVE_ELEMENT_LIBRARIES="$active_element_libraries"' >> config/sst_elements_config_output.m4
echo ' SST_DIST_ELEMENT_LIBRARIES="$dist_element_libraries"' >> config/sst_elements_config_output.m4
echo " AC_SUBST(SST_ACTIVE_ELEMENT_LIBRARIES)" >> config/sst_elements_config_output.m4
echo " AC_SUBST(SST_DIST_ELEMENT_LIBRARIES)" >> config/sst_elements_config_output.m4
echo "])" >> config/sst_elements_config_output.m4
# Output our findings
echo
echo "Included Element Libraries via Makefile in src/sst/elements/"
echo "========================================================="
for i in $added_make_list ; do echo " $i" ; done
echo
echo "Included Element Libraries via config.m4 files in src/sst/elements/"
echo "========================================================="
for i in $added_m4_list ; do echo " $i" ; done
echo
echo "Ignored Element Libraries in src/sst/elements/"
echo "========================================================="
for i in $ignored_list ; do echo " $i" ; done
echo
echo "========================================================="
echo "========================================================="
echo
echo "Generating configure files..."
# Delete the old libtool output
rm -rf libltdl src/libltdl
echo "Running ${LIBTOOLIZE}..."
$LIBTOOLIZE --automake --copy --ltdl
if test -d libltdl; then
echo "Moving libltdl to src .."
mv libltdl ./src/
fi
if test ! -d src/libltdl ; then
echo "libltdl for elements exist. Aborting."
exit 1
fi
aclocal -I config
autoheader
autoconf
automake --foreign --add-missing --include-deps
autoreconf --force --install