-
Notifications
You must be signed in to change notification settings - Fork 34
/
autogen.sh
executable file
·148 lines (135 loc) · 5.68 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
144
145
146
147
148
#!/bin/bash
#
# Authors: Brian W. Barrett <[email protected]>,
# Kyle B. Wheeler <[email protected]>
#
echo "Generating configure files..."
if [ "$ACLOCAL" ] ; then
# do nothing
echo I saw ACLOCAL defined to be $ACLOCAL
elif type aclocal &>/dev/null ; then
export ACLOCAL=`type -P aclocal`
else
echo "ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "I need aclocal in order to generate the configure script and makefiles. I couldn't find it in your PATH, though. Perhaps you need to set the ACLOCAL environment variable to point toward a custom installation?"
exit -1
fi
if [ "$LIBTOOLIZE" ] ; then
# accept anything that's been pre-configured
echo LIBTOOLIZE=$LIBTOOLIZE
elif type glibtoolize &>/dev/null ; then
# prefer glibtoolize over libtoolize
export LIBTOOLIZE=`type -p glibtoolize`
echo LIBTOOLIZE=$LIBTOOLIZE
elif type libtoolize &>/dev/null ; then
export LIBTOOLIZE=`type -p libtoolize`
echo LIBTOOLIZE=$LIBTOOLIZE
else
echo "ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "I need libtoolize in order to generate the configure script and makefiles. I couldn't find either libtoolize or glibtoolize in your PATH. Perhaps you need to set the LIBTOOLIZE environment variable to point toward a custom installation?"
exit -1
fi
libtool_version=( $($LIBTOOLIZE --version) )
libtool_version=( ${libtool_version[3]//./ } )
libtool_version=( ${libtool_version[*]/[a-z]/} )
if [ ${libtool_version[0]} -lt 2 ] ; then
if [ ${libtool_version[0]} -eq 1 ] ; then
if [ ${libtool_version[1]} -lt 5 ] ; then
echo "Your version of libtoolize ($LIBTOOLIZE) is too old!"
echo "We have tested with libtool 1.5.22."
echo -n "You have: "
$LIBTOOLIZE --version | head -n 1
exit -1
elif [ ${libtool_version[1]} -lt 9 ] ; then
echo "You have an awfully old version of libtool. (${libtool_version[0]}.${libtool_version[1]}.${libtool_version[2]})"
echo "We prefer to use LT_INIT, which came out with libtool 1.9b,"
echo "way back in 2004. Maybe you should consider upgrading."
fi
else
echo "Your version of libtoolize ($LIBTOOLIZE) is too old!"
echo "We have tested with libtool 1.5.22."
echo -n "You have: "
$LIBTOOLIZE --version | head -n 1
exit -1
fi
fi
if [ "${LIBTOOLIZE}" = "${LIBTOOLIZE#/}" ] ; then
libtool_fullpath=$(type -p "${LIBTOOLIZE}" )
else
libtool_fullpath="$LIBTOOLIZE"
fi
if [ "${ACLOCAL}" = "${ACLOCAL#/}" ] ; then
aclocal_fullpath=$(type -p "${ACLOCAL}" )
else
aclocal_fullpath="$ACLOCAL"
fi
if [ "${libtool_fullpath%bin/*}" != "${aclocal_fullpath%bin/*}" ] ; then
echo "Libtoolize and aclocal are not in the same directory, so I'm guessing ACLOCAL needs to be modified to include libtoolize's directory in its search path."
if [ -d "${libtool_fullpath%/bin/*}/share/aclocal" ] ; then
ACLOCAL_INCLUDE="${libtool_fullpath%/bin/*}/share/aclocal"
echo 'That aclocal directory looks like "'$ACLOCAL_INCLUDE'"'
else
echo "I would do it for you, but I can't find a likely candidate".
fi
else
echo "Since LIBTOOLIZE and ACLOCAL are in the same directory, I'm going to assume they know about each other."
fi
if [ "$AUTOMAKE" ] ; then
# accept anything that's been pre-configured
echo Using AUTOMAKE=$AUTOMAKE
elif type automake &>/dev/null ; then
export AUTOMAKE=`type -p automake`
else
echo "ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "I need automake in order to generate the configure script and makefiles. I couldn't find it in your PATH, though. Perhaps you need to set the AUTOMAKE environment variable to point toward a custom installation?"
exit -1
fi
if [ "$AUTOCONF" ] ; then
# accept anything that's been pre-configured
echo Using AUTOCONF=$AUTOCONF
elif type autoconf &>/dev/null ; then
export AUTOCONF=`type -p autoconf`
else
echo "ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "I need autoconf in order to generate the configure script and makefiles. I couldn't find it in your PATH, though. Perhaps you need to set the AUTOCONF environment variable to point toward a custom installation?"
exit -1
fi
if [ "$AUTORECONF" ] ; then
# accept anything that's been pre-configured
echo Using AUTORECONF=$AUTORECONF
elif type autoreconf &>/dev/null ; then
export AUTORECONF=`type -p autoreconf`
else
echo "ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "I need autoreconf in order to generate the configure script and makefiles. I couldn't find it in your PATH, though. Perhaps you need to set the AUTORECONF environment variable to point toward a custom installation?"
exit -1
fi
if [ "$ACLOCAL_INCLUDE" ] ; then
echo 'ACLOCAL="'$ACLOCAL -I$ACLOCAL_INCLUDE'"'
export ACLOCAL="$ACLOCAL -I$ACLOCAL_INCLUDE"
fi
# If this directory isn't removed, the configure script may not have the right
# dynamically-generated version number
if [ -d autom4te.cache ] ; then
rm -rf autom4te.cache
fi
version=$(awk '{if(NR==1)print$2;else exit}' ./NEWS)
if [[ ${version%b} != ${version} ]] && type git &>/dev/null && [[ $SKIPVGEN != 1 ]] ; then
echo "Counting entries in git's log to come up with a revision number..."
#git log -1 --pretty=format:%h | tee .autogen_git_output
git log --pretty=oneline | wc -l | tee .autogen_git_output
#svn stat -u README | tee .autogen_svn_output
rev=$version-$(awk '{print $1}' .autogen_git_output)
if [ "$rev" ] ; then
echo -n $rev > .autogen-version
else
echo $version | tr -d '\012' > .autogen-version
fi
else
echo $version | tr -d '\012' > .autogen-version
fi
$AUTORECONF --install --symlink --warnings=gnu,obsolete,override,portability,no-obsolete "$@" && \
echo "Preparing was successful if there were no error messages above." && \
exit 0
echo "It appears that configure file generation failed. Sorry :(."
exit -1