summaryrefslogtreecommitdiff
path: root/mcon/U/d_fast_assert.U
diff options
context:
space:
mode:
Diffstat (limited to 'mcon/U/d_fast_assert.U')
-rw-r--r--mcon/U/d_fast_assert.U85
1 files changed, 85 insertions, 0 deletions
diff --git a/mcon/U/d_fast_assert.U b/mcon/U/d_fast_assert.U
new file mode 100644
index 0000000..10c60a0
--- /dev/null
+++ b/mcon/U/d_fast_assert.U
@@ -0,0 +1,85 @@
+?RCS: $Id: d_fast_assert.U 167 2013-05-08 17:58:00Z rmanfredi $
+?RCS:
+?RCS: Copyright (c) 2006, Christian Biere
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic License,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic License; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?MAKE:d_fast_assert: Myread Setvar cat gccversion spackage \
+ sed +ccflags +cc +ldflags +optimize
+?MAKE: -pick add $@ %<
+?S:d_fast_assert:
+?S: This variable conditionally defines FAST_ASSERTIONS.
+?S:.
+?C:FAST_ASSERTIONS:
+?C: This symbol, when defined, indicates that the program should make
+?C: use of its own asserting and failure reporting code, instead of
+?C: the one from GLib.
+?C:.
+?H:#$d_fast_assert FAST_ASSERTIONS /**/
+?H:.
+?F:!try.c !try
+?LINT:set d_fast_assert
+?LINT:change ccflags
+: determine whether to enable fast assertions
+echo " "
+case "$d_fast_assert" in
+"$undef")
+ dflt=n;;
+*)
+ dflt=y;;
+esac
+$cat <<EOM
+$spackage contains code called "fast assertions" which are lightweight
+assertions in terms of code space used. They use much less code than
+their GLib counterpart, and therefore should be more efficient.
+
+EOM
+rp='Shall I enable "fast assertions"'
+. ./myread
+case "$ans" in
+y) val="$define";;
+*) val="$undef";;
+esac
+set d_fast_assert
+eval $setvar
+?X: When gcc is used, see whether we can use -momit-leaf-frame-pointer
+?X: This is useful for tail routines containing assertions if they use
+?X: "fast assertions", given that the code is not calling any routine.
+case "$gccversion" in
+'') ;;
+*)
+ case "$d_fast_assert" in
+ "$define")
+ $cat >try.c <<'EOC'
+int main()
+{
+ return 0;
+}
+EOC
+ if $cc $ccflags -momit-leaf-frame-pointer $ldflags -o try try.c >/dev/null 2>&1
+ then
+ case "$ccflags $optimize" in
+ *-momit-leaf-frame-pointer*) ;;
+ *-O0*) ;;
+ *-O*)
+ ccflags="-momit-leaf-frame-pointer $ccflags"
+ echo "Added -momit-leaf-frame-pointer to the cc flags." >&4
+ ;;
+ esac
+ else
+ case "$ccflags" in
+ *-momit-leaf-frame-pointer*)
+ echo "Stripping -momit-leaf-frame-pointer from cc flags." >&4
+ ccflags=`echo $ccflags | $sed 's/ *-momit-leaf-frame-pointer//'`
+ ;;
+ esac
+ fi
+ ;;
+ esac
+;;
+esac
+