Add fix for gmpc-live
[gmpc-lirc.git] / autogen.sh
blob8eae50b27b749273a4d7ba284cddf885a3fddfe6
1 #!/bin/sh
2 # Run this to set up the build system: configure, makefiles, etc.
3 # (at one point this was based on the version in enlightenment's cvs)
5 package="gmpc-lirc"
7 olddir="`pwd`"
8 srcdir="`dirname $0`"
9 test -z "$srcdir" && srcdir=.
10 cd "$srcdir"
11 DIE=
12 AM_VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
13 AC_VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9][0-9]\).*/\1/"
14 VERSIONMKINT="sed -e s/[^0-9]//"
15 case `uname` in
16 FreeBSD)
17 AM_VERSIONS='1.4 1.5 1.9'
18 AC_VERSIONS='2.53 2.59'
20 Linux)
21 AM_VERSIONS='1.10'
22 AC_VERSIONS='2.61'
24 #OpenBSD)
25 #Needs works
26 # AM_VERSIONS='1.4 1.8 1.9'
27 # AC_VERSIONS='2.13 2.52 2.57 2.59'
28 #;;
30 # Use * here not to limit systems we do not have a case for.
31 # wrappers should pick these up without the need of our help.
32 #AM_VERSIONS='1.4 1.5 1.6 1.7 1.8 1.9 1.10'
33 #AC_VERSIONS='2.13 2.58 2.59 2.60'
34 AM_VERSIONS=''
35 AC_VERSIONS=''
37 esac
38 if test -n "$AM_FORCE_VERSION"
39 then
40 AM_VERSIONS="$AM_FORCE_VERSION"
41 else
42 $AM_VERSIONS
44 if test -n "$AC_FORCE_VERSION"
45 then
46 AC_VERSIONS="$AC_FORCE_VERSION"
47 else
48 $AC_VERSIONS
51 versioned_bins ()
53 bin="$1"
54 needed_int=`echo $VERNEEDED | $VERSIONMKINT`
55 for i in $VERSIONS
57 i_int=`echo $i | $VERSIONMKINT`
58 if test $i_int -ge $needed_int
59 then
60 echo $bin-$i $bin$i $bin-$i_int $bin$i_int
62 done
63 echo $bin
66 for c in autoconf autoheader automake aclocal
68 uc=`echo $c | tr a-z A-Z`
69 eval "val=`echo '$'$uc`"
70 if test -n "$val"
71 then
72 echo "$uc=$val in environment, will not attempt to auto-detect"
73 continue
76 case "$c" in
77 autoconf|autoheader)
78 VERNEEDED=`fgrep AC_PREREQ configure.ac | $AC_VERSIONGREP`
79 VERSIONS="$AC_VERSIONS"
80 pkg=autoconf
82 automake|aclocal)
83 VERNEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $AM_VERSIONGREP`
84 VERSIONS="$AM_VERSIONS"
85 pkg=automake
87 esac
88 printf "checking for $c ... "
89 for x in `versioned_bins $c`; do
90 ($x --version < /dev/null > /dev/null 2>&1) > /dev/null 2>&1
91 if test $? -eq 0
92 then
93 echo $x
94 eval $uc=$x
95 break
97 done
98 eval "val=`echo '$'$uc`"
99 if test -z "$val"
100 then
101 if test $c = $pkg
102 then
103 DIE="$DIE $c=$VERNEEDED"
104 else
105 DIE="$DIE $c($pkg)=$VERNEEDED"
108 done
110 if test -n "$LIBTOOLIZE"
111 then
112 echo "LIBTOOLIZE=$LIBTOOLIZE in environment," \
113 "will not attempt to auto-detect"
114 else
115 printf "checking for libtoolize ... "
116 for x in libtoolize glibtoolize
118 ($x --version < /dev/null > /dev/null 2>&1) > /dev/null 2>&1
119 if test $? -eq 0
120 then
121 echo $x
122 LIBTOOLIZE=$x
123 break
125 done
128 if test -z "$LIBTOOLIZE"
129 then
130 DIE="$DIE libtoolize(libtool)"
133 if test -n "$DIE"
134 then
135 echo "You must have the following installed to compile $package:"
136 for i in $DIE
138 printf ' '
139 echo $i | sed -e 's/(/ (from /' -e 's/=\(.*\)/ (>= \1)/'
140 done
141 echo "Download the appropriate package(s) for your system,"
142 echo "or get the source from one of the GNU ftp sites"
143 echo "listed in http://www.gnu.org/order/ftp.html"
144 exit 1
147 echo "Generating configuration files for $package, please wait...."
149 ACLOCAL_FLAGS="$ACLOCAL_FLAGS"
151 # /usr/share/aclocal is most likely included by default, already...
152 ac_local_paths='
153 /usr/local/share/aclocal
154 /sw/share/aclocal
155 /usr/pkg/share/aclocal
156 /opt/share/aclocal
157 /usr/gnu/share/aclocal
160 for i in $ac_local_paths; do
161 if test -d "$i"; then
162 ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $i"
163 # we probably only want one of these...
164 break
166 done
168 echo " $ACLOCAL $ACLOCAL_FLAGS"
169 $ACLOCAL $ACLOCAL_FLAGS
171 echo " $AUTOHEADER"
172 $AUTOHEADER
174 echo " $LIBTOOLIZE --automake"
175 $LIBTOOLIZE --automake
177 echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
178 $AUTOMAKE --add-missing $AUTOMAKE_FLAGS
180 echo " $AUTOCONF"
181 $AUTOCONF
183 cd "$olddir"
184 if test x$NOCONFIGURE = x; then
185 "$srcdir"/configure "$@" && echo