Merged silc_1_0_branch to trunk.
[silc.git] / apps / irssi / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 PKG_NAME="SILC Client"
5
6 srcdir=`dirname $0`
7 test -z "$srcdir" && srcdir=.
8
9 if test ! -f $srcdir/irssi.cvs -a -f $srcdir/configure; then
10   echo
11   echo "Use ./configure instead"
12   echo
13   echo "This script should only be run if you got sources from CVS."
14   echo "If you really want to do this, say:"
15   echo "  touch irssi.cvs"
16   exit 0
17 fi
18
19 if test ! -f $srcdir/configure.in; then
20     echo -n "**Error**: Directory \`$srcdir\' does not look like the"
21     echo " top-level $PKG_NAME directory"
22     exit 1
23 fi
24
25 # get versions
26 version_date=`date +%Y%m%d`
27
28 # create help files
29 echo "Creating help files..."
30 perl syntax.pl
31
32 files=`echo docs/help/in/*.in|sed -e 's,docs/help/in/Makefile.in ,,' -e 's,docs/help/in/,!,g' -e 's/\.in /.in ?/g'`
33 cat docs/help/in/Makefile.am.gen|sed "s/@HELPFILES@/$files/g"|sed 's/?/\\?/g'|tr '!?' '\t\n' > docs/help/in/Makefile.am
34
35 files=`echo $files|sed 's/\.in//g'`
36 cat docs/help/Makefile.am.gen|sed "s/@HELPFILES@/$files/g"|sed 's/?/\\?/g'|tr '!?' '\t\n' > docs/help/Makefile.am
37
38 # .html -> .txt with lynx
39 echo "Documentation: html -> txt..."
40
41 echo "Checking auto* tools..."
42
43 # *********** a bit modified GNOME's macros/autogen.sh **********
44 DIE=0
45
46 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
47   echo
48   echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME."
49   echo "Download the appropriate package for your distribution,"
50   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
51   DIE=1
52 }
53
54 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
55   (libtool --version) < /dev/null > /dev/null 2>&1 || {
56     echo
57     echo "**Error**: You must have \`libtool' installed to compile $PKG_NAME."
58     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
59     echo "(or a newer version if it is available)"
60     DIE=1
61   }
62 }
63
64 (automake --version) < /dev/null > /dev/null 2>&1 || {
65   echo
66   echo "**Error**: You must have \`automake' installed to compile $PKG_NAME."
67   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
68   echo "(or a newer version if it is available)"
69   DIE=1
70   NO_AUTOMAKE=yes
71 }
72
73
74 # if no automake, don't bother testing for aclocal
75 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
76   echo
77   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
78   echo "installed doesn't appear recent enough."
79   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
80   echo "(or a newer version if it is available)"
81   DIE=1
82 }
83
84 if test "$DIE" -eq 1; then
85   exit 1
86 fi
87
88 #if test -z "$*"; then
89 #  echo "**Warning**: I am going to run \`configure' with no arguments."
90 #  echo "If you wish to pass any to it, please specify them on the"
91 #  echo \`$0\'" command line."
92 #  echo
93 #fi
94
95 case $CC in
96 xlc )
97   am_opt=--include-deps;;
98 esac
99
100 rm -f aclocal.m4 glib.m4 glib-2.0.m4
101 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
102   echo "Running libtoolize..."
103   libtoolize --force --copy
104 fi
105 aclocalinclude="$ACLOCAL_FLAGS -I ."
106 echo "Running aclocal $aclocalinclude ..."
107
108 # see if we don't have glib.m4 or glib-2.0.m4 there yet
109 error=`aclocal $aclocalinclude 2>&1`
110 if test "x`echo $error|grep 'AM_PATH_GLIB[^_]'`" != "x"; then
111   cp glib.m4_ glib.m4
112   error=`aclocal $aclocalinclude 2>&1`
113 fi
114 if test "x`echo $error|grep AM_PATH_GLIB_2_0`" != "x"; then
115   cp glib-2.0.m4_ glib-2.0.m4
116 fi
117
118 aclocal $aclocalinclude
119
120 # aclocal for some reason doesn't complain about glib2, so we still need
121 # to check it later again..
122 if grep "^AC_DEFUN.AM_PATH_GLIB_2_0" aclocal.m4 >/dev/null; then :;
123 else
124   cp glib-2.0.m4_ glib-2.0.m4
125   aclocal $aclocalinclude
126 fi
127
128 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
129   echo "Running autoheader..."
130   autoheader
131 fi
132 echo "Running autoconf ..."
133 autoconf
134 echo "Running automake --gnu $am_opt ..."
135 automake --add-missing --gnu $am_opt
136
137 #conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
138
139 #if test x$NOCONFIGURE = x; then
140 #  echo Running $srcdir/configure $conf_flags "$@" ...
141 #  $srcdir/configure $conf_flags "$@" \
142 #  && echo Now type \`make\' to compile $PKG_NAME || exit 1
143 #else
144 #  echo Skipping configure process.
145 #fi
146
147 # make sure perl hashes have correct length
148 find src/perl -name *.c -o -name *.xs | xargs grep -n hv_store | perl -ne 'if (/"(\w+)",\s*(\d+)/) { print unless $2 == length $1 }'
149