~ubuntu-branches/ubuntu/precise/boinc/precise

1 by Frank S. Thomas
Import upstream version 5.4.9
1
#!/bin/sh
2
1.2.4 by Steffen Moeller
Import upstream version 6.12.8+dfsg
3
## $Id: _autosetup 19144 2009-09-23 17:16:24Z davea $
1 by Frank S. Thomas
Import upstream version 5.4.9
4
5
## ---------- some portability checks/adjustments [stolen from configure] ----------
6
## 'echo -n' is not portable..
7
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
8
  *c*,-n*) ECHO_N= ECHO_C='
9
' ECHO_T='	' ;;
10
  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
11
  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
12
esac
13
##----------
14
15
## ----------------------------------------------------------------------
16
## Check that given command $1 has version >= $2.$3
17
## return 0 if ok, 1 too old or not found  (-> shell conventions).
18
## ----------------------------------------------------------------------
19
check_version()
20
{  
21
    dir=`pwd`
22
    cd /tmp
23
    foundit=
24
    ## get current version of $1
1.1.3 by Frank S. Thomas
Import upstream version 5.8.17
25
    desired=`echo $2 | awk -F. '{print $1*100+$2}'`
1 by Frank S. Thomas
Import upstream version 5.4.9
26
    echo $ECHO_N "Checking version of '$1' >= $desired... $ECHO_C"
27
    name=$1
28
    fullpath=`type $name | awk '{ print $(NF) }'`;
29
    if [ -x "$fullpath" ]; then
30
	foundit=yes;
31
    fi
32
33
    if [ "$foundit" != yes ]; then 
34
	echo "Didn't find application";
35
	version=0
36
	success=no
37
    else
38
	cmdline="$fullpath --version";
39
	if version=`($cmdline 2>/dev/null)` 2>/dev/null; then
40
	    echo >/dev/null
41
	else
42
	    version="0";
43
	fi
44
	if [ -n "${version}" ]; then
1.1.3 by Frank S. Thomas
Import upstream version 5.8.17
45
	    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; } } }'`
1 by Frank S. Thomas
Import upstream version 5.4.9
46
	    if [ -z "$version" ]; then version=0; fi
47
	    success=`echo "$version" "$desired" | awk '{ if ($1 >= $2) { print "yes";} else {print "no";}} '`
48
	else
49
	    version=0
50
	    success=no
51
	fi
52
    fi
53
    cd $dir
54
55
    if [ $success = "yes" ] ; then
56
      echo "succeeded. ($version)"
57
      return 0;
58
    else
59
      echo "failed. ($version)"
60
      return 1;
61
    fi
62
} ## check_version()
63
64
65
  ## --------------------------------------------------------------------------------
66
  ## 'MAIN' starts here 
67
  ## --------------------------------------------------------------------------------
68
  echo "Bootstrapping configure script and makefiles:"
69
70
  ## ---------- first check santity of the installed versions of the build-system
71
  ## in case there's GNU drop-in tools available, set these
72
73
  ## some sorry systems don't have proper GNU-make...
74
  if check_version make 3.79; then
75
      echo >/dev/null
76
  else
77
      if check_version gmake 3.79; then
78
	  have_gmake=yes;
79
      else
80
	echo "Couldn't find a new-enough version of GNU 'make', please install one!";
1.2.4 by Steffen Moeller
Import upstream version 6.12.8+dfsg
81
    echo "If you have a newer version, set the environment variable 'MAKE' to its path";
1 by Frank S. Thomas
Import upstream version 5.4.9
82
	exit 1;
83
      fi
84
  fi
85
86
  ## FreeBSD's m4 seems to be broken? Download a fresh one
87
  if check_version m4 1.4; then
88
      echo >/dev/null
89
  else
1.1.3 by Frank S. Thomas
Import upstream version 5.8.17
90
      ## solaris m4 works fine
91
      if test -f /usr/ccs/bin/m4
92
      then
93
         echo >/dev/null
1.2.3 by Rene Mayorga
Import upstream version 6.4.5
94
      elif check_version gm4 1.4; then
95
         have_gm4=yes;
1.1.3 by Frank S. Thomas
Import upstream version 5.8.17
96
      else 
97
         echo "Couldn't find a new-enough version of 'm4', please install one!";
1.2.4 by Steffen Moeller
Import upstream version 6.12.8+dfsg
98
         echo "If you have a newer version, set the environment variable 'M4' to its path";
1.1.3 by Frank S. Thomas
Import upstream version 5.8.17
99
         exit 1;
100
      fi
1 by Frank S. Thomas
Import upstream version 5.4.9
101
      # build_lsc_aux "m4-1.4.1"
102
  fi
103
104
  if check_version pkg-config 0.15; then
105
      echo >/dev/null
106
  else
107
      echo "Couldn't find a new-enough version of 'pkg-config', please install one!";
108
      exit 1;
109
      # build_lsc_aux "pkgconfig-0.15.0"
110
  fi
111
1.2.4 by Steffen Moeller
Import upstream version 6.12.8+dfsg
112
  if check_version autoreconf 2.58; then
1 by Frank S. Thomas
Import upstream version 5.4.9
113
      echo >/dev/null
114
  else
1.2.4 by Steffen Moeller
Import upstream version 6.12.8+dfsg
115
      echo "Couldn't find a new-enough version of 'autoreconf', please install one!";
1 by Frank S. Thomas
Import upstream version 5.4.9
116
      exit 1;
117
      # build_lsc_aux "autoconf-2.59"
118
  fi
119
  if check_version automake 1.8; then
120
      echo >/dev/null
121
  else
122
      echo "Couldn't find a new-enough version of 'automake', please install one!";
1.2.4 by Steffen Moeller
Import upstream version 6.12.8+dfsg
123
      echo "If you have a newer version, set the environment variable 'AUTOMAKE' and 'ACLOCAL' to its path";
1 by Frank S. Thomas
Import upstream version 5.4.9
124
      exit 1;
125
      # build_lsc_aux "automake-1.8.5"
126
  fi
1.2.4 by Steffen Moeller
Import upstream version 6.12.8+dfsg
127
  if check_version libtoolize 1.5; then
128
      echo >/dev/null
129
  else
130
      echo "Couldn't find a new-enough version of 'libtoolize', please install one!";
131
      echo "If you have a newer version, set the environment variable 'LIBTOOLIZE' to its path";
132
      exit 1;
133
  fi
1 by Frank S. Thomas
Import upstream version 5.4.9
134
1.2.4 by Steffen Moeller
Import upstream version 6.12.8+dfsg
135
  ## ---------- now run autoreconf
136
  cmdline="autoreconf -i";
1 by Frank S. Thomas
Import upstream version 5.4.9
137
echo "$cmdline"
138
if eval $cmdline; then
139
    echo "Done, now run ./configure"
140
    echo " ./configure -C                         to enable caching"
141
    exit 0
142
else
143
    echo "Something failed .... please check error-message and re-run when fixed."
144
    echo "exiting..."
145
    exit 1
146
fi