updates.
[silc.git] / prepare
diff --git a/prepare b/prepare
index cc6f6d77da33ffe1ba7ff45c6d659458088a8f69..2a749e6e8dbbeb9effb02b7c5a0b97994257838a 100755 (executable)
--- a/prepare
+++ b/prepare
@@ -64,7 +64,7 @@ echo "Preparing $distribution distribution version $version"
 
 #
 # 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
@@ -84,21 +84,36 @@ do
 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
 
 
 #