Merged with Irssi CVS.
[silc.git] / apps / irssi / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 PKG_NAME="Irssi SILC"
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 lynx -dump -nolist docs/faq.html|perl -pe 's/^ *//; if ($_ eq "\n" && $state eq "Q") { $_ = ""; } elsif (/^([QA]):/) { $state = $1 } elsif ($_ ne "\n") { $_ = "   $_"; };' > docs/faq.txt
41
42 echo "Checking auto* tools..."
43
44 # *********** a bit modified GNOME's macros/autogen.sh **********
45 DIE=0
46
47 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
48   echo
49   echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME."
50   echo "Download the appropriate package for your distribution,"
51   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
52   DIE=1
53 }
54
55 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
56   (libtool --version) < /dev/null > /dev/null 2>&1 || {
57     echo
58     echo "**Error**: You must have \`libtool' installed to compile $PKG_NAME."
59     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
60     echo "(or a newer version if it is available)"
61     DIE=1
62   }
63 }
64
65 (automake --version) < /dev/null > /dev/null 2>&1 || {
66   echo
67   echo "**Error**: You must have \`automake' installed to compile $PKG_NAME."
68   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
69   echo "(or a newer version if it is available)"
70   DIE=1
71   NO_AUTOMAKE=yes
72 }
73
74
75 # if no automake, don't bother testing for aclocal
76 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
77   echo
78   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
79   echo "installed doesn't appear recent enough."
80   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
81   echo "(or a newer version if it is available)"
82   DIE=1
83 }
84
85 if test "$DIE" -eq 1; then
86   exit 1
87 fi
88
89 #if test -z "$*"; then
90 #  echo "**Warning**: I am going to run \`configure' with no arguments."
91 #  echo "If you wish to pass any to it, please specify them on the"
92 #  echo \`$0\'" command line."
93 #  echo
94 #fi
95
96 case $CC in
97 xlc )
98   am_opt=--include-deps;;
99 esac
100
101 rm -f aclocal.m4 glib.m4 glib-2.0.m4
102 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
103   echo "Running libtoolize..."
104   libtoolize --force --copy
105 fi
106 aclocalinclude="$ACLOCAL_FLAGS -I ."
107 echo "Running aclocal $aclocalinclude ..."
108
109 # see if we don't have glib.m4 or glib-2.0.m4 there yet
110 error=`aclocal $aclocalinclude 2>&1`
111 if test "x`echo $error|grep 'AM_PATH_GLIB[^_]'`" != "x"; then
112   cp glib.m4_ glib.m4
113   error=`aclocal $aclocalinclude 2>&1`
114 fi
115 if test "x`echo $error|grep AM_PATH_GLIB_2_0`" != "x"; then
116   cp glib-2.0.m4_ glib-2.0.m4
117 fi
118
119 aclocal $aclocalinclude
120
121 # aclocal for some reason doesn't complain about glib2, so we still need
122 # to check it later again..
123 if grep "^AC_DEFUN.AM_PATH_GLIB_2_0" aclocal.m4 >/dev/null; then :;
124 else
125   cp glib-2.0.m4_ glib-2.0.m4
126   aclocal $aclocalinclude
127 fi
128
129 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
130   echo "Running autoheader..."
131   autoheader
132 fi
133 echo "Running autoconf ..."
134 autoconf
135 echo "Running automake --gnu $am_opt ..."
136 automake --add-missing --gnu $am_opt
137
138 #conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
139
140 #if test x$NOCONFIGURE = x; then
141 #  echo Running $srcdir/configure $conf_flags "$@" ...
142 #  $srcdir/configure $conf_flags "$@" \
143 #  && echo Now type \`make\' to compile $PKG_NAME || exit 1
144 #else
145 #  echo Skipping configure process.
146 #fi
147
148 # make sure perl hashes have correct length
149 find src/perl -name *.c -o -name *.xs | xargs grep -n hv_store | perl -ne 'if (/"(\w+)",\s*(\d+)/) { print unless $2 == length $1 }'
150