source: trunk/dports/science/chemical-mime-data/files/autogen.sh @ 135560

Last change on this file since 135560 was 135560, checked in by devans@…, 5 years ago

chemical-mime-data: reconfigure using upstream autogen.sh for intltool 0.51 compatibility.

File size: 3.1 KB
Line 
1#!/bin/sh
2#
3# Document  $Id: autogen.sh 58 2006-12-30 15:40:20Z dleidert $
4# Summary   Auto-generate the package source.
5#
6# Copyright (C) 2004-2006 Egon Willighagen.
7# Copyright (C) 2004-2006 Daniel Leidert <daniel.leidert@wgdd.de>.
8#
9# This file is free software. The copyright owner gives unlimited
10# permission to copy, distribute and modify it.
11
12set -e
13
14## all initial declarations, overwrite them using e.g. 'ACLOCAL=aclocal-1.7 AUTOMAKE=automake-1.7 ./autogen.sh'
15ACLOCAL=${ACLOCAL:-aclocal}
16AUTOCONF=${AUTOCONF:-autoconf}
17AUTOMAKE=${AUTOMAKE:-automake}
18INTLTOOLIZE=${INTLTOOLIZE:-intltoolize}
19
20## check, if all binaries exist and fail with error 1 if not
21if [ -z `which $ACLOCAL` ] ; then echo "Error. ACLOCAL=$ACLOCAL not found." >&2 && exit 1 ; fi
22if [ -z `which $AUTOCONF` ] ; then echo "Error. AUTOCONF=$AUTOCONF not found." >&2 && exit 1 ; fi
23if [ -z `which $AUTOMAKE` ] ; then echo "Error. AUTOMAKE=$AUTOMAKE not found." >&2 && exit 1 ; fi
24if [ -z `which $INTLTOOLIZE` ] ; then echo "Error. INTLTOOLIZE=$INTLTOOLIZE not found." >&2 && exit 1 ; fi
25
26## find where automake is installed and get the version
27AUTOMAKE_PATH=${AUTOMAKE_PATH:-`which $AUTOMAKE | sed 's|\/bin\/automake.*||'`}
28AUTOMAKE_VERSION=`$AUTOMAKE --version | grep automake | awk '{print $4}' | awk -F. '{print $1"."$2}'`
29
30## automake files we need to have inside our source
31if [ $AUTOMAKE_VERSION = "1.7" ] ; then
32        AUTOMAKE_FILES="missing mkinstalldirs install-sh"
33else
34        AUTOMAKE_FILES="missing install-sh"
35fi
36
37## our help output - if autogen.sh was called with -h|--help or unknown option
38autogen_help() {
39        echo
40        echo "autogen.sh usage:"
41        echo
42        echo "  Produces all files necessary to build the chemical-mime-data project files."
43        echo "  The files are linked by default, if you run ./autogen.sh without an option."
44        echo
45        echo "    -c, --copy      Copy files instead to link them."
46        echo "    -h, --help      Print this message."
47        echo
48        echo "  You can overwrite the automatically determined location of aclocal, automake,"
49        echo "  autoconf and intltoolize using:"
50        echo
51        echo "    ACLOCAL=/foo/bin/aclocal-1.8 AUTOMAKE=automake-1.8 ./autogen.sh"
52        echo
53}
54
55## check if $AUTOMAKE_FILES were copied to our source
56## link/copy them if not - necessary for e.g. gettext, which seems to always need mkinstalldirs
57autogen_if_missing() {
58        case "$1" in
59                copy)
60                        command="cp"
61                ;;
62                link)
63                        command="ln -s"
64                ;;
65                *)
66                        echo "Error. autogen_if_missing() was called with unknown parameter $1." >&2
67                ;;
68        esac
69       
70        for file in $AUTOMAKE_FILES ; do
71                if [ ! -e "$file" ] ; then
72                        $command -f $AUTOMAKE_PATH/share/automake-$AUTOMAKE_VERSION/$file .
73                fi
74        done
75}
76
77## link/copy the necessary files to our source to prepare for a build
78autogen() {
79        case "$1" in
80                copy)
81                        copyoption="-c"
82                ;;
83                link)
84                ;;
85                *)
86                        echo "Error. autogen() was called with unknown parameter $1." >&2
87                ;;
88        esac
89        $INTLTOOLIZE -f $copyoption
90        $ACLOCAL
91        $AUTOMAKE --gnu -a $copyoption
92        autogen_if_missing $1
93        $AUTOCONF
94}
95
96## the main function
97case "$1" in
98        -h | --help)
99                autogen_help
100                exit 0
101        ;;
102        -c | --copy)
103                autogen copy
104        ;;
105        *)
106                autogen link
107        ;;
108esac
109
110## ready to rumble
111echo "Run ./configure with the appropriate options, then make and enjoy."
112
113exit 0
114
Note: See TracBrowser for help on using the repository browser.