1#!/usr/local/bin/bash
2# Run this to generate all the initial makefiles, etc.
3
4: ${AUTOCONF=autoconf}
5: ${AUTOHEADER=autoheader}
6: ${AUTOMAKE=automake}
7: ${ACLOCAL=aclocal}
8if test "$(uname)" != "Darwin"; then
9    : ${LIBTOOLIZE=libtoolize}
10else
11    : ${LIBTOOLIZE=glibtoolize}
12fi
13: ${INTLTOOLIZE=intltoolize}
14: ${LIBTOOL=libtool}
15
16srcdir=`dirname $0`
17test -z "$srcdir" && srcdir=.
18
19ORIGDIR=`pwd`
20cd $srcdir
21PROJECT=ccnet
22TEST_TYPE=-f
23FILE=net/main.c
24CONFIGURE=configure.ac
25
26DIE=0
27
28($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
29	echo
30	echo "You must have autoconf installed to compile $PROJECT."
31	echo "Download the appropriate package for your distribution,"
32	echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
33	DIE=1
34}
35
36(grep "^AC_PROG_INTLTOOL" $srcdir/$CONFIGURE >/dev/null) && {
37  ($INTLTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
38    echo
39    echo "You must have \`intltoolize' installed to compile $PROJECT."
40    echo "Get ftp://ftp.gnome.org/pub/GNOME/stable/sources/intltool/intltool-0.22.tar.gz"
41    echo "(or a newer version if it is available)"
42    DIE=1
43  }
44}
45
46($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
47	echo
48	echo "You must have automake installed to compile $PROJECT."
49	echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.7.tar.gz"
50	echo "(or a newer version if it is available)"
51	DIE=1
52}
53
54if test "$(uname)" != "Darwin"; then
55(grep "^AC_PROG_LIBTOOL" $CONFIGURE >/dev/null) && {
56  ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || {
57    echo
58    echo "**Error**: You must have \`libtool' installed to compile $PROJECT."
59    echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
60    echo "(or a newer version if it is available)"
61    DIE=1
62  }
63}
64fi
65
66
67if grep "^AM_[A-Z0-9_]\{1,\}_GETTEXT" "$CONFIGURE" >/dev/null; then
68  if grep "sed.*POTFILES" "$CONFIGURE" >/dev/null; then
69    GETTEXTIZE=""
70  else
71    if grep "^AM_GLIB_GNU_GETTEXT" "$CONFIGURE" >/dev/null; then
72      GETTEXTIZE="glib-gettextize"
73      GETTEXTIZE_URL="ftp://ftp.gtk.org/pub/gtk/v2.0/glib-2.0.0.tar.gz"
74    else
75      GETTEXTIZE="gettextize"
76      GETTEXTIZE_URL="ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
77    fi
78
79    $GETTEXTIZE --version < /dev/null > /dev/null 2>&1
80    if test $? -ne 0; then
81      echo
82      echo "**Error**: You must have \`$GETTEXTIZE' installed to compile $PKG_NAME."
83      echo "Get $GETTEXTIZE_URL"
84      echo "(or a newer version if it is available)"
85      DIE=1
86    fi
87  fi
88fi
89
90if test "$DIE" -eq 1; then
91	exit 1
92fi
93
94dr=`dirname .`
95echo processing $dr
96aclocalinclude="$aclocalinclude -I m4"
97
98if test x"$MSYSTEM" = x"MINGW32"; then
99    aclocalinclude="$aclocalinclude -I /mingw32/share/aclocal"
100elif test "$(uname)" = "Darwin"; then
101    aclocalinclude="$aclocalinclude -I /opt/local/share/aclocal"
102fi
103
104
105echo "Creating $dr/aclocal.m4 ..."
106test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
107echo "Running glib-gettextize...  Ignore non-fatal messages."
108echo "no" | glib-gettextize --force --copy
109
110echo "Making $dr/aclocal.m4 writable ..."
111test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
112
113echo "Running intltoolize..."
114intltoolize --copy --force --automake
115
116echo "Running $LIBTOOLIZE..."
117$LIBTOOLIZE --force --copy
118
119echo "Running $ACLOCAL $aclocalinclude ..."
120$ACLOCAL $aclocalinclude
121
122echo "Running $AUTOHEADER..."
123$AUTOHEADER
124
125echo "Running $AUTOMAKE --gnu $am_opt ..."
126$AUTOMAKE --add-missing --gnu $am_opt
127
128echo "Running $AUTOCONF ..."
129$AUTOCONF
130