The Autodist environment added.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 11 Apr 2005 10:41:58 +0000 (10:41 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 11 Apr 2005 10:41:58 +0000 (10:41 +0000)
34 files changed:
CHANGES
Makefile.ad [moved from Makefile.am.pre with 77% similarity]
Makefile.defines.pre [deleted file]
Makefile.defines_int.pre [deleted file]
README.CVS
README.DIST
acconfig.h.pre [deleted file]
apps/silcd/server_version.c
autodist [new file with mode: 0755]
configure.ad [moved from configure.in.pre with 87% similarity]
distdir/autodist.conf [new file with mode: 0644]
distdir/client [new file with mode: 0644]
distdir/default [new file with mode: 0644]
distdir/post-run [new file with mode: 0644]
distdir/server [new file with mode: 0644]
distdir/toolkit [new file with mode: 0644]
distributions [deleted file]
doc/Makefile.ad [moved from doc/Makefile.am.pre with 80% similarity]
includes/Makefile.ad [moved from includes/Makefile.am with 67% similarity]
includes/silcincludes.h.in
includes/silcversion.h.in [moved from includes/silcversion.h with 80% similarity]
lib/Makefile.ad [moved from lib/Makefile.am.pre with 58% similarity]
lib/configure.ad
lib/silcclient/Makefile.ad [moved from lib/silcclient/Makefile.am with 76% similarity]
lib/silccore/Makefile.ad [moved from lib/silccore/Makefile.am with 82% similarity]
lib/silccrypt/Makefile.ad [moved from lib/silccrypt/Makefile.am with 89% similarity]
lib/silcmath/Makefile.ad [moved from lib/silcmath/Makefile.am with 75% similarity]
lib/silcsftp/Makefile.ad [moved from lib/silcsftp/Makefile.am with 76% similarity]
lib/silcsim/Makefile.ad [moved from lib/silcsim/Makefile.am with 87% similarity]
lib/silcske/Makefile.ad [moved from lib/silcske/Makefile.am with 74% similarity]
lib/silcutil/Makefile.ad [moved from lib/silcutil/Makefile.am with 87% similarity]
lib/silcutil/silcmemory.h
prepare [deleted file]
prepare-clean [deleted file]

diff --git a/CHANGES b/CHANGES
index 242662b228a640c653f77b2bc2b7e2ff10db255e..b9b8ab796507155f0278b83eba1ef8df2468289f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,10 @@
+Mon Apr 11 13:40:27 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added the Autodist into the source tree.  It replaces the
+         old ./prepare.  It can be used to create distributions as
+         previously.  See README.CVS and README.DIST.  See
+         distributions in distdir/.
+
 Sun Apr 10 11:30:56 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
 
        * Make sure query sends at least an error back if nothing
similarity index 77%
rename from Makefile.am.pre
rename to Makefile.ad
index 2c1eae371f80b3ea10812edaba96cadf677785f6..4e3625f1af17b78334743fe60411a6f1d864585e 100644 (file)
@@ -1,9 +1,9 @@
 #
-#  Makefile.am
+#  Makefile.ad
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 - 2003 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
 
 AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
 
-COMMONDIRS = lib irssi silc silcd doc includes
-
-# Sub directories defined by "distributions" file, and can be overridden
-# with ./configure, which substitutes these variables.
-SUBDIRS = @SILC_DIST_SUBDIRS@
-DIST_SUBDIRS = @SILC_DIST_SUBDIRS@
+SUBDIRS =              \
+       lib             \
+#ifdef SILC_DIST_CLIENT
+       irssi           \
+#endif SILC_DIST_CLIENT
+#ifdef SILC_DIST_SERVER
+       silcd           \
+#endif SILC_DIST_SERVER
+#ifdef SILC_DIST_TOOLKIT
+       silc            \
+       win32           \
+#endif SILC_DIST_TOOLKIT
+       doc             \
+       includes
 
 include $(top_srcdir)/Makefile.defines.in
 
@@ -32,8 +40,12 @@ dist-bzip: distdir
        -bzip2 $(distdir).tar
        -rm -rf $(distdir)
 
-SILC_EXTRA_DIST = SILC_DISTRIBUTION_EXTRA
-EXTRA_DIST = libtoolfix CHANGES CREDITS $(SILC_EXTRA_DIST)
+EXTRA_DIST =           \
+#ifdef SILC_DIST_TOOLKIT
+       README.CVS README.WIN32 README.MACOSX silcer tutorial \
+#endif SILC_DIST_TOOLKIT
+       libtoolfix      \
+       CHANGES CREDITS
 
 #
 # Installing of SILC into the system
@@ -51,15 +63,6 @@ install-dirs:
        -mkdir -p $(modulesdir)
        -mkdir -p $(docdir)
 
-install-dirs-client: install-dirs
-       -mkdir -p $(helpdir)
-       -mkdir -p $(mandir)/man1
-
-install-dirs-server: install-dirs
-       -mkdir -p $(logsdir)
-       -mkdir -p $(mandir)/man5
-       -mkdir -p $(mandir)/man8
-
 doc-install:
        -$(INSTALL_DATA) $(srcdir)/doc/CodingStyle $(docdir)/
        -$(INSTALL_DATA) $(srcdir)/doc/FAQ $(docdir)/
@@ -71,12 +74,40 @@ doc-install:
        -$(INSTALL_DATA) $(srcdir)/INSTALL $(docdir)/
        -$(INSTALL_DATA) $(srcdir)/TODO $(docdir)/
 
+sim-install:
+       -$(INSTALL_DATA) $(srcdir)/lib/silcsim/*.so $(modulesdir)/
+
+examples-install:
+       -mkdir -p $(docdir)/examples/
+       -$(INSTALL_DATA) $(srcdir)/doc/examples/README $(docdir)/examples/
+       -$(INSTALL_DATA) $(srcdir)/doc/examples/silc* $(docdir)/examples/
+
+#ifdef SILC_DIST_CLIENT
+install-dirs-client: install-dirs
+       -mkdir -p $(helpdir)
+       -mkdir -p $(mandir)/man1
+
 doc-install-client: doc-install
        $(INSTALL_DATA) $(srcdir)/irssi/silc.conf $(docdir)/example_silc.conf
        -@if test -f $(srcdir)/doc/silc.1 ; then \
         $(INSTALL_DATA) $(srcdir)/doc/silc.1 $(mandir)/man1; \
        fi
 
+etc-install-client:
+       -@if test '!' -d $(srcdir)/irssi ; then \
+         if test '!' -f $(etcdir)/silc.conf ; then \
+           $(INSTALL_DATA) $(srcdir)/irssi/silc.conf \
+               $(etcdir)/silc.conf; \
+         fi; \
+       fi
+#endif SILC_DIST_CLIENT
+
+#ifdef SILC_DIST_SERVER
+install-dirs-server: install-dirs
+       -mkdir -p $(logsdir)
+       -mkdir -p $(mandir)/man5
+       -mkdir -p $(mandir)/man8
+
 doc-install-server: doc-install
        -$(INSTALL_DATA) $(srcdir)/doc/example_silcd.conf $(docdir)/
        -@if test -f $(srcdir)/doc/silcd.8 ; then \
@@ -86,14 +117,6 @@ doc-install-server: doc-install
         $(INSTALL_DATA) $(srcdir)/doc/silcd.conf.5 $(mandir)/man5; \
        fi
 
-etc-install-client:
-       -@if test '!' -d $(srcdir)/irssi ; then \
-         if test '!' -f $(etcdir)/silc.conf ; then \
-           $(INSTALL_DATA) $(srcdir)/irssi/silc.conf \
-               $(etcdir)/silc.conf; \
-         fi; \
-       fi
-
 etc-install-server:
        -@if test '!' -f $(etcdir)/silcd.conf ; then \
          $(INSTALL_DATA) $(srcdir)/doc/example_silcd.conf \
@@ -103,31 +126,34 @@ etc-install-server:
           chmod go= $(etcdir)/silcd.conf; \
        fi
 
-sim-install:
-       -$(INSTALL_DATA) $(srcdir)/lib/silcsim/*.so $(modulesdir)/
+generate-server-key:
+       -@if test '!' -f $(etcdir)/silcd.pub ; then \
+         $(sbindir)/silcd -C $(etcdir); \
+       fi
+#endif SILC_DIST_SERVER
 
+#ifdef SILC_DIST_TOOLKIT
 toolkit-install:
        -mkdir -p $(docdir)/toolkit/
        -$(INSTALL_DATA) $(srcdir)/doc/toolkit/* $(docdir)/toolkit
        -$(INSTALL_DATA) $(srcdir)/lib/doc/*.gif $(docdir)/toolkit
        -cp -R $(srcdir)/tutorial $(prefix)
-
-examples-install:
-       -mkdir -p $(docdir)/examples/
-       -$(INSTALL_DATA) $(srcdir)/doc/examples/README $(docdir)/examples/
-       -$(INSTALL_DATA) $(srcdir)/doc/examples/silc* $(docdir)/examples/
-
-generate-server-key:
-       -@if test '!' -f $(etcdir)/silcd.pub ; then \
-         $(sbindir)/silcd -C $(etcdir); \
-       fi
-
-if SILC_DIST_CLIENT
-install-data-hook: install-dirs-client sim-install doc-install-client etc-install-client
-else
-if SILC_DIST_TOOLKIT
-install-data-hook: install-dirs-client install-dirs-server sim-install doc-install-client doc-install-server toolkit-install examples-install etc-install-client etc-install-server
-else
-install-data-hook: install-dirs-server sim-install doc-install-server examples-install etc-install-server generate-server-key
-endif
-endif
+#endif SILC_DIST_TOOLKIT
+
+install-data-hook:             \
+#ifdef SILC_DIST_CLIENT
+       install-dirs-client     \
+       doc-install-client      \
+       etc-install-client      \
+#endif SILC_DIST_CLIENT
+#ifdef SILC_DIST_SERVER
+       install-dirs-server     \
+       doc-install-server      \
+       etc-install-server      \
+       examples-install        \
+       generate-server-key     \
+#endif SILC_DIST_SERVER
+#ifdef SILC_DIST_TOOLKIT
+       toolkit-install         \
+#endif SILC_DIST_TOOLKIT
+       sim-install
diff --git a/Makefile.defines.pre b/Makefile.defines.pre
deleted file mode 100644 (file)
index ecffbc5..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-#  Makefile.defines.pre
-#
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
-#
-#  Copyright (C) 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.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-
-#
-# This file is intended to include all common compilation defines for the
-# SILC source tree.  All Makefile.ams in the SILC source tree are expected
-# to include this file (Makefile.defines.in).  Also this file may be included
-# in any external project that is included in the SILC source tree.
-#
-# Add following to your Makefile.am:
-#
-# include $(top_srcdir)/Makefile.defines.in
-#
-# All packages in the SILC source tree that include the Makefile.defines.in
-# must also include the following two lines in their configure.in file.
-#
-# INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"   
-# AC_SUBST(INCLUDE_DEFINES_INT)
-#
-# (See the Makefile.defines_int.pre for all different definitions but DO NOT
-#  directly include that file!)
-#
-
-@INCLUDE_DEFINES_INT@
-
-#
-# INCLUDE defines
-#
-INCLUDES = $(ADD_INCLUDES) $(SILC_CFLAGS) -DHAVE_SILCDEFS_H \
-       -I$(srcdir) -I$(top_srcdir) \
-       -I$(silc_top_srcdir) $(SILC_LIB_INCLUDES) \
-        -I$(silc_top_srcdir)/includes \
-        -I$(silc_top_srcdir)/doc
-
-#
-#includes-install: Makefile
-#      for i in $(include_HEADERS); do s=$(srcdir)/$$i;
-#d=$(silc_top_srcdir)/includes/$$i; \
-#         ln $$s $$d 2>/dev/null || (rm -f $$d; cp -p $$s $$d;); \
-#      done;
-#
-#all-local: includes-install
diff --git a/Makefile.defines_int.pre b/Makefile.defines_int.pre
deleted file mode 100644 (file)
index cf4b430..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-#  Makefile.defines_int.pre
-#
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
-#
-#  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.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-
-#
-# Internal file for definitions. This is read by Makefile.defines. DO NOT
-# include this file directly to your Makefile.ams.
-#
-
-#
-# Generic definitions
-#
-silc_top_srcdir=@SILC_TOP_SRCDIR@
-silc_install_prefix=@prefix@
-
-#
-# Common libraries that are linked against the created executable
-#
-SILC_COMMON_LIBS= @LIBS@ -L$(silc_top_srcdir)/lib -lsilc
-
-#
-# Common compilation flags
-#
-SILC_CFLAGS=@CFLAGS@
-
-#
-# SILC Library includes
-#
-SILC_LIB_INCLUDES=@SILC_LIB_INCLUDES@
-
-#
-# Installation defines
-#
-silc_etcdir=@ETCDIR@
-silc_modulesdir=@MODULESDIR@
-silc_helpdir=@HELPDIR@
-silc_docdir=@DOCDIR@
-silc_logsdir=@LOGSDIR@
index e7568ead1ca31985c33708f802e9e21d0c4fbb70..45d6095080d2a9b98edff5d4de6a4de2b40552d9 100644 (file)
@@ -167,15 +167,14 @@ Howto Compile SILC Source Tree
 After checkout from CVS the SILC source tree must be prepared for 
 configuration and compilation.  To compile the source tree, give,
 
-       ./prepare
+       ./autodist
        ./configure --enable-debug
        make
 
-The ./prepare script is included in to the source tree and it never
+The ./autodist is included in to the source tree and it never
 appears in public distribution.  The script prepares the source tree
-by creating configuration scripts and Makefiles.  The prepare must be
-run every time you make some changes to configuration scripts (however,
-making changes to Makefile.am's does not require running ./prepare).
+by creating configuration scripts and Makefiles.  The autodist must be
+run every time you make some changes to configuration scripts.
 
 As a developer you should read the ./configure script's help by
 giving ./configure --help and study all of its different options.  Also,
@@ -197,31 +196,31 @@ like "*server*,*rng*" to match all functions, and filenames that has
 can freely define regural expressions as debug string.
 
 
-Howto Clean SILC Source Tree
-============================
-
-To entirely clear the source tree to the state after it was checked out
-from CVS, give,
-
-       ./prepare-clean
-
-This calls `make distclean' plus removes automatically generated files
-by hand.  It also removes *.log files. However, it will not remove
-any other files you might have created.
-
-
 Makefiles and configuration files
 =================================
 
-Developers should never directly write a Makefile.  All Makefiles are
-always automatically generated by ./prepare and later by ./configure
-scripts.  Instead, developers must write Makefile.am files.  There
-are plenty of examples what they should look like.  If you change
-Makefile.am during development you don't have to run ./prepare, just
-run normal make.
-
-Configuration files are the files that ./prepare automatically generates
-and what will be included into public distribution.  ./prepare creates
-for example the ./configure script that is not commited to the CVS.
-`configure.in' is the file that developers must edit to change ./configure
-script.  After changing one must run  ./prepare.
+Developers should never directly write a Makefile.  All Makefiles are 
+always automatically generated by ./autodist and later by ./configure 
+scripts.  Instead, developers must write Makefile.ad files or Makefile.am 
+files.  If the Makefile needs to include any distdefs (SILC_DIST_XXX), 
+then Makefile.ad (.ad stands for autodist) must be written.  If the 
+Makefile is generic (common to all distributions) then Makefile.am may be 
+written.  Note that distdefs MUST NOT be used in Makefile.am files, as the 
+autodist will modify them.  See the source tree for examples.  If you 
+change Makefile.ad files, the autodist must be rerun.
+
+The autodist also creates the configure.ac script from which the autoconf 
+then creates the ./configure script.  All changes to configure must 
+always be done into the configure.ad scripts.  All changes made to 
+configure.ac will be lost.  The autodist distdefs may also be used in 
+configure.ad files.  It is also possible to write more than one 
+configure.ad in the source tree.  All configure.ad fragments will be 
+collected from the source tree by autodist and combined into one 
+configure.ac scripts.  After making changes to configure.ad files the 
+autodist must be rerun.
+
+The distdefs are defined in the corresponding distributions.  All 
+distributions live in distdir/ directory.  The distdefs can be used in any 
+file in the source tree, but mainly they are used in Makefile.ad, 
+configure.ad and source and headers files.  See autodist documentation for 
+more information how to use distdefs.
index 08c679b81ecdb62a618a63a6bffd5af427a86ddd..c8c24494e08fdac074efaa4ac0f02981eab8937d 100644 (file)
@@ -25,25 +25,18 @@ compiled and packaged.  The ./prepare script is used to prepare
 distribution for configuration, compilation and packaging.  To prepare a 
 specific distribution with specific version, give command:
 
-       ./prepare <name> <version>
+       ./autodist <name> <version>
 
 Where the <name> is the distribution name.  It is one of the distributions 
-that was defined in 'distributions' file.  The <version> is the version of 
+that was defined in distdir/ directory.  The <version> is the version of 
 the distribution that will be prepared.  The version format is 
 major.minor.build, for example 0.9.10.  Example:
 
-       ./prepare client 0.9.15
+       ./autodist client 0.9.15
 
 This prepares 'client' distribution of version 0.9.15.  The package will 
 have the version 0.9.15 automatically.
 
-NOTE for 'toolkit' distribution:  The toolkit version is defined in the 
-'prepare' file itself.  Edit the SILC_VERSION variable inside the 
-'prepare' script, and then run the prepare without the version argument.
-
-NOTE:  You may have to run prepare twice to produce valid Makfiles for
-distribution due to (known but not fixed) bugs in automake.
-
 
 Configuring and compiling the distribution
 ==========================================
diff --git a/acconfig.h.pre b/acconfig.h.pre
deleted file mode 100644 (file)
index 711975f..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Name of the package. */
-#undef PACKAGE
-
-/* Version of the package. */
-#undef VERSION
-
-/* Default configuration file */
-#undef SILC_SERVER_CONFIG_FILE
-
-/* Multi-thread support */
-#undef SILC_THREADS
-
-/* These can be defined only on other than Win32 systems */
-#ifndef SILC_WIN32
-
-/* Debugging */
-#undef SILC_DEBUG
-#undef SILC_STACKTRACE
-
-/* Multi-thread support */
-#undef SILC_HAVE_PTHREAD
-
-/* IPv6 Support */
-#undef HAVE_IPV6
-
-#endif /* SILC_WIN32 */
-
-/* Default paths */
-#undef SILC_ETCDIR
-#undef SILC_HELPDIR
-#undef SILC_DOCDIR
-#undef SILC_MODULESDIR
-#undef SILC_LOGSDIR
-
-/* SIM (SILC Module) support */
-#undef SILC_SIM
-#undef HAVE_RTLD_NOW
-#undef HAVE_RTLD_LAZY
-
-/* MP library */
-#undef SILC_MP_GMP
-#undef SILC_MP_NSS_MPI
-
-/* contrib library functions */
-#undef HAVE_REGEX
-#undef HAVE_GETOPT_LONG
-
-/* macros/curses checks */
-#undef HAS_CURSES
-#undef USE_SUNOS_CURSES
-#undef USE_BSD_CURSES
-#undef USE_SYSV_CURSES
-#undef USE_NCURSES
-#undef NO_COLOR_CURSES
-#undef SCO_FLAVOR
-
-/* Redefs for SOCKS5 library */
-#undef SOCKS
-#undef SOCKS5
-#undef Rconnect
-#undef Rgetsockname
-#undef Rgetpeername
-#undef Rbind
-#undef Raccept  
-#undef Rlisten
-#undef Rselect
-#undef Rrecvfrom
-#undef Rsendto
-#undef Rrecv
-#undef Rsend
-#undef Rread
-#undef Rwrite
-#undef Rrresvport
-#undef Rshutdown
-#undef Rlisten
-#undef Rclose
-#undef Rdup
-#undef Rdup2
-#undef Rfclose
-#undef Rgethostbyname
-
-/* Native WIN32 compilation (-mno-cygwin GCC option) under cygwin, though
-   the code compiles with any native WIN32 compiler. */
-#undef SILC_WIN32
-
-/* SILC distribution definitions (leave this at the end of file) */
index 97fc6cff208a89d2ba5a5ad8a533b934e031b883..f60c15ac1319411c7f26bedcb941ae8f9562d3c1 100644 (file)
@@ -19,6 +19,6 @@
 */
 
 #include "serverincludes.h"
-#include "version_internal.h"
+#include "silcversion.h"
 
 const char *server_version = SILC_DIST_VERSION_STRING;
diff --git a/autodist b/autodist
new file mode 100755 (executable)
index 0000000..6c3d078
--- /dev/null
+++ b/autodist
@@ -0,0 +1,1017 @@
+#!/bin/sh
+#
+# Author: Pekka Riikonen <priikone@silcnet.org>
+#
+# Copyright (C) 2005 Pekka Riikonen
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without 
+# modification, are permitted provided that the following conditions are 
+# met:
+#
+#   1. Redistributions of source code must retain the above copyright 
+#      notice, this list of conditions and the following disclaimer.
+#   2. Redistributions in binary form must reproduce the above copyright
+#      notice, this list of conditions and the following disclaimer in the
+#      documentation and/or other materials provided with the distribution.
+#   3. The name of the author may not be used to endorse or promote
+#      products derived from this software without specific prior written 
+#      permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 
+# NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
+# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+###############################################################################
+
+# XXXXXXXXXXXXXXX
+#
+# TODO
+#
+# --makedist
+# "pre-dist-hooks"
+# "post-dist-hooks"
+# "include"
+# "exclude"
+# "option"
+# default conffile in -i
+# default distro in -i
+#
+# NOTE: inherit inherits only distdefs, undefs, hooks, options, includes
+# and excludes.  It must not inherit others.
+#
+# XXXXXXXXXXXXXXX
+
+# Scripts have the following variables in their disposal
+#
+# distribution      distribution name
+# dist_version      distribution version
+# package           the package name of the distribution
+
+# Allowed structure for distdefs in non-source files
+
+#ifdef SILC_DIST_DEFINE
+#endif SILC_DIST_DEFINE
+
+#ifndef SILC_DIST_DEFINE
+#endif SILC_DIST_DEFINE
+
+#ifdef SILC_DIST_DEFINE
+#else !SILC_DIST_DEFINE
+#endif SILC_DIST_DEFINE
+
+#ifndef SILC_DIST_DEFINE
+#else SILC_DIST_DEFINE
+#endif SILC_DIST_DEFINE
+
+# Allowed structure for distdefs in source files
+
+#ifdef SILC_DIST_DEFINE
+#endif /* SILC_DIST_DEFINE */
+
+#ifndef SILC_DIST_DEFINE
+#endif /* SILC_DIST_DEFINE */
+
+#ifdef SILC_DIST_DEFINE
+#else /* !SILC_DIST_DEFINE */
+#endif /* SILC_DIST_DEFINE */
+
+#ifndef SILC_DIST_DEFINE
+#else /* SILC_DIST_DEFINE */
+#endif /* SILC_DIST_DEFINE */
+
+###############################################################################
+# Global variables
+
+# Distribution subdirectory
+distdir="distdir"
+
+# This current distribution
+distribution=default
+dist_version=0.0
+package=
+
+# All inherited distributions in this distribution
+inherits=
+
+# All distribution defines for this distribution
+distdefs=
+
+# All distribution undefines for this distribution
+undistdefs=
+
+# All distribution options
+options=
+
+# All includes
+includes=
+
+# All excludes
+excludes=
+
+# All pre, post pre-dist and post-dist hooks
+pre_hooks=
+post_hooks=
+pre_dist_hooks=
+post_dist_hooks=
+
+# Distribution license and license header
+license=
+licenseh=
+
+# Whether to output ad_debug information
+debug=false
+ver="1.0"
+makedist=false
+
+
+###############################################################################
+# Configuration file
+if test -f "$distdir/autodist.conf"; then
+  . $distdir/autodist.conf
+fi
+
+DP=$DISTPREFIX
+
+
+###############################################################################
+# Functions
+
+#
+# Print out debug information if debugging is enabled.  To enable debugging
+# set the global variable "debug" to true value.
+#
+# Arguments: ad_debug <ad_debug string>
+#
+ad_debug()
+{
+  if test x$debug = xtrue; then
+    echo autodist: $1
+  fi
+}
+
+#
+# Prints out error message and exits the script.
+#
+# Arguments: ad_fatal <error message>
+#
+ad_fatal()
+{
+  echo autodist: error: $1
+  exit 1
+}
+
+#
+# Initializes the Autodist environment, creates default distribution
+# directory, and default distribution.
+#
+# Arguments: ad_initialize
+#
+ad_initialize()
+{
+  ad_debug "-->$FUNCNAME()"
+
+  # Create default distdir
+  if test '!' -f $distdir; then
+    mkdir -p $distdir
+  fi
+
+  # Create default distribution
+  # XXX
+
+  ad_debug "<--$FUNCNAME()"
+}
+
+#
+# Creates the distdefs header file including defined distdefs
+#
+# Arguments: ad_create_distdefs_h
+#
+ad_create_distdefs_h()
+{
+  ad_debug "-->$FUNCNAME()"
+
+  fname=$DISTDEFS
+  rm -f $fname
+  echo "/*" > $fname
+  echo "  Automatically generated by Autodist $ver.  Do not edit." >> $fname
+  echo >> $fname
+  echo "  Generated: `date` by `whoami`" >> $fname
+  echo "  Distribution: $distribution" >> $fname
+  echo "  License: $license" >> $fname
+  echo "*/" >> $fname
+  echo >> $fname
+  echo "#ifndef _"$DP"_DISTDEFS_H" >> $fname
+  echo "#define _"$DP"_DISTDEFS_H" >> $fname
+  echo >> $fname
+
+  for i in $distdefs
+  do
+    echo "#define $i 1" >>$fname
+  done
+
+  echo >> $fname
+  echo "#endif /* _"$DP"_DISTDEFS_H */" >> $fname
+
+  ad_debug "<--$FUNCNAME()"
+}
+
+#
+# Creates the main configure script for the distribution.  This runs
+# the aclocal, autoheader and autoconf tools.
+#
+# Arguments: ad_make_configure
+#
+ad_make_configure()
+{
+  ad_debug "-->$FUNCNAME()"
+  local run_autoconf=false
+
+  rm -f configure
+
+  if test "$ACLOCAL"; then
+    ad_debug "Running aclocal"
+    $ACLOCAL 1>/dev/null 2>/dev/null
+    if test $? != 0; then
+      ad_fatal "aclocal failed"
+    fi
+  fi
+
+  if test "$AUTOCONF"; then
+    ad_debug "Running autoconf"
+    $AUTOCONF
+    if test $? != 0; then
+      ad_fatal "autoconf failed"
+    fi
+    run_autoconf=true
+  fi
+
+  if test "$AUTOHEADER"; then
+    ad_debug "Running autoheader"
+    $AUTOHEADER
+    if test $? != 0; then
+      ad_fatal "autoheader failed"
+    fi
+  fi
+
+  if test "$LIBTOOLIZE"; then
+    ad_debug "Running libtoolize"
+    $LIBTOOLIZE
+    if test $? != 0; then
+      ad_fatal "libtoolize failed"
+    fi
+  fi
+
+  if test x$run_autoconf = xtrue; then
+    if test '!' -f configure; then
+      ad_fatal "creating configure script failed"
+    fi 
+  fi
+
+  ad_debug "<--$FUNCNAME()"
+}
+
+#
+# Creates the configure.ac script from the configure.ad fragments in
+# the source tree.  Takes the source configure file as argument which
+# is used to create the actual configure.ac.
+#
+# Arguments: ad_make_configure_ac <configure_ac_source>
+#
+ad_make_configure_ac()
+{
+  ad_debug "-->$FUNCNAME(): $1"
+
+  if test '!' -f $1; then
+    ad_fatal "The configure file '$1' does not exist"
+  fi
+
+  rm -f configure.ac configure.ad.cfs
+
+  cfs=`find . -name configure\*\.ad`
+  for i in $cfs
+  do
+    if test "x$i" = "x$1"; then
+      continue
+    fi
+    ad_debug "including $i"
+    cat $i >> configure.ad.cfs
+  done
+
+  # Header for configure.ac
+  fname="configure.tmp.ac"
+  echo "# Automatically generated by Autodist $ver.  Do not edit." > $fname
+  echo "# To make changes edit the $i file in the source tree." >> $fname
+  echo >> $fname
+  echo "# Source: $i" >> $fname
+  echo "# Generated: `date` by `whoami`" >> $fname
+  echo "# Distribution: $distribution" >> $fname
+  echo "# License: $license" >> $fname
+  echo >> $fname
+
+  ad_debug "creating configure.ac"
+  if test -f configure.ad.cfs; then
+    sed '/AD_INCLUDE_CONFIGURE/ r configure.ad.cfs' $1 > $fname.tmp
+    sed -e "/AD_INCLUDE_CONFIGURE/s///" $fname.tmp >> $fname
+    rm -f configure.ad.cfs $fname.tmp
+  else
+    cat $1 >> $fname
+  fi
+
+  # Process AD_INIT
+  sed -e "/AD_INIT/s//AC_INIT($distribution, $dist_version, [], $package)/" $fname > $fname.tmp
+
+  # Process for distribution
+  ad_process_file $fname.tmp configure.ac
+  rm -f $fname $fname.tmp
+
+  ad_debug "<--$FUNCNAME(): $1"
+}
+
+#
+# Creates the Makefile.in files by running the automake tool.
+#
+# Arguments: ad_make_makefile_ins
+#
+ad_make_makefile_ins()
+{
+  ad_debug "-->$FUNCNAME()"
+
+  if test "$AUTOMAKE"; then
+    ad_debug "Running automake"
+    $AUTOMAKE
+    if test $? != 0; then
+      ad_fatal "automake failed"
+    fi
+  fi
+
+  ad_debug "<--$FUNCNAME()"
+}
+
+#
+# Creates the Makefile.am files from the Makefile.ad files in the
+# source tree.  This runs the distribution specific processing for the
+# Makefile.ad files.
+#
+# Arguments: ad_make_makefile_ams
+#
+ad_make_makefile_ams()
+{
+  ad_debug "-->$FUNCNAME()"
+
+  files=`find . -name Makefile\.ad`
+  for i in $files
+  do
+    fname=`echo $i | sed s/\.ad//`
+
+    # Header for the Makefile.am
+    echo "# Automatically generated by Autodist $ver from Makefile.ad.  Do not edit." > $fname.am
+    echo "# To make changes edit the $i file in the source tree." >> $fname.am
+    echo >> $fname.am
+    echo "# Source: $i" >> $fname.am
+    echo "# Generated: `date` by `whoami`" >> $fname.am
+    echo "# Distribution: $distribution" >> $fname.am
+    echo "# License: $license" >> $fname.am
+    echo >> $fname.am
+
+    # Run the distribution processing for this Makefile.ad
+    ad_debug "Processing $i to be $fname.am"
+    ad_process_file $i $fname.am
+  done
+
+  ad_debug "<--$FUNCNAME()"
+}
+
+#
+# Processes all files with .ad suffix, with exception of configure*.ad
+# and Makefile.ad files, for distribution from the source tree.
+#
+# Arguments: ad_process_ads
+#
+ad_process_ads()
+{
+  ad_debug "-->$FUNCNAME()"
+
+  files=`find . -name \*\.ad \! -name configure\*\.ad \! -name Makefile\.ad`
+  for i in $files
+  do
+    fname=`echo $i | sed s/\.ad//`
+
+    # Header
+    echo "# Automatically generated by Autodist $ver.  Do not edit." > $fname
+    echo "# To make changes edit the $i file in the source tree." >> $fname
+    echo >> $fname
+    echo "# Source: $i" >> $fname
+    echo "# Generated: `date` by `whoami`" >> $fname
+    echo "# Distribution: $distribution" >> $fname
+    echo "# License: $license" >> $fname
+    echo >> $fname
+
+    # Run the distribution processing for this file
+    ad_debug "Processing $i to be $fname"
+    ad_process_file $i $fname
+  done
+
+  ad_debug "<--$FUNCNAME()"
+}
+
+#
+# Processes the entire source tree for distribution.  This inspects files
+# in the source tree, with exception of any file with .ad suffix, and
+# performs distribution processing for the file.  The original file is
+# replaced with the processed file.  This function is used when creating
+# the distribution for packaging.
+#
+# Arguments: ad_process_source_tree <directory>
+#
+ad_process_source_tree()
+{
+  ad_debug "-->$FUNCNAME(): $1"
+
+  ad_debug "<--$FUNCNAME(): $1"
+}
+
+#
+# Creates distribution of the source tree.  All files in the distribution
+# will be processed and the distribution will be packaged.
+#
+ad_makedist()
+{
+  ad_debug "-->$FUNCNAME()"
+
+  ad_debug "<--$FUNCNAME()"
+}
+
+#
+# Parses the distribution.  Gets all distribution defines from the
+# distribution.  This also expands all inherited distributions recursively
+# to get all inherited distribution defines.  From inherited distributions
+# their name and package name is not inherited.
+#
+# Arguments: parse_distribution <distribution name> <inherit>
+#
+ad_parse_distribution()
+{
+  ad_debug "-->$FUNCNAME(): $1"
+
+  if test '!' -f $distdir/$1; then
+    ad_fatal "Distribution '$1' is not declared"
+  fi
+
+  # Get inherited
+  local inhs=`cat $distdir/$1 | grep -v "#" \
+    | grep "inherit " | cut -d' ' -f2 | sort | uniq`
+
+  # Get distdefs
+  local defs=`cat $distdir/$1 | grep -v "#" \
+   | grep "define " | cut -d' ' -f2 | sort | uniq`
+
+  if test "$inhs" = "" && test "$defs" = ""; then
+    ad_fatal "Distribution '$1' does not define anything"
+  fi
+
+  # Get undefined distdefs
+  local undefs=`cat $distdir/$1 | grep -v "#" \
+   | grep "undef " | cut -d' ' -f2`
+
+  # Get options
+  local opts=`cat $distdir/$1 | grep -v "#" \
+   | grep "option " | cut -d' ' -f2`
+
+  # Get includes
+  local incs=`cat $distdir/$1 | grep -v "#" \
+   | grep "include " | cut -d' ' -f2`
+
+  # Get excludes
+  local excs=`cat $distdir/$1 | grep -v "#" \
+   | grep "exclude " | cut -d' ' -f2`
+
+  ad_debug "inherits=$inhs"
+  ad_debug "distdefs=$defs"
+  ad_debug "includes=$incs"
+  ad_debug "excludes=$excs"
+  ad_debug "undistdefs=$undefs"
+  ad_debug "options=$opts"
+
+  # Expand distdefs from inherited distributions
+  for i in $inhs
+  do
+    if test x$1 = x$i; then
+      ad_fatal "Infinite recursion detected.  Fix the '$distdir/$1' \
+            distribution to not have 'inherit $i' declared."
+    fi
+
+    if test '!' -f $distdir/$i; then
+      ad_fatal "Distribution '$i' is not declared (inherited from '$1')"
+    fi
+
+    ad_parse_distribution $i true
+  done
+
+  # Get license
+  license=`cat $distdir/$1 | grep -v "#" \
+   | grep "license " | cut -d' ' -f2`
+  licenseh=`cat $distdir/$1 | grep -v "#" \
+   | grep "license-header " | cut -d' ' -f2`
+
+  ad_debug "license=$license"
+  ad_debug "licenseh=$licenseh"
+
+  if test x$2 = xfalse; then
+    # Get distribution name
+    local dname=`cat $distdir/$1 | grep -v "#" | grep "name "`
+
+    if test "$dname"; then
+      distribution=$dname
+    fi
+
+    # Get distribution package name (optional)
+    local dpname=`cat $distdir/$1 | grep -v "#" \
+     | grep "package " | cut -d' ' -f2`
+
+    if test "$dpname"; then
+      package=$dpname
+    else
+      package=$distribution
+    fi
+
+    ad_debug "distribution=$distribution"
+    ad_debug "package=$package"
+  fi
+
+  # Get hooks (optional)
+  local prh=`cat $distdir/$1 | grep -v "#" \
+   | grep "pre-hook " | cut -d' ' -f2`
+  local poh=`cat $distdir/$1 | grep -v "#" \
+   | grep "post-hook " | cut -d' ' -f2`
+  local prdh=`cat $distdir/$1 | grep -v "#" \
+   | grep "pre-dist-hook " | cut -d' ' -f2`
+  local podh=`cat $distdir/$1 | grep -v "#" \
+   | grep "post-dist-hook " | cut -d' ' -f2`
+
+  # Return to caller
+  inherits="$inherits $inhs"
+  distdefs="$distdefs $defs"
+  includes="$includes $incs"
+  excludes="$excludes $incs"
+  undistdefs="$undistdefs $undefs"
+  options="$options $opts"
+  pre_hooks="$pre_hooks $prh"
+  post_hooks="$post_hooks $poh"
+  pre_dist_hooks="$pre_dist_hooks $prdh"
+  post_dist_hooks="$post_dist_hooks $podh"
+
+  ad_debug "<--$FUNCNAME(): $1"
+}
+
+#
+# Processes parsed distdefs.  Removes duplicates, and undefined distdefs
+# from the distdefs.
+#
+# Arguments: ad_process_distdefs
+#
+ad_process_distdefs()
+{
+  ad_debug "-->$FUNCNAME()"
+
+  # Remove all undefined distribution defines
+  for i in $undistdefs
+  do
+    ad_debug "undefining $i distdef"
+    distdefs=`echo $distdefs | sed s/$i//`
+  done
+
+  rm -f autodist.tmp.defs autodist.pre.hooks autodist.post.hooks 
+  rm -f autodist.pre.dist.hooks autodist.post.dist.hooks
+
+  # Remove duplicate distdefs
+  for i in $distdefs
+  do
+    echo $i >>autodist.tmp.defs
+  done
+  distdefs=`cat autodist.tmp.defs | sort | uniq`
+  distdefs=`echo $distdefs`
+  rm -f autodist.tmp.defs
+
+  ad_debug "distdefs=$distdefs"
+
+  # Remove duplicate pre-hooks
+  for i in $pre_hooks
+  do
+    echo ". $i" >>autodist.tmp.defs
+  done
+  if test -f autodist.tmp.defs; then
+    cat autodist.tmp.defs | sort | uniq > autodist.pre.hooks
+    rm -f autodist.tmp.defs
+  fi
+
+  # Remove duplicate post-hooks
+  for i in $post_hooks
+  do
+    echo ". $i" >>autodist.tmp.defs
+  done
+  if test -f autodist.tmp.defs; then
+    cat autodist.tmp.defs | sort | uniq > autodist.post.hooks
+    rm -f autodist.tmp.defs
+  fi
+
+  # Remove duplicate pre-dist-hooks
+  for i in $pre_dist_hooks
+  do
+    echo ". $i" >>autodist.tmp.defs
+  done
+  if test -f autodist.tmp.defs; then
+    cat autodist.tmp.defs | sort | uniq > autodist.pre.dist.hooks
+    rm -f autodist.tmp.defs
+  fi
+
+  # Remove duplicate post-dist-hooks
+  for i in $post_dist_hooks
+  do
+    echo ". $i" >>autodist.tmp.defs
+  done
+  if test -f autodist.tmp.defs; then
+    cat autodist.tmp.defs | sort | uniq > autodist.post.dist.hooks
+    rm -f autodist.tmp.defs
+  fi
+
+  ad_debug "<--$FUNCNAME()"
+}
+
+#
+# Process a file given as argument for the distribution.
+#
+# Arguments: process_file <filepath> <dest_filepath>
+#
+ad_process_file()
+{
+  local found=false
+
+  ad_debug "-->$FUNCNAME(): $1 $2"
+
+  # Process only regular files
+  if test '!' -f $1; then
+    ad_debug "<--$FUNCNAME(): $1 $2"
+    return
+  fi
+
+  ad_debug "Getting #ifdef's and #ifndef's"
+
+  # Get defined distribution defines
+  local defs=`awk "/#ifdef "$DP"_DIST_|#else "$DP"_DIST_/ { print; }" \
+    $1 |cut -d'*' -f2 |cut -d' ' -f2 | sort | uniq`
+
+  # Get explicitly not-defined distribution defines
+  local ndefs=`awk "/#ifndef "$DP"_DIST_|#else !"$DP"_DIST_/ { print; }" \
+    $1 |cut -d'*' -f2 |cut -d' ' -f2 | cut -d'!' -f2 | sort | uniq`
+
+  ad_debug "defs=$defs"
+  ad_debug "ndefs=$ndefs"
+
+  # Create the script to include and exclude stuff in the file according
+  # to the distribution defines
+  local f=autodist.tmp.script
+  rm -f $f
+
+  # ifdefs
+  ad_debug "processing ifdefs"
+  for d in $defs
+  do
+    found=false
+    for i in $distdefs
+    do
+      if test x$d = x$i; then
+        found=true
+        break
+      fi
+    done
+
+    # If distribution define was not found exclude those lines from the file.
+    # This also handles the #ifdef's #else (ie. #ifndef) branch.
+    if test x$found = xfalse; then
+      ad_debug "ifdef $d will be excluded (it is NOT defined)"
+      echo "/^#ifdef $d/,/^#else !$d|^#endif $d/ { next; }" >> $f
+    else
+      echo "/^#else !$d/,/^#endif $d/ { next; }" >> $f
+    fi
+  done
+
+  # ifndefs
+  ad_debug "processing ifndefs"
+  for d in $ndefs
+  do
+    found=false
+    for i in $distdefs
+    do
+      if test x$d = x$i; then
+        found=true
+        break
+      fi
+    done
+
+    # If distribution define was found exclude those lines from the file.
+    # This also handles the #ifndef's #else (ie. #ifdef) branch.
+    if test x$found = xtrue; then
+      ad_debug "ifndef $d will be excluded (it IS defined)"
+      echo "/^#ifndef $d/,/^#else $d|^#endif $d/ { next; }" >> $f
+    else
+      echo "/^#else $d/,/^#endif $d/ { next; }" >> $f
+    fi
+  done
+
+  # Now process the file with the script
+  if test -f $f; then
+
+    # Those distdef lines that remain in the file are removed to make
+    # the appearance prettier
+    echo "/^#ifdef "$DP"_DIST_|^#endif "$DP"_DIST_|^#else "$DP"_DIST_|^#else !"$DP"_DIST_|^#ifndef "$DP"_DIST_/ { next; }" >> $f
+    echo "{ print; }" >> $f
+
+    # Execute the script
+    awk -f $f $1 >> $2
+  fi
+
+  rm -f $f
+
+  ad_debug "<--$FUNCNAME(): $1 $2"
+}
+
+
+#
+# Process a source file given as argument for the distribution.
+#
+# Arguments: process_source_file <filepath> <dest_filepath>
+#
+ad_process_source_file()
+{
+  local found=false
+
+  ad_debug "-->$FUNCNAME(): $1 $2"
+
+  # Process only regular files
+  if test '!' -f $1; then
+    ad_debug "<--$FUNCNAME(): $1 $2"
+    return
+  fi
+
+  ad_debug "Getting #ifdef's and #ifndef's"
+
+  # Get defined distribution defines
+  local defs=`awk '/#ifdef SILC_DIST_|#else \/\* SILC_DIST_/ { print; }' \
+    $1 |cut -d'*' -f2 |cut -d' ' -f2 | sort | uniq`
+
+  # Get explicitly not-defined distribution defines
+  local ndefs=`awk '/#ifndef SILC_DIST_|#else \/\* \!SILC_DIST_/ { print; }' \
+    $1 |cut -d'*' -f2 |cut -d' ' -f2 | cut -d'!' -f2 | sort | uniq`
+
+  ad_debug "defs=$defs"
+  ad_debug "ndefs=$ndefs"
+
+  # Create the script to include and exclude stuff in the file according
+  # to the distribution defines
+  local f=autodist.tmp.script
+  rm -f $f
+
+  # ifdefs
+  ad_debug "processing ifdefs"
+  for d in $defs
+  do
+    found=false
+    for i in $distdefs
+    do
+      if test x$d = x$i; then
+        found=true
+        break
+      fi
+    done
+
+    # If distribution define was not found exclude those lines from the file.
+    # This also handles the #ifdef's #else (ie. #ifndef) branch.
+    if test x$found = xfalse; then
+      ad_debug "ifdef $d will be excluded (it is NOT defined)"
+      echo "/^#ifdef $d/,/^#else \/\* \!$d|^#endif \/\* $d/ { next; }" >> $f
+    else
+      echo "/^#else \/\* \!$d/,/^#endif \/\* $d/ { next; }" >> $f
+    fi
+  done
+
+  # ifndefs
+  ad_debug "processing ifndefs"
+  for d in $ndefs
+  do
+    found=false
+    for i in $distdefs
+    do
+      if test x$d = x$i; then
+        found=true
+        break
+      fi
+    done
+
+    # If distribution define was found exclude those lines from the file.
+    # This also handles the #ifndef's #else (ie. #ifdef) branch.
+    if test x$found = xtrue; then
+      ad_debug "ifndef $d will be excluded (it IS defined)"
+      echo "/^#ifndef $d/,/^#else \/\* $d|^#endif \/\* $d/ { next; }" >> $f
+    else
+      echo "/^#else \/\* $d/,/^#endif \/\* $d/ { next; }" >> $f
+    fi
+  done
+
+  # Now process the file with the script
+  if test -f $f; then
+
+    # Those distdef lines that remain in the file are removed to make
+    # the appearance prettier
+    echo "/^#ifdef SILC_DIST_|^#endif \/\* SILC_DIST_|^#else \/\* SILC_DIST_|^#else \/\* \!SILC_DIST_|^#ifndef SILC_DIST_/ { next; }" >> $f
+    echo "{ print; }" >> $f
+
+    # Execute the script
+    awk -f $f $1 >> $2
+  fi
+
+  rm -f $f
+
+  ad_debug "<--$FUNCNAME(): $1 $2"
+}
+
+
+###############################################################################
+# Autodist code
+
+usage="Usage: autodist [options] [distribution] [version]"
+help="\
+Autodist prepares source tree for configuration, compilation and 
+distribution.  Prepares the source tree from the \`autodist.ad' 
+configuration file.  Generates Automake.am files from Automake.ad
+files, configure.ac file from configure.ad file(s), generates the 
+configure script by running Autoconf tool, and generates Makefile.in 
+files by running Automake tool.
+
+Operation modes:
+  -h, --help                print this help, then exit
+  -V, --version             print version number, then exit
+  -v, --verbose             verbosely report processing
+  -d, --distdir <dir>       search distributions from <dir>
+  -s, --distdefs [<dist>]   print distribution defines of <dist>, then exit
+  -m, --makedist            create and package distribution
+  -i, --init                initialize Autodist environment, create default
+                            distribution directory and distribution, then exit"
+
+#
+# Process command line arguments
+#
+while test $# -gt 0; do
+  case "${1}" in
+
+  -d |--distdir)
+    shift;
+    test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
+    distdir="${1}";
+    shift;;
+
+  --list)
+    exit 0;;
+
+  -s | --distdefs)
+    shift;
+    if test $# -eq 0; then
+      ad_parse_distribution $distribution false
+      echo "Distribution: ${distribution}" 1>&2;
+    else
+      ad_parse_distribution $1 false
+      echo "Distribution: ${1}" 1>&2;
+    fi
+    ad_process_distdefs
+    echo "Distdefs:" 1>&2;
+    echo "${distdefs}";
+    exit 0;;
+
+  -i | --init)
+    ad_initialize;
+    exit 0;;
+
+  -m | --makedist)
+    makdist=true
+    shift;;
+
+  -v | --verbose)
+    debug=true
+    shift;;
+
+  -h | --help | --h*)
+    echo "${usage}" 1>&2;
+    echo 1>&2;
+    echo "${help}" 1>&2;
+    echo 1>&2;
+    exit 0;;
+
+  -V | --version)
+    echo "autodist (SILC Autodist) $ver" 1>&2;
+    echo "Written by Pekka Riikonen" 1>&2;
+    echo 1>&2;
+    echo "Copyright (C) 2004 - 2005 SILC Project" 1>&2;
+    echo "\
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " 1>&2;
+    exit 0;;
+
+  --)
+    shift;
+    break;;
+
+  -*)
+    echo "${usage}" 1>&2;
+    exit 1;;
+
+  *)
+    break;;
+
+  esac
+done
+
+#
+# Parse the requested distribution
+#
+if test $# != 0; then
+  distribution="${1}";
+  shift
+fi
+ad_parse_distribution $distribution false
+ad_process_distdefs
+
+if test $# != 0; then
+  dist_version="${1}";
+fi
+ad_debug "Preparing source tree for configuration and compilation..."
+ad_debug "Preparing $distribution distribution version $dist_version"
+
+#
+# Create the distribution defines header file
+#
+if test "$DISTDEFS"; then
+  ad_create_distdefs_h
+else
+  ad_fatal "DISTDEFS not defined in $distdir/autodist.conf"
+fi
+
+#
+# Run pre-hooks
+#
+if test -f autodist.pre.hooks; then
+  . autodist.pre.hooks
+  rm -f autodist.pre.hooks
+fi
+
+#
+# Generate the Makefile.am files from Makefile.ad files
+#
+ad_make_makefile_ams
+
+#
+# Generate the configure.ac from configure.ad file(s)
+#
+ad_make_configure_ac ./configure.ad
+
+#
+# Generate configure script
+#
+ad_make_configure
+
+#
+# Generate Makefile.in files
+#
+ad_make_makefile_ins
+
+#
+# Process all files with .ad suffix for distribution processing
+#
+ad_process_ads
+
+#
+# Run post-hooks
+#
+if test -f autodist.post.hooks; then
+  . autodist.post.hooks
+  rm -f autodist.post.hooks
+fi
+
+#
+# Generate distribution, if requested
+#
+if test x$makedist = xtrue; then
+ ad_debug "Creating distribution"
+
+ exit 0
+fi
+
+ad_debug "Done, now run ./configure and make."
+exit 0
similarity index 87%
rename from configure.in.pre
rename to configure.ad
index d1e6a379961b3c0bc353142d29f1ee1d6d76ffc2..f2b140d394d63b018b88efb45448fd0b0ca108f5 100644 (file)
@@ -1,5 +1,5 @@
 #
-#  configure.in.pre
+#  configure.ad
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
@@ -15,7 +15,7 @@
 #  GNU General Public License for more details.
 #
 
-AC_INIT(includes/silcversion.h)
+AD_INIT
 
 # Put here any platform specific stuff
 #
@@ -32,9 +32,7 @@ case "$target" in
     ;;
 esac
 
-# ./prepare script will automatically put the correct version. Do not edit!
-#
-AM_INIT_AUTOMAKE(SILC_PACKAGE, SILC_VERSION)
+AM_INIT_AUTOMAKE
 AC_PREREQ(2.52)
 AC_CONFIG_HEADERS(includes/silcdefs.h)
 
@@ -46,14 +44,6 @@ AC_C_CONST
 AC_PROG_LN_S
 AC_SUBST(LN_S)
 
-##
-## Distribution definition. ./prepare will automatically add here a correct
-## value. Do not edit!
-##
-silc_dist=SILC_PACKAGE
-SILC_DIST_SUBDIRS="SILC_DISTRIBUTION_SUBDIRS"
-AC_DEFINE(SILC_DIST_DEFINE)
-
 __SILC_HAVE_PTHREAD=""
 __SILC_HAVE_SIM=""
 __SILC_ENABLE_DEBUG=""
@@ -135,14 +125,14 @@ AC_CHECK_HEADERS(dlfcn.h,
   [
     AC_CHECK_LIB(dl, dlopen,
       [
-        AC_DEFINE(SILC_SIM)
+        AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
         sim_support=true
         LIBS="$LIBS -ldl"
       ],
       [
         AC_CHECK_LIB(c, dlopen,
           [
-            AC_DEFINE(SILC_SIM)
+            AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
             sim_support=true
           ])
       ])
@@ -160,7 +150,7 @@ fi
 #
 AC_CHECK_HEADER(regex.h,
   [
-    AC_DEFINE(HAVE_REGEX)
+    AC_DEFINE([HAVE_REGEX], [], [HAVE_REGEX])
     have_regex=1
   ], have_regex=0
 )
@@ -168,7 +158,7 @@ AM_CONDITIONAL(HAVE_REGEX, test x$have_regex = x1)
 
 AC_CHECK_FUNC(getopt_long,
   [
-    AC_DEFINE(HAVE_GETOPT_LONG)
+    AC_DEFINE([HAVE_GETOPT_LONG], [], [HAVE_GETOPT_LONG])
     have_getopt_long=1
   ], have_getopt_long=0
 )
@@ -189,7 +179,7 @@ AC_ARG_ENABLE(ipv6,
         want_ipv6=true
         check_ipv6=false
        summary_ipv6="yes"
-        AC_DEFINE(HAVE_IPV6)
+        AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
         AC_MSG_RESULT(yes)
         ;;
       *)
@@ -226,7 +216,7 @@ if test x$check_ipv6 = xtrue; then
       int family = AF_INET6;
     ],
     [
-      AC_DEFINE(HAVE_IPV6)
+      AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
       AC_MSG_RESULT(yes)
       summary_ipv6="yes"
     ],
@@ -245,7 +235,7 @@ AC_ARG_ENABLE(debug,
     case "${enableval}" in
       yes)
         AC_MSG_RESULT(yes)
-        AC_DEFINE(SILC_DEBUG)
+        AC_DEFINE([SILC_DEBUG], [], [enable-debug])
        summary_debug="yes"
         __SILC_ENABLE_DEBUG="#define __SILC_ENABLE_DEBUG 1"
         ;;
@@ -373,7 +363,7 @@ AC_ARG_WITH(etcdir,
     esac
   ])
 AC_SUBST(ETCDIR)
-AC_DEFINE_UNQUOTED(SILC_ETCDIR, "$ETCDIR")
+AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
 
 # help directory
 #
@@ -390,7 +380,7 @@ AC_ARG_WITH(helpdir,
     esac
   ])
 AC_SUBST(HELPDIR)
-AC_DEFINE_UNQUOTED(SILC_HELPDIR, "$HELPDIR")
+AC_DEFINE_UNQUOTED([SILC_HELPDIR], "$HELPDIR", [SILC_HELPDIR])
 
 # doc directory
 #
@@ -407,7 +397,7 @@ AC_ARG_WITH(docdir,
     esac
   ])
 AC_SUBST(DOCDIR)
-AC_DEFINE_UNQUOTED(SILC_DOCDIR, "$DOCDIR")
+AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
 
 # SIM modules directory
 #
@@ -424,7 +414,9 @@ AC_ARG_WITH(simdir,
     esac
   ])
 AC_SUBST(MODULESDIR)
-AC_DEFINE_UNQUOTED(SILC_MODULESDIR, "$MODULESDIR")
+AC_DEFINE_UNQUOTED([SILC_MODULESDIR], "$MODULESDIR", [SILC_MODULESDIR])
+
+#ifdef SILC_DIST_SERVER
 
 # Logs directory
 #
@@ -441,7 +433,7 @@ AC_ARG_WITH(logsdir,
     esac
   ])
 AC_SUBST(LOGSDIR)
-AC_DEFINE_UNQUOTED(SILC_LOGSDIR, "$LOGSDIR")
+AC_DEFINE_UNQUOTED([SILC_LOGSDIR], "$LOGSDIR", [SILC_LOGSDIR])
 
 # silcd config file checking
 #
@@ -449,7 +441,7 @@ summary_silcd_configfile="/etc/silc/silcd.conf"
 AC_ARG_WITH(silcd-config-file,
   [[  --with-silcd-config-file=FILE  use FILE as default configuration file
                                  for SILC Server [/etc/silc/silcd.conf]]],
-    AC_DEFINE_UNQUOTED(SILC_SERVER_CONFIG_FILE, "$withval")
+    AC_DEFINE_UNQUOTED([SILC_SERVER_CONFIG_FILE], "$withval", [SILC_SERVER_CONFIG_FILE])
     summary_silcd_configfile="$withval"
   )
 
@@ -474,7 +466,7 @@ AC_ARG_WITH(silcd-pid-file,
     esac
   ])
 AC_SUBST(PIDFILE)
-
+#endif SILC_DIST_SERVER
 
 ##
 ##  With/without checkings
@@ -484,7 +476,7 @@ AC_SUBST(PIDFILE)
 # SILC library checking
 compile_libs=true
 
-if test "x$silc_dist" != "xsilc-toolkit"; then
+#ifndef SILC_DIST_TOOLKIT
 
 AC_ARG_WITH(silc-includes, 
   [  --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
@@ -509,7 +501,7 @@ if test "$ac_silc_libs" != "no"; then
   LIBS="$LIBS -L$ac_silc_libs"
 fi
 
-fi # silc_dist != silc-toolkit
+#endif SILC_DIST_TOOLKIT
 
 
 # SOCKS4 support checking
@@ -597,34 +589,34 @@ AC_ARG_WITH(socks5,
   )
 
 if test "x$socks" = "x4"; then
-  AC_DEFINE(SOCKS)
+  AC_DEFINE([SOCKS], [], [Socks])
   CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
 fi
 
 if test "x$socks" = "x5"; then
-  AC_DEFINE(SOCKS)
-  AC_DEFINE(SOCKS5)
-  AC_DEFINE(Rconnect, SOCKSconnect)
-  AC_DEFINE(Rgetsockname, SOCKSgetsockname)
-  AC_DEFINE(Rgetpeername, SOCKSgetpeername)
-  AC_DEFINE(Rbind, SOCKSbind)
-  AC_DEFINE(Raccept, SOCKSaccept)
-  AC_DEFINE(Rlisten, SOCKSlisten)
-  AC_DEFINE(Rselect, SOCKSselect)
-  AC_DEFINE(Rrecvfrom, SOCKSrecvfrom)
-  AC_DEFINE(Rsendto, SOCKSsendto)
-  AC_DEFINE(Rrecv, SOCKSrecv)
-  AC_DEFINE(Rsend, SOCKSsend)
-  AC_DEFINE(Rread, SOCKSread)
-  AC_DEFINE(Rwrite, SOCKSwrite)
-  AC_DEFINE(Rrresvport, SOCKSrresvport)
-  AC_DEFINE(Rshutdown, SOCKSshutdown)
-  AC_DEFINE(Rlisten, SOCKSlisten)
-  AC_DEFINE(Rclose, SOCKSclose)
-  AC_DEFINE(Rdup, SOCKSdup)
-  AC_DEFINE(Rdup2, SOCKSdup2)
-  AC_DEFINE(Rfclose, SOCKSfclose)
-  AC_DEFINE(Rgethostbyname, SOCKSgethostbyname)
+  AC_DEFINE([SOCKS], [], [Socks])
+  AC_DEFINE([SOCKS5], [], [Socks5])
+  AC_DEFINE([Rconnect], [SOCKSconnect], [Socks])
+  AC_DEFINE([Rgetsockname], [SOCKSgetsockname], [Socks])
+  AC_DEFINE([Rgetpeername], [SOCKSgetpeername], [Socks])
+  AC_DEFINE([Rbind], [SOCKSbind], [Socks])
+  AC_DEFINE([Raccept], [SOCKSaccept], [Socks])
+  AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
+  AC_DEFINE([Rselect], [SOCKSselect], [Socks])
+  AC_DEFINE([Rrecvfrom], [SOCKSrecvfrom], [Socks])
+  AC_DEFINE([Rsendto], [SOCKSsendto], [Socks])
+  AC_DEFINE([Rrecv], [SOCKSrecv], [Socks])
+  AC_DEFINE([Rsend], [SOCKSsend], [Socks])
+  AC_DEFINE([Rread], [SOCKSread], [Socks])
+  AC_DEFINE([Rwrite], [SOCKSwrite], [Socks])
+  AC_DEFINE([Rrresvport], [SOCKSrresvport], [Socks])
+  AC_DEFINE([Rshutdown], [SOCKSshutdown], [Socks])
+  AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
+  AC_DEFINE([Rclose], [SOCKSclose], [Socks])
+  AC_DEFINE([Rdup], [SOCKSdup], [Socks])
+  AC_DEFINE([Rdup2], [SOCKSdup2], [Socks])
+  AC_DEFINE([Rfclose], [SOCKSfclose], [Socks])
+  AC_DEFINE([Rgethostbyname], [SOCKSgethostbyname], [Socks])
 fi
 
 # MP library checking. First check whether user wants to use GMP and use
@@ -660,7 +652,7 @@ AC_ARG_WITH(gmp,
     AC_CHECK_LIB(gmp, __gmpz_init,
       [
         mp_gmp=true
-        AC_DEFINE(SILC_MP_GMP)
+        AC_DEFINE([SILC_MP_GMP], [], [GMP])
         AC_MSG_RESULT(Using GMP as a MP library.)
       ],
       [
@@ -675,7 +667,7 @@ AC_ARG_WITH(gmp,
 AM_CONDITIONAL(SILC_MP_GMP, test x$mp_gmp = xtrue)
 AM_CONDITIONAL(SILC_MP_NSS_MPI, test x$mp_gmp = xfalse)
 if test x$mp_gmp = xfalse; then
-  AC_DEFINE(SILC_MP_NSS_MPI)
+  AC_DEFINE([SILC_MP_NSS_MPI], [], [MPI])
   AC_MSG_RESULT(Using NSS MPI as a MP library.)
 fi
 
@@ -747,7 +739,7 @@ if test x$check_iconv = xtrue; then
         ],
         [
           echo "yes"
-          AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
+          AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
           has_iconv=true
           check_iconv=false
         ],
@@ -800,7 +792,7 @@ if test x$check_iconv = xtrue; then
             [
               echo "yes"
               has_iconv=true
-              AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
+              AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
             ],
             [
               echo "no"
@@ -982,9 +974,9 @@ if test x$has_threads = xtrue; then
    esac
 
   AC_CHECK_FUNC(pthread_create)
-  AC_DEFINE(SILC_HAVE_PTHREAD)
-  AC_DEFINE(SILC_THREADS)
-  __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHEAD 1"
+  AC_DEFINE([SILC_HAVE_PTHREAD], [], [HAVE_PTHREAD])
+  AC_DEFINE([SILC_THREADS], [], [HAVE_THREAD])
+  __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
 fi
 
 # Native WIN32 compilation under cygwin
@@ -994,7 +986,7 @@ AC_ARG_WITH(win32,
   [  --with-win32            compile native WIN32 (MinGW) code (-mno-cygwin)],
   [
     AC_MSG_RESULT(yes)
-    AC_DEFINE(SILC_WIN32)
+    AC_DEFINE([SILC_WIN32], [], [SILC_WIN32])
     win32_support=true
     CFLAGS="-mno-cygwin $CFLAGS"
     LIBS="$LIBS -lwsock32"
@@ -1016,6 +1008,8 @@ AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
 #
 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
 
+#ifdef SILC_DIST_TOOLKIT
+
 # --without-irssi
 #
 without_irssi=false
@@ -1025,7 +1019,6 @@ AC_ARG_WITH(irssi,
   [
     AC_MSG_RESULT(no)
     without_irssi=true
-    SILC_DIST_SUBDIRS=`echo $SILC_DIST_SUBDIRS | $sedpath -e 's/irssi//'`
   ],
   [
     AC_MSG_RESULT(yes)
@@ -1040,18 +1033,21 @@ AC_ARG_WITH(silcd,
   [
     AC_MSG_RESULT(no)
     without_silcd=true
-    SILC_DIST_SUBDIRS=`echo $SILC_DIST_SUBDIRS | $sedpath -e 's/silcd//'`
   ],
   [
     AC_MSG_RESULT(yes)
   ])
 
+#endif SILC_DIST_TOOLKIT
+
+#ifdef SILC_DIST_CLIENT
 # Irssi perl support
 #
 AC_ARG_WITH(perl,
   [[  --with-perl[=yes|no|module]  Build with Perl support - also specifies
                                if it should be built into main silc binary
                                (static, default) or as a module]])
+#endif SILC_DIST_CLIENT
 
 libtoolfix=true
 AC_MSG_CHECKING(whether to do libtoolfix)
@@ -1066,9 +1062,7 @@ AC_ARG_WITH(libtoolfix,
   ])
 
 AC_SUBST(ETCDIR)
-AC_DEFINE_UNQUOTED(SILC_ETCDIR, "$ETCDIR")
-
-
+AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
 
 ##
 ##  Misc
@@ -1076,12 +1070,17 @@ AC_DEFINE_UNQUOTED(SILC_ETCDIR, "$ETCDIR")
 
 # Other configure scripts
 #
+
+#ifdef SILC_DIST_TOOLKIT
 if test x$without_irssi = xfalse; then
-  if test "x$silc_dist" = "xsilc-client" ||
-     test "x$silc_dist" = "xsilc-toolkit"; then
-    AC_CONFIG_SUBDIRS(irssi)
-  fi
+#endif SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_CLIENT
+  AC_CONFIG_SUBDIRS(irssi)
+  irssi="yes"
+#endif SILC_DIST_CLIENT
+#ifdef SILC_DIST_TOOLKIT
 fi
+#endif SILC_DIST_TOOLKIT
 
 SILC_TOP_SRCDIR=`pwd`
 
@@ -1095,8 +1094,10 @@ AC_SUBST(SILC_TOP_SRCDIR)
 AC_SUBST(LIBS)
 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
 AC_SUBST(INCLUDE_DEFINES_INT)
-AC_SUBST(SILC_DIST_SUBDIRS)
 AC_SUBST(SILC_LIB_INCLUDES)
+AC_SUBST(__SILC_HAVE_PTHREAD)
+AC_SUBST(__SILC_HAVE_SIM)
+AC_SUBST(__SILC_ENABLE_DEBUG)
 
 #
 # Fix the libtool to support run-time configuration.  This allows us
@@ -1108,10 +1109,6 @@ if test x$libtoolfix = xtrue; then
 fi
 AM_CONDITIONAL(SILC_LIBTOOLFIX, test x$libtoolfix = xtrue)
 
-AC_SUBST(__SILC_HAVE_PTHREAD)
-AC_SUBST(__SILC_HAVE_SIM)
-AC_SUBST(__SILC_ENABLE_DEBUG)
-
 #
 # Makefile outputs
 #
@@ -1122,30 +1119,35 @@ Makefile.defines_int
 doc/Makefile
 includes/Makefile
 doc/example_silcd.conf
+includes/silcversion.h
 includes/silcincludes.h
 )
 
+#ifdef SILC_DIST_TOOLKIT
 if test x$without_irssi = xfalse ; then
-  if test "x$silc_dist" = "xsilc-client" ||
-     test "x$silc_dist" = "xsilc-toolkit"; then
-    AC_CONFIG_FILES(
+#endif SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_CLIENT
+  AC_CONFIG_FILES(
 irssi/Makefile.defines
 irssi/Makefile.defines_int
 )
-  fi
+#endif SILC_DIST_CLIENT
+#ifdef SILC_DIST_TOOLKIT
 fi
+#endif SILC_DIST_TOOLKIT
 
+#ifdef SILC_DIST_TOOLKIT
 if test x$without_silcd = xfalse ; then
-  if test "x$silc_dist" = "xsilc-server" ||
-     test "x$silc_dist" = "xsilc-toolkit"; then
-    AC_CONFIG_FILES(
-silcd/Makefile
-)
-  fi
+#endif SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_SERVER
+  AC_CONFIG_FILES(silcd/Makefile)
+#endif SILC_DIST_SERVER
+#ifdef SILC_DIST_TOOLKIT
 fi
+#endif SILC_DIST_TOOLKIT
 
-if test "x$silc_dist" = "xsilc-toolkit"; then
-  AC_CONFIG_FILES(
+#ifdef SILC_DIST_TOOLKIT
+AC_CONFIG_FILES(
 silc/Makefile
 win32/Makefile
 win32/libsilc/Makefile
@@ -1154,7 +1156,7 @@ tutorial/Makefile
 tutorial/Makefile.defines
 tutorial/Makefile.defines_int
 )
-fi
+#endif SILC_DIST_TOOLKIT
 
 AC_OUTPUT
 
@@ -1185,25 +1187,28 @@ echo " SIM directory .................: $MODULESDIR"
 echo " include directory .............: $s_includedir"
 echo ""
 
-if test "x$silc_dist" = "xsilc-client" ||
-   test "x$silc_dist" = "xsilc-toolkit"; then
-  irssi="yes"
-  if test x$without_irssi = xtrue; then
-    irssi="no"
-  fi
-echo " Compile SILC Client ...........: $irssi"
+#ifdef SILC_DIST_SERVER
+silcd="yes"
+#endif SILC_DIST_SERVER
+
+#ifdef SILC_DIST_TOOLKIT
+if test x$without_irssi = xtrue; then
+  irssi="no"
+fi
+if test x$without_silcd = xtrue; then
+  silcd="no"
 fi
+#endif SILC_DIST_TOOLKIT
 
-if test "x$silc_dist" = "xsilc-server" ||
-   test "x$silc_dist" = "xsilc-toolkit"; then
-  silcd="yes"
-  if test x$without_silcd = xtrue; then
-    silcd="no"
-  fi
+#ifdef SILC_DIST_CLIENT
+echo " Compile SILC Client ...........: $irssi"
+#endif SILC_DIST_CLIENT
+
+#ifdef SILC_DIST_SERVER
 echo " Compile SILC Server ...........: $silcd"
 echo " Server configuration file .....: $summary_silcd_configfile"
 echo " Server PID file ...............: $PIDFILE"
-fi
+#endif SILC_DIST_SERVER
 
 if test x$sim_support = xfalse; then
   sim_support="no"
@@ -1238,8 +1243,4 @@ fi
 echo " Multi-threads support .........: $threads"
 echo " Debugging enabled .............: $summary_debug"
 echo ""
-if test "x$silc_dist" = "xsilc-client"; then
-  echo "Compile the sources with 'make' or 'gmake' command (GNU make is required)."
-else
-  echo "Compile the sources with 'make' or 'gmake' command."
-fi
+echo "Compile the sources with 'make' or 'gmake' command."
diff --git a/distdir/autodist.conf b/distdir/autodist.conf
new file mode 100644 (file)
index 0000000..84044df
--- /dev/null
@@ -0,0 +1,9 @@
+DISTPREFIX="SILC"
+
+DISTDEFS="includes/silcdistdefs.h"
+
+ACLOCAL="aclocal"
+AUTOHEADER="autoheader"
+AUTOCONF="autoconf"
+AUTOMAKE="automake"
+LIBTOOLIZE="libtoolize --automake --copy"
diff --git a/distdir/client b/distdir/client
new file mode 100644 (file)
index 0000000..2cdceaa
--- /dev/null
@@ -0,0 +1,6 @@
+name Client
+package silc-client
+define SILC_DIST_CLIENT
+define SILC_DIST_CLIENTLIB
+define SILC_DIST_MPI
+post-hook distdir/post-run
diff --git a/distdir/default b/distdir/default
new file mode 100644 (file)
index 0000000..85edccc
--- /dev/null
@@ -0,0 +1,18 @@
+# Default distribution for preparing raw CVS sources.
+inherit client
+inherit server
+inherit toolkit
+option no-dist
+define SILC_DIST_INPLACE
+post-hook distdir/post-run
+
+#include README.FOOBAR foobar.dir
+#exclude distdir foobar
+#define SILC_DIST_DEFAULT
+#undef SILC_DIST_FOOBAR
+#pre-hook scripts/foobar-pre.sh
+#post-hook scripts/foobar-post.sh
+#pre-dist-hook scripts/foobar-dist-pre.sh
+#post-dist-hook scripts/foobar-dist-post.sh
+#option no-dist
+#option template
diff --git a/distdir/post-run b/distdir/post-run
new file mode 100644 (file)
index 0000000..134eab9
--- /dev/null
@@ -0,0 +1,13 @@
+# preparing irssi
+echo "Preparing irssi"
+file=irssi/irssi-version.h.in
+cd irssi
+ln -fs ../Makefile.defines.in Makefile.defines.in
+ln -fs ../Makefile.defines_int.in Makefile.defines_int.in
+sh autogen.sh 2>/dev/null 1>/dev/null
+cd ..
+version_date=`date +%Y%m%d`
+echo "/* automatically created by autogen.sh */" > $file
+echo "#define IRSSI_VERSION \"$dist_version (Irssi base: @VERSION@ - SILC base: SILC $dist_version)\"" >>$file
+echo "#define IRSSI_VERSION_DATE $version_date" >> $file
+echo "#define IRSSI_VERSION_TIME $version_date" >> $file
diff --git a/distdir/server b/distdir/server
new file mode 100644 (file)
index 0000000..86d2a72
--- /dev/null
@@ -0,0 +1,4 @@
+name Server
+package silc-server
+define SILC_DIST_SERVER
+define SILC_DIST_MPI
diff --git a/distdir/toolkit b/distdir/toolkit
new file mode 100644 (file)
index 0000000..07ee1fe
--- /dev/null
@@ -0,0 +1,9 @@
+name Toolkit
+package silc-toolkit
+define SILC_DIST_TOOLKIT
+define SILC_DIST_CLIENT
+define SILC_DIST_CLIENTLIB
+define SILC_DIST_SERVER
+define SILC_DIST_MPI
+include README.CVS README.WIN32 README.MACOSX silcer tutorial
+post-hook distdir/post-run
diff --git a/distributions b/distributions
deleted file mode 100644 (file)
index a0a16cb..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Distributions
-#
-# Distributions file describing the different distributions that are
-# created out of the SILC source tree.  The ./prepare script will read
-# this file to determine what kind of distributions are created.
-#
-# Give the name of the distribution and the version as arguments to the
-# ./prepare script to prepare the source tree for the specific
-# distribution.
-#
-# The format of this file is as follows:
-#
-# <name>_SUBDIRS                       Subdirs for the distribution
-# <name>_SUBDIRS_<dir>                 Subdirs under <dir>
-# <name>_DISTLABEL                     Preprocessor label
-# <name>_EXTRA_DIST                    List of extra files or directories
-#
-# The _SUBDIRS define all the subdirectories that the Makefile should
-# traverse.  The SUBDIRS_<dir> defines all subdirectories in the 
-# subdirectory <dir>.  The DISTLABEL defines a preprocessor label
-# that can be used in the source code like `#ifdef SILC_DIST_CLIENT' to
-# define code only for the specific distribution.  The label can also be
-# used in the Makefiles by `if SILC_DIST_CLIENT' to define something in
-# the Makefile only for the specific distribution.
-#
-# The DISTRIBUTIONS defines all distributions in this file.  The
-# EXTRA_DIST is used to add extra files or directories to the
-# distribution. The files may be in subdirectories.
-#
-# NOTE: For now this supports only one sublevel of the directories.
-#       Also make sure that the <dir> directory includes Makefile.am.pre
-#       instead of Makefile.am, otherwise it won't work.  The Makefile.am.pre
-#       must have DIST_SUBDIRS = SILC_DISTRIBUTIONS_SUBDIRS line in it.
-#
-# NOTE: Also note that if any subdirectory has Makefile.am.pre then you
-#       must list it here as <name>_SUBDIRS_<dir>. To define all sub
-#       directories use $(COMMONDIRS) that must be defined in the Makefile
-#       and list all subdirs.
-#
-# Example:
-#
-# xyz_SUBDIRS=lib irssi doc includes
-# xyz_SUBDIRS_lib=$(COMMONDIRS)
-# xyz_DISTLABEL=SILC_DIST_XYZ
-# xyz_EXTRA_DIST=README.XYZ
-#
-# To prepare the distribution give command ./prepare xyz 1.0.4
-#
-
-# Default Toolkit distribution
-toolkit_SUBDIRS=lib irssi silc silcd doc includes win32
-toolkit_SUBDIRS_lib=$(COMMONDIRS)
-toolkit_SUBDIRS_doc=$(COMMONDIRS)
-toolkit_DISTLABEL=SILC_DIST_TOOLKIT
-toolkit_EXTRA_DIST=README.CVS README.WIN32 README.MACOSX silcer tutorial
-
-# Irssi SILC Client distribution
-client_SUBDIRS=lib irssi doc includes
-client_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil silcclient silcsftp
-client_SUBDIRS_doc=$(COMMONDIRS)
-client_DISTLABEL=SILC_DIST_CLIENT
-client_EXTRA_DIST=#
-
-# SILC Server distribution
-server_SUBDIRS=lib silcd doc includes
-server_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil silcsftp
-server_SUBDIRS_doc=$(COMMONDIRS)
-server_DISTLABEL=SILC_DIST_SERVER
-server_EXTRA_DIST=#
-
-# Native WIN32 SILC library distribution (will include only the libraries)
-# XXX This is not really used at all!
-win32dll_SUBDIRS=lib doc includes
-win32dll_SUBDIRS_lib=silccore silccrypt silcsim silcmath silcske silcutil silcclient
-win32dll_SUBDIRS_doc=$(COMMONDIRS)
-win32dll_DISTLABEL=SILC_DIST_WIN32DLL
-win32dll_EXTRA_DIST=README.CVS README.WIN32
-
-DISTRIBUTIONS=toolkit client server win32dll
similarity index 80%
rename from doc/Makefile.am.pre
rename to doc/Makefile.ad
index b63eb061adbbaec0ba913df5f558edc8a0264124..834caf10fa1a9ce4c9d328522401a925c9903554 100644 (file)
@@ -1,14 +1,13 @@
 #
-#  Makefile.am
+#  Makefile.ad
 #
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+#  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 - 2001 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
 
 AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
 
-COMMONDIRS = .
-SUBDIRS = SILC_DISTRIBUTION_SUBDIRS
-DIST_SUBDIRS = SILC_DISTRIBUTION_SUBDIRS
-makerfc = ../scripts/makerfc
-
 all:
        touch draft-riikonen-silc-spec-08.txt
        touch draft-riikonen-silc-pp-09.txt
@@ -31,7 +25,9 @@ all:
        touch draft-riikonen-silc-flags-payloads-04.txt
        touch draft-riikonen-presence-attrs-03.txt
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
+makerfc = $(SILC_TOP_SRCDIR)/scripts/makerfc
+
 toolkit-ref-html:
        -@if test -f $(SILC_TOP_SRCDIR)/util/robodoc/Source/robodoc ; then \
          echo Generating Toolkit Reference Manual ; \
@@ -55,6 +51,7 @@ toolkit-ref-pdf:
         fi
 
 dist-hook:
+       rm -rf `find $(top_distdir)/doc -name CVS`
        $(SILC_TOP_SRCDIR)/scripts/manpages.pl
        touch draft-riikonen-silc-spec-08.txt
        touch draft-riikonen-silc-pp-09.txt
@@ -75,8 +72,9 @@ dist-hook:
        $(makerfc) draft-riikonen-presence-attrs-03.nroff \
                draft-riikonen-presence-attrs-03.txt
 
-else
+#else !SILC_DIST_TOOLKIT
 dist-hook:
+       rm -rf `find $(top_distdir)/doc -name CVS`
        $(SILC_TOP_SRCDIR)/scripts/manpages.pl
        rm draft-riikonen*.txt
        touch draft-riikonen-silc-spec-08.txt
@@ -85,21 +83,20 @@ dist-hook:
        touch draft-riikonen-silc-commands-06.txt
        touch draft-riikonen-silc-flags-payloads-04.txt
        touch draft-riikonen-presence-attrs-03.txt
-endif
-
-if SILC_DIST_TOOLKIT
-SILC_EXTRA_DIST = toolkit examples silc.1 silcd.8 silcd.conf.5
-else
-if SILC_DIST_SERVER
-SILC_EXTRA_DIST = examples silcd.8 silcd.conf.5
-else
-SILC_EXTRA_DIST = silc.1
-endif
-endif
+#endif SILC_DIST_TOOLKIT
 
-EXTRA_DIST = \
-       CodingStyle \
-       FAQ \
-       example_silcd.conf \
-       silcalgs.conf \
-       draft-riikonen*.txt $(SILC_EXTRA_DIST)
+EXTRA_DIST =                   \
+#ifdef SILC_DIST_CLIENT
+       silc.1                  \
+#endif SILC_DIST_CLIENT
+#ifdef SILC_DIST_SERVER
+       examples silcd.8 silcd.conf.5   \
+#endif SILC_DIST_SERVER
+#ifdef SILC_DIST_TOOLKIT
+       toolkit                 \
+#endif SILC_DIST_TOOLKIT
+       CodingStyle             \
+       FAQ                     \
+       example_silcd.conf      \
+       silcalgs.conf           \
+       draft-riikonen*.txt
similarity index 67%
rename from includes/Makefile.am
rename to includes/Makefile.ad
index bf47b28ea3ccfe52f902aca8dd292edec774ba39..946ac7e5c8b564f870960cfa94445b33d6abf690 100644 (file)
@@ -1,14 +1,13 @@
 #
-#  Makefile.am
+#  Makefile.ad
 #
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+#  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
 
 AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
 include_HEADERS = \
        silcincludes.h \
        silcwin32.h \
        silcepoc.h \
        silcbeos.h \
        silcos2.h \
-       silcversion.h \
-       version_internal.h
-endif
+       silcversion.h
+#endif SILC_DIST_TOOLKIT
 
 EXTRA_DIST = \
        silcincludes.h \
@@ -35,6 +33,6 @@ EXTRA_DIST = \
        silcepoc.h \
        silcbeos.h \
        silcos2.h \
-       silcversion.h \
-       version_internal.h \
+       silcversion.h.in \
+       silcdistdefs.h \
        silcdefs.h.in
index 6752ce062bd1a493262bc2971aee71131727dc71..8e57209f31bc93dd0135729fa53c5cc1b71ff83b 100644 (file)
@@ -85,6 +85,7 @@ extern "C" {
 #if defined(HAVE_SILCDEFS_H)
 /* Automatically generated configuration header */
 #include "silcdefs.h"
+#include "silcdistdefs.h"
 #endif /* HAVE_SILCDEFS_H */
 
 /* Platform specific includes */
similarity index 80%
rename from includes/silcversion.h
rename to includes/silcversion.h.in
index e8959c134b85121f67d2c43ffcfdeb973fbe2c8b..86c16ba99963c9998a2c56b15fae5e12113f7c1e 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2002 Pekka Riikonen
+  Copyright (C) 1997 - 2005 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
 extern "C" {
 #endif
 
-#include "version_internal.h"
+#define SILC_VERSION_STRING "@VERSION@"
+#define SILC_DIST_VERSION_STRING "@VERSION@"
+#define SILC_PROTOCOL_VERSION_STRING "SILC-1.2-@VERSION@ @PACKAGE@"
+#define SILC_NAME "SILC @PACKAGE_NAME@"
 
 /* SILC Protocol version number */
 #define SILC_PROTOCOL_VERSION_CURRENT 12
similarity index 58%
rename from lib/Makefile.am.pre
rename to lib/Makefile.ad
index d4a37013b5400ccc1e9bbd58417fd907a8c00787..bb90b0cfa6a726262490a90d6d0230618bbb43e2 100644 (file)
@@ -1,14 +1,13 @@
 #
 #  Makefile.am
 #
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+#  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
 
 AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
 
-COMMONDIRS = \
-       contrib \
-       silccore \
-       silccrypt \
-       silcsim \
-       silcmath \
-       silcske \
-       silcutil \
-       silcclient \
-       silcsftp
-#      zlib
-
-SUBDIRS = SILC_DISTRIBUTION_SUBDIRS
-DIST_SUBDIRS = SILC_DISTRIBUTION_SUBDIRS
-
 # SILC Library dirs
 SILCLIB_DIRS = \
        contrib \
@@ -44,68 +28,57 @@ SILCLIB_DIRS = \
        silcutil \
        silcsftp
 
+SILCLIB = libsilc.a
+
+#ifdef SILC_DIST_CLIENTLIB
 # SILC Client Library dirs
-SILCCLIENTLIB_DIRS = \
-       silcclient
+SILCCLIENTLIB_DIRS = silcclient
+SILCCLIENTLIB = libsilcclient.a
+#endif SILC_DIST_CLIENTLIB
+
+SUBDIRS = $(SILCLIB_DIRS) $(SILCCLIENTLIB_DIRS)
 
 CLEANFILES = libsilc.a libsilcclient.a
 DISTCLEANFILES = libsilc.a libsilcclient.a
 
-if SILC_DIST_CLIENT
-all:  remove libsilc.a libsilcclient.a
-else
-if SILC_DIST_TOOLKIT
-all:  remove libsilc.a libsilcclient.a
-else
-if SILC_DIST_WIN32DLL
-all:  silc.dll silcclient.dll
-else
-all:  remove libsilc.a
-endif
-endif
-endif
-
 remove:
-       -rm -rf libsilc.a
-       -rm -rf libsilcclient.a
+       -rm -f libsilc.a
+       -rm -f libsilcclient.a
 
-if SILC_DIST_TOOLKIT
+all:   remove $(SILCLIB) $(SILCCLIENTLIB)
+
+#ifdef SILC_DIST_TOOLKIT
 install-exec-hook:
        -mkdir -p $(DESTDIR)$(libdir)
        -$(LIBTOOL) $(INSTALL) libsilc.la $(DESTDIR)$(libdir)/
        -$(LIBTOOL) $(INSTALL) libsilcclient.la $(DESTDIR)$(libdir)/
-else
+#else !SILC_DIST_TOOLKIT
+
+#ifdef SILC_DIST_SERVER
 install-exec-hook:
+if SILC_ENABLE_SHARED
        -mkdir -p $(libdir)
        -$(LIBTOOL) $(INSTALL) libsilc.la $(DESTDIR)$(libdir)/
        -rm -rf $(DESTDIR)$(libdir)/libsilc.a
-if SILC_DIST_CLIENT
-       -$(LIBTOOL) $(INSTALL) libsilcclient.la $(DESTDIR)$(libdir)/
-       -rm -rf $(DESTDIR)$(libdir)/libsilcclient.a
-endif
 endif
+#endif SILC_DIST_SERVER
 
-if SILC_DIST_WIN32DLL
-# WIN32 DLL generation
-silc.dll: libsilc.a
-       dllwrap --export-all --output-def silc.def --output-exp silc.exp \
-       --output-lib silc.lib --driver-name $(CC) --target i386-mingw32 \
-       -mno-cygwin -o silc.dll libsilc.a -lwsock32
-
-silcclient.dll: libsilcclient.a
-       dllwrap --export-all --output-def silcclient.def \
-       --output-lib silcclient.lib --output-exp silcclient.exp \
-       --driver-name $(CC) --target i386-mingw32 \
-       -mno-cygwin -o silcclient.dll libsilcclient.a -L. -lsilc -lwsock32
+#ifdef SILC_DIST_CLIENT
+install-exec-hook:
+if SILC_ENABLE_SHARED
+       -mkdir -p $(libdir)
+       -$(LIBTOOL) $(INSTALL) libsilc.la $(DESTDIR)$(libdir)/
+       -$(LIBTOOL) $(INSTALL) libsilcclient.la $(DESTDIR)$(libdir)/
+       -rm -rf $(DESTDIR)$(libdir)/libsilc.a
+       -rm -rf $(DESTDIR)$(libdir)/libsilcclient.a
 endif
+#endif SILC_DIST_CLIENT
+#endif SILC_DIST_TOOLKIT
 
 LIB_BASE_VERSION=@LIB_BASE_VERSION@
 LIBSILC_CURRENT=@LIBSILC_CURRENT@
 LIBSILC_REVISION=@LIBSILC_REVISION@
 LIBSILC_AGE=@LIBSILC_AGE@
-LIBSILCCLIENT_CURRENT=@LIBSILCCLIENT_CURRENT@
-LIBSILCCLIENT_REVISION=@LIBSILCCLIENT_REVISION@
-LIBSILCCLIENT_AGE=@LIBSILCCLIENT_AGE@
 
 libsilc.a:
        find $(SILCLIB_DIRS) -type f -name *.lo | xargs \
@@ -113,23 +86,22 @@ libsilc.a:
        -version-info $(LIBSILC_CURRENT):$(LIBSILC_REVISION):$(LIBSILC_AGE) \
        -release $(LIB_BASE_VERSION) -rpath $(DESTDIR)$(libdir) -o libsilc.la
 
+#ifdef SILC_DIST_CLIENTLIB
+LIBSILCCLIENT_CURRENT=@LIBSILCCLIENT_CURRENT@
+LIBSILCCLIENT_REVISION=@LIBSILCCLIENT_REVISION@
+LIBSILCCLIENT_AGE=@LIBSILCCLIENT_AGE@
+
 libsilcclient.a:
        find $(SILCCLIENTLIB_DIRS) -type f -name *.lo | xargs \
        $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) \
        -version-info $(LIBSILCCLIENT_CURRENT):$(LIBSILCCLIENT_REVISION):$(LIBSILCCLIENT_AGE) \
        -release $(LIB_BASE_VERSION) -rpath $(DESTDIR)$(libdir) -o libsilcclient.la
+#endif SILC_DIST_CLIENTLIB
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = silc.pc silcclient.pc
 
-SILC_EXTRA_DIST = doc silc.pc.in silcclient.pc.in
-else
-if SILC_DIST_SERVER
-SILC_EXTRA_DIST = 
-else
-SILC_EXTRA_DIST =
-endif
-endif
+EXTRA_DIST = doc silc.pc.in silcclient.pc.in
+#endif SILC_DIST_TOOLKIT
 
-EXTRA_DIST = $(SILC_EXTRA_DIST)
index 4e025ccad6330eef759f9c577cc1f3492e417e0e..9550cf9b4257b1f31021adf158aac4dd1553f71d 100644 (file)
 #  GNU General Public License for more details.
 #
 
-if test x$compile_libs = xfalse; then
-
-##
-## Not compiling included libs.
-##
-
-# Remove lib subdir from SUBDIRS
-SILC_DIST_SUBDIRS=`echo $SILC_DIST_SUBDIRS | $sedpath -e 's/lib//'`
-
-else   # compile_libs = true
+if test x$compile_libs = xtrue; then
 
 ##
 ## Will compile included libs
@@ -40,8 +31,10 @@ SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcske"
 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcsim"
 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcutil"
 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcsftp"
-SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcclient"
 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/contrib"
+#ifdef SILC_DIST_CLIENT
+SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcclient"
+#endif SILC_DIST_CLIENT
 
 ##
 ## Library versioning.
@@ -84,6 +77,9 @@ AC_SUBST(LIBSILCCLIENT_CURRENT)
 AC_SUBST(LIBSILCCLIENT_REVISION)
 AC_SUBST(LIBSILCCLIENT_AGE)
 
+# Make enable-shared aware
+AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
+
 # Stack trace checking
 #
 AC_MSG_CHECKING(whether to enable stack tracing)
@@ -93,7 +89,7 @@ AC_ARG_ENABLE(stack-trace,
     case "${enableval}" in
     yes)
       AC_MSG_RESULT(yes)
-      AC_DEFINE(SILC_STACKTRACE)
+      AC_DEFINE([SILC_STACKTRACE], [], [SILC_STACKTRACE])
       ;;
     *)
       AC_MSG_RESULT(no)
@@ -110,9 +106,7 @@ AC_CONFIG_FILES(
 lib/Makefile
 lib/contrib/Makefile
 lib/silccore/Makefile
-lib/silccore/tests/Makefile
 lib/silccrypt/Makefile
-lib/silccrypt/tests/Makefile
 lib/silcsim/Makefile
 lib/silcske/Makefile
 lib/silcutil/Makefile
@@ -121,23 +115,26 @@ lib/silcutil/win32/Makefile
 lib/silcutil/beos/Makefile
 lib/silcutil/os2/Makefile
 lib/silcutil/epoc/Makefile
-lib/silcutil/tests/Makefile
 lib/silcmath/Makefile
 lib/silcsftp/Makefile
+#ifdef SILC_DIST_INPLACE
+lib/silcutil/tests/Makefile
+lib/silccrypt/tests/Makefile
+lib/silccore/tests/Makefile
 lib/silcsftp/tests/Makefile
+#endif SILC_DIST_INPLACE
 )
 
-if test "x$silc_dist" = "xsilc-toolkit"; then
-  AC_CONFIG_FILES(
+#ifdef SILC_DIST_TOOLKIT
+AC_CONFIG_FILES(
 lib/silc.pc
 lib/silcclient.pc
 )
-fi
+#endif SILC_DIST_TOOLKIT
 
-if test "x$silc_dist" = "xsilc-client" ||
-   test "x$silc_dist" = "xsilc-toolkit"; then
-  AC_CONFIG_FILES(lib/silcclient/Makefile)
-fi
+#ifdef SILC_DIST_CLIENTLIB
+AC_CONFIG_FILES(lib/silcclient/Makefile)
+#endif SILC_DIST_CLIENTLIB
 
 fi     # compile_libs
 
similarity index 76%
rename from lib/silcclient/Makefile.am
rename to lib/silcclient/Makefile.ad
index 103e09e59bb1d61541d7489cbd7ff9bd0e5e60bd..b85ac5a9f083af64a9c746681ad9cfa08c4ddbfc 100644 (file)
@@ -1,14 +1,13 @@
 #
 #  Makefile.am
 #
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+#  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
@@ -34,7 +33,7 @@ libsilcclient_la_SOURCES = \
        idlist.c \
        protocol.c
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
 include_HEADERS=       \
        client.h        \
        command.h       \
@@ -42,8 +41,10 @@ include_HEADERS=     \
        idlist.h        \
        protocol.h      \
        silcclient.h
-endif
 
-EXTRA_DIST = *.h client_ops_example.c
+SILC_EXTRA_DIST = client_ops_example.c
+#endif SILC_DIST_TOOLKIT
+
+EXTRA_DIST = *.h $(SILC_EXTRA_DIST)
 
 include $(top_srcdir)/Makefile.defines.in
similarity index 82%
rename from lib/silccore/Makefile.am
rename to lib/silccore/Makefile.ad
index 7dae40126f105118794fa04d60a7521451d95abb..b5d6d71b277bed0a82eb8adf351016f4d481173d 100644 (file)
@@ -1,9 +1,9 @@
 #
-#  Makefile.am
+#  Makefile.ad
 #
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+#  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 - 2003 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
@@ -32,7 +32,7 @@ libsilccore_la_SOURCES = \
        silcattrs.c \
        silcstatus.c
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
 include_HEADERS =      \
        silcauth.h      \
        silcchannel.h   \
@@ -46,8 +46,10 @@ include_HEADERS =    \
        silcargument.h  \
        silcstatus.h    \
        silcattrs.h
-endif
 
-EXTRA_DIST = *.h tests
+SILC_EXTRA_DIST = tests
+#endif SILC_DIST_TOOLKIT
+
+EXTRA_DIST = *.h $(SILC_EXTRA_DIST)
 
 include $(top_srcdir)/Makefile.defines.in
similarity index 89%
rename from lib/silccrypt/Makefile.am
rename to lib/silccrypt/Makefile.ad
index 87d5613848f7bf6c8dac6ec0e440ba9cd6a2d3cb..c5b3a112bcf1391a79a03c5fd5e1cb0cc92e7e86 100644 (file)
@@ -1,9 +1,9 @@
 #
-#  Makefile.am
+#  Makefile.ad
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 2003 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
@@ -45,7 +45,7 @@ endif
 
 CFLAGS = $(LTFLAGS)
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
 include_HEADERS =      \
        aes.h           \
        blowfish.h      \
@@ -65,9 +65,11 @@ include_HEADERS =    \
        silcrng.h       \
        silcpkcs1.h     \
        twofish.h
-endif
 
-EXTRA_DIST = *.h tests
+SILC_EXTRA_DIST = tests
+#endif SILC_DIST_TOOLKIT
+
+EXTRA_DIST = *.h $(SILC_EXTRA_DIST)
 
 include $(top_srcdir)/Makefile.defines.in
 
similarity index 75%
rename from lib/silcmath/Makefile.am
rename to lib/silcmath/Makefile.ad
index dd96205cf07bc74dce28725029a2f1a0c5f02e11..a65c9d88f9dceb8e777f30e090eb39172868001e 100644 (file)
@@ -1,14 +1,13 @@
 #
-#  Makefile.am
+#  Makefile.ad
 #
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+#  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
@@ -30,14 +29,8 @@ noinst_LTLIBRARIES = libsilcmath.la
 
 if SILC_MP_NSS_MPI
 MP_SOURCE = mp_mpi.c
-if SILC_DIST_TOOLKIT
-MP_HEADER = mpi/mpi.h mpi/mplogic.h mpi/mpi-config.h
-else
-MP_HEADER =
-endif
 else
 MP_SOURCE = mp_gmp.c
-MP_HEADER =
 endif
 
 libsilcmath_la_SOURCES = \
@@ -46,14 +39,15 @@ libsilcmath_la_SOURCES = \
        mpbin.c \
        $(MP_SOURCE)
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
+MP_HEADER = mpi/mpi.h mpi/mplogic.h mpi/mpi-config.h
 include_HEADERS =      \
        mp_gmp.h        \
        mp_mpi.h        \
        silcmath.h      \
        silcmp.h        \
        $(MP_HEADER)
-endif
+#endif SILC_DIST_TOOLKIT
 
 EXTRA_DIST = mp_gmp.c mp_mpi.c *.h
 
similarity index 76%
rename from lib/silcsftp/Makefile.am
rename to lib/silcsftp/Makefile.ad
index 1d0932975eff50b02554022531ef93dfaed0fdab..de35d2ad2494057fec0eb5f28b6c22f2a1c3738e 100644 (file)
@@ -1,14 +1,13 @@
 #
-#  Makefile.am
+#  Makefile.ad
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2001 Pekka Riikonen
+#  Copyright (C) 2001 - 2005 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
@@ -26,12 +25,14 @@ libsilcsftp_la_SOURCES =    \
        sftp_util.c             \
        sftp_fs_memory.c
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
 include_HEADERS =      \
        silcsftp.h      \
        silcsftp_fs.h
-endif
 
-EXTRA_DIST = *.h tests
+SILC_EXTRA_DIST = tests
+#endif SILC_DIST_TOOLKIT
+
+EXTRA_DIST = *.h $(SILC_EXTRA_DIST)
 
 include $(top_srcdir)/Makefile.defines.in
similarity index 87%
rename from lib/silcsim/Makefile.am
rename to lib/silcsim/Makefile.ad
index c4eb761f2d403d710c8a345cbfbbc43e58b00ead..baf8d782081c728dbb2d8666417dcf5b48098996 100644 (file)
@@ -1,14 +1,13 @@
 #
-#  Makefile.am
+#  Makefile.ad
 #
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+#  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
@@ -75,9 +74,9 @@ $(SIM_HASH_OBJS):
 
 CLEANFILES = *.sim.so *.la
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
 include_HEADERS = silcsim.h silcsimutil.h
-endif
+#endif SILC_DIST_TOOLKIT
 
 EXTRA_DIST = *.h
 
similarity index 74%
rename from lib/silcske/Makefile.am
rename to lib/silcske/Makefile.ad
index 0d18470a5cab807f87bc44fb45dee0dc64923e3c..b6cad66559bf0606066546822672eeb95efb2901 100644 (file)
@@ -1,14 +1,13 @@
 #
-#  Makefile.am
+#  Makefile.ad
 #
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+#  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
@@ -25,13 +24,13 @@ libsilcske_la_SOURCES = \
        payload.c \
         groups.c
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
 include_HEADERS =              \
        silcske_groups.h        \
        silcske_payload.h       \
        silcske_status.h        \
        silcske.h
-endif
+#endif SILC_DIST_TOOLKIT
 
 EXTRA_DIST = *.h
 
similarity index 87%
rename from lib/silcutil/Makefile.am
rename to lib/silcutil/Makefile.ad
index 100fcb097d188fb3cc824d96d3c42502ee9725e6..c9ba5f61ffb1a1a2abb83ba1fda97779d27bf487 100644 (file)
@@ -1,9 +1,9 @@
 #
-#  Makefile.am
+#  Makefile.ad
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 - 2004 Pekka Riikonen
+#  Copyright (C) 2000 - 2005 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
@@ -37,13 +37,10 @@ endif
 
 DIST_SUBDIRS=win32 epoc beos os2 unix
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
 SILC_DIST_SOURCE = stacktrace.c
 SILC_DIST_HEADER = stacktrace.h
-else
-SILC_DIST_SOURCE =
-SILC_DIST_HEADER =
-endif
+#endif SILC_DIST_TOOLKIT
 
 noinst_LTLIBRARIES = libsilcutil.la
 
@@ -66,7 +63,7 @@ libsilcutil_la_SOURCES = \
        silcutf8.c      \
        silcstringprep.c
 
-if SILC_DIST_TOOLKIT
+#ifdef SILC_DIST_TOOLKIT
 include_HEADERS =      \
        $(SILC_DIST_HEADER) \
        silcbuffer.h    \
@@ -91,8 +88,10 @@ include_HEADERS =    \
        silcutf8.h      \
        silcstringprep.h        \
        silctypes.h
-endif
 
-EXTRA_DIST = *.h tests
+SILC_EXTRA_DIST = tests
+#endif SILC_DIST_TOOLKIT
+
+EXTRA_DIST = *.h $(SILC_EXTRA_DIST)
 
 include $(top_srcdir)/Makefile.defines.in
index 6c213f7a4b1ce73836b8605457e56dfb383afec3..149e8c9044d9f72045ccc78dd82818507eefb7ee 100644 (file)
@@ -122,7 +122,7 @@ void *silc_memdup(const void *ptr, size_t size);
 #else
 #ifndef SILC_DIST_TOOLKIT
 #error "The stack trace is not supported in this distribution"
-#endif
+#endif /* SILC_DIST_TOOLKIT */
 
 #include "stacktrace.h"
 #endif /* SILC_STACKTRACE */
diff --git a/prepare b/prepare
deleted file mode 100755 (executable)
index a325243..0000000
--- a/prepare
+++ /dev/null
@@ -1,183 +0,0 @@
-#! /bin/sh
-#
-#  prepare
-#
-#  Author: Pekka Riikonen <priikone@silcnet.org>
-#
-#  Copyright (C) 2000 - 2002 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; 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
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-
-#
-# Prepares SILC source tree for configuration and compilation. This is
-# done only after checkout from CVS. This is only for developers of SILC
-# and will never appear in public distribution. When creating distributions
-# this is always run first. After the distribution is created all
-# temporary files (including these prepare* scripts) are removed.
-#
-
-#
-# Usage: ./prepare [<distribution> <package version>]
-#
-# If <package version> is omitted <base version> is used as package
-# version.  The package version appears in the package name and in those
-# distributions that used the SILC_DIST_VERSION_STRING define in the
-# code.  The base version is the SILC_VERSION_STRING define.
-#
-
-#
-# SILC Distribution versions. Set here or give the version on the command
-# line as argument.
-#
-SILC_VERSION=0.9.13                    # Base version
-
-#############################################################################
-
-#############################################################################
-# Functions
-
-#
-# Creates the main configure script from the configure.ad fragments in
-# the source tree.
-#
-# Arguments: ad_make_configure <main_configure_file>
-#
-ad_make_configure()
-{
-  rm -f configure.in
-
-  cfs=`find . -name configure\*\.ad`
-  for i in $cfs
-  do
-    if test "x$i" = "x$1"; then
-      continue
-    fi
-    cat $i >> configure.ad.cfs
-  done
-
-  if test -f configure.ad.cfs; then
-    sed '/AD_INCLUDE_CONFIGURE/ r configure.ad.cfs' $1 > configure.in.tmp
-    sed -e "/AD_INCLUDE_CONFIGURE/s///" configure.in.tmp > configure.in
-    rm -f configure.ad.cfs configure.in.tmp
-  else
-    cp $1 configure.in
-  fi
-}
-
-
-#############################################################################
-
-echo "Preparing SILC source tree for configuration and compilation..."
-
-distribution=$1
-if test "$distribution" = ""; then
-  distribution="toolkit";
-fi
-
-dist_version=$2
-if test "$dist_version" = ""; then
-  dist_version=$SILC_VERSION
-fi
-
-
-echo "Preparing $distribution distribution version $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`
-ed=`grep "$distribution"_EXTRA_DIST= distributions |cut -d=  -f2`
-sed -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`
-  if test "$sub" = ""; then
-    cd $path
-    continue;
-  fi
-  if [ -f Makefile.am.pre ]; then
-    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, 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_DISTRIBUTION_SUBDIRS/s//$subdirs/" -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.in4
-ad_make_configure ./configure.in4
-rm -f configure.in2 configure.in3 configure.in4 am_cond
-
-
-#
-# Prepare the Makefile.defines
-#
-cp Makefile.defines.pre Makefile.defines.in
-cp Makefile.defines_int.pre Makefile.defines_int.in
-cp Makefile.defines.in irssi
-cp Makefile.defines_int.in irssi
-
-aclocal
-autoconf
-autoheader >/dev/null 2>/dev/null
-libtoolize --automake --copy
-automake
-
-file=includes/version_internal.h
-echo "/* Automatically generated by ./prepare */" >$file
-echo "#define SILC_VERSION_STRING \"$dist_version\"" >>$file
-echo "#define SILC_DIST_VERSION_STRING \"$dist_version\"" >>$file
-echo "#define SILC_PROTOCOL_VERSION_STRING \"SILC-1.2-$dist_version $distribution\"" >>$file
-echo "#define SILC_NAME \"SILC $distribution\"" >>$file
-
-# preparing irssi
-echo "Preparing irssi"
-file=irssi/irssi-version.h.in
-touch $file
-cd irssi
-sh autogen.sh 2>/dev/null 1>/dev/null
-cd ..
-version_date=`date +%Y%m%d`
-echo "/* automatically created by autogen.sh */" > $file
-echo "#define IRSSI_VERSION \"$dist_version (Irssi base: @VERSION@ - SILC base: SILC $dist_version)\"" >>$file
-echo "#define IRSSI_VERSION_DATE $version_date" >> $file
-echo "#define IRSSI_VERSION_TIME $version_date" >> $file
-
-echo "Done, now run ./configure and make."
diff --git a/prepare-clean b/prepare-clean
deleted file mode 100755 (executable)
index a07ab1c..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-#! /bin/sh
-#
-#  prepare-clean
-#
-#  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
-#
-#  Copyright (C) 2000 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.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-
-#
-# Removes *all* automatically generated files so that after calling this
-# the tree is completely clean and can be prepared for configuration
-# and compilation by calling ./prepare.
-#
-
-if [ -z "$MAKE" ]; then
-       MAKE=`which gmake`
-       if [ -z "$MAKE" ]; then
-               MAKE=`which make`
-               if [ -z "$MAKE" ]; then
-                       echo "Error, no [g]make in your path."
-                       exit 0
-               fi
-       fi
-fi
-echo "Using $MAKE as a make program..."
-
-echo "Cleaning entire SILC source tree..."
-echo "All errors and warnings may be safely ignored."
-$MAKE clean -k
-$MAKE distclean -k
-rm -f ltcf*
-rm -f Makefile.am
-rm -f Makefile.defines
-rm -f Makefile.defines.in
-rm -f Makefile.defines_int
-rm -f Makefile.defines_int.in
-rm -f acconfig.h
-rm -f irssi/Makefile.defines
-rm -f irssi/Makefile.defines.in
-rm -f irssi/Makefile.defines_int
-rm -f irssi/Makefile.defines_int.in
-rm -f lib/Makefile.am
-rm -f configure.in
-rm -f includes/stamp-*
-rm -f includes/silcconfig.*
-rm -f includes/version_internal.h
-rm -f includes/silcdefs.h.in
-rm -f Makefile.in
-rm -f doc/draft-*.txt
-rm -f doc/Makefile.in
-rm -f includes/Makefile.in
-rm -f lib/Makefile.in
-rm -f lib/contrib/Makefile.in
-rm -f lib/silcclient/Makefile.in
-rm -f lib/silccore/Makefile.in
-rm -f lib/silcutil/Makefile.in
-rm -f lib/silccrypt/Makefile.in
-rm -f lib/silcmath/Makefile.in
-rm -f lib/silcsim/Makefile.in
-rm -f lib/silcsim/modules/Makefile.in
-rm -f lib/silcske/Makefile.in
-rm -rf lib/silcmath/gmp/.deps
-rm -f silcd/Makefile.in silcd/log* silcd/*.log
-rm -f silc/Makefile.in silc/log* silc/*.log
-rm -f aclocal.m4
-rm -f config.status
-rm -f configure
-cd irssi
-rm -f COPYING
-rm -f INSTALL
-rm -f Makefile.in
-rm -f */Makefile.in
-rm -f */*/Makefile.in
-rm -f */*/*/Makefile.in
-rm -f */*/*/*/Makefile.in
-rm -f default-theme.h
-rm -f libtool-shared
-rm -f stamp-*
-rm -f docs/startup*.txt
-cd docs/help
-cp Makefile.am.gen ..
-rm -f * 2>/dev/null
-mv ../Makefile.am.gen .
-cd ../..
-rm -f docs/help/in/Makefile.am
-echo "Done."