updates.
[silc.git] / prepare
diff --git a/prepare b/prepare
index cca511fcc8f32108d8272c04e21955afee83a0ee..0f7b15b806edac0cda2d8b6d72acd1a6b80161a7 100755 (executable)
--- a/prepare
+++ b/prepare
@@ -1,15 +1,14 @@
-#!/bin/sh
+#! /bin/sh
 #
 #  prepare
 #
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+#  Author: Pekka Riikonen <priikone@silcnet.org>
 #
 #  Copyright (C) 2000 - 2001 Pekka Riikonen
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
+#  the Free Software Foundation; version 2 of the License.
 #
 #  This program is distributed in the hope that it will be useful,
 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -38,7 +37,7 @@
 # SILC Distribution versions. Set here or give the version on the command
 # line as argument.
 #
-SILC_VERSION=0.2.6                     # Base version
+SILC_VERSION=0.6                       # Base version
 
 
 #############################################################################
@@ -60,68 +59,105 @@ if test "$dist_version" = ""; then
   dist_version=$version
 fi
 
-echo "Preparing $distribution distribution version $version"
+echo "Preparing $distribution distribution version $version (package $dist_version)"
 
+#
 # Go though the subdirs and create the Makefile.ams from the
 # Makefile.am.pre files.
-
-subdirs=`grep _"$distribution"_SUBDIRS= distributions |cut -d=  -f2`
-sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$subdirs/" Makefile.am.pre >Makefile.am
+#
+subdirs=`grep "$distribution"_SUBDIRS= distributions |cut -d=  -f2`
+ed=`grep "$distribution"_EXTRA_DIST= distributions |cut -d=  -f2`
+sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$subdirs/" -e "/SILC_DISTRIBUTION_EXTRA/s,,$ed," Makefile.am.pre >Makefile.am
 path=`pwd`
 for i in $subdirs
 do
   cd $i
-  sub=`grep _"$distribution"_SUBDIRS_"$i"= $path/distributions |cut -d=  -f2`
+  sub=`grep "$distribution"_SUBDIRS_"$i"= $path/distributions |cut -d=  -f2`
   if test "$sub" = ""; then
     cd $path
     continue;
   fi
   if [ -f Makefile.am.pre ]; then
-    sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$sub/" Makefile.am.pre >Makefile.am 2>/dev/null
+    sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$sub/" -e "/SILC_DISTRIBUTION_SUBDIRS/s//$sub/" Makefile.am.pre >Makefile.am 2>/dev/null
   fi
   cd $path
 done
 cd $path
 
-# Replace version string and create configure.in
+
+#
+# Replace version string, package name and distribution infos, and create 
+# the actual configure.in
+#
 echo "# Automatically generated by ./prepare from configure.in.pre. Do not edit!" >configure.in2
-sed -e "/SILC_VERSION/s//$dist_version/" configure.in.pre >>configure.in2
-sed -e "/SILC_PACKAGE/s//silc-"$distribution"/" configure.in2 >configure.in
-rm -f configure.in2
+sed -e "/SILC_VERSION/s//$dist_version/" -e "/SILC_PACKAGE/s//silc-"$distribution"/" configure.in.pre >>configure.in2
+
+#
+# Create also the acconfig.h for the distribution. Note that this sets
+# also dist labels for distributions that are not defined.
+#
+cp acconfig.h.pre acconfig.h
+dists=`grep DISTRIBUTIONS= distributions |cut -d=  -f2`
+touch am_cond
+for i in $dists
+do
+  dl=`grep "$i"_DISTLABEL= distributions |cut -d=  -f2`
+  echo "#undef $dl" >>acconfig.h
+  if test "$i" = "$distribution"; then
+    echo "AM_CONDITIONAL($dl, test xtrue = xtrue)" >>am_cond
+  else
+    echo "AM_CONDITIONAL($dl, test xtrue = xfalse)" >>am_cond
+  fi
+done
+
+sed '/SILC_DIST_DEFINE/ r am_cond' configure.in2 >configure.in3
+dl=`grep "$distribution"_DISTLABEL= distributions |cut -d=  -f2`
+sed -e "/SILC_DIST_DEFINE/s//$dl/" configure.in3 >configure.in
+rm -f configure.in2 configure.in3 am_cond
+
 
 #
-# Prepare the Makefile.defines and Makefile.defines_int
+# Prepare the Makefile.defines
 #
 cp Makefile.defines.pre Makefile.defines.in
-cp Makefile.defines.in Makefile.defines
-cp Makefile.defines.in irssi
-cp Makefile.defines.in irssi/Makefile.defines
 cp Makefile.defines_int.pre Makefile.defines_int.in
-cp Makefile.defines_int.in Makefile.defines_int
+cp Makefile.defines.in irssi
 cp Makefile.defines_int.in irssi
-cp Makefile.defines_int.in irssi/Makefile.defines_int
+cp Makefile.defines.in lib/silcmath/mpi
+cp Makefile.defines_int.in lib/silcmath/mpi
 
 aclocal
 autoconf
-autoheader
+autoheader >/dev/null 2>/dev/null
 automake
 
+echo "Preparing trq"
 cd lib/trq
 aclocal
 autoconf
-autoheader
+autoheader </dev/null 2>/dev/null
 automake >/dev/null 2>/dev/null
 cd ../..
 
+echo "Preparing mpi"
+cd lib/silcmath/mpi
+aclocal
+autoconf
+autoheader </dev/null 2>/dev/null
+automake >/dev/null 2>/dev/null
+cd ../../..
+
 file=includes/version_internal.h
 echo "/* Automatically generated by ./prepare */" >$file
 echo "#define SILC_VERSION_STRING \"$version\"" >>$file
 echo "#define SILC_DIST_VERSION_STRING \"$dist_version\"" >>$file
 echo "#define SILC_PROTOCOL_VERSION_STRING \"SILC-1.0-$version\"" >>$file
+echo "#define SILC_NAME \"SILC $distribution\"" >>$file
 
 # preparing irssi
+echo "Preparing irssi"
 cd irssi
-sh autogen.sh
+sh autogen.sh 2>/dev/null 1>/dev/null
 cd ..
 file=irssi/irssi-version.h.in
 version_date=`date +%Y%m%d`