# _<name>_SUBDIRS_<dir> Subdirs under <dir>
# _<name>_DISTLABEL Preprocessor label
#
+# DISTRBUTIONS=<distributions>
+#
# 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
# 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.
#
# NOTE: For now this supports only one sublevel of the directories.
# Also make sure that the <dir> directory includes Makefile.am.pre
_server_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq dotconf
_server_DISTLABEL=SILC_DIST_SERVER
+DISTRIBUTIONS=toolkit client server
#
# Go though the subdirs and create the Makefile.ams from the
-# Makefile.am.pre files. Create also the acconfig.h for the distribution.
+# Makefile.am.pre files.
#
subdirs=`grep _"$distribution"_SUBDIRS= distributions |cut -d= -f2`
sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$subdirs/" Makefile.am.pre >Makefile.am
done
cd $path
-distlabel=`grep _"$distribution"_DISTLABEL= distributions |cut -d= -f2`
-cp acconfig.h.pre acconfig.h
-echo "#undef $distlabel" >>acconfig.h
-
#
# Replace version string, package name and distribution infos, and create
# the actual configure.in
#
echo "# Automatically generated by ./prepare from configure.in.pre. Do not edit!" >configure.in2
-sed -e "/SILC_VERSION/s//$dist_version/" configure.in.pre >>configure.in2
-sed -e "/SILC_PACKAGE/s//silc-"$distribution"/" configure.in2 >configure.in3
-sed -e "/SILC_DIST_DEFINE/s//$distlabel/" configure.in3 >configure.in4
-sed -e "/SILC_DIST_DEFINE/s//$distlabel/" configure.in4 >configure.in
-rm -f configure.in2 configure.in3 configure.in4
+sed -e "/SILC_VERSION/s//$dist_version/" -e "/SILC_PACKAGE/s//silc-"$distribution"/" configure.in.pre >>configure.in2
+
+#
+# Create also the acconfig.h for the distribution. Note that this sets
+# also dist labels for distributions that are not defined.
+#
+cp acconfig.h.pre acconfig.h
+dists=`grep DISTRIBUTIONS= distributions |cut -d= -f2`
+touch am_cond
+for i in $dists
+do
+ dl=`grep _"$i"_DISTLABEL= distributions |cut -d= -f2`
+ echo "#undef $dl" >>acconfig.h
+ if test "$i" = "$distribution"; then
+ echo "AM_CONDITIONAL($dl, test xtrue = xtrue)" >>am_cond
+ else
+ echo "AM_CONDITIONAL($dl, test xtrue = xfalse)" >>am_cond
+ fi
+done
+
+sed '/SILC_DIST_DEFINE/ r am_cond' configure.in2 >configure.in3
+dl=`grep _"$distribution"_DISTLABEL= distributions |cut -d= -f2`
+sed -e "/SILC_DIST_DEFINE/s//$dl/" configure.in3 >configure.in
+rm -f configure.in2 configure.in3 am_cond
#