summaryrefslogtreecommitdiff
path: root/ace-diff-config.in
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>1999-02-14 21:38:09 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>1999-02-14 21:38:09 +0000
commitd559bf8f4a0f24769fab8053bf35bebdd408feb9 (patch)
tree100e46ca99f69257ecbe700c6a090c55b15b3a40 /ace-diff-config.in
parent5b794ef61f121a0064fa48276875cdf69666a601 (diff)
downloadATCD-d559bf8f4a0f24769fab8053bf35bebdd408feb9.tar.gz
Started to introduce the work done by the ACE Configuration
Project into the official ACE distribution.
Diffstat (limited to 'ace-diff-config.in')
-rw-r--r--ace-diff-config.in192
1 files changed, 192 insertions, 0 deletions
diff --git a/ace-diff-config.in b/ace-diff-config.in
new file mode 100644
index 00000000000..3ac2c46f335
--- /dev/null
+++ b/ace-diff-config.in
@@ -0,0 +1,192 @@
+#!/bin/sh
+
+# -------------------------------------------------------------------------
+# $Id$
+#
+# ace-diff-config script - use to compare ACE macro definitions in
+# ACE configuration headers
+#
+# -------------------------------------------------------------------------
+
+# Copyright (C) 1998 Ossama Othman
+#
+# All Rights Reserved
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the current ACE distribution terms.
+#
+# This library 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.
+
+# This is a script that can be used to determine differences between two ACE
+# configuration headers. The file `ACE.ifnames' contains a list of all of the
+# identifiers used in ACE's preprocessor conditionals (generated with
+# GNU Autoconf's "ifnames" program). The script will go through the list in
+# ACE.ifnames and determine if the given macro was defined in only one of the
+# two headers being headers being compared.
+#
+# The C++ pre-processor is used when comparing so that macros from "#included"
+# headers will also be checked.
+
+set -e
+
+INCLUDES="@top_srcdir@"
+CXXCPP="@CXXCPP@ -I. -I$INCLUDES"
+MACRO_LIST_FILE="ACE.ifnames"
+RESULTS_FILE=ace-diff-config.results
+TEST_FILE="ace-diff-config.test.cpp"
+
+usage()
+{
+ cat <<EOF
+Usage: ace-diff-config HEADER1 HEADER2
+ e.g.: ./ace-diff-config ace/config-linux-lxpthreads.h ace/config.h
+
+EOF
+
+ exit $1
+}
+
+if test $# -eq 0; then
+ usage 1
+fi
+
+if test -f $RESULTS_FILE; then
+ mv $RESULTS_FILE $RESULTS_FILE.bak
+fi
+
+if test -f $1; then
+ :
+else
+ echo "error: $1 does not exist"
+ exit 1
+fi
+
+if test -f $2; then
+ :
+else
+ echo "error: $2 does not exist"
+ exit 1
+fi
+
+# Process the first header
+echo ""
+echo -n "Processing $1 "
+
+echo "Macros that are defined in $1" >> $RESULTS_FILE
+echo "but not in $2" >> $RESULTS_FILE
+echo "-------------------------------------------------------" >> $RESULTS_FILE
+
+list=`cat $MACRO_LIST_FILE`; for p in $list; do
+ # Provide some output
+ echo -n "."
+ cat > $TEST_FILE <<EOF
+
+#include "$1"
+
+#ifdef $p
+DEFINED
+#endif
+
+EOF
+
+ if (eval "$CXXCPP $TEST_FILE") |
+ egrep "DEFINED" >/dev/null; then
+ defined=true
+ else
+ defined=false
+ fi
+
+ # now check if it is defined in header #2
+ if test $defined = true; then
+ cat > $TEST_FILE <<EOF
+
+#include "$2"
+
+#ifdef $p
+DEFINED
+#endif
+
+EOF
+
+ if (eval "$CXXCPP $TEST_FILE") |
+ egrep "DEFINED" >/dev/null; then
+ defined=true
+ else
+ defined=false
+ fi
+
+ # if "defined" is false then, the first header is the only header that
+ # defines the macro.
+ if test $defined = false; then
+ echo $p >> $RESULTS_FILE
+ fi
+ fi
+
+done
+
+
+# Process the second header
+echo ""
+echo -n "Processing $2 "
+
+echo "" >> $RESULTS_FILE
+echo "Macros that are defined in $2" >> $RESULTS_FILE
+echo "but not in $1" >> $RESULTS_FILE
+echo "-------------------------------------------------------" >> $RESULTS_FILE
+
+list=`cat $MACRO_LIST_FILE`; for p in $list; do
+ # Provide some output
+ echo -n "."
+
+ cat > $TEST_FILE <<EOF
+
+#include "$2"
+
+#ifdef $p
+DEFINED
+#endif
+
+EOF
+
+ if (eval "$CXXCPP $TEST_FILE") |
+ egrep "DEFINED" >/dev/null; then
+ defined=true
+ else
+ defined=false
+ fi
+
+ # now check if it is defined in header #1
+ if test $defined = true; then
+ cat > $TEST_FILE <<EOF
+
+#include "$1"
+
+#ifdef $p
+DEFINED
+#endif
+
+EOF
+
+ if (eval "$CXXCPP $TEST_FILE") |
+ egrep "DEFINED" >/dev/null; then
+ defined=true
+ else
+ defined=false
+ fi
+
+ # if "defined" is false then, the second header is the only header that
+ # defines the macro.
+ if test $defined = false; then
+ echo $p >> $RESULTS_FILE
+ fi
+ fi
+
+done
+
+rm $TEST_FILE
+
+echo ""
+echo "Results are in $RESULTS_FILE."
+echo ""