Diffstat (limited to 'mcon/U/d_fast_assert.U')
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
@@ -0,0 +1,85 @@
+?RCS: Copyright (c) 2006, Christian Biere
+?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.
+?MAKE:d_fast_assert: Myread Setvar cat gccversion spackage \
+ sed +ccflags +cc +ldflags +optimize
+?MAKE: -pick add $@ %<
+?S: This variable conditionally defines 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.
+?H:#$d_fast_assert FAST_ASSERTIONS /**/
+: determine whether to enable fast assertions
+echo " "
+case "$d_fast_assert" in
+$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.
+rp='Shall I enable "fast assertions"'
+case "$ans" in
+?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
+ $cat >try.c <<'EOC'
+ return 0;
+ if $cc $ccflags -momit-leaf-frame-pointer $ldflags -o try try.c >/dev/null 2>&1
+ case "$ccflags $optimize" in
+ *-momit-leaf-frame-pointer*) ;;
+ *-O0*) ;;
+ ccflags="-momit-leaf-frame-pointer $ccflags"
+ echo "Added -momit-leaf-frame-pointer to the cc flags." >&4
+ case "$ccflags" in
+ echo "Stripping -momit-leaf-frame-pointer from cc flags." >&4
+ ccflags=`echo $ccflags | $sed 's/ *-momit-leaf-frame-pointer//'`