1#!/bin/sh
2#
3# autogen.sh glue for CMU Cyrus IMAP
4# $Id: autogen.sh,v 1.4 2006/05/25 12:25:19 rollinhand Exp $
5#
6# Requires: automake, autoconf, dpkg-dev
7set -e
8test ! ${OSTYPE} && {
9	OSTYPE="other"
10}
11
12# Check if needed software is available on system
13# MSYS is used on Windows
14test "${OSTYPE}" = "msys" && {
15	echo "Detected Operating System: ${OSTYPE}"
16}
17
18# Unix-based operating systems
19test ${OSTYPE} != "msys" -a ${OSTYPE} != "cygwin" && {
20	echo "Detected Operating System: ${OSTYPE}"
21	echo -n "Check Build Environment..."
22	for tool in aclocal autoreconf autoheader automake libtoolize intltoolize autoconf; do
23		test ! `whereis ${tool} | awk '{print $2}'` && {
24			echo " not OK"
25			echo "${tool} not found - please install first!"
26			exit
27		}
28	done
29	echo " OK"
30}
31
32# Refresh GNU autotools toolchain.
33# Test if /usr/share/automake exists, else prove for automake-$version
34# This test-case is e.g. needed for SuSE distributions
35#automk="automake"
36#test ! -d /usr/share/automake && {
37#	version=`automake --version | head -n 1 | awk '{print $4}' | awk -F. '{print $1"."$2}'`
38#	automk="automake-${version}"
39#}
40
41#for i in config.guess config.sub missing install-sh mkinstalldirs ; do
42#	test -r /usr/share/${automk}/${i} && {
43#		rm -f ${i}
44#		cp /usr/share/${automk}/${i} .
45#	}
46#	chmod 755 ${i}
47#done
48
49libtoolize --copy --force
50aclocal
51autoheader
52automake --verbose --copy --add-missing
53glib-gettextize --force --copy
54#autoreconf -i -f -v --warnings=all
55intltoolize --copy --force
56autoconf
57
58
59# For the Debian build
60test -d debian -a "${OSTYPE}" != "msys" -a "${OSTYPE}" != "cygwin" && {
61	# Kill executable list first
62	`rm -f debian/executable.files`
63
64	# Make sure our executable and removable lists won't be screwed up
65	debclean && echo Cleaned buildtree just in case...
66
67	# refresh list of executable scripts, to avoid possible breakage if
68	# upstream tarball does not include the file or if it is mispackaged
69	# for whatever reason.
70	echo Generating list of executable files...
71	`rm -f debian/executable.files`
72	`find -type f -perm +111 ! -name '.*' -fprint debian/executable.files`
73
74	# link these in Debian builds
75#	rm -f config.sub config.guess
76#	ln -s /usr/share/misc/config.sub .
77#	ln -s /usr/share/misc/config.guess .
78}
79
80exit 0
81