Ticket #17052: autogen.sh

File autogen.sh, 5.2 KB (added by shreevatsa.public@…, 15 years ago)

Pidgin's autogen.sh, modified to remove last line

Line 
1#! /bin/sh
2# Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
3# Copyright (C) 2003-2008 Gary Kramlich <grim@reaperworld.com>
4#
5# This program is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License as published by the Free
7# Software Foundation; either version 2 of the License, or (at your option)
8# any later version.
9#
10# This program is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13# more details.
14#
15# You should have received a copy of the GNU General Public License along with
16# this program; if not, write to the Free Software Foundation, Inc., 51
17# Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
19###############################################################################
20# Usage
21###############################################################################
22# This script uses a config file that can be used to stash common arguments
23# passed to configure or environment variables that need to be set before
24# configure is called.  The configuration file is a simple shell script that
25# gets sourced.
26#
27# By default, the config file that is used is named 'autogen.args'.  This can
28# be configured below.
29#
30# Available options that are handled are as follow:
31#   ACLOCAL_FLAGS - command line arguments to pass to aclocal
32#   AUTOCONF_FLAGS - command line arguments to pass to autoconf
33#   AUTOHEADER_FLAGS - command line arguments to pass to autoheader
34#   AUTOMAKE_FLAGS - command line arguments to pass to automake flags
35#   CONFIGURE_FLAGS - command line arguments to pass to configure
36#   GLIB_GETTEXTIZE_FLAGS - command line arguments to pass to glib-gettextize
37#   INTLTOOLIZE_FLAGS - command line arguments to pass to intltoolize
38#   LIBTOOLIZE_FLAGS - command line arguments to pass to libtoolize
39#
40# Other helpful notes:
41#   If you're using a different c compiler, you can override the environment
42#   variable in 'autogen.args'.  For example, say you're using distcc, just add
43#   the following to 'autogen.args':
44#
45#       CC="distcc"
46#
47#   This will work for any influential environment variable to configure.
48###############################################################################
49PACKAGE="Pidgin"
50ARGS_FILE="autogen.args"
51export CFLAGS
52export LDFLAGS
53
54libtoolize="libtoolize"
55case $(uname -s) in
56        Darwin*)
57                libtoolize="glibtoolize"
58                ;;
59        *)
60esac
61
62###############################################################################
63# Some helper functions
64###############################################################################
65check () {
66        CMD=$1
67
68        printf "%s" "checking for ${CMD}... "
69        BIN=`which ${CMD} 2>/dev/null`
70
71        if [ x"${BIN}" = x"" ] ; then
72                echo "not found."
73                echo "${CMD} is required to build ${PACKAGE}!"
74                exit 1;
75        fi
76
77        echo "${BIN}"
78}
79
80run_or_die () { # beotch
81        CMD=$1
82        shift
83
84        OUTPUT=`mktemp autogen-XXXXXX`
85
86        printf "%s" "running ${CMD} ${@}... "
87        ${CMD} ${@} >${OUTPUT} 2>&1
88
89        if [ $? != 0 ] ; then
90                echo "failed."
91                cat ${OUTPUT}
92                rm -f ${OUTPUT}
93                exit 1
94        else
95                echo "done."
96                cat ${OUTPUT}
97
98                rm -f ${OUTPUT}
99        fi
100}
101
102###############################################################################
103# We really start here, yes, very sneaky!
104###############################################################################
105FIGLET=`which figlet 2> /dev/null`
106if [ x"${FIGLET}" != x"" ] ; then
107        ${FIGLET} -f small ${PACKAGE}
108        echo "build system is being generated"
109else
110        echo "autogenerating build system for '${PACKAGE}'"
111fi
112
113###############################################################################
114# Look for our args file
115###############################################################################
116printf "%s" "checking for ${ARGS_FILE}: "
117if [ -f ${ARGS_FILE} ] ; then
118        echo "found."
119        printf "%s" "sourcing ${ARGS_FILE}: "
120        . "`dirname "$0"`"/${ARGS_FILE}
121        echo "done."
122else
123        echo "not found."
124fi
125
126###############################################################################
127# Check for our required helpers
128###############################################################################
129check "$libtoolize";            LIBTOOLIZE=${BIN};
130check "glib-gettextize";        GLIB_GETTEXTIZE=${BIN};
131check "intltoolize";            INTLTOOLIZE=${BIN};
132check "aclocal";                ACLOCAL=${BIN};
133check "autoheader";             AUTOHEADER=${BIN};
134check "automake";               AUTOMAKE=${BIN};
135check "autoconf";               AUTOCONF=${BIN};
136
137###############################################################################
138# Run all of our helpers
139###############################################################################
140run_or_die ${LIBTOOLIZE} ${LIBTOOLIZE_FLAGS:-"-c -f --automake"}
141run_or_die ${GLIB_GETTEXTIZE} ${GLIB_GETTEXTIZE_FLAGS:-"--force --copy"}
142run_or_die ${INTLTOOLIZE} ${INTLTOOLIZE_FLAGS:-"-c -f --automake"}
143run_or_die ${ACLOCAL} ${ACLOCAL_FLAGS:-"-I m4macros"}
144run_or_die ${AUTOHEADER} ${AUTOHEADER_FLAGS}
145run_or_die ${AUTOMAKE} ${AUTOMAKE_FLAGS:-"-a -c --gnu"}
146run_or_die ${AUTOCONF} ${AUTOCONF_FLAGS}
147
148###############################################################################
149# Run configure
150###############################################################################
151echo "NOT running ./configure ${CONFIGURE_FLAGS} $@"