-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathautogen.sh
executable file
·99 lines (87 loc) · 3.47 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
#!/bin/sh
# This file is a part of SEAPT, Samsung Extended Autotools Project Template
# Copyright 2012,2013 Samsung R&D Institute Russia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
isubuntu="$(uname -v|grep Ubuntu)"
check_prog() {
printf "Checking for $1... "
if [ -z "$($1 --version 2>/dev/null)" ]; then
echo no
if [ -n "$isubuntu" ]; then
sudo apt-get -y install $2
printf "Checking for $1... "
if [ -z "$($1 --version 2>/dev/null)" ]; then
echo no
echo "Error: $1 was not found, aborting"
exit 1
fi
else
echo "Error: $1 was not found, aborting"
exit 1
fi
fi
echo yes
}
check_prog aclocal automake
check_prog autoheader autoconf
check_prog autoconf autoconf
check_prog libtoolize libtool
check_prog automake automake
rm -rf autom4te.cache
rm -f aclocal.m4 ltmain.sh config.log config.status configure libtool stamp-h1 config.h config.h.in
find -name Makefile.in -exec rm {} \;
mkdir -p m4
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS || (rmdir --ignore-fail-on-non-empty m4; exit 1)
rmdir --ignore-fail-on-non-empty m4
echo "Running autoheader..." ; autoheader || exit 1
echo "Running autoconf..." ; autoconf || exit 1
echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
echo "Running automake..." ; (automake --add-missing --copy --foreign ) || exit 1
W=0
rm -f config.cache-env.tmp
echo "OLD_PARM=\"$@\"" >> config.cache-env.tmp
echo "OLD_CFLAGS=\"$CFLAGS\"" >> config.cache-env.tmp
echo "OLD_CXXFLAGS=\"$CXXFLAGS\"" >> config.cache-env.tmp
echo "OLD_CPPFLAGS=\"$CPPFLAGS\"" >> config.cache-env.tmp
echo "OLD_PATH=\"$PATH\"" >> config.cache-env.tmp
echo "OLD_PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\"" >> config.cache-env.tmp
echo "OLD_LDFLAGS=\"$LDFLAGS\"" >> config.cache-env.tmp
cmp -s config.cache-env.tmp config.cache-env >> /dev/null
if [ $? -ne 0 ]; then
W=1;
fi
if [ $W -ne 0 ]; then
echo "Cleaning configure cache...";
rm -f config.cache config.cache-env
mv config.cache-env.tmp config.cache-env
else
rm -f config.cache-env.tmp
fi
if [ -n "$1" ]; then
path=$(pwd)
mkdir -p "$1"
cd "$1"
shift
$path/configure $@
cd $path
fi