-
Notifications
You must be signed in to change notification settings - Fork 452
/
_autosetup
executable file
·126 lines (113 loc) · 4.27 KB
/
_autosetup
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
#!/bin/sh
## $Id$
## ---------- some portability checks/adjustments [stolen from configure] ----------
## 'echo -n' is not portable..
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
##----------
## ----------------------------------------------------------------------
## Check that given command $1 has version >= $2
## Full path $3 may be specified in order to skip command search.
## return 0 if ok, 1 too old or not found (-> shell conventions).
## ----------------------------------------------------------------------
check_version()
{
dir=`pwd`
cd /tmp
foundit=
## get current version of $1
desired=`echo $2 | awk -F. '{print $1*100+$2}'`
echo $ECHO_N "Checking version of '$1' >= $desired... $ECHO_C"
name=$1
fullpath=${3:-`command -v "$name"`};
if [ -x "$fullpath" ]; then
foundit=yes;
fi
if [ "$foundit" != yes ]; then
echo "Didn't find application";
version=0
success=no
else
cmdline="$fullpath --version";
if version=`($cmdline 2>/dev/null)` 2>/dev/null; then
echo >/dev/null
else
version="0";
fi
if [ -n "${version}" ]; then
version=`echo $version | awk '{ for (i=1;i<=NF;i++) { split($i,j,"."); m=j[1]*100+j[2] ; if ((m*1)>0) { print m ; break; } } }'`
if [ -z "$version" ]; then version=0; fi
success=`echo "$version" "$desired" | awk '{ if ($1 >= $2) { print "yes";} else {print "no";}} '`
else
version=0
success=no
fi
fi
cd $dir
if [ $success = "yes" ] ; then
echo "succeeded. ($version)"
return 0;
else
echo "failed. ($version)"
return 1;
fi
} ## check_version()
## --------------------------------------------------------------------------------
## 'MAIN' starts here
## --------------------------------------------------------------------------------
echo "Bootstrapping configure script and makefiles:"
## ---------- first check santity of the installed versions of the build-system
## in case there's GNU drop-in tools available, set these
## some sorry systems don't have proper GNU-make...
if ! check_version make 3.79 "$MAKE"; then
echo "Couldn't find a new-enough version of GNU 'make', please install one!";
echo "If you have a newer version, set the environment variable 'MAKE' to its path";
exit 1;
fi
## FreeBSD's m4 seems to be broken? Download a fresh one
if ! check_version m4 1.4 "$M4" && [ ! -f /usr/ccs/bin/m4 ] && ! check_version gm4 1.4; then
echo "Couldn't find a new-enough version of 'm4', please install one!";
echo "If you have a newer version, set the environment variable 'M4' to its path";
exit 1;
fi
if ! check_version pkg-config 0.15; then
echo "Couldn't find a new-enough version of 'pkg-config', please install one!";
exit 1;
# build_lsc_aux "pkgconfig-0.15.0"
fi
if ! check_version autoreconf 2.58; then
echo "Couldn't find a new-enough version of 'autoreconf', please install one!";
exit 1;
# build_lsc_aux "autoconf-2.59"
fi
if ! check_version automake 1.8 "$AUTOMAKE"; then
echo "Couldn't find a new-enough version of 'automake', please install one!";
echo "If you have a newer version, set the environment variable 'AUTOMAKE' and 'ACLOCAL' to its path";
exit 1;
# build_lsc_aux "automake-1.8.5"
fi
if ! check_version libtoolize 1.5 "$LIBTOOLIZE"; then
echo "Couldn't find a new-enough version of 'libtoolize', please install one!";
echo "If you have a newer version, set the environment variable 'LIBTOOLIZE' to its path";
exit 1;
fi
## ---------- now run autoreconf
cmdline="autoreconf -i";
## -- if _autosetup was invoked with -f run autoreconf with -f to force a recreation of all files
if [ "$1" = "-f" ]; then
cmdline="autoreconf -i -f";
fi
echo "$cmdline"
if eval $cmdline; then
echo "Done, now run ./configure"
echo " ./configure -C to enable caching"
exit 0
else
echo "Something failed .... please check error-message and re-run when fixed."
echo "exiting..."
exit 1
fi