3 # ngIRCd -- The Next Generation IRC Daemon
4 # Copyright (c)2001-2004 Alexander Barton <alex@barton.de>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 # Please read the file COPYING, README and AUTHORS for more information.
12 # $Id: autogen.sh,v 1.10 2004/03/15 20:32:31 alex Exp $
16 # Usage: [VAR=<value>] ./autogen.sh [<configure-args>]
18 # This script generates the ./configure script using GNU automake and
19 # GNU autoconf. It tries to be smart in finding the correct/usable/available
20 # installed versions of these tools on your system.
22 # The following strategy is used for each of aclocal, autoheader, automake,
23 # and autoconf: first, "tool" (the regular name of the tool, e. g. "autoconf"
24 # or "automake") is checked. If this fails, "tool<major><minor>" (for example
25 # "automake16") and "tool-<major>.<minor>" (e. g. "autoconf-2.54") are tried
26 # with <major> being 2 for tool of GNU autoconf and 1 for tools of automake;
27 # <minor> is tried from 99 to 0. The first occurrence will be used.
29 # When you pass <configure-args> to autogen.sh it will call the generated
30 # ./configure script on success and pass these parameters to it.
32 # You can tweak the behaviour using these environment variables:
34 # - ALICA=<cmd>, AUTOHEADER=<cmd>, AUTOMAKE=<cmd>, AUTOCONF=<cmd>
35 # Name and optionally path to the particular tool.
37 # Search the GNU autoconf and GNU automake tools in <path> first. If the
38 # generated ./configure script will be called, pass "--prefix=<path>" to it.
40 # Output the detected names of the GNU automake and GNU autoconf tools.
42 # Call ./configure even if no arguments have been passed to autogen.sh.
47 # Generates the ./configure script.
49 # Generates the ./configure script and runs it as "./configure".
50 # - VERBOSE=1 ./autogen.sh --with-ident
51 # Show tool names, generates the ./configure script, and runs it with
52 # these arguments: "./configure --with-ident".
53 # - ACLOCAL=aclocal-1.6 GO=1 PREFIX=$HOME ./autogen.sh
54 # Uses "aclocal-1.6" as aclocal tool, generates the ./configure script,
55 # and runs it with these arguments: "./configure --prefix=$HOME".
60 [ $# -eq 2 ] || exit 1
66 [ -n "$PREFIX" ] && searchlist="${PREFIX}$1 ${PREFIX}/bin/$1 $searchlist"
68 for name in $searchlist; do
69 type "${name}" >/dev/null 2>&1
76 while [ $minor -ge 0 ]; do
77 for name in $searchlist; do
78 type "${name}${major}${minor}" >/dev/null 2>&1
80 echo "${name}${major}${minor}"
83 type "${name}-${major}.${minor}" >/dev/null 2>&1
85 echo "${name}-${major}.${minor}" >/dev/null 2>&1
89 minor=`expr $minor - 1`
96 echo "Error: $* not found!"
97 echo "Please install recent versions of GNU autoconf and GNU automake."
101 # Reset locale settings to suppress warning messages of Perl
105 # We want to use GNU automake 1.7, if available (WANT_AUTOMAKE is used by
106 # the wrapper scripts of Gentoo Linux):
110 # Try to detect the needed tools when no environment variable already
112 echo "Searching tools ..."
113 [ -z "$ACLOCAL" ] && ACLOCAL=`Search aclocal 1`
114 [ -z "$AUTOHEADER" ] && AUTOHEADER=`Search autoheader 2`
115 [ -z "$AUTOMAKE" ] && AUTOMAKE=`Search automake 1`
116 [ -z "$AUTOCONF" ] && AUTOCONF=`Search autoconf 2`
118 # Some debugging output ...
119 if [ -n "$VERBOSE" ]; then
120 echo "ACLOCAL=$ACLOCAL"
121 echo "AUTOHEADER=$AUTOHEADER"
122 echo "AUTOMAKE=$AUTOMAKE"
123 echo "AUTOCONF=$AUTOCONF"
126 # Verify that all tools have been found
127 [ -z "$AUTOCONF" ] && Notfounf autoconf
128 [ -z "$AUTOHEADER" ] && Notfound autoheader
129 [ -z "$AUTOMAKE" ] && Notfound automake
130 [ -z "$AUTOCONF" ] && Notfound autoconf
132 export AUTOCONF AUTOHEADER AUTOMAKE AUTOCONF
135 echo "Generating files ..."
138 $AUTOMAKE --add-missing && \
141 if [ $? -eq 0 -a -x ./configure ]; then
142 # Success: if we got some parameters we call ./configure and pass
144 if [ -n "$*" -o -n "$GO" ]; then
145 [ -n "$PREFIX" ] && p=" --prefix=$PREFIX" || p=""
146 [ -n "$*" ] && a=" $*" || a=""
147 c="./configure${p}${a}"
148 echo "Calling \"$c\" ..."
152 echo "Okay, autogen.sh done; now run the \"configure\" script."
157 echo "Error! Check your installation of GNU automake and autoconf!"