summaryrefslogtreecommitdiff
path: root/libmudflap
diff options
context:
space:
mode:
Diffstat (limited to 'libmudflap')
-rw-r--r--libmudflap/ChangeLog957
-rw-r--r--libmudflap/Makefile.am388
-rw-r--r--libmudflap/Makefile.in918
-rw-r--r--libmudflap/acinclude.m4928
-rw-r--r--libmudflap/aclocal.m41066
-rw-r--r--libmudflap/config.h.in62
-rwxr-xr-xlibmudflap/configure3218
-rw-r--r--libmudflap/configure.in137
-rw-r--r--libmudflap/mf-heuristics.c174
-rw-r--r--libmudflap/mf-hooks1.c478
-rw-r--r--libmudflap/mf-hooks2.c1767
-rw-r--r--libmudflap/mf-hooks3.c573
-rw-r--r--libmudflap/mf-impl.h389
-rw-r--r--libmudflap/mf-runtime.c2431
-rw-r--r--libmudflap/mf-runtime.h.in191
-rw-r--r--libmudflap/stamp-h.in0
-rw-r--r--libmudflap/testsuite/Makefile.am18
-rw-r--r--libmudflap/testsuite/Makefile.in249
-rw-r--r--libmudflap/testsuite/config/default.exp2
-rw-r--r--libmudflap/testsuite/lib/libmudflap.exp237
-rw-r--r--libmudflap/testsuite/lib/mfdg.exp377
-rw-r--r--libmudflap/testsuite/libmudflap.c++/c++frags.exp16
-rw-r--r--libmudflap/testsuite/libmudflap.c++/fail24-frag.cxx16
-rw-r--r--libmudflap/testsuite/libmudflap.c++/pass27-frag.cxx12
-rw-r--r--libmudflap/testsuite/libmudflap.c++/pass28-frag.cxx20
-rw-r--r--libmudflap/testsuite/libmudflap.c++/pass31-frag.cxx12
-rw-r--r--libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx10
-rw-r--r--libmudflap/testsuite/libmudflap.c/cfrags.exp15
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail1-frag.c13
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail10-frag.c16
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail11-frag.c19
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail12-frag.c19
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail13-frag.c26
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail14-frag.c29
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail15-frag.c27
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail16-frag.c26
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail17-frag.c18
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail18-frag.c16
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail19-frag.c18
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail2-frag.c13
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail20-frag.c13
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail21-frag.c18
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail22-frag.c17
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail23-frag.c16
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail25-frag.c18
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail26-frag.c24
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail27-frag.c24
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail28-frag.c18
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail29-frag.c17
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail3-frag.c13
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail30-frag.c18
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail31-frag.c22
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail4-frag.c13
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail5-frag.c14
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail6-frag.c17
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail7-frag.c17
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail8-frag.c19
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail9-frag.c21
-rw-r--r--libmudflap/testsuite/libmudflap.c/hook-allocstuff.c16
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass-stratcliff.c319
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass1-frag.c9
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass10-frag.c12
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass11-frag.c15
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass12-frag.c15
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass13-frag.c17
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass14-frag.c20
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass15-frag.c23
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass16-frag.c22
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass17-frag.c9
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass18-frag.c27
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass19-frag.c11
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass2-frag.c9
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass20-frag.c13
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass21-frag.c15
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass22-frag.c23
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass23-frag.c29
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass24-frag.c18
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass25-frag.c15
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass26-frag.c52
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass29-frag.c15
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass3-frag.c9
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass30-frag.c12
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass32-frag.c18
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass33-frag.c17
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass34-frag.c18
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass35-frag.c14
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass36-frag.c15
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass38-frag.c9
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass4-frag.c9
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass42-frag.c17
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass43-frag.c11
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass44-frag.c14
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass45-frag.c31
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass46-frag.c18
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass5-frag.c11
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass6-frag.c14
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass7-frag.c13
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass8-frag.c16
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass9-frag.c16
-rw-r--r--libmudflap/testsuite/libmudflap.cth/cthfrags.exp23
-rw-r--r--libmudflap/testsuite/libmudflap.cth/pass37-frag.c58
-rw-r--r--libmudflap/testsuite/libmudflap.cth/pass39-frag.c57
-rw-r--r--libmudflap/testsuite/libmudflap.cth/pass40-frag.c59
103 files changed, 16403 insertions, 0 deletions
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog
new file mode 100644
index 00000000000..eafa5eb3e57
--- /dev/null
+++ b/libmudflap/ChangeLog
@@ -0,0 +1,957 @@
+2004-03-25 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-impl.h: Added libgcc license header.
+
+2004-03-20 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks[123].c, mf-runtime.c, mf-heuristics.c:
+ Added libgcc license header.
+ * mf-hooks3.c (__mf_0fn_pthread_create): Correct arg constness.
+ (pthread_create): Simplify stack allocation syntax.
+
+2004-03-08 Loren J. Rittle <ljrittle@acm.org>
+
+ * mf-hooks2.c: Support FreeBSD.
+ (WRAP_gets): Avoid gets().
+ * testsuite/libmudflap.c/pass-stratcliff.c: Do not
+ test unimplemented mem/str calls on FreeBSD.
+ * testsuite/libmudflap.c/pass21-frag.c: Do not include
+ <alloca.h> on FreeBSD.
+
+2004-01-30 Frank Ch. Eigler <fche@redhat.com>
+
+ * testsuite/libmudflap.c/pass36-frag.c: Add missing free() call.
+ * testsuite/libmudflap.c/pass46-frag.c: New test for -fmudflapir.
+ * testsuite/libmudflap.cth/cthfrags.exp: Add -DSTATIC to compiler
+ flags for static linking permutation.
+ * testsuite/libmudflap.cth/pass40-frag.c: When -DSTATIC, avoid
+ some pthreads code that croaks on linux glibc tls.
+
+2004-01-27 Frank Ch. Eigler <fche@redhat.com>
+
+ * testsuite/libmudflap.c/fail31-frag.c, pass45-frag.c: New tests.
+
+2004-01-15 Frank Ch. Eigler <fche@redhat.com>
+
+ * testsuite/libmudflap.c/pass44-frag.c: New test.
+
+2004-01-12 Frank Ch. Eigler <fche@redhat.com>
+
+ * testsuite/libmudflap.c/fail{28,29,30}-frag.c: New tests.
+
+2004-01-08 Frank Ch. Eigler <fche@redhat.com>
+
+ * testsuite/libmudflap.c/pass43-frag.c: Added missing program rc.
+
+2003-12-11 Frank Ch. Eigler <fche@redhat.com>
+
+ * testsuite/libmudflap.c/pass42-frag.c, pass43-frag.c: New tests.
+
+2003-12-08 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libmudflap/12670
+ * configure.in: Add check for see if
+ socklen_t typedef is in sys/socket.h.
+ * mf-hooks1.c: Add define if socklen_t
+ is not typedef.
+ * mf-hooks2.c: Likewise.
+ * mf-hooks3.c: Likewise.
+ * config.h.in: Regen.
+ * configure: Regen.
+
+2003-12-08 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-runtime.c (__mf_watch_or_not): Tweak tracing message.
+ * testsuite/libmudflap.c/fail21-frag.c: Defeat aliasing
+ optimizations.
+ * testsuite/libmudflap.c/pass25-frag.c: Ditto.
+ * testsuite/libmudflap.c/pass26-frag.c: Tolerate non-overlapping
+ (unoptimized) allocation of stack space.
+
+2003-12-07 Richard Henderson <rth@redhat.com>
+
+ * testsuite/libmudflap.c/fail23-frag.c (main): Adjust addend to 11.
+ * testsuite/libmudflap.c/fail27-frag.c (foo): Mark noinline.
+
+2003-12-06 Andrew Pinski <apinski@apple.com>
+
+ partial PR libmudflap/12670
+ * mf-hooks1.c: Respect Darwin checks. Conditionalize POSIX_SOURCE.
+ * mf-hooks2.c: Likewise.
+ * mf-hooks3.c: Likewise.
+
+2003-11-19 Frank Ch. Eigler <fche@redhat.com>
+
+ libstdc++/11696
+ * mf-runtime.h.in: Switch to #pragma redefine_extname for
+ symbols interposed at compile time.
+ * testsuite/libmudflap.c++/pass41-frag.cxx: New test.
+
+ libmudflap/12939
+ * mf-hooks2.c (semctl): Tolerate FreeBSD.
+
+ * configure.in: Reorganize check for <pthread.h>.
+ * configure: Regenerated.
+
+2003-11-04 David Edelsohn <edelsohn@gnu.org>
+
+ * mf-runtime.c (_ALL_SOURCE): Define for AIX.
+ (_LARGE_FILE_API): Define for AIX.
+ * mf-hooks[123]: Same.
+ (_XOPEN_SOURCE_EXTENDED): Define to 1 for AIX.
+
+2003-10-21 David Edelsohn <edelsohn@gnu.org>
+
+ * mf-runtime.c (_XOPEN_SOURCE_EXTENDED): Define to 1 for AIX.
+
+2003-07-29 Frank Ch. Eigler <fche@redhat.com>
+
+ 2003-07-29 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
+
+ * configure.in: Update check for union semun.
+
+2003-07-29 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
+
+ PR other/11673
+ * mf-hooks2.c [WRAP_semctl]: Fix check for HAVE_UNION_SEMUN.
+
+2003-07-29 Frank Ch. Eigler <fche@redhat.com>
+
+ PR other/11673
+ * configure.in: Add checks for 64-bit LFS functions, struct semun
+ definition, for BSD compatibility.
+ * mf-hooks1.c: Respect BSD checks. Conditionalize POSIX_SOURCE.
+ * mf-hooks2.c: Ditto. Include <strings.h> for bcmp* decls.
+ * mf-hooks3.c: Ditto.
+ (pthread_create): Try MAP_ANON on platforms without the MAP_ANONYMOUS
+ mmap flag.
+ * configure, config.h.in: Regenerated.
+
+2003-07-23 Frank Ch. Eigler <fche@redhat.com>
+
+ Multithreading fixes:
+ * mf-runtime.c (__mf_object): Store allocating/deallocating
+ thread id.
+ (options): Support new "-thread-stack" option.
+ Rename "-heur-argv-environ" option to "-heur-stdlib".
+ Disable "-lc-mask" and "-lc-shift" options.
+ (__mf_dynamic): Add function pointers for pthread_join/_exit.
+ (__assert_fail): New self-contained function for glibc.
+ * mf-hooks3.c: Essentially rewritten, particularly related to
+ use of __mf_pthread_info array.
+ (pthread_join, _exit): New hook functions.
+ * mf-impl.h (BEGIN_PROTECT): Handle starting_p case.
+ * testsuite/libmudflap.cth/pass40-frag.c: New test.
+
+ Warning cleanups:
+ * mf-heuristics.c: Add type casts for tracing, sub calls.
+ * mf-impl.h (BEGIN_PROTECT): Redefine to omit result type.
+ Update all callers to declare explicit result holder.
+ (END_PROTECT): Removed.
+ * testsuite/*/*frags.exp: Clean up default MUDFLAP_OPTIONS.
+
+2003-07-15 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libmudflap.c/fail21-frag.c: Add volatile modifiers.
+ * testsuite/libmudflap.c/fail15-frag.c: Likewise.
+ * testsuite/libmudflap.c/fail13-frag.c: Likewise.
+
+2003-07-04 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks1.c, 2.c, 3.c: New file, splits up content from old ...
+ * mf-hooks: Removed.
+ * mf-impl.h (MF_VALIDATE_EXTENT, BEGIN_PROTECT, END_PROTECT):
+ Move these macros from old mf-hooks.c here.
+ * Makefile.am: Adapt to split-up hook sources for faster builds.
+ * Makefile.in: Regenerated.
+
+ * mf-heuristics.c: Remove #if-0 block.
+
+ * mf-impl.h (__mf_state): Reorganize declaration and implementation.
+ (__mf_starting_p): New state only for use while dlsym bootstrapping.
+ (CALL_REAL, __mf_init): Corresponding changes.
+ (TRACE, VERBOSE_TRACE): Include thread id and "mf:" prefix. Update
+ all callers to remove redundant "mf:" prefix.
+ * mf-runtime.h.in: #define a few reentrancy macros for libmudflapth.
+ * mf-hooks3.c: Rewrite chunks to support per-thread __mf_state value.
+ (__mf_pthread_info): Become a hash table.
+
+ * testsuite/lib/mfdg.exp: Support new "dg-timeout" and
+ "dg-repetitions" directives to control test case execution.
+ * testsuite/libmudflap.cth/pass37-frag.c: Add timeout and repeat
+ options.
+ * testsuite/libmudflap.cth/pass39-frag.c: Ditto for this new test.
+
+2003-06-25 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks.c (alloca): Separate into stub.
+ (__mf_wrap_alloca_indirect): New function. Use CALL_REAL
+ malloc/free for alloca blocks.
+ (pthread_create): Tolerate failing pthread_attr_get* calls.
+ * mf-runtime.c (__mf_fini): Call __mf_wrap_alloca_indirect.
+ * mf-impl.h (CALL_WRAP): Remove macro.
+ * testsuite/libmudflap.c/pass21-frag.c: Include <alloca.h>.
+ * testsuite/libmudflap.c/pass23-frag.c: Include more struct
+ padding for ia64 BIT_FIELD_REF constructs.
+
+2003-06-19 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks.c (struct pthread_info): Add "thread_errno" field.
+ (__mf_pthread_spawner, __mf_pthread_cleanup): Use it with GUESS
+ libmudflap object type.
+ * mf-runtime.c (__mfu_unregister): Correct cemetary logic to avoid
+ crashes on unregistering STATIC objects.
+
+2003-06-17 Frank Ch. Eigler <fche@redhat.com>
+
+ Based on patch from Eyal Lebedinsky <eyal@eyal.emu.id.au>:
+ * mf-hooks.c (__mf_pthread_spawner): Register thread errno.
+ (time, strerror, fopen, fopen64, fclose, fread): New hooks.
+ (fwrite, fgetc, fgets, getc, gets, ungetc, fputc): New hooks.
+ (fputs, putc, puts, clearerr, feof, ferror, fileno): New hooks.
+ (printf, fprintf, sprintf, snprintf, vprintf, vfprintf): New hooks.
+ (vsprintf, vsnprintf, access, remove, fflush, fseek): New hooks.
+ (fseeko64, ftell, ftello64, rewind, fgetpos, fsetpos): New hooks.
+ (stat, stat64, fstat, lstat, mkfifo, setvbuf, setbuf): New hooks.
+ (setvbuf, opendir, closedir, readdir, recv, recvfrom): New hooks.
+ (recvmsg, send, sendto, sendmsg, setsockopt, getsockopt): New hooks.
+ (accept, bind, connect, gethostname, sethostname): New hooks.
+ (gethostbyname, wait, waitpid, popen, pclose, execve): New hooks.
+ (execv, execvp, system, dlopen, dlclose, dlerror, dlsym): New hooks.
+ (semop, semctl, shmctl, shmat, shmdt): New hooks.
+ * mf-runtime.h.in: Corresponding changes.
+ * mf-runtime.c (__mf_ini): Register stdio objects. Use STATIC type.
+ (opts) Rename heur_argv_environ to heur_std_data.
+ (__mf_wrap_main): Use STATIC type for argv/environ strings.
+ * Makefile.am: Corresponding changes.
+ * Makefile.in: Regenerated.
+
+2003-06-11 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-heuristics.c (__mf_heuristic_check): Disable stack_bounds
+ heuristic for threaded case, and for non-x86-linux targets.
+ * mf-hooks.c (__mf_0fn_calloc): Provide a working dummy implementation
+ for use during pre-main() program startup.
+ (__mf_0fn_*): Make these functions non-static.
+ * mf-impl.h (DECLARE, CALL_REAL): Support calls to 0fn backup hook
+ functions.
+ * mf-runtime.c (__mf_state): Set initial state to "starting".
+ (__mf_resolve_single_dynamic): Tolerate repeated calls for same symbol.
+ (__wrap_main): New function to register argv[] and environ[] strings.
+ (__mf_ini): Call it.
+ (*): In all trace functions, use "%p" as formatter for uintptr_t.
+
+ * testsuite/libmudflap.c/pass38-frag.c: New test case.
+ * testsuite/libmudflap.cth/pass37-frag.c: Improved test.
+
+ * acinclude.m4: Add comments with aoliva's concerns about x86_64
+ pass_all.
+ * aclocal.m4, configure: Regenerated.
+
+2003-06-04 Frank Ch. Eigler <fche@redhat.com>
+
+ * acinclude.m4: Correct typo in AC_MSG_CHECKING.
+ * aclocal.m4, configure: Regenerated.
+
+2003-06-03 Frank Ch. Eigler <fche@redhat.com>
+
+ * acinclude.m4: Force "pass_all" deplibs_check_method for libtool
+ for x86_64 target. Disable caching for this value.
+ * aclocal.m4, configure: Regenerated.
+
+2003-06-02 Frank Ch. Eigler <fche@redhat.com>
+
+ * testsuite/libmudflap.c/pass38-frag.c: Deleted. -fwritable-strings
+ is about to become deprecated, and its present handling bugs are
+ unworthy of fixing.
+
+2003-05-30 Frank Ch. Eigler <fche@redhat.com>
+
+ * testsuite/libmudflap.c/pass38-frag.c: New test for
+ -fwritable-strings.
+
+2003-05-23 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-runtime.c (__mf_sigusr1_handle): Call unlocked variant of
+ __mf_report, asserting reentrant calling context.
+
+2003-05-23 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks.c (realloc): Correct reentrancy logic.
+ * testsuite/libmudflap.c/hook-allocstuff.c: New test case.
+
+2003-05-20 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks.c (LIBMUDFLAPTH_THREADS_MAX): New macro, replaces
+ PTHREAD_THREADS_MAX. Update users.
+ * mf-runtime.c (__mf_usage): Print [active] instead of [default]
+ for active options.
+ * testsuite/Makefile.am (all-local): Prime dejagnu site.exp file
+ with libmudflapth presence indicator.
+ * testsuite/Makefile.in: Regenerated.
+
+2003-05-16 Frank Ch. Eigler <fche@redhat.com>
+
+ * Makefile.am (AM_CFLAGS): Remove "-ansi".
+ * configure.in: Remove silly no-pthreads => no-shared logic.
+ * Makefile.in, configure: Regenerated.
+ * mf-heuristics.c (__mf_heuristic_check): Remove reentrancy hacks.
+ * mf-hooks.c (BEGIN_PROTECT, END_PROTECT): Reorganize reentrancy
+ code. Count reentrancy events.
+ (all hook functions): Don't directly manipulate __mf_state variable.
+ Add TRACE calls to hook functions without them.
+ * mf-impl.h (LOCKTH): Try to count lock contention events.
+ (VERBOSE_TRACE, TRACE): Remove reentrancy hacks.
+ * mf-runtime.c (BEGIN_RECURSION_PROTECT, END_RECURSION_PROTECT):
+ Reorganize reentrancy code.
+ (external __mf_ entry points): Use RECURSION_PROTECT mechanism to
+ identify reentrancy with mutex holding times.
+ (internal __mfu_ entry points): Remove internal reentrancy code.
+ (__mf_init): Use ordinary locked calls.
+ (__mfu_report): Print the two new counts.
+ * testsuite/lib/libmudflap.exp: Filter out junk ld/pthreads messages.
+ * testsuite/libmudfap.cth/cthfrags.exp: New test driver.
+ * testsuite/libmudflap.cth/pass37-frag.c: New pthreads test.
+ * testsuite/libmudfap.cth/cfrags.exp: Adapt to new libmudflap
+ option defaults.
+
+2003-05-09 Frank Ch. Eigler <fche@redhat.com>
+
+ * configure.in: Add pthread support, plus glibc and porting hacks.
+ * Makefile.am (LIBMUDFLAPTH): New conditional, to build -lmudflapth
+ from objects built into ./pth/.
+ * mf-runtime.c (__mfu_watch,register,...): Fork new unlocked
+ functions for internal entry points. Update callers to pick
+ locked vs. unlocked variants.
+ (__mf_resolve_single_dynamic): Extend to support symbol versioning
+ info coming in from a static data structure.
+ (*): Reorder miscellaneous declarations to group data vs functions.
+ (__mf_set_default_options): Simplify.
+ (__mf_usage): Mention threading status of host executable.
+ * mf-impl.h: Move max/min decls here. Reorganize __mf_dynamic
+ decls to match above.
+ (LOCKTH, UNLOCKTH): New macros for Big Libmudflap Lock management.
+ * mf-heuristics.c: Choose between locked/unlocked calls. Add
+ some lock/unlock markers. Remove some unused code.
+ * mf-hooks: Ditto.
+ (pthread_create): New hook function.
+ (__mf_pthread_cleanup, _spawner): New helper functions.
+ * configure. aclocal.m4, config.h.in, Makefile.in: Regenerated.
+
+2003-05-02 Frank Ch. Eigler <fche@redhat.com>
+
+ * testsuite/libmudflap.c/fail27-frag.c: Add more volatile flags.
+
+2002-04-28 Frank Ch. Eigler <fche@redhat.com>
+
+ * Makefile.am (HOOKOBJS): Add *time related hooks.
+ * configure.in: Look for pthreads.h header.
+ * mf-hooks.c (asctime, ctime, gmtime, localtime): New wrappers.
+ * mf-runtime.c: Begin sketching some pthreads support.
+ (__mf_usage): Check for -lpthread presence.
+ (__mf_unregister): Confirm matching unregistration base.
+ (__mf_find_objects_rec): Reduce unnecessary recursion.
+ * mf-runtime.h.in: Add "nothrow" attribute to functions. Add
+ #defines for new hook functions.
+ * mf-impl.h: Corresponding changes.
+ * config.h.in, configure, Makefile.in: Regenerated.
+
+2002-04-27 Diego Novillo <dnovillo@redhat.com>
+
+ * testsuite/libmudflap.c/fail1-frag.c: Add volatile
+ modifiers to prevent being optimized away.
+ * testsuite/libmudflap.c/fail10-frag.c: Likewise.
+ * testsuite/libmudflap.c/fail13-frag.c: Likewise.
+ * testsuite/libmudflap.c/fail14-frag.c: Likewise.
+ * testsuite/libmudflap.c/fail15-frag.c: Likewise.
+ * testsuite/libmudflap.c/fail2-frag.c: Likewise.
+ * testsuite/libmudflap.c/fail20-frag.c: Likewise.
+ * testsuite/libmudflap.c/fail3-frag.c: Likewise.
+
+2003-04-15 Frank Ch. Eigler <fche@redhat.com>
+
+ * Makefile.am (libmudflap_la_LIBADD): Remove -ldl.
+ * configure.in: Look for uintptr_t and -ldl on target.
+ * mf-runtime.h.in: Adjust uintptr_t declaration logic.
+ * Makefile.in, aclocal.m4, configure, config.h.in: Regenerated.
+ * testsuite/Makefile.in: Regenerated.
+ * mf-runtime.c (__mf_sigusr1_respond): Tweak declaration and calls
+ for better C compliance.
+
+2003-04-15 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks.c (MF_VALIDATE_EXTENT): Remove unnecessary reentrancy
+ prevention code.
+ * mf-runtime.c (__mf_set_default_options): Turn off
+ check-initialization.
+ (__mf_describe_object): Shorten description.
+ * testsuite/libmudflap.c/fail25-frag.c: Turn on check-initialization.
+
+2003-04-07 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks.c (__mf_0fn_mmap): Correct return value, as per <rth>.
+
+2003-04-02 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks.c (BEGIN_PROTECT): Handle startup-time reentrant
+ calls specially.
+ (__mf_0fn_malloc ... _munmap): New dummy backup calls.
+ * mf-impl.h (CALL_BACKUP): New macros.
+ * mf-runtime.c (__mf_init): Tweak __mf_state during startup.
+
+2003-03-31 Frank Ch. Eigler <fche@redhat.com>
+
+ * Makefile.am (AM_CFLAGS): Remove optimization flags.
+ (HOOKOBJS): Remove dlopen hook.
+ (libmudflap_la_LIBADD): Add -ldl.
+ * mf-hooks.c (dlopen): Remove hook.
+ * mf-impl.h (__mf_dynamic): Ditto.
+ * mf-runtime.c (__mf_resolve_dynamics): Ditto.
+ * Makefile.in: Regenerated.
+
+2003-03-28 Frank Ch. Eigler <fche@redhat.com>
+
+ * configure.in: Check for target gettimeofday, signal, some headers.
+ * mf-impl.h (__mf_opts): Add new "sigusr1_report" field. Comment
+ out inop multi_threaded field.
+ * mf-runtime.c (options): Handle new "-sigusr1-report" option.
+ (__mf_set_options): Correct handling of "-help".
+ (__mf_sigusr1_respond): New function to manage SIGUSR1 response.
+ (__mf_check, __mf_register, __mf_unregister): Call it.
+ (__mf_insert_new_object, __mf_unregister): Respect HAVE_GETTIMEOFDAY.
+ (__mf_report_leaks): Make callable
+ (__mf_tree_analyze): Traverse in-order. Accumulate address bit
+ distribution statistics.
+ (__mf_adapt_cache): Rewrite shift guessing logic based on address
+ bit distributions.
+ * config.h.in, configure: Regenerated.
+ * testsuite/libmudflap.c/fail27-frag.c: New test.
+ * testsuite/libmudflap.c/pass36-frag.c: New test.
+
+2003-03-11 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-runtime.h.in: Tweak.
+ * Makefile.am, configure.in: Tweak mf-runtime.h generation some more.
+ Don't use intermediate files nor AC_OUTPUT-time postprocessing.
+ * Makefile.in, testsuite/Makefile.in, configure: Regenerated.
+
+2003-03-10 Frank Ch. Eigler <fche@redhat.com>
+
+ * configure.in: Tweak generation of mf-runtime.h some more. It
+ needs to work from both config.status and configure.
+ * configure: Regenerated.
+
+2003-03-10 Frank Ch. Eigler <fche@redhat.com>
+
+ * Makefile.am: Reorganize hook file building. Add auto dependencies.
+ * configure.in: Tweak generation of mf-runtime.h.
+ * mf-runtime.h.in: Add new __MF_TYPE_HEAP_I.
+ * mf-hooks.c (*): Adapt to initialized-heap object type.
+ * mf-impl.h: Tweak cemetary boundaries.
+ * mf-runtime.c (__mf_check): Adapt to new initialized-heap object
+ type.
+ (__mf_insert_new_object, __mf_register, __mf_unregister): Ditto.
+ (__mf_describe_object, __mf_report_leaks, __mf_violation): Ditto.
+ * testsuite/lib/libmudflap.exp (includes): Include build tree.
+ * testsuite/libmudflap.c/pass{26,5}: Further adapt to initialization
+ checking.
+ * testsuite/.../fail{25,26}-frag.c: New tests.
+ * testsuite/.../pass{32,33,34,35}-frag.c: New tests.
+ * Makefile.in, configure: Regenerated.
+
+2003-03-05 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-runtime.c (__mf_set_default_options): Turn on initialization
+ checking by default.
+ (__mf_insert_new_object): As a temporary hack, assume that new
+ objects registered on the stack start out initialized.
+ * testsuite/libmudflap.c/fail9,pass23,pass[6789]-*: Initialize
+ heap objects by hand.
+
+2003-03-05 Frank Ch. Eigler <fche@redhat.com>
+
+ Switch to macro-style hooks for str*/mem*/b* functions.
+ * mf-runtime.h.in (__MF_TYPE_*): Moved some internal values out.
+ (mem*, str*, b*): Added macro-style hooks for _MUDFLAP case.
+ * mf-runtime.c: #include config.h to enable glibc backtraces again.
+ (__mf_set_default_options): Turn off heur_proc_map.
+ (*): Adapt to to macro-style hook functions.
+ (__mf_object_dead_head, __mf_object_cemetary): Correct bounds.
+ (__mf_check, __mf_register, __mf_unregister): Tweak tracing message.
+ (__mf_violation): Handle __MF_VIOL_WATCH.
+ * mf-impl.h (__MF_TYPE_*): Moved these internal values here.
+ (__mf_dynamic): Removed mem*/str*/b* functions.
+ (TRACE, VERBOSE_TRACE): Add reentrancy locking.
+ (WRAPPER2): New macro for macro-style hooks.
+ * mf-hooks.c: Convert mem*/str*/b* functions to simpler
+ macro-style hooks.
+ (BEGIN_PROTECT): Tweak tracing vs reentrancy-lock ordering.
+ * mf-heuristics.c: Adapt to macro-style hook functions.
+ Correct some comments.
+ * testsuite/lib/mfdg.exp (dg-test): Simplify result string for
+ output pattern tests.
+ * testsuite/libmudflap.c/fail[89]-frag.c: Elaborate output test.
+ * testsuite/libmudflap.c++/c++frags.exp: Enable non-static tests.
+
+2003-02-28 Frank Ch. Eigler <fche@redhat.com>
+
+ * testsuite/libmudflap.c/fail23-frag.c, pass30-frag.c: New tests
+ for global array registration.
+ * testsuite/libmudflap.c++/fail24-frag.cxx, pass31-frag.cxx: Ditto.
+ * testsuite/libmudflap.c++/c++frags.exp: Tweak -static multilib hack.
+
+2003-02-27 Frank Ch. Eigler <fche@redhat.com>
+
+ * Makefile.am: Add gross make bug workarounds. Tweaked
+ SUBDIRS and AM_CFLAGS.
+ * Makefile.in: Regenerated.
+
+2003-02-26 Frank Ch. Eigler <fche@redhat.com>
+
+ Switch to dejagnu.
+ * configure.in (AC_PROG_CXX): Don't look for C++ any more.
+ * Makefile.am (TESTS): Remove simple automake testing.
+ * configure, Makefile.in: Regenerated.
+ (SUBDIRS): Include new testsuite/ directory.
+ * tests/*: Removed all files; moved bulk under:
+ * testsuite/*: New subdirectory tree.
+ * testsuite/libmudflap.c/cfrags.exp: New file, C test driver.
+ * testsuite/libmudflap.c++/c++frags.exp: New file, C++ test driver.
+ * testsuite/lib/libmudflap.exp: New file, derived from libstdc++.
+ * testsuite/lib/mfdg.exp: New file, derived from dejagnu.
+ * testsuite/config/default.exp: New file.
+ * testsuite/Makefile.am, Makefile.in: New files.
+
+2003-01-29 Frank Ch. Eigler <fche@redhat.com>
+
+ * Makefile.am (TESTS_ENVIRONMENT): Remove redundant "-mode-check".
+ (TESTS): Add fail22 and pass29 tests.
+ * mf-runtime.h.in: Change API to take void*/size_t region parameters.
+ Add new access-type parameter for __mf_check. Move __MF_VIOL* out.
+ * mf-impl.h: Corresponding changes. Update CLAMP* macros for void*
+ values. Move __MF_VIOL* here.
+ * mf-runtime.c (*): Adapt to void*/size_t API in mf-runtime.h.
+ (check_initialization): New field in __mf_opts. Default off.
+ (read_count,write_count): New fields in __mf_object.
+ (__mf_check): Implement basic initialization checking.
+ (__mf_insert_new_object): Assume STATIC|GUESS regions are initialized.
+ (__mf_describe_object): Print new fields.
+ (__mf_violation): Identify check/read vs. check/write in messages.
+ * test/pass29-frag.c, test/fail22-frag.c: Basic tests for new
+ "-check-initialized" mudflap option.
+ * test/pass25-frag.c, test/fail21-frag.c: Adapt to API changes.
+ * mf-hooks.c (MF_VALIDATE_EXTENT): Add new access-type parameter.
+ Drop __FILE__/__LINE__ hack. Update callers.
+ (*): Adapt to new mf-runtime.h API.
+ * Makefile.in: regenerated.
+
+2003-01-24 Frank Ch. Eigler <fche@redhat.com>
+
+ * configure.in: Build mf-runtime.h a more proper way.
+ * mf-hooks.c (strdup, strndup): Correct reentrancy logic.
+ * mf-runtime.c (verbose_violations): Turn on by default.
+ * mf-runtime.h.in: Remove some miscellaneous stuff ...
+ * mf-impl.h: ... and move it here.
+ * configure: Regenerated.
+
+2003-01-22 Frank Ch. Eigler <fche@redhat.com>
+
+ * configure.in: Look for C++ compiler.
+ * test/*-frag.c, mf-driver.c: Reformatted with GNU indent and
+ fixed type warnings when built with C++.
+ * test/pass27-frag.cxx, pass28-frag.cxx: New C++ tests.
+ * Makefile.am (TESTS): Run them.
+ (*) Add new rules for building and running C++ tests.
+ (TESTFLAGS): Set new default to avoid libstdc++-v3 shlib issues.
+ * mf-runtime.h.in: Protect with extern "C".
+ * Makefile, configure: Regenerated.
+
+2003-01-06 Frank Ch. Eigler <fche@redhat.com>
+
+ Portability improvements.
+ * configure.in: Look for glibc backtrace headers/functions.
+ * mf-hooks.c: Don't include <execinfo.h> any more.
+ * mf-runtime.c (__mf_set_options): Call more stdlib functions
+ via CALL_REAL.
+ (__mf_backtrace): Provide alternate baby implementation in
+ absence of glibc.
+ * test/mf-driver.c: Portability tweaks.
+ * acinclude.m4: New file, containing top level libtool.m4.
+ * aclocal.m4, configure, Makefile.in, config.h.in: Regenerated.
+
+2002-12-19 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-runtime.h.in (HAVE_UINTPTR_T): Define unconditionally.
+
+2002-11-08 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-runtime.c (options): Add new "wipe-heap", "wipe-stack"
+ options.
+ (__mf_unregister): Implement stack/heap object wiping.
+ (__mf_set_options): Renamed from __mf_process_opts.
+ (__mf_uncache_object): Change arg type, correct callers.
+ * mf-impl.h: Corresponding changes.
+ * mf-hooks.c (realloc): Save/restore heap-wiping flag.
+ * mf-runtime.h.in (__mf_set_options): Extend public API.
+ * test/pass26-frag.c: New test for stack wiping.
+ * Makefile.am (TESTS): Run it.
+ * Makefile.in: Regenerated.
+
+2002-11-07 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-runtime.h.in (__mf_watch, __mf_unwatch): Extend public API.
+ * mf-runtime.c (__mf_object_t): Add watching_p field.
+ (__mf_watch_or_not): New function to implement
+ object watch flagging.
+ (__mf_watch, __mf_unwatch): New wrappers for above.
+ (__mf_check, __mf_describe_object): Handle objects with watching_p.
+ (__mf_count_violation): Enlarge array.
+ (__mf_uncache_object): Renamed from __mf_remove_old_object. Don't
+ unlink object. Clear cache properly.
+ (__mf_unregister): Unlink object explicitly before uncaching.
+ * test/fail21-frag.c, pass25-frag.c: New tests.
+ * Makefile.in, aclocal.m4: Regenerated.
+
+2002-11-05 Frank Ch. Eigler <fche@redhat.com>
+
+ * test/fail20-frag.c: New test for NULL pointer dereferencing.
+ * Makefile.am (TESTS): Add it.
+ * test/pass-stratcliff.c: Add decls of stpcpy.
+ * configure.in: Test for <stdint.h>. Generate mf-runtime.h in
+ build tree from config.h and new file mf-runtime.h.in.
+ * mf-runtime.h.in: Renamed from mf-runtime.h. Tweak uintptr_t decl.
+ * Makefile.in, configure, config.h.in: Regenerated.
+ * mf-hooks.c: Add #undef for wrapped glibc str*/mem* macros.
+ * mf-runtime.c (options, __mf_set_default_options): Support new
+ default "abbreviate" option.
+ (__mf_object.description_epoch): New field.
+ (__mf_describe_object): Conditionally abbreviate objects already
+ displayed in current epoch. Accept NULL input to increment epoch.
+ (__mf_fini, __mf_ini): Reset description epoch.
+ (__mf_register, __mf_unregister, __mf_adapt_cache, __mf_init): Ensure
+ that NULL pointer slot in lookup cache is invalidated. Register a
+ NOACCESS region around NULL.
+ * mf-impl.h: Corresponding changes.
+
+2002-10-16 Frank Ch. Eigler <fche@redhat.com>
+
+ * test/fail19-frag.c, pass24-frag.c, pass-stratcliff.c: New tests.
+ * Makefile.am: Run them. Install mf-runtime.h.
+ * Makefile.in: Regenerated.
+ * mf-hooks.c: Add some markers for more missing functions.
+ * mf-runtime.c (__mf_adapt_cache): Experiment with a utilization-based
+ statistic to tune tune cache size (mask).
+
+2002-10-01 Frank Ch. Eigler <fche@redhat.com>
+
+ * test/pass23-frag.c: New test for bit_field_ref expressions.
+ * Makefile.am, Makefile.in: Add new test.
+ * mf-hooks.c (mmap, munmap): Rewrite to track individual pages.
+ (MF_VALIDATE_EXTENT): Accept zero-size mem/str operations.
+ * mf-runtime.c (__mf_init): Register errno global.
+ (__mf_find_object): Removed function.
+ (__mf_check): Rewrite logic to support accesses across some
+ contiguous but distinctly registered objects.
+ (__mf_remove_old_object): Tolerate cache entries that span
+ contiguous objects.
+
+2002-09-30 Frank Ch. Eigler <fche@redhat.com>
+
+ * test/pass21-frag.c, pass22-frag.c: New tests: alloca, bitfields.
+ * Makefile.am, Makefile.in: Run new tests.
+ * mf-hooks.c (alloca): Correct stack direction logic.
+
+2002-09-26 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-impl.h (adapt_cache): New option.
+ * mf-runtime.c (__mf_set_default_options): Set its default value.
+ Tweak the tree_aging parameter down.
+ (__mf_check): Maintain separate counter for cache-adaptation.
+ (__mf_tree_analyze): New function to collect object tree stats.
+ (__mf_adapt_cache): New function to automate cache parameters.
+
+2002-09-24 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-heuristics.c (__init_misc, __mf_heuristic_check): Add
+ hypothetical #if-0'd argv/envp region registration.
+ * mf-runtime.c (__mf_init): Add kludged form of above.
+ (*) Add "heur_argv_environ" flag, default on, to govern this.
+ * mf-impl.h: Corresponding changes.
+
+2002-09-20 Frank Ch. Eigler <fche@redhat.com>
+
+ * test/fail18-frag.c: New test file for NOACCESS regions.
+ * Makefile.am (TESTS): Add new test.
+ * Makefile.in: Regenerated.
+
+ * mf-heuristics.c (__mf_heuristics_check): Correct deja_vu logic.
+ * mf-impl.h (tree_aging): Add new mudflap_option, default 1000000.
+ (optimize_object_tree): Remove unused mudflap_option.
+ * mf-runtime.h (__MF_TYPE_NOACCESS): New region type. Add printing
+ support throughout. Use .._MAX_CEM for cemetary upper bound.
+ * mf-runtime.c (__mf_init): Register __mf_* globals as NOACCESS
+ regions.
+ (__mf_object): Add new liveness field for use by tree aging.
+ (__mf_check): Trigger tree aging when needed.
+ (__mf_age_tree): New function to decay liveness field.
+ (__mf_find_objects_rec): Use liveness field to rotate tree.
+ (__mf_insert_new_object): Only provide backtrace for HEAP objects.
+ (__mf_unregister): Ditto.
+ (__mf_register): Tweak duplicate-static message.
+ (__mf_violation: Tweak nearby-object counter printing.
+
+2002-09-16 Frank Ch. Eigler <fche@redhat.com>
+
+ * test/pass20-frag.c: New test file.
+ * Makefile.am (TESTS): Reorganize. Add pass20 test.
+ * Makefile.in: Regenerated.
+
+ * mf-impl.h (TRACE_IN, TRACE_OUT): Remove macros. Update callers.
+ * mf-hooks.c (BEGIN_PROTECT): Add hook tracing here.
+ * mf-heuristic.c (__mf_heuristic_check): Track seen /proc/self/map
+ entries to avoid repeat registration.
+ * mf-runtime.c (__mf_object_cemetary): Don't bother bury GUESS regions.
+ (__mf_register, __mf_unregister): Rewrite GUESS handling logic.
+
+2002-09-09 Frank Ch. Eigler <fche@redhat.com>
+
+ * Makefile.am: Create test sources with #include, not cat>>.
+ * Makefile.in: Regenerated.
+ * test/buildtest.sh: Removed.
+ * test/driver.c (abort_handler, main): Be quiet.
+
+2002-09-06 Frank Ch. Eigler <fche@redhat.com>
+
+ * test/pass18-frag.c, pass19-frag.c: New tests.
+ * Makefile.am (check): Run them. Rebuild test programs each time.
+ * Makefile.in: Regenerated.
+
+2002-09-06 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-runtime.c (__mf_register): Correct SEGV-inducing error in
+ overlapping object search.
+ (__mf_violation): Likewise for nearby objects.
+ Improve nearby-object listing.
+
+ cleanup:
+ * mf-runtime.c, mf-hooks.c: Remove "{{{"/"}}}" folding marks.
+ * mf-heuristics.c (__mf_heuristic_check): Tweak message.
+
+2002-09-03 Frank Ch. Eigler <fche@redhat.com>
+
+ alloca support:
+ * Makefile.am (AM_CFLAGS): New definition of needed settings.
+ (HOOKOBJS): Add alloca-hook.o.
+ * mf-hooks.c (alloca): New function to implement alloca in libiberty
+ style.
+ * mf-runtime.c (__mf_report): Call alloca(0) to flush remaining blocks.
+ (__mf_backtrace): Reimplement without using alloca.
+ * Makefile.in: Regenerated.
+
+ cleanup:
+ * mf-hooks.c: Use VERBOSE_TRACE throughout instead of fprintf(stderr).
+ Correct signedness bugs in length-tracking variables.
+ * mf-impl.h: Make options unsigned.
+ (CALL_WRAP): New macro to parallel CALL_REAL().
+ (DECLARE): Remove erroneous ";" at end.
+ * mf-runtime.c, mf-hooks.c, mf-heuristics.c: Replace remaining %p
+ formatting specs with %08lx. Correct several compiler warnings.
+
+2002-08-28 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-runtime.c (__mf_violation): Try harder to locate nearby objects.
+
+2002-08-27 Frank Ch. Eigler <fche@redhat.com>
+
+ libmudflap hook breakup:
+ * Makefile.am (TESTS_ENVIRONMENT): Add ../../gcc to LD_LIBRARY_PATH
+ for libgcc_s.
+ (TESTS): Make dependent on libmudflap.
+ (HOOKOBJS): Break up mf-hooks.o into many little hook objects,
+ compiled from segments of mf-hooks.c.
+ * mf-hooks.c: Corresponding changes: wrap each function in
+ #ifdef/#endif.
+ * Makefile.in: Regenerated.
+
+ Heuristics reorganization:
+ * mf-heuristics.c (__mf_register_ro_sections, __mf_init_heuristics):
+ Remove these functions. Update callers.
+ (__mf_heuristic_check): Incorporate all the various heuristics.
+ Encode cacheability/retry judgement into trinary return value.
+ Separate start-end logic into a separate fallback heuristic. Only
+ register relevant /proc/self/map segments.
+ * mf-impl.h: Corresponding changes.
+ * mf-runtime.c (__mf_check): Reorganize heuristics fallback logic.
+ (__mf_init): Don't call __mf_init_heuristics.
+
+ Tracing cleanup:
+ * mf-heuristics.c, mf-runtime.c: Use new MUDFLAP_OPTION
+ "-verbose-trace" to emit all tracing messages other than those of
+ basic public api. Eliminate some duplicate/excessive messages.
+ * mf-runtime.h: Corresponding changes.
+
+2002-08-27 Graydon Hoare <graydon@redhat.com>
+
+ * mf-impl.h (WRAPPER): Change to create linker aliases for __wrap
+ and __real when compiled with -DPIC.
+ * mf-hooks.c (WRAPPER): Change all uses of WRAPPER macro slightly.
+ * Makefile.am (AUTOMAKE_OPTIONS): Fix LD_LIBRARY_PATH for tests.
+ * Makefile.in: Regenerate.
+
+2002-08-26 Graydon Hoare <graydon@redhat.com>
+
+ * mf-impl.h: New file, private implementation header.
+ * mf-runtime.h: Reorganize a bit.
+ (CLAMPSZ): Fix arithmetic.
+ (__MF_CACHE_MISS_P): Fix arithmetic.
+ * mf-runtime.c: Reorganize a bit.
+ (__mf_dynamic): New structure.
+ (resolve_single_dynamic): New function.
+ (__mf_resolve_dynamics): New function.
+ (__mf_init): Initialize dynamic wrappers.
+ * mf-hooks.c: Macro-ize __real calls.
+ Clamp various bits of arithmetic.
+ Add explicit __mf_check call contexts.
+ * Makefile.am: Add dependencies on mf-impl.h
+ * Makefile.in: Regenerate.
+ * configure.in: Comment out shared override.
+ * configure: Regenerate.
+
+2002-08-22 Graydon Hoare <graydon@redhat.com>
+
+ * mf-runtime.c (__mf_process_opts): Sanity-check free_queue_length.
+ (__mf_check): Re-inialize and check heuristics before violation.
+ (__mf_register): Permit updating pure-guess regions.
+ * mf-hooks.c (__wrap_free): Correct some free queue logic.
+ (__wrap_dlopen): New wrapper function.
+ (__wrap_mmap): New wrapper function.
+ (__wrap_munmap): New wrapper function.
+ * mf-heuristics.c (__mf_register_ro_sections): Register *all* regions
+ which are not stack addresses.
+ (is_stack_address): New function.
+ (__mf_init_heuristics): Save and restore state, always initialize with
+ "starting" state.
+
+2002-08-21 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks.c (MF_VALIDATE_EXTENT): Rewrite to correct off-by-one
+ error. Pass location string.
+ (wrap_strcpy, wrap_strncpy): Remove extra %s in trace strings.
+ * mf-runtime.c (options): Add lc-mask, lc-shift options.
+ (__mf_process_opts): Apply some sanity checking for lc-mask.
+ (__mf_check, __mf_violation): Take new location-string argument.
+ Update callers to pass NULL if necessary.
+ (__mf_backtrace): New smart backtracer function. Calls replace
+ several ad-hoc blocks elsewhere.
+ (__mf_describe_object): Remove bad reentrancy test. Improve
+ tracing message.
+ * mf-runtime.h: Corresponding changes. Public/private markup.
+ (__MF_CACHE_MISS_P): New macro.
+
+2002-08-20 Graydon Hoare <graydon@redhat.com>
+
+ * mf-runtime.h: New option: stack_bound (heuristic).
+ Move some macros out of implementation files.
+ * mf-runtime.c: New option string: -stack-bound.
+ Unify recursion protection with hooks.
+ Add more logging.
+ (__mf_check): Call __mf_heuristic_check.
+ (__mf_process_opts): Fix "no-" processing.
+ * mf-heuristics.c (__mf_heuristic_check): New function.
+ * mf-hooks.c: Much off-by-one fixing, recursion protection.
+
+2002-08-20 Frank Ch. Eigler <fche@redhat.com>
+
+ Option parsing improvements, region splitting bug fixes:
+ * mf-heuristics.c (__mf_register_ro_sections): Add warned casts.
+ * mf-runtime.h (heur_proc_map): New libmudflap option.
+ * mf-runtime.c (__mf_set_default_options): Set it.
+ (__mf_usage): Print default values/status.
+ (__mf_process_opts): Support general "no-" option string prefix.
+ (__mf_init): Print __mf_usage on unknown-option error.
+ (__mf_register): Print trace message up front.
+ Correct region splitting logic for case where a subregion disappears.
+ Correct memory leak.
+ (__mf_violation): Make even basic message conditional on option.
+
+ Build cleanup:
+ * Makefile.am (TESTS_ENVIRONMENT): Add -no-heur-proc-map.
+ (clean-local): New target.
+ (test/*x rules): Add -g CFLAGS.
+ (CFLAGS): Add -freorder-blocks.
+ (MFCONFIG_CFLAGS, INCLUDE): Remove unneeded settings.
+ * Makefile.in: Regenerated.
+ * Makefile, mf-config.h: Removed files.
+
+2002-08-16 Graydon Hoare <graydon@redhat.com>
+
+ * mf-runtime.c (__mf_insert_new_object): Factor out of
+ __mf_register.
+ (__mf_remove_old_object): Factor out of __mf_unregister.
+ (__mf_register): Handle guessed regions, splitting
+ guesses when new registrations arrive.
+ (__mf_unregister): Do not unregister guesses.
+ * mf-runtime.h: Move convenience macros around,
+ declare new option fields. Add __MF_TYPE_GUESS.
+ * mf-hooks.c (__wrap_*alloc): Use crumple zones.
+ (__wrap_free): Call __real_free for deferred frees.
+ * Makefile.am: Add more tests, fix dependency.
+ * Makefile.in: Regenerate.
+ * test/pass[13..17]-frag.c: New testcases.
+ * test/fail[13..17]-frag.c: New testcases.
+
+2002-08-15 Graydon Hoare <graydon@redhat.com>
+
+ * mf-heuristics.c: New file.
+ * mf-runtime.c (options): Add -trace-calls option.
+ (__mf_init): Call __mf_init_heuristics.
+
+2002-08-14 Graydon Hoare <graydon@redhat.com>
+
+ * Makefile.am (TESTS): Add testsuite support.
+ * Makefile.in: Regenerate.
+ * test/mf-driver.c: New file.
+ * test/buildtest.sh: New file.
+ * test/passNN-frag.c: New testcases.
+ * test/failNN-frag.c: New testcases.
+
+2002-08-14 Graydon Hoare <graydon@redhat.com>
+
+ * mf-hooks.c: Change __real_strlen() to __real_strlen()+1 when
+ verifying non-size-limited string extents.
+
+2002-08-14 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks.c: Make __wrap string* functions use __real_str[n]len
+ instead of plain str[n]len for internal checks.
+ * mf-runtime.c (__mf_violation): Print optional stack traceback.
+
+2002-08-14 Frank Ch. Eigler <fche@redhat.com>
+
+ * mf-hooks.c: Remove #if-0 around hooks that are now ld-wrapped.
+
+2002-08-13 Graydon Hoare <graydon@redhat.com>
+
+ * mf-runtime.c: Rework configuration to operate on
+ environment variable options rather than #defines
+ (__mf_violation): Add simple fork-a-gdb violaiton mode.
+ (__mf_init): Set static __mf_active_p flag on startup,
+ to inhibit mudflap wrap-based checking during crt0.s.
+ * mf-runtime.h: Declare options structure.
+ * mf-hooks.c: New wrappings for mem*, b*, str*
+ libc functions (temporarily #if 0-ed out).
+
+2002-08-12 Frank Ch. Eigler <fche@redhat.com>
+
+ * Makefile.am, configure.in: New files.
+ * Makefile.in, Makefile, configure, config.h.in: New generated files.
+ * stamp-h.in, aclocal.m4: Ditto.
+
+2002-08-08 Frank Ch. Eigler <fche@redhat.com>
+
+ * Makefile: New file.
+ * mf-config.h: New file: runtime configuration.
+ * mf-hooks.c: New file: interposed libc functions.
+ * mf-runtime.c: New file: bulk of runtime.
+ * mf-runtime.h: New file: public functions.
+
diff --git a/libmudflap/Makefile.am b/libmudflap/Makefile.am
new file mode 100644
index 00000000000..c5a07490f26
--- /dev/null
+++ b/libmudflap/Makefile.am
@@ -0,0 +1,388 @@
+## Makefile for the toplevel directory of the mudflap library.
+##
+## Copyright (C) 2002, 2003
+## Free Software Foundation, Inc.
+##
+
+AUTOMAKE_OPTIONS = 1.3 foreign
+MAINT_CHARSET = latin1
+SUBDIRS = testsuite
+
+AM_CFLAGS = -Wall
+
+if LIBMUDFLAPTH
+libmudflapth = libmudflapth.la
+else
+libmudflapth =
+endif
+
+lib_LTLIBRARIES = libmudflap.la $(libmudflapth)
+include_HEADERS = mf-runtime.h
+
+libmudflap_la_SOURCES = \
+ mf-runtime.c \
+ mf-heuristics.c
+
+HOOK1OBJS = \
+ malloc-hook.lo \
+ free-hook.lo \
+ calloc-hook.lo \
+ realloc-hook.lo \
+ mmap-hook.lo \
+ munmap-hook.lo \
+ alloca-hook.lo
+
+HOOK2OBJS = \
+ memcpy-hook.lo \
+ memmove-hook.lo \
+ memset-hook.lo \
+ memcmp-hook.lo \
+ memchr-hook.lo \
+ memrchr-hook.lo \
+ strcpy-hook.lo \
+ strncpy-hook.lo \
+ strcat-hook.lo \
+ strncat-hook.lo \
+ strcmp-hook.lo \
+ strcasecmp-hook.lo \
+ strncmp-hook.lo \
+ strncasecmp-hook.lo \
+ strdup-hook.lo \
+ strndup-hook.lo \
+ strchr-hook.lo \
+ strrchr-hook.lo \
+ strstr-hook.lo \
+ memmem-hook.lo \
+ strlen-hook.lo \
+ strnlen-hook.lo \
+ bzero-hook.lo \
+ bcopy-hook.lo \
+ bcmp-hook.lo \
+ index-hook.lo \
+ rindex-hook.lo \
+ asctime-hook.lo \
+ ctime-hook.lo \
+ gmtime-hook.lo \
+ localtime-hook.lo \
+ time-hook.lo \
+ strerror-hook.lo \
+ fopen-hook.lo \
+ fclose-hook.lo \
+ fread-hook.lo \
+ fwrite-hook.lo \
+ fgetc-hook.lo \
+ fgets-hook.lo \
+ getc-hook.lo \
+ gets-hook.lo \
+ ungetc-hook.lo \
+ fputc-hook.lo \
+ fputs-hook.lo \
+ putc-hook.lo \
+ puts-hook.lo \
+ clearerr-hook.lo \
+ feof-hook.lo \
+ ferror-hook.lo \
+ fileno-hook.lo \
+ printf-hook.lo \
+ fprintf-hook.lo \
+ sprintf-hook.lo \
+ snprintf-hook.lo \
+ vprintf-hook.lo \
+ vfprintf-hook.lo \
+ vsprintf-hook.lo \
+ vsnprintf-hook.lo \
+ access-hook.lo \
+ remove-hook.lo \
+ fflush-hook.lo \
+ fseek-hook.lo \
+ ftell-hook.lo \
+ rewind-hook.lo \
+ fgetpos-hook.lo \
+ fsetpos-hook.lo \
+ stat-hook.lo \
+ fstat-hook.lo \
+ lstat-hook.lo \
+ mkfifo-hook.lo \
+ setvbuf-hook.lo \
+ setbuf-hook.lo \
+ opendir-hook.lo \
+ closedir-hook.lo \
+ readdir-hook.lo \
+ recv-hook.lo \
+ recvfrom-hook.lo \
+ recvmsg-hook.lo \
+ send-hook.lo \
+ sendto-hook.lo \
+ sendmsg-hook.lo \
+ setsockopt-hook.lo \
+ getsockopt-hook.lo \
+ accept-hook.lo \
+ bind-hook.lo \
+ connect-hook.lo \
+ gethostname-hook.lo \
+ sethostname-hook.lo \
+ gethostbyname-hook.lo \
+ wait-hook.lo \
+ waitpid-hook.lo \
+ popen-hook.lo \
+ pclose-hook.lo \
+ execve-hook.lo \
+ execv-hook.lo \
+ execvp-hook.lo \
+ system-hook.lo \
+ dlopen-hook.lo \
+ dlerror-hook.lo \
+ dlsym-hook.lo \
+ dlclose-hook.lo \
+ fopen64-hook.lo \
+ stat64-hook.lo \
+ fseeko64-hook.lo \
+ ftello64-hook.lo \
+ semop-hook.lo \
+ semctl-hook.lo \
+ shmctl-hook.lo \
+ shmat-hook.lo \
+ shmdt-hook.lo
+HOOK3OBJS =
+
+$(HOOK1OBJS): mf-hooks1.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DWRAP_$$hook -c $(srcdir)/mf-hooks1.c -o $@
+$(HOOK2OBJS): mf-hooks2.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DWRAP_$$hook -c $(srcdir)/mf-hooks2.c -o $@
+$(HOOK3OBJS): mf-hooks3.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DWRAP_$$hook -c $(srcdir)/mf-hooks3.c -o $@
+
+# Hook objects only for libmudflapth use
+PTHHOOK1OBJS= \
+ pth/malloc-hook.lo \
+ pth/free-hook.lo \
+ pth/calloc-hook.lo \
+ pth/realloc-hook.lo \
+ pth/mmap-hook.lo \
+ pth/munmap-hook.lo \
+ pth/alloca-hook.lo
+
+PTHHOOK2OBJS= \
+ pth/memcpy-hook.lo \
+ pth/memmove-hook.lo \
+ pth/memset-hook.lo \
+ pth/memcmp-hook.lo \
+ pth/memchr-hook.lo \
+ pth/memrchr-hook.lo \
+ pth/strcpy-hook.lo \
+ pth/strncpy-hook.lo \
+ pth/strcat-hook.lo \
+ pth/strncat-hook.lo \
+ pth/strcmp-hook.lo \
+ pth/strcasecmp-hook.lo \
+ pth/strncmp-hook.lo \
+ pth/strncasecmp-hook.lo \
+ pth/strdup-hook.lo \
+ pth/strndup-hook.lo \
+ pth/strchr-hook.lo \
+ pth/strrchr-hook.lo \
+ pth/strstr-hook.lo \
+ pth/memmem-hook.lo \
+ pth/strlen-hook.lo \
+ pth/strnlen-hook.lo \
+ pth/bzero-hook.lo \
+ pth/bcopy-hook.lo \
+ pth/bcmp-hook.lo \
+ pth/index-hook.lo \
+ pth/rindex-hook.lo \
+ pth/asctime-hook.lo \
+ pth/ctime-hook.lo \
+ pth/gmtime-hook.lo \
+ pth/localtime-hook.lo \
+ pth/time-hook.lo \
+ pth/strerror-hook.lo \
+ pth/fopen-hook.lo \
+ pth/fclose-hook.lo \
+ pth/fread-hook.lo \
+ pth/fwrite-hook.lo \
+ pth/fgetc-hook.lo \
+ pth/fgets-hook.lo \
+ pth/getc-hook.lo \
+ pth/gets-hook.lo \
+ pth/ungetc-hook.lo \
+ pth/fputc-hook.lo \
+ pth/fputs-hook.lo \
+ pth/putc-hook.lo \
+ pth/puts-hook.lo \
+ pth/clearerr-hook.lo \
+ pth/feof-hook.lo \
+ pth/ferror-hook.lo \
+ pth/fileno-hook.lo \
+ pth/printf-hook.lo \
+ pth/fprintf-hook.lo \
+ pth/sprintf-hook.lo \
+ pth/snprintf-hook.lo \
+ pth/vprintf-hook.lo \
+ pth/vfprintf-hook.lo \
+ pth/vsprintf-hook.lo \
+ pth/vsnprintf-hook.lo \
+ pth/access-hook.lo \
+ pth/remove-hook.lo \
+ pth/fflush-hook.lo \
+ pth/fseek-hook.lo \
+ pth/ftell-hook.lo \
+ pth/rewind-hook.lo \
+ pth/fgetpos-hook.lo \
+ pth/fsetpos-hook.lo \
+ pth/stat-hook.lo \
+ pth/fstat-hook.lo \
+ pth/lstat-hook.lo \
+ pth/mkfifo-hook.lo \
+ pth/setvbuf-hook.lo \
+ pth/setbuf-hook.lo \
+ pth/opendir-hook.lo \
+ pth/closedir-hook.lo \
+ pth/readdir-hook.lo \
+ pth/recv-hook.lo \
+ pth/recvfrom-hook.lo \
+ pth/recvmsg-hook.lo \
+ pth/send-hook.lo \
+ pth/sendto-hook.lo \
+ pth/sendmsg-hook.lo \
+ pth/setsockopt-hook.lo \
+ pth/getsockopt-hook.lo \
+ pth/accept-hook.lo \
+ pth/bind-hook.lo \
+ pth/connect-hook.lo \
+ pth/gethostname-hook.lo \
+ pth/sethostname-hook.lo \
+ pth/gethostbyname-hook.lo \
+ pth/wait-hook.lo \
+ pth/waitpid-hook.lo \
+ pth/popen-hook.lo \
+ pth/pclose-hook.lo \
+ pth/execve-hook.lo \
+ pth/execv-hook.lo \
+ pth/execvp-hook.lo \
+ pth/system-hook.lo \
+ pth/dlopen-hook.lo \
+ pth/dlerror-hook.lo \
+ pth/dlsym-hook.lo \
+ pth/dlclose-hook.lo \
+ pth/fopen64-hook.lo \
+ pth/stat64-hook.lo \
+ pth/fseeko64-hook.lo \
+ pth/ftello64-hook.lo \
+ pth/semop-hook.lo \
+ pth/semctl-hook.lo \
+ pth/shmctl-hook.lo \
+ pth/shmat-hook.lo \
+ pth/shmdt-hook.lo
+
+PTHHOOK3OBJS= \
+ pth/pthreadstuff-hook.lo
+
+
+clean-local:
+ rm -f pth/*.o pth/*.lo
+
+libmudflapth_la_SOURCES =
+pth/mf-runtime.lo: mf-runtime.c mf-runtime.h mf-impl.h
+ $(LTCOMPILE) -DLIBMUDFLAPTH -c $(srcdir)/mf-runtime.c -o $@
+pth/mf-heuristics.lo: mf-heuristics.c mf-runtime.h mf-impl.h
+ $(LTCOMPILE) -DLIBMUDFLAPTH -c $(srcdir)/mf-heuristics.c -o $@
+$(PTHHOOK1OBJS): mf-hooks1.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DLIBMUDFLAPTH -DWRAP_$$hook -c $(srcdir)/mf-hooks1.c -o $@
+$(PTHHOOK2OBJS): mf-hooks2.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DLIBMUDFLAPTH -DWRAP_$$hook -c $(srcdir)/mf-hooks2.c -o $@
+$(PTHHOOK3OBJS): mf-hooks3.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DLIBMUDFLAPTH -DWRAP_$$hook -c $(srcdir)/mf-hooks3.c -o $@
+
+libmudflap_la_LIBADD = $(HOOK1OBJS) $(HOOK2OBJS) $(HOOK3OBJS)
+libmudflap_la_DEPENDENCIES = $(libmudflap_la_LIBADD)
+
+libmudflapth_la_LIBADD = pth/mf-runtime.lo pth/mf-heuristics.lo \
+ $(PTHHOOK1OBJS) $(PTHHOOK2OBJS) $(PTHHOOK3OBJS)
+libmudflapth_la_DEPENDENCIES = $(libmudflapth_la_LIBADD)
+
+
+
+# XXX hack alert
+# From libffi/Makefile.am
+
+# Work around what appears to be a GNU make bug handling MAKEFLAGS
+# values defined in terms of make variables, as is the case for CC and
+# friends when we are called from the top level Makefile.
+AM_MAKEFLAGS = \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
+ "JC1FLAGS=$(JC1FLAGS)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
+ "MAKE=$(MAKE)" \
+ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
+ "SHELL=$(SHELL)" \
+ "exec_prefix=$(exec_prefix)" \
+ "infodir=$(infodir)" \
+ "libdir=$(libdir)" \
+ "prefix=$(prefix)" \
+ "AR=$(AR)" \
+ "AS=$(AS)" \
+ "CC=$(CC)" \
+ "CXX=$(CXX)" \
+ "LD=$(LD)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "NM=$(NM)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "DESTDIR=$(DESTDIR)"
+
+MAKEOVERRIDES=
+
+# Multilib support variables.
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+
+# Multilib support.
+.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
+ maintainer-clean-multi
+
+all-recursive: all-multi
+install-recursive: install-multi
+mostlyclean-recursive: mostlyclean-multi
+clean-recursive: clean-multi
+distclean-recursive: distclean-multi
+maintainer-clean-recursive: maintainer-clean-multi
+
+all-multi:
+ : $(MAKE) ; exec $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
+
+
+## ################################################################
+
diff --git a/libmudflap/Makefile.in b/libmudflap/Makefile.in
new file mode 100644
index 00000000000..c21b2dc335f
--- /dev/null
+++ b/libmudflap/Makefile.in
@@ -0,0 +1,918 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = .
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AS = @AS@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MF_HAVE_STDINT_H = @MF_HAVE_STDINT_H@
+MF_HAVE_UINTPTR_T = @MF_HAVE_UINTPTR_T@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+libtool_VERSION = @libtool_VERSION@
+
+AUTOMAKE_OPTIONS = 1.3 foreign
+MAINT_CHARSET = latin1
+SUBDIRS = testsuite
+
+AM_CFLAGS = -Wall
+@LIBMUDFLAPTH_TRUE@libmudflapth = @LIBMUDFLAPTH_TRUE@libmudflapth.la
+@LIBMUDFLAPTH_FALSE@libmudflapth =
+
+lib_LTLIBRARIES = libmudflap.la $(libmudflapth)
+include_HEADERS = mf-runtime.h
+
+libmudflap_la_SOURCES = \
+ mf-runtime.c \
+ mf-heuristics.c
+
+
+HOOK1OBJS = \
+ malloc-hook.lo \
+ free-hook.lo \
+ calloc-hook.lo \
+ realloc-hook.lo \
+ mmap-hook.lo \
+ munmap-hook.lo \
+ alloca-hook.lo
+
+
+HOOK2OBJS = \
+ memcpy-hook.lo \
+ memmove-hook.lo \
+ memset-hook.lo \
+ memcmp-hook.lo \
+ memchr-hook.lo \
+ memrchr-hook.lo \
+ strcpy-hook.lo \
+ strncpy-hook.lo \
+ strcat-hook.lo \
+ strncat-hook.lo \
+ strcmp-hook.lo \
+ strcasecmp-hook.lo \
+ strncmp-hook.lo \
+ strncasecmp-hook.lo \
+ strdup-hook.lo \
+ strndup-hook.lo \
+ strchr-hook.lo \
+ strrchr-hook.lo \
+ strstr-hook.lo \
+ memmem-hook.lo \
+ strlen-hook.lo \
+ strnlen-hook.lo \
+ bzero-hook.lo \
+ bcopy-hook.lo \
+ bcmp-hook.lo \
+ index-hook.lo \
+ rindex-hook.lo \
+ asctime-hook.lo \
+ ctime-hook.lo \
+ gmtime-hook.lo \
+ localtime-hook.lo \
+ time-hook.lo \
+ strerror-hook.lo \
+ fopen-hook.lo \
+ fclose-hook.lo \
+ fread-hook.lo \
+ fwrite-hook.lo \
+ fgetc-hook.lo \
+ fgets-hook.lo \
+ getc-hook.lo \
+ gets-hook.lo \
+ ungetc-hook.lo \
+ fputc-hook.lo \
+ fputs-hook.lo \
+ putc-hook.lo \
+ puts-hook.lo \
+ clearerr-hook.lo \
+ feof-hook.lo \
+ ferror-hook.lo \
+ fileno-hook.lo \
+ printf-hook.lo \
+ fprintf-hook.lo \
+ sprintf-hook.lo \
+ snprintf-hook.lo \
+ vprintf-hook.lo \
+ vfprintf-hook.lo \
+ vsprintf-hook.lo \
+ vsnprintf-hook.lo \
+ access-hook.lo \
+ remove-hook.lo \
+ fflush-hook.lo \
+ fseek-hook.lo \
+ ftell-hook.lo \
+ rewind-hook.lo \
+ fgetpos-hook.lo \
+ fsetpos-hook.lo \
+ stat-hook.lo \
+ fstat-hook.lo \
+ lstat-hook.lo \
+ mkfifo-hook.lo \
+ setvbuf-hook.lo \
+ setbuf-hook.lo \
+ opendir-hook.lo \
+ closedir-hook.lo \
+ readdir-hook.lo \
+ recv-hook.lo \
+ recvfrom-hook.lo \
+ recvmsg-hook.lo \
+ send-hook.lo \
+ sendto-hook.lo \
+ sendmsg-hook.lo \
+ setsockopt-hook.lo \
+ getsockopt-hook.lo \
+ accept-hook.lo \
+ bind-hook.lo \
+ connect-hook.lo \
+ gethostname-hook.lo \
+ sethostname-hook.lo \
+ gethostbyname-hook.lo \
+ wait-hook.lo \
+ waitpid-hook.lo \
+ popen-hook.lo \
+ pclose-hook.lo \
+ execve-hook.lo \
+ execv-hook.lo \
+ execvp-hook.lo \
+ system-hook.lo \
+ dlopen-hook.lo \
+ dlerror-hook.lo \
+ dlsym-hook.lo \
+ dlclose-hook.lo \
+ fopen64-hook.lo \
+ stat64-hook.lo \
+ fseeko64-hook.lo \
+ ftello64-hook.lo \
+ semop-hook.lo \
+ semctl-hook.lo \
+ shmctl-hook.lo \
+ shmat-hook.lo \
+ shmdt-hook.lo
+
+HOOK3OBJS =
+
+# Hook objects only for libmudflapth use
+PTHHOOK1OBJS = \
+ pth/malloc-hook.lo \
+ pth/free-hook.lo \
+ pth/calloc-hook.lo \
+ pth/realloc-hook.lo \
+ pth/mmap-hook.lo \
+ pth/munmap-hook.lo \
+ pth/alloca-hook.lo
+
+
+PTHHOOK2OBJS = \
+ pth/memcpy-hook.lo \
+ pth/memmove-hook.lo \
+ pth/memset-hook.lo \
+ pth/memcmp-hook.lo \
+ pth/memchr-hook.lo \
+ pth/memrchr-hook.lo \
+ pth/strcpy-hook.lo \
+ pth/strncpy-hook.lo \
+ pth/strcat-hook.lo \
+ pth/strncat-hook.lo \
+ pth/strcmp-hook.lo \
+ pth/strcasecmp-hook.lo \
+ pth/strncmp-hook.lo \
+ pth/strncasecmp-hook.lo \
+ pth/strdup-hook.lo \
+ pth/strndup-hook.lo \
+ pth/strchr-hook.lo \
+ pth/strrchr-hook.lo \
+ pth/strstr-hook.lo \
+ pth/memmem-hook.lo \
+ pth/strlen-hook.lo \
+ pth/strnlen-hook.lo \
+ pth/bzero-hook.lo \
+ pth/bcopy-hook.lo \
+ pth/bcmp-hook.lo \
+ pth/index-hook.lo \
+ pth/rindex-hook.lo \
+ pth/asctime-hook.lo \
+ pth/ctime-hook.lo \
+ pth/gmtime-hook.lo \
+ pth/localtime-hook.lo \
+ pth/time-hook.lo \
+ pth/strerror-hook.lo \
+ pth/fopen-hook.lo \
+ pth/fclose-hook.lo \
+ pth/fread-hook.lo \
+ pth/fwrite-hook.lo \
+ pth/fgetc-hook.lo \
+ pth/fgets-hook.lo \
+ pth/getc-hook.lo \
+ pth/gets-hook.lo \
+ pth/ungetc-hook.lo \
+ pth/fputc-hook.lo \
+ pth/fputs-hook.lo \
+ pth/putc-hook.lo \
+ pth/puts-hook.lo \
+ pth/clearerr-hook.lo \
+ pth/feof-hook.lo \
+ pth/ferror-hook.lo \
+ pth/fileno-hook.lo \
+ pth/printf-hook.lo \
+ pth/fprintf-hook.lo \
+ pth/sprintf-hook.lo \
+ pth/snprintf-hook.lo \
+ pth/vprintf-hook.lo \
+ pth/vfprintf-hook.lo \
+ pth/vsprintf-hook.lo \
+ pth/vsnprintf-hook.lo \
+ pth/access-hook.lo \
+ pth/remove-hook.lo \
+ pth/fflush-hook.lo \
+ pth/fseek-hook.lo \
+ pth/ftell-hook.lo \
+ pth/rewind-hook.lo \
+ pth/fgetpos-hook.lo \
+ pth/fsetpos-hook.lo \
+ pth/stat-hook.lo \
+ pth/fstat-hook.lo \
+ pth/lstat-hook.lo \
+ pth/mkfifo-hook.lo \
+ pth/setvbuf-hook.lo \
+ pth/setbuf-hook.lo \
+ pth/opendir-hook.lo \
+ pth/closedir-hook.lo \
+ pth/readdir-hook.lo \
+ pth/recv-hook.lo \
+ pth/recvfrom-hook.lo \
+ pth/recvmsg-hook.lo \
+ pth/send-hook.lo \
+ pth/sendto-hook.lo \
+ pth/sendmsg-hook.lo \
+ pth/setsockopt-hook.lo \
+ pth/getsockopt-hook.lo \
+ pth/accept-hook.lo \
+ pth/bind-hook.lo \
+ pth/connect-hook.lo \
+ pth/gethostname-hook.lo \
+ pth/sethostname-hook.lo \
+ pth/gethostbyname-hook.lo \
+ pth/wait-hook.lo \
+ pth/waitpid-hook.lo \
+ pth/popen-hook.lo \
+ pth/pclose-hook.lo \
+ pth/execve-hook.lo \
+ pth/execv-hook.lo \
+ pth/execvp-hook.lo \
+ pth/system-hook.lo \
+ pth/dlopen-hook.lo \
+ pth/dlerror-hook.lo \
+ pth/dlsym-hook.lo \
+ pth/dlclose-hook.lo \
+ pth/fopen64-hook.lo \
+ pth/stat64-hook.lo \
+ pth/fseeko64-hook.lo \
+ pth/ftello64-hook.lo \
+ pth/semop-hook.lo \
+ pth/semctl-hook.lo \
+ pth/shmctl-hook.lo \
+ pth/shmat-hook.lo \
+ pth/shmdt-hook.lo
+
+
+PTHHOOK3OBJS = \
+ pth/pthreadstuff-hook.lo
+
+
+libmudflapth_la_SOURCES =
+
+libmudflap_la_LIBADD = $(HOOK1OBJS) $(HOOK2OBJS) $(HOOK3OBJS)
+libmudflap_la_DEPENDENCIES = $(libmudflap_la_LIBADD)
+
+libmudflapth_la_LIBADD = pth/mf-runtime.lo pth/mf-heuristics.lo \
+ $(PTHHOOK1OBJS) $(PTHHOOK2OBJS) $(PTHHOOK3OBJS)
+
+libmudflapth_la_DEPENDENCIES = $(libmudflapth_la_LIBADD)
+
+# XXX hack alert
+# From libffi/Makefile.am
+
+# Work around what appears to be a GNU make bug handling MAKEFLAGS
+# values defined in terms of make variables, as is the case for CC and
+# friends when we are called from the top level Makefile.
+AM_MAKEFLAGS = \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
+ "JC1FLAGS=$(JC1FLAGS)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
+ "MAKE=$(MAKE)" \
+ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
+ "SHELL=$(SHELL)" \
+ "exec_prefix=$(exec_prefix)" \
+ "infodir=$(infodir)" \
+ "libdir=$(libdir)" \
+ "prefix=$(prefix)" \
+ "AR=$(AR)" \
+ "AS=$(AS)" \
+ "CC=$(CC)" \
+ "CXX=$(CXX)" \
+ "LD=$(LD)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "NM=$(NM)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "DESTDIR=$(DESTDIR)"
+
+
+MAKEOVERRIDES =
+
+# Multilib support variables.
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = mf-runtime.h
+LTLIBRARIES = $(lib_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I.
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libmudflap_la_LDFLAGS =
+libmudflap_la_OBJECTS = mf-runtime.lo mf-heuristics.lo
+libmudflapth_la_LDFLAGS =
+libmudflapth_la_OBJECTS =
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+HEADERS = $(include_HEADERS)
+
+DIST_COMMON = ./stamp-h.in ChangeLog Makefile.am Makefile.in \
+acinclude.m4 aclocal.m4 config.h.in configure configure.in \
+mf-runtime.h.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+DEP_FILES = .deps/mf-heuristics.P .deps/mf-runtime.P
+SOURCES = $(libmudflap_la_SOURCES) $(libmudflapth_la_SOURCES)
+OBJECTS = $(libmudflap_la_OBJECTS) $(libmudflapth_la_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
+ cd $(srcdir) && $(ACLOCAL)
+
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
+
+config.h: stamp-h
+ @if test ! -f $@; then \
+ rm -f stamp-h; \
+ $(MAKE) stamp-h; \
+ else :; fi
+stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > stamp-h 2> /dev/null
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/stamp-h.in; \
+ $(MAKE) $(srcdir)/stamp-h.in; \
+ else :; fi
+$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+ -rm -f config.h
+
+maintainer-clean-hdr:
+mf-runtime.h: $(top_builddir)/config.status mf-runtime.h.in
+ cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+mostlyclean-libLTLIBRARIES:
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+
+distclean-libLTLIBRARIES:
+
+maintainer-clean-libLTLIBRARIES:
+
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
+ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
+ done
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+ $(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+ -rm -f *.$(OBJEXT)
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.s.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+libmudflap.la: $(libmudflap_la_OBJECTS) $(libmudflap_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libmudflap_la_LDFLAGS) $(libmudflap_la_OBJECTS) $(libmudflap_la_LIBADD) $(LIBS)
+
+libmudflapth.la: $(libmudflapth_la_OBJECTS) $(libmudflapth_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libmudflapth_la_LDFLAGS) $(libmudflapth_la_OBJECTS) $(libmudflapth_la_LIBADD) $(LIBS)
+
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(includedir)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
+ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
+ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ list='$(include_HEADERS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(includedir)/$$p; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ rev="$$subdir $$rev"; \
+ test "$$subdir" = "." && dot_seen=yes; \
+ done; \
+ test "$$dot_seen" = "no" && rev=". $$rev"; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ -rm -rf $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ dc_install_base=`cd $(distdir)/=inst && pwd`; \
+ cd $(distdir)/=build \
+ && ../configure --srcdir=.. --prefix=$$dc_install_base \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) dist
+ -rm -rf $(distdir)
+ @banner="$(distdir).tar.gz is ready for distribution"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"
+dist: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+dist-all: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+distdir: $(DISTFILES)
+ -rm -rf $(distdir)
+ mkdir $(distdir)
+ -chmod 777 $(distdir)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ chmod 777 $(distdir)/$$subdir; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ fi; \
+ done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+ -rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+ @echo '$(COMPILE) -c $<'; \
+ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+ @-cp .deps/$(*F).pp .deps/$(*F).P; \
+ tr ' ' '\012' < .deps/$(*F).pp \
+ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+ >> .deps/$(*F).P; \
+ rm .deps/$(*F).pp
+
+%.lo: %.c
+ @echo '$(LTCOMPILE) -c $<'; \
+ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
+ < .deps/$(*F).pp > .deps/$(*F).P; \
+ tr ' ' '\012' < .deps/$(*F).pp \
+ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+ >> .deps/$(*F).P; \
+ rm -f .deps/$(*F).pp
+info-am:
+info: info-recursive
+dvi-am:
+dvi: dvi-recursive
+check-am: all-am
+check: check-recursive
+installcheck-am:
+installcheck: installcheck-recursive
+all-recursive-am: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+install-exec-am: install-libLTLIBRARIES
+install-exec: install-exec-recursive
+
+install-data-am: install-includeHEADERS
+install-data: install-data-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-recursive
+uninstall-am: uninstall-libLTLIBRARIES uninstall-includeHEADERS
+uninstall: uninstall-recursive
+all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h
+all-redirect: all-recursive-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs: installdirs-recursive
+installdirs-am:
+ $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-hdr mostlyclean-libLTLIBRARIES \
+ mostlyclean-compile mostlyclean-libtool \
+ mostlyclean-tags mostlyclean-depend mostlyclean-generic
+
+mostlyclean: mostlyclean-recursive
+
+clean-am: clean-hdr clean-libLTLIBRARIES clean-compile clean-libtool \
+ clean-tags clean-depend clean-generic mostlyclean-am \
+ clean-local
+
+clean: clean-recursive
+
+distclean-am: distclean-hdr distclean-libLTLIBRARIES distclean-compile \
+ distclean-libtool distclean-tags distclean-depend \
+ distclean-generic clean-am
+ -rm -f libtool
+
+distclean: distclean-recursive
+ -rm -f config.status
+
+maintainer-clean-am: maintainer-clean-hdr \
+ maintainer-clean-libLTLIBRARIES \
+ maintainer-clean-compile maintainer-clean-libtool \
+ maintainer-clean-tags maintainer-clean-depend \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f config.status
+
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
+clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
+uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
+distclean-compile clean-compile maintainer-clean-compile \
+mostlyclean-libtool distclean-libtool clean-libtool \
+maintainer-clean-libtool uninstall-includeHEADERS \
+install-includeHEADERS install-data-recursive uninstall-data-recursive \
+install-exec-recursive uninstall-exec-recursive installdirs-recursive \
+uninstalldirs-recursive all-recursive check-recursive \
+installcheck-recursive info-recursive dvi-recursive \
+mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir \
+mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend info-am info dvi-am dvi check check-am \
+installcheck-am installcheck all-recursive-am install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs-am \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+$(HOOK1OBJS): mf-hooks1.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DWRAP_$$hook -c $(srcdir)/mf-hooks1.c -o $@
+$(HOOK2OBJS): mf-hooks2.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DWRAP_$$hook -c $(srcdir)/mf-hooks2.c -o $@
+$(HOOK3OBJS): mf-hooks3.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DWRAP_$$hook -c $(srcdir)/mf-hooks3.c -o $@
+
+clean-local:
+ rm -f pth/*.o pth/*.lo
+pth/mf-runtime.lo: mf-runtime.c mf-runtime.h mf-impl.h
+ $(LTCOMPILE) -DLIBMUDFLAPTH -c $(srcdir)/mf-runtime.c -o $@
+pth/mf-heuristics.lo: mf-heuristics.c mf-runtime.h mf-impl.h
+ $(LTCOMPILE) -DLIBMUDFLAPTH -c $(srcdir)/mf-heuristics.c -o $@
+$(PTHHOOK1OBJS): mf-hooks1.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DLIBMUDFLAPTH -DWRAP_$$hook -c $(srcdir)/mf-hooks1.c -o $@
+$(PTHHOOK2OBJS): mf-hooks2.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DLIBMUDFLAPTH -DWRAP_$$hook -c $(srcdir)/mf-hooks2.c -o $@
+$(PTHHOOK3OBJS): mf-hooks3.c mf-runtime.h mf-impl.h
+ hook=`basename $@ -hook.lo`; \
+ $(LTCOMPILE) -DLIBMUDFLAPTH -DWRAP_$$hook -c $(srcdir)/mf-hooks3.c -o $@
+
+# Multilib support.
+.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
+ maintainer-clean-multi
+
+all-recursive: all-multi
+install-recursive: install-multi
+mostlyclean-recursive: mostlyclean-multi
+clean-recursive: clean-multi
+distclean-recursive: distclean-multi
+maintainer-clean-recursive: maintainer-clean-multi
+
+all-multi:
+ : $(MAKE) ; exec $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libmudflap/acinclude.m4 b/libmudflap/acinclude.m4
new file mode 100644
index 00000000000..421197d6124
--- /dev/null
+++ b/libmudflap/acinclude.m4
@@ -0,0 +1,928 @@
+## libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
+## Copyright 1996, 1997, 1998, 1999, 2000, 2001
+## Free Software Foundation, Inc.
+## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program 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. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that contains a
+## configuration script generated by Autoconf, you may include it under
+## the same distribution terms that you use for the rest of that program.
+
+# serial 46 AC_PROG_LIBTOOL
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+ AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [AC_LIBTOOL_CXX],
+ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [ifdef([AC_PROG_GCJ],
+ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])
+ ifdef([A][M_PROG_GCJ],
+ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])
+ ifdef([LT_AC_PROG_GCJ],
+ [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])])])])])
+
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ AC_PATH_MAGIC
+ fi
+ ;;
+esac
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+AC_ARG_WITH(pic,
+ [ --with-pic try to use only PIC/non-PIC objects [default=use both]],
+ pic_mode="$withval", pic_mode=default)
+test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
+test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_SAVE
+ AC_LANG_C
+ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_RESTORE])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+ # recent cygwin and mingw systems supply a stub DllMain which the user
+ # can override, but on older systems we have to supply one
+ AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
+ [AC_TRY_LINK([],
+ [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+ DllMain (0, 0, 0);],
+ [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
+
+ case $host/$CC in
+ *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+ # old mingw systems require "-dll" to link a DLL, while more recent ones
+ # require "-mdll"
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -mdll"
+ AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
+ [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+ CFLAGS="$SAVE_CFLAGS" ;;
+ *-*-cygwin* | *-*-pw32*)
+ # cygwin systems need to pass --dll to the linker, and not link
+ # crt.o which will require a WinMain@16 definition.
+ lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+ esac
+ ;;
+ ])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_LIBTOOL_PICMODE - implement the --with-pic flag
+# Usage: AC_LIBTOOL_PICMODE[(MODE)]
+# Where MODE is either `yes' or `no'. If omitted, it defaults to
+# `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)])
+
+
+# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="ifelse([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+])
+
+
+# AC_PATH_MAGIC - find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])
+
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]* | [A-Za-z]:[\\/]*)]
+ re_direlt=['/[^/][^/]*/\.\./']
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ lt_cv_prog_gnu_ld=yes
+else
+ lt_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])
+
+# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+])
+
+# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+# Don't cache this sucker.
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_MSG_CHECKING([how to recognise dependant libraries])
+lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi4*)
+ lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)']
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin* | mingw* |pw32*)
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.[012])
+ lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
+ ;;
+
+freebsd* )
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20*|hpux11*)
+ case $host_cpu in
+ hppa*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ ia64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ esac
+ ;;
+
+irix5* | irix6*)
+ case $host_os in
+ irix5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"]
+ ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ case $host_cpu in
+ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | x86_64*)
+ lt_cv_deplibs_check_method=pass_all ;;
+ # NB 2003-06-03: According to Alexandre Oliva, x86_64 should not be
+ # in this list. However, it works around a libtool problem that
+ # wrongly excludes -ldl/-lpthread from the libmudflap(th) dependencies.
+ *)
+ # glibc up to 2.1.1 does not perform some relocations on ARM
+ lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
+ else
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$']
+ fi
+ ;;
+
+newsos6)
+ [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+osf3* | osf4* | osf5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+
+[sysv5uw[78]* | sysv4*uw2*)]
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ case $host_vendor in
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ motorola)
+ lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]']
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ esac
+ ;;
+esac
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+# NB: See above NB ... this is to make sure that the overriden
+# local libtool variant doesn't pollute the upstream cache
+unset lt_cv_file_magic_cmd
+unset lt_cv_deplibs_check_method
+AC_MSG_RESULT($deplibs_check_method)
+])
+
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm=$ac_dir/${ac_tool_prefix}nm
+ if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ else
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments. Note that LIBLTDL and INCLTDL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
+# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
+# with '${top_builddir}/' and INCLTDL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case $enable_ltdl_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
+# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!). If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ INCLTDL=
+ fi
+])
+
+# If this macro is not defined by Autoconf, define it here.
+ifdef([AC_PROVIDE_IFELSE],
+ [],
+ [define([AC_PROVIDE_IFELSE],
+ [ifdef([AC_PROVIDE_$1],
+ [$2], [$3])])])
+
+# AC_LIBTOOL_CXX - enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])])
+
+AC_DEFUN([_AC_LIBTOOL_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
+dnl is set to the C++ compiler.
+AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
+|| AC_MSG_ERROR([libtool tag configuration failed])
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+# AC_LIBTOOL_GCJ - enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])])
+
+AC_DEFUN([_AC_LIBTOOL_GCJ],
+[AC_REQUIRE([AC_PROG_LIBTOOL])
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
+dnl is set to the C++ compiler.
+AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
+|| AC_MSG_ERROR([libtool tag configuration failed])
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+dnl old names
+AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)
+])
diff --git a/libmudflap/aclocal.m4 b/libmudflap/aclocal.m4
new file mode 100644
index 00000000000..f33f60bba61
--- /dev/null
+++ b/libmudflap/aclocal.m4
@@ -0,0 +1,1066 @@
+dnl aclocal.m4 generated automatically by aclocal 1.4
+
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+
+# serial 46 AC_PROG_LIBTOOL
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+ AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [AC_LIBTOOL_CXX],
+ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [ifdef([AC_PROG_GCJ],
+ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])
+ ifdef([A][M_PROG_GCJ],
+ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])
+ ifdef([LT_AC_PROG_GCJ],
+ [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])])])])])
+
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ AC_PATH_MAGIC
+ fi
+ ;;
+esac
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+AC_ARG_WITH(pic,
+ [ --with-pic try to use only PIC/non-PIC objects [default=use both]],
+ pic_mode="$withval", pic_mode=default)
+test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
+test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_SAVE
+ AC_LANG_C
+ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_RESTORE])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+ # recent cygwin and mingw systems supply a stub DllMain which the user
+ # can override, but on older systems we have to supply one
+ AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
+ [AC_TRY_LINK([],
+ [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+ DllMain (0, 0, 0);],
+ [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
+
+ case $host/$CC in
+ *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+ # old mingw systems require "-dll" to link a DLL, while more recent ones
+ # require "-mdll"
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -mdll"
+ AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
+ [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+ CFLAGS="$SAVE_CFLAGS" ;;
+ *-*-cygwin* | *-*-pw32*)
+ # cygwin systems need to pass --dll to the linker, and not link
+ # crt.o which will require a WinMain@16 definition.
+ lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+ esac
+ ;;
+ ])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_LIBTOOL_PICMODE - implement the --with-pic flag
+# Usage: AC_LIBTOOL_PICMODE[(MODE)]
+# Where MODE is either `yes' or `no'. If omitted, it defaults to
+# `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)])
+
+
+# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="ifelse([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+])
+
+
+# AC_PATH_MAGIC - find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])
+
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]* | [A-Za-z]:[\\/]*)]
+ re_direlt=['/[^/][^/]*/\.\./']
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ lt_cv_prog_gnu_ld=yes
+else
+ lt_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])
+
+# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+])
+
+# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+# Don't cache this sucker.
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_MSG_CHECKING([how to recognise dependant libraries])
+lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi4*)
+ lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)']
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin* | mingw* |pw32*)
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.[012])
+ lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
+ ;;
+
+freebsd* )
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20*|hpux11*)
+ case $host_cpu in
+ hppa*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ ia64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ esac
+ ;;
+
+irix5* | irix6*)
+ case $host_os in
+ irix5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"]
+ ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ case $host_cpu in
+ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | x86_64*)
+ lt_cv_deplibs_check_method=pass_all ;;
+ # NB 2003-06-03: According to Alexandre Oliva, x86_64 should not be
+ # in this list. However, it works around a libtool problem that
+ # wrongly excludes -ldl/-lpthread from the libmudflap(th) dependencies.
+ *)
+ # glibc up to 2.1.1 does not perform some relocations on ARM
+ lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
+ else
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$']
+ fi
+ ;;
+
+newsos6)
+ [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+osf3* | osf4* | osf5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+
+[sysv5uw[78]* | sysv4*uw2*)]
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ case $host_vendor in
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ motorola)
+ lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]']
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ esac
+ ;;
+esac
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+# NB: See above NB ... this is to make sure that the overriden
+# local libtool variant doesn't pollute the upstream cache
+unset lt_cv_file_magic_cmd
+unset lt_cv_deplibs_check_method
+AC_MSG_RESULT($deplibs_check_method)
+])
+
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm=$ac_dir/${ac_tool_prefix}nm
+ if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ else
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments. Note that LIBLTDL and INCLTDL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
+# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
+# with '${top_builddir}/' and INCLTDL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case $enable_ltdl_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
+# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!). If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ INCLTDL=
+ fi
+])
+
+# If this macro is not defined by Autoconf, define it here.
+ifdef([AC_PROVIDE_IFELSE],
+ [],
+ [define([AC_PROVIDE_IFELSE],
+ [ifdef([AC_PROVIDE_$1],
+ [$2], [$3])])])
+
+# AC_LIBTOOL_CXX - enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])])
+
+AC_DEFUN([_AC_LIBTOOL_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
+dnl is set to the C++ compiler.
+AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
+|| AC_MSG_ERROR([libtool tag configuration failed])
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+# AC_LIBTOOL_GCJ - enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])])
+
+AC_DEFUN([_AC_LIBTOOL_GCJ],
+[AC_REQUIRE([AC_PROG_LIBTOOL])
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
+dnl is set to the C++ compiler.
+AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
+|| AC_MSG_ERROR([libtool tag configuration failed])
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+dnl old names
+AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)
+])
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN(AM_INIT_AUTOMAKE,
+[AC_REQUIRE([AC_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN(AM_SANITY_CHECK,
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN(AM_MISSING_PROG,
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# serial 1
+
+AC_DEFUN(AM_MAINTAINER_MODE,
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode is disabled by default
+ AC_ARG_ENABLE(maintainer-mode,
+[ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ USE_MAINTAINER_MODE=$enableval,
+ USE_MAINTAINER_MODE=no)
+ AC_MSG_RESULT($USE_MAINTAINER_MODE)
+ AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST(MAINT)dnl
+]
+)
+
+# Define a conditional.
+
+AC_DEFUN(AM_CONDITIONAL,
+[AC_SUBST($1_TRUE)
+AC_SUBST($1_FALSE)
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN(AM_CONFIG_HEADER,
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated. We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+ case " <<$>>CONFIG_HEADERS " in
+ *" <<$>>am_file "*<<)>>
+ echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+ ;;
+ esac
+ am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
diff --git a/libmudflap/config.h.in b/libmudflap/config.h.in
new file mode 100644
index 00000000000..ebb7360df60
--- /dev/null
+++ b/libmudflap/config.h.in
@@ -0,0 +1,62 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if you have the backtrace function. */
+#undef HAVE_BACKTRACE
+
+/* Define if you have the backtrace_symbols function. */
+#undef HAVE_BACKTRACE_SYMBOLS
+
+/* Define if you have the dlvsym function. */
+#undef HAVE_DLVSYM
+
+/* Define if you have the fopen64 function. */
+#undef HAVE_FOPEN64
+
+/* Define if you have the fseeko64 function. */
+#undef HAVE_FSEEKO64
+
+/* Define if you have the ftello64 function. */
+#undef HAVE_FTELLO64
+
+/* Define if you have the gettimeofday function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if you have the signal function. */
+#undef HAVE_SIGNAL
+
+/* Define if you have the stat64 function. */
+#undef HAVE_STAT64
+
+/* Define if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define if you have the <execinfo.h> header file. */
+#undef HAVE_EXECINFO_H
+
+/* Define if you have the <signal.h> header file. */
+#undef HAVE_SIGNAL_H
+
+/* Define if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define if you have the dl library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Name of package */
+#undef PACKAGE
+
+/* Version number of package */
+#undef VERSION
+
+/* union semun defined in sys/ipc.h or sys/sem.h */
+#undef HAVE_UNION_SEMUN
+
+/* Define it socklen_t typedef is in sys/socket.h. */
+#undef HAVE_SOCKLEN_T
+
+/* define if you have <pthread.h> */
+#undef HAVE_PTHREAD_H
+
+/* pthread_create symbol version */
+#undef PTHREAD_CREATE_VERSION
+
diff --git a/libmudflap/configure b/libmudflap/configure
new file mode 100755
index 00000000000..71259c4ce75
--- /dev/null
+++ b/libmudflap/configure
@@ -0,0 +1,3218 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer"
+ac_help="$ac_help
+ --enable-shared[=PKGS] build shared libraries [default=yes]"
+ac_help="$ac_help
+ --enable-static[=PKGS] build static libraries [default=yes]"
+ac_help="$ac_help
+ --enable-fast-install[=PKGS] optimize for fast installation [default=yes]"
+ac_help="$ac_help
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]"
+ac_help="$ac_help
+ --disable-libtool-lock avoid locking (might break parallel builds)"
+ac_help="$ac_help
+ --with-pic try to use only PIC/non-PIC objects [default=use both]"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=mf-runtime.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+ac_aux_dir=
+for ac_dir in ${GNUSYSTEM_AUX_DIR} $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+# configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+# same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+# as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:587: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:608: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+ case $nonopt in
+ NONE) target_alias=$host_alias ;;
+ *) target_alias=$nonopt ;;
+ esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:626: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:660: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:713: checking whether build environment is sane" >&5
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "$*" != "X $srcdir/configure conftestfile" \
+ && test "$*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" 1>&2; exit 1; }
+ fi
+
+ test "$2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
+fi
+rm -f conftest*
+echo "$ac_t""yes" 1>&6
+if test "$program_transform_name" = s,x,x,; then
+ program_transform_name=
+else
+ # Double any \ or $. echo might interpret backslashes.
+ cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+ program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:770: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+PACKAGE=libmudflap
+
+VERSION=1.0
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
+fi
+cat >> confdefs.h <<EOF
+#define PACKAGE "$PACKAGE"
+EOF
+
+cat >> confdefs.h <<EOF
+#define VERSION "$VERSION"
+EOF
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
+echo "configure:816: checking for working aclocal" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (aclocal --version) < /dev/null > /dev/null 2>&1; then
+ ACLOCAL=aclocal
+ echo "$ac_t""found" 1>&6
+else
+ ACLOCAL="$missing_dir/missing aclocal"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
+echo "configure:829: checking for working autoconf" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
+ AUTOCONF=autoconf
+ echo "$ac_t""found" 1>&6
+else
+ AUTOCONF="$missing_dir/missing autoconf"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working automake""... $ac_c" 1>&6
+echo "configure:842: checking for working automake" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (automake --version) < /dev/null > /dev/null 2>&1; then
+ AUTOMAKE=automake
+ echo "$ac_t""found" 1>&6
+else
+ AUTOMAKE="$missing_dir/missing automake"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
+echo "configure:855: checking for working autoheader" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoheader --version) < /dev/null > /dev/null 2>&1; then
+ AUTOHEADER=autoheader
+ echo "$ac_t""found" 1>&6
+else
+ AUTOHEADER="$missing_dir/missing autoheader"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
+echo "configure:868: checking for working makeinfo" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
+ MAKEINFO=makeinfo
+ echo "$ac_t""found" 1>&6
+else
+ MAKEINFO="$missing_dir/missing makeinfo"
+ echo "$ac_t""missing" 1>&6
+fi
+
+
+
+
+# For libtool versioning info, format is CURRENT:REVISION:AGE
+libtool_VERSION=1:0:0
+
+
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:888: checking whether to enable maintainer-specific portions of Makefiles" >&5
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:911: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 916 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_cygwin=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:944: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 949 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:956: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_mingw32=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:975: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+ ac_cv_exeext=.exe
+else
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.$ac_ext
+ ac_cv_exeext=
+ if { (eval echo configure:985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj) ;;
+ *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ else
+ { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+ fi
+ rm -f conftest*
+ test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+
+target_alias=${target_alias-$target}
+
+
+
+
+
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1023: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1053: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1104: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1136: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1147 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1178: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1183: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1192: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1211: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+if test "x$GCC" != "xyes"; then
+ { echo "configure: error: libmudflap must be built with GCC" 1>&2; exit 1; }
+fi
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1246: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1261 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1267: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1278 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1295 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1301: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+
+# Some hosts don't have dlsym(RTLD_NEXT, "symbol") for use in
+# symbol interposition. We disable shared libraries for these.
+echo $ac_n "checking whether dlsym(RTLD_NEXT,...) is available""... $ac_c" 1>&6
+echo "configure:1329: checking whether dlsym(RTLD_NEXT,...) is available" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1331 "configure"
+#include "confdefs.h"
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+
+int main() {
+void *foo = dlsym (RTLD_NEXT, "exit");
+; return 0; }
+EOF
+if { (eval echo configure:1341: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+enable_shared=no
+fi
+rm -f conftest*
+
+for ac_hdr in stdint.h execinfo.h signal.h dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1357: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1362 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1367: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in backtrace backtrace_symbols gettimeofday signal
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1396: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1401 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+for ac_func in fopen64 fseeko64 ftello64 stat64
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1452: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1457 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+cat > conftest.$ac_ext <<EOF
+#line 1506 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+int main() {
+union semun foo;
+; return 0; }
+EOF
+if { (eval echo configure:1515: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ mf_have_semun=1
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ mf_have_semun=0
+fi
+rm -f conftest*
+if test $mf_have_semun = 1
+then
+ cat >> confdefs.h <<\EOF
+#define HAVE_UNION_SEMUN 1
+EOF
+
+fi
+
+
+echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
+echo "configure:1535: checking for socklen_t in sys/socket.h" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1537 "configure"
+#include "confdefs.h"
+#define _POSIX_PII_SOCKET
+#include <sys/types.h>
+#include <sys/socket.h>
+int main() {
+socklen_t x = 5;
+; return 0; }
+EOF
+if { (eval echo configure:1546: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ cat >> confdefs.h <<\EOF
+#define HAVE_SOCKLEN_T 1
+EOF
+
+ echo "$ac_t""yes" 1>&6
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=yes
+fi
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:1643: checking for ld used by GCC" >&5
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:1673: checking for GNU ld" >&5
+else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:1676: checking for non-GNU ld" >&5
+fi
+if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ echo "$ac_t""$LD" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:1711: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ lt_cv_prog_gnu_ld=yes
+else
+ lt_cv_prog_gnu_ld=no
+fi
+fi
+
+echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
+echo "configure:1728: checking for $LD option to reload object files" >&5
+if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+
+echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:1740: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm=$ac_dir/${ac_tool_prefix}nm
+ if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ else
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+
+NM="$lt_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:1778: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
+echo "configure:1799: checking how to recognise dependant libraries" >&5
+lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi4*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin* | mingw* |pw32*)
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.012)
+ lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
+ ;;
+
+freebsd* )
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20*|hpux11*)
+ case $host_cpu in
+ hppa*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ esac
+ ;;
+
+irix5* | irix6*)
+ case $host_os in
+ irix5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+ ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ case $host_cpu in
+ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | x86_64*)
+ lt_cv_deplibs_check_method=pass_all ;;
+ # NB 2003-06-03: According to Alexandre Oliva, x86_64 should not be
+ # in this list. However, it works around a libtool problem that
+ # wrongly excludes -ldl/-lpthread from the libmudflap(th) dependencies.
+ *)
+ # glibc up to 2.1.1 does not perform some relocations on ARM
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
+ fi
+ ;;
+
+newsos6)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+osf3* | osf4* | osf5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+
+sysv5uw[78]* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ case $host_vendor in
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ esac
+ ;;
+esac
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+# NB: See above NB ... this is to make sure that the overriden
+# local libtool variant doesn't pollute the upstream cache
+unset lt_cv_file_magic_cmd
+unset lt_cv_deplibs_check_method
+echo "$ac_t""$deplibs_check_method" 1>&6
+
+echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+echo "configure:1973: checking for object suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftest*
+echo 'int i = 1;' > conftest.$ac_ext
+if { (eval echo configure:1979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c) ;;
+ *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+ esac
+ done
+else
+ { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_objext" 1>&6
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
+
+if test $host != $build; then
+ ac_tool_prefix=${host_alias}-
+else
+ ac_tool_prefix=
+fi
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
+echo "configure:2009: checking for ${ac_tool_prefix}file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="/usr/bin:$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ echo $ac_n "checking for file""... $ac_c" 1>&6
+echo "configure:2071: checking for file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="/usr/bin:$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2142: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2174: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+ RANLIB=":"
+fi
+fi
+
+# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2209: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+ echo "$ac_t""$STRIP" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_STRIP"; then
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2241: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_STRIP="strip"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+ echo "$ac_t""$STRIP" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+ STRIP=":"
+fi
+fi
+
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+libtool_flags="$libtool_flags --enable-dlopen"
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+ :
+fi
+
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+ withval="$with_pic"
+ pic_mode="$withval"
+else
+ pic_mode=default
+fi
+
+test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
+test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 2308 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo configure:2328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case "`/usr/bin/file conftest.o`" in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo configure:2344: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:2388: checking whether the C compiler needs -belf" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+ ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ cat > conftest.$ac_ext <<EOF
+#line 2401 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:2408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+ ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+
+esac
+
+
+# Save cache, so that ltconfig can load it
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
+|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
+
+
+
+
+
+
+
+
+ac_safe=`echo "stdint.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for stdint.h""... $ac_c" 1>&6
+echo "configure:2528: checking for stdint.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2533 "configure"
+#include "confdefs.h"
+#include <stdint.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2538: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ MF_HAVE_STDINT_H=1
+else
+ echo "$ac_t""no" 1>&6
+MF_HAVE_STDINT_H=0
+fi
+
+
+if test $MF_HAVE_STDINT_H = 1
+then
+ MF_HAVE_UINTPTR_T=1
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2566 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int main() {
+uintptr_t k = 0;
+; return 0; }
+EOF
+if { (eval echo configure:2573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ MF_HAVE_UINTPTR_T=1
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ MF_HAVE_UINTPTR_T=0
+fi
+rm -f conftest*
+fi
+
+
+if test ! -d pth
+then
+ # libmudflapth objects are built in this subdirectory
+ mkdir pth
+fi
+
+pthread_create_version='""'
+ac_safe=`echo "pthread.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for pthread.h""... $ac_c" 1>&6
+echo "configure:2595: checking for pthread.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2600 "configure"
+#include "confdefs.h"
+#include <pthread.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+
+cat >> confdefs.h <<EOF
+#define HAVE_PTHREAD_H 1
+EOF
+
+ac_have_pthread_h=yes
+
+else
+ echo "$ac_t""no" 1>&6
+
+ac_have_pthread_h=
+
+fi
+
+
+
+if test "x$ac_have_pthread_h" != ""; then
+ LIBMUDFLAPTH_TRUE=
+ LIBMUDFLAPTH_FALSE='#'
+else
+ LIBMUDFLAPTH_TRUE='#'
+ LIBMUDFLAPTH_FALSE=
+fi
+
+echo $ac_n "checking for dlsym in -ldl""... $ac_c" 1>&6
+echo "configure:2646: checking for dlsym in -ldl" >&5
+ac_lib_var=`echo dl'_'dlsym | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2654 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlsym();
+
+int main() {
+dlsym()
+; return 0; }
+EOF
+if { (eval echo configure:2665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-ldl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+if test "x$enable_shared" = "xyes" && test "x$ac_have_pthread_h" != ""; then
+ # NB: don't check for -lpthread here, because then it would be
+ # added to LIBS. For the thread-unaware libmudflap.la, we don't
+ # want it there.
+
+ # glibc-related hacks. dlsym() may pick the wrong version of
+ # interposed functions like pthread_create on modern glibc.
+ # We need to find the proper symbol version string, and use
+ # the nonstandard dlvsym().
+ for ac_func in dlvsym
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2705: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2710 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ # Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nm; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2760: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$NM"; then
+ ac_cv_prog_NM="$NM" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_NM="${ac_tool_prefix}nm"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_NM" && ac_cv_prog_NM="nm"
+fi
+fi
+NM="$ac_cv_prog_NM"
+if test -n "$NM"; then
+ echo "$ac_t""$NM" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+ if test "x$ac_cv_have_dlvsym" != ""; then
+ # Try compiling a simple pthreads program. Find the shared libraries it
+ # ends up with. Then use "nm" on those libraries to extract the
+ # default symbol versioning suffix ("@@"), if any. But that's tricky.
+ # Rather, run nm on the resulting executable. Unfortunately, autoconf
+ # doesn't appear to have a macro that builds a test executable for
+ # subsequent analysis ... so we do it by hand here.
+ cat >> conftest.c << EOF
+#include <pthread.h>
+int main () { void *p = (void *) & pthread_create; return (int) p; }
+EOF
+ oldLIBS="$LIBS"
+ LIBS="$LIBS -lpthread"
+ pthread_create_version="\"\""
+ echo $ac_n "checking pthread_create symbol version""... $ac_c" 1>&6
+echo "configure:2804: checking pthread_create symbol version" >&5
+ if eval $ac_link 2>&5 && test -s conftest${ac_exeext}; then
+ version=`$NM conftest${ac_exeect} | grep 'pthread_create@@' | sed -e 's/^.*@@//'`
+ if test "x$version" != "x"; then
+ pthread_create_version="\"$version\""
+ fi
+ fi
+ echo "$ac_t""$pthread_create_version" 1>&6
+ LIBS="$oldLIBS"
+ fi
+fi
+cat >> confdefs.h <<EOF
+#define PTHREAD_CREATE_VERSION $pthread_create_version
+EOF
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile testsuite/Makefile mf-runtime.h config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@PACKAGE@%$PACKAGE%g
+s%@VERSION@%$VERSION%g
+s%@ACLOCAL@%$ACLOCAL%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOMAKE@%$AUTOMAKE%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@libtool_VERSION@%$libtool_VERSION%g
+s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
+s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
+s%@MAINT@%$MAINT%g
+s%@EXEEXT@%$EXEEXT%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@LN_S@%$LN_S%g
+s%@OBJEXT@%$OBJEXT%g
+s%@RANLIB@%$RANLIB%g
+s%@STRIP@%$STRIP%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@enable_shared@%$enable_shared%g
+s%@enable_static@%$enable_static%g
+s%@MF_HAVE_STDINT_H@%$MF_HAVE_STDINT_H%g
+s%@MF_HAVE_UINTPTR_T@%$MF_HAVE_UINTPTR_T%g
+s%@LIBMUDFLAPTH_TRUE@%$LIBMUDFLAPTH_TRUE%g
+s%@LIBMUDFLAPTH_FALSE@%$LIBMUDFLAPTH_FALSE%g
+s%@NM@%$NM%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile testsuite/Makefile mf-runtime.h"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/libmudflap/configure.in b/libmudflap/configure.in
new file mode 100644
index 00000000000..afdde6c52a8
--- /dev/null
+++ b/libmudflap/configure.in
@@ -0,0 +1,137 @@
+# Process this file with autoconf to produce a configure script, like so:
+# aclocal && autoconf && autoheader && automake
+
+AC_PREREQ(2.13)
+AC_INIT(mf-runtime.c)
+AC_CANONICAL_SYSTEM
+AM_INIT_AUTOMAKE(libmudflap, 1.0)
+
+AC_SUBST(PACKAGE)
+# For libtool versioning info, format is CURRENT:REVISION:AGE
+libtool_VERSION=1:0:0
+AC_SUBST(libtool_VERSION)
+
+dnl AM_ENABLE_MULTILIB
+AM_MAINTAINER_MODE
+AC_EXEEXT
+
+target_alias=${target_alias-$target}
+AC_SUBST(target_alias)
+
+AM_CONFIG_HEADER(config.h)
+
+AC_LANG_C
+AC_PROG_CC
+if test "x$GCC" != "xyes"; then
+ AC_MSG_ERROR([libmudflap must be built with GCC])
+fi
+AC_PROG_CPP
+
+# Some hosts don't have dlsym(RTLD_NEXT, "symbol") for use in
+# symbol interposition. We disable shared libraries for these.
+AC_MSG_CHECKING([whether dlsym(RTLD_NEXT,...) is available])
+AC_TRY_COMPILE([
+#define _GNU_SOURCE
+#include <dlfcn.h>
+],
+[void *foo = dlsym (RTLD_NEXT, "exit");],
+[AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)
+enable_shared=no])
+
+AC_CHECK_HEADERS(stdint.h execinfo.h signal.h dlfcn.h)
+AC_CHECK_FUNCS(backtrace backtrace_symbols gettimeofday signal)
+
+dnl Check for 64-bit stdio calls related to Large File Support
+AC_CHECK_FUNCS(fopen64 fseeko64 ftello64 stat64)
+
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>],[union semun foo;], [mf_have_semun=1], [mf_have_semun=0])
+if test $mf_have_semun = 1
+then
+ AC_DEFINE(HAVE_UNION_SEMUN, 1, [union semun defined in sys/ipc.h or sys/sem.h])
+fi
+
+
+AC_MSG_CHECKING([for socklen_t in sys/socket.h])
+AC_TRY_COMPILE([#define _POSIX_PII_SOCKET
+#include <sys/types.h>
+#include <sys/socket.h>], [socklen_t x = 5;],
+ [AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define it socklen_t typedef is in sys/socket.h.])
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)])
+
+AC_LIBTOOL_DLOPEN
+AM_PROG_LIBTOOL
+AC_SUBST(enable_shared)
+AC_SUBST(enable_static)
+
+AC_CHECK_HEADER(stdint.h, [MF_HAVE_STDINT_H=1], [MF_HAVE_STDINT_H=0])
+AC_SUBST(MF_HAVE_STDINT_H)
+if test $MF_HAVE_STDINT_H = 1
+then
+ MF_HAVE_UINTPTR_T=1
+else
+ AC_TRY_COMPILE([#include <sys/types.h>], [uintptr_t k = 0;],
+ [MF_HAVE_UINTPTR_T=1], [MF_HAVE_UINTPTR_T=0])
+fi
+AC_SUBST(MF_HAVE_UINTPTR_T)
+
+if test ! -d pth
+then
+ # libmudflapth objects are built in this subdirectory
+ mkdir pth
+fi
+
+pthread_create_version='""'
+AC_CHECK_HEADER(pthread.h,[
+AC_DEFINE_UNQUOTED(HAVE_PTHREAD_H, 1, [define if you have <pthread.h>])
+ac_have_pthread_h=yes
+],[
+ac_have_pthread_h=
+])
+AM_CONDITIONAL(LIBMUDFLAPTH, [test "x$ac_have_pthread_h" != ""])
+
+AC_CHECK_LIB(dl, dlsym)
+
+if test "x$enable_shared" = "xyes" && test "x$ac_have_pthread_h" != ""; then
+ # NB: don't check for -lpthread here, because then it would be
+ # added to LIBS. For the thread-unaware libmudflap.la, we don't
+ # want it there.
+
+ # glibc-related hacks. dlsym() may pick the wrong version of
+ # interposed functions like pthread_create on modern glibc.
+ # We need to find the proper symbol version string, and use
+ # the nonstandard dlvsym().
+ AC_CHECK_FUNCS(dlvsym)
+ AC_CHECK_TOOL(NM, nm)
+ if test "x$ac_cv_have_dlvsym" != ""; then
+ # Try compiling a simple pthreads program. Find the shared libraries it
+ # ends up with. Then use "nm" on those libraries to extract the
+ # default symbol versioning suffix ("@@"), if any. But that's tricky.
+ # Rather, run nm on the resulting executable. Unfortunately, autoconf
+ # doesn't appear to have a macro that builds a test executable for
+ # subsequent analysis ... so we do it by hand here.
+ cat >> conftest.c << EOF
+#include <pthread.h>
+int main () { void *p = (void *) & pthread_create; return (int) p; }
+EOF
+ oldLIBS="$LIBS"
+ LIBS="$LIBS -lpthread"
+ pthread_create_version="\"\""
+ AC_MSG_CHECKING(pthread_create symbol version)
+ if eval $ac_link 2>&5 && test -s conftest${ac_exeext}; then
+ version=`$NM conftest${ac_exeect} | grep 'pthread_create@@' | sed -e 's/^.*@@//'`
+ if test "x$version" != "x"; then
+ pthread_create_version="\"$version\""
+ fi
+ fi
+ AC_MSG_RESULT($pthread_create_version)
+ LIBS="$oldLIBS"
+ fi
+fi
+AC_DEFINE_UNQUOTED(PTHREAD_CREATE_VERSION, $pthread_create_version, [pthread_create symbol version])
+
+
+AC_OUTPUT([Makefile testsuite/Makefile mf-runtime.h])
diff --git a/libmudflap/mf-heuristics.c b/libmudflap/mf-heuristics.c
new file mode 100644
index 00000000000..5231a08253a
--- /dev/null
+++ b/libmudflap/mf-heuristics.c
@@ -0,0 +1,174 @@
+/* Mudflap: narrow-pointer bounds-checking by tree rewriting.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Contributed by Frank Ch. Eigler <fche@redhat.com>
+ and Graydon Hoare <graydon@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+GCC 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. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+
+#include "config.h"
+
+#include <stdio.h>
+
+#include "mf-runtime.h"
+#include "mf-impl.h"
+
+#ifdef _MUDFLAP
+#error "Do not compile this file with -fmudflap!"
+#endif
+
+
+extern char _end;
+extern char _start;
+
+
+/* Run some quick validation of the given region.
+ Return -1 / 0 / 1 if the access known-invalid, possibly-valid, or known-valid.
+*/
+int
+__mf_heuristic_check (uintptr_t ptr, uintptr_t ptr_high)
+{
+ VERBOSE_TRACE ("mf: heuristic check\n");
+
+ /* XXX: Disable the stack bounding check for libmudflapth. We do
+ actually have enough information to track stack bounds (see
+ __mf_pthread_info in mf-hooks.c), so with a bit of future work,
+ this heuristic can be turned on. */
+#ifndef LIBMUDFLAPTH
+
+ /* The first heuristic is to check stack bounds. This is a
+ transient condition and quick to check. */
+ if (__mf_opts.heur_stack_bound)
+ {
+ uintptr_t stack_top_guess = (uintptr_t)__builtin_frame_address(0);
+#if defined(__i386__) && defined (__linux__)
+ uintptr_t stack_segment_base = 0xC0000000; /* XXX: Bad assumption. */
+#else
+ /* Cause tests to fail. */
+ uintptr_t stack_segment_base = 0;
+#endif
+
+ VERBOSE_TRACE ("mf: stack estimated as %p-%p\n",
+ (void *) stack_top_guess, (void *) stack_segment_base);
+
+ if (ptr_high <= stack_segment_base &&
+ ptr >= stack_top_guess &&
+ ptr_high >= ptr)
+ {
+ return 1;
+ }
+ }
+#endif
+
+
+ /* The second heuristic is to scan the range of memory regions
+ listed in /proc/self/maps, a special file provided by the Linux
+ kernel. Its results may be cached, and in fact, a GUESS object
+ may as well be recorded for interesting matching sections. */
+ if (__mf_opts.heur_proc_map)
+ {
+ /* Keep a record of seen records from /proc/self/map. */
+ enum { max_entries = 500 };
+ struct proc_self_map_entry
+ {
+ uintptr_t low;
+ uintptr_t high;
+ };
+ static struct proc_self_map_entry entry [max_entries];
+ static unsigned entry_used [max_entries];
+
+ /* Look for a known proc_self_map entry that may cover this
+ region. If one exists, then this heuristic has already run,
+ and should not be run again. The check should be allowed to
+ fail. */
+ unsigned i;
+ unsigned deja_vu = 0;
+ for (i=0; i<max_entries; i++)
+ {
+ if (entry_used[i] &&
+ (entry[i].low <= ptr) &&
+ (entry[i].high >= ptr_high))
+ deja_vu = 1;
+ }
+
+ if (! deja_vu)
+ {
+ /* Time to run the heuristic. Rescan /proc/self/maps; update the
+ entry[] array; XXX: remove expired entries, add new ones.
+ XXX: Consider entries that have grown (e.g., stack). */
+ char buf[512];
+ char flags[4];
+ void *low, *high;
+ FILE *fp;
+
+ fp = fopen ("/proc/self/maps", "r");
+ if (fp)
+ {
+ while (fgets (buf, sizeof(buf), fp))
+ {
+ if (sscanf (buf, "%p-%p %4c", &low, &high, flags) == 3)
+ {
+ if ((uintptr_t) low <= ptr &&
+ (uintptr_t) high >= ptr_high)
+ {
+ for (i=0; i<max_entries; i++)
+ {
+ if (! entry_used[i])
+ {
+ entry[i].low = (uintptr_t) low;
+ entry[i].high = (uintptr_t) high;
+ entry_used[i] = 1;
+ break;
+ }
+ }
+
+ VERBOSE_TRACE ("mf: registering region #%d "
+ "%p-%p given %s",
+ i, (void *) low, (void *) high, buf);
+
+ __mfu_register ((void *) low, (size_t) (high-low),
+ __MF_TYPE_GUESS,
+ "/proc/self/maps segment");
+
+ return 0; /* undecided (tending to cachable) */
+ }
+ }
+ }
+ fclose (fp);
+ }
+ }
+ }
+
+
+ /* The third heuristic is to approve all accesses between _start and _end,
+ which should include all text and initialized data. */
+ if (__mf_opts.heur_start_end)
+ if (ptr >= (uintptr_t) & _start && ptr_high <= (uintptr_t) & _end)
+ return 1; /* uncacheable */
+
+ return 0; /* unknown */
+}
diff --git a/libmudflap/mf-hooks1.c b/libmudflap/mf-hooks1.c
new file mode 100644
index 00000000000..7199472ebe1
--- /dev/null
+++ b/libmudflap/mf-hooks1.c
@@ -0,0 +1,478 @@
+/* Mudflap: narrow-pointer bounds-checking by tree rewriting.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Contributed by Frank Ch. Eigler <fche@redhat.com>
+ and Graydon Hoare <graydon@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+GCC 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. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+
+#include "config.h"
+
+#ifndef HAVE_SOCKLEN_T
+#define socklen_t int
+#endif
+
+
+/* These attempt to coax various unix flavours to declare all our
+ needed tidbits in the system headers. */
+#if !defined(__FreeBSD__) && !defined(__APPLE__)
+#define _POSIX_SOURCE
+#endif /* Some BSDs break <sys/socket.h> if this is defined. */
+#define _GNU_SOURCE
+#define _XOPEN_SOURCE
+#define _BSD_TYPES
+#define __EXTENSIONS__
+#define _ALL_SOURCE
+#define _LARGE_FILE_API
+#define _XOPEN_SOURCE_EXTENDED 1
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <time.h>
+
+#include "mf-runtime.h"
+#include "mf-impl.h"
+
+#ifdef _MUDFLAP
+#error "Do not compile this file with -fmudflap!"
+#endif
+
+
+/* Memory allocation related hook functions. Some of these are
+ intercepted via linker wrapping or symbol interposition. Others
+ use plain macros in mf-runtime.h. */
+
+
+#ifdef WRAP_malloc
+
+#if PIC
+/* A special bootstrap variant. */
+void *
+__mf_0fn_malloc (size_t c)
+{
+ /* fprintf (stderr, "0fn malloc c=%lu\n", c); */
+ return NULL;
+}
+#endif
+
+#undef malloc
+WRAPPER(void *, malloc, size_t c)
+{
+ size_t size_with_crumple_zones;
+ DECLARE(void *, malloc, size_t c);
+ void *result;
+ BEGIN_PROTECT (malloc, c);
+
+ size_with_crumple_zones =
+ CLAMPADD(c,CLAMPADD(__mf_opts.crumple_zone,
+ __mf_opts.crumple_zone));
+ result = (char *) CALL_REAL (malloc, size_with_crumple_zones);
+
+ if (LIKELY(result))
+ {
+ result += __mf_opts.crumple_zone;
+ __mf_register (result, c, __MF_TYPE_HEAP, "malloc region");
+ /* XXX: register __MF_TYPE_NOACCESS for crumple zones. */
+ }
+
+ return result;
+}
+#endif
+
+
+#ifdef WRAP_calloc
+
+#ifdef PIC
+/* A special bootstrap variant. */
+void *
+__mf_0fn_calloc (size_t c, size_t n)
+{
+ enum foo { BS = 4096, NB=10 };
+ static char bufs[NB][BS];
+ static unsigned bufs_used[NB];
+ unsigned i;
+
+ /* fprintf (stderr, "0fn calloc c=%lu n=%lu\n", c, n); */
+ for (i=0; i<NB; i++)
+ {
+ if (! bufs_used[i] && (c*n) < BS)
+ {
+ bufs_used[i] = 1;
+ return & bufs[i][0];
+ }
+ }
+ return NULL;
+}
+#endif
+
+#undef calloc
+WRAPPER(void *, calloc, size_t c, size_t n)
+{
+ size_t size_with_crumple_zones;
+ DECLARE(void *, calloc, size_t, size_t);
+ DECLARE(void *, malloc, size_t);
+ DECLARE(void *, memset, void *, int, size_t);
+ char *result;
+ BEGIN_PROTECT (calloc, c, n);
+
+ size_with_crumple_zones =
+ CLAMPADD((c * n), /* XXX: CLAMPMUL */
+ CLAMPADD(__mf_opts.crumple_zone,
+ __mf_opts.crumple_zone));
+ result = (char *) CALL_REAL (malloc, size_with_crumple_zones);
+
+ if (LIKELY(result))
+ memset (result, 0, size_with_crumple_zones);
+
+ if (LIKELY(result))
+ {
+ result += __mf_opts.crumple_zone;
+ __mf_register (result, c*n /* XXX: clamp */, __MF_TYPE_HEAP_I, "calloc region");
+ /* XXX: register __MF_TYPE_NOACCESS for crumple zones. */
+ }
+
+ return result;
+}
+#endif
+
+#ifdef WRAP_realloc
+
+#if PIC
+/* A special bootstrap variant. */
+void *
+__mf_0fn_realloc (void *buf, size_t c)
+{
+ return NULL;
+}
+#endif
+
+#undef realloc
+WRAPPER(void *, realloc, void *buf, size_t c)
+{
+ DECLARE(void * , realloc, void *, size_t);
+ size_t size_with_crumple_zones;
+ char *base = buf;
+ unsigned saved_wipe_heap;
+ char *result;
+ BEGIN_PROTECT (realloc, buf, c);
+
+ if (LIKELY(buf))
+ base -= __mf_opts.crumple_zone;
+
+ size_with_crumple_zones =
+ CLAMPADD(c, CLAMPADD(__mf_opts.crumple_zone,
+ __mf_opts.crumple_zone));
+ result = (char *) CALL_REAL (realloc, base, size_with_crumple_zones);
+
+ /* Ensure heap wiping doesn't occur during this peculiar
+ unregister/reregister pair. */
+ LOCKTH ();
+ __mf_state = reentrant;
+ saved_wipe_heap = __mf_opts.wipe_heap;
+ __mf_opts.wipe_heap = 0;
+
+ if (LIKELY(buf))
+ __mfu_unregister (buf, 0);
+
+ if (LIKELY(result))
+ {
+ result += __mf_opts.crumple_zone;
+ __mfu_register (result, c, __MF_TYPE_HEAP_I, "realloc region");
+ /* XXX: register __MF_TYPE_NOACCESS for crumple zones. */
+ }
+
+ /* Restore previous setting. */
+ __mf_opts.wipe_heap = saved_wipe_heap;
+
+ __mf_state = active;
+ UNLOCKTH ();
+
+ return result;
+}
+#endif
+
+
+#ifdef WRAP_free
+
+#if PIC
+/* A special bootstrap variant. */
+void
+__mf_0fn_free (void *buf)
+{
+ return;
+}
+#endif
+
+#undef free
+WRAPPER(void, free, void *buf)
+{
+ /* Use a circular queue to delay some number (__mf_opts.free_queue_length) of free()s. */
+ static void *free_queue [__MF_FREEQ_MAX];
+ static unsigned free_ptr = 0;
+ static int freeq_initialized = 0;
+ DECLARE(void, free, void *);
+
+ BEGIN_PROTECT (free, buf);
+
+ if (UNLIKELY(buf == NULL))
+ return;
+
+ LOCKTH ();
+ if (UNLIKELY(!freeq_initialized))
+ {
+ memset (free_queue, 0,
+ __MF_FREEQ_MAX * sizeof (void *));
+ freeq_initialized = 1;
+ }
+ UNLOCKTH ();
+
+ __mf_unregister (buf, 0);
+
+ if (UNLIKELY(__mf_opts.free_queue_length > 0))
+ {
+ char *freeme = NULL;
+ LOCKTH ();
+ if (free_queue [free_ptr] != NULL)
+ {
+ freeme = free_queue [free_ptr];
+ freeme -= __mf_opts.crumple_zone;
+ }
+ free_queue [free_ptr] = buf;
+ free_ptr = (free_ptr == (__mf_opts.free_queue_length-1) ? 0 : free_ptr + 1);
+ UNLOCKTH ();
+ if (freeme)
+ {
+ if (__mf_opts.trace_mf_calls)
+ {
+ VERBOSE_TRACE ("freeing deferred pointer %p (crumple %u)\n",
+ (void *) freeme,
+ __mf_opts.crumple_zone);
+ }
+ CALL_REAL (free, freeme);
+ }
+ }
+ else
+ {
+ /* back pointer up a bit to the beginning of crumple zone */
+ char *base = (char *)buf;
+ base -= __mf_opts.crumple_zone;
+ if (__mf_opts.trace_mf_calls)
+ {
+ VERBOSE_TRACE ("freeing pointer %p = %p - %u\n",
+ (void *) base,
+ (void *) buf,
+ __mf_opts.crumple_zone);
+ }
+ CALL_REAL (free, base);
+ }
+}
+#endif
+
+
+#ifdef WRAP_mmap
+
+#if PIC
+/* A special bootstrap variant. */
+void *
+__mf_0fn_mmap (void *start, size_t l, int prot, int f, int fd, off_t off)
+{
+ return (void *) -1;
+}
+#endif
+
+
+#undef mmap
+WRAPPER(void *, mmap,
+ void *start, size_t length, int prot,
+ int flags, int fd, off_t offset)
+{
+ DECLARE(void *, mmap, void *, size_t, int,
+ int, int, off_t);
+ void *result;
+ BEGIN_PROTECT (mmap, start, length, prot, flags, fd, offset);
+
+ result = CALL_REAL (mmap, start, length, prot,
+ flags, fd, offset);
+
+ /*
+ VERBOSE_TRACE ("mmap (%08lx, %08lx, ...) => %08lx\n",
+ (uintptr_t) start, (uintptr_t) length,
+ (uintptr_t) result);
+ */
+
+ if (result != (void *)-1)
+ {
+ /* Register each page as a heap object. Why not register it all
+ as a single segment? That's so that a later munmap() call
+ can unmap individual pages. XXX: would __MF_TYPE_GUESS make
+ this more automatic? */
+ size_t ps = getpagesize ();
+ uintptr_t base = (uintptr_t) result;
+ uintptr_t offset;
+
+ for (offset=0; offset<length; offset+=ps)
+ {
+ /* XXX: We could map PROT_NONE to __MF_TYPE_NOACCESS. */
+ /* XXX: Unaccessed HEAP pages are reported as leaks. Is this
+ appropriate for unaccessed mmap pages? */
+ __mf_register ((void *) CLAMPADD (base, offset), ps,
+ __MF_TYPE_HEAP_I, "mmap page");
+ }
+ }
+
+ return result;
+}
+#endif
+
+
+#ifdef WRAP_munmap
+
+#if PIC
+/* A special bootstrap variant. */
+int
+__mf_0fn_munmap (void *start, size_t length)
+{
+ return -1;
+}
+#endif
+
+
+#undef munmap
+WRAPPER(int , munmap, void *start, size_t length)
+{
+ DECLARE(int, munmap, void *, size_t);
+ int result;
+ BEGIN_PROTECT (munmap, start, length);
+
+ result = CALL_REAL (munmap, start, length);
+
+ /*
+ VERBOSE_TRACE ("munmap (%08lx, %08lx, ...) => %08lx\n",
+ (uintptr_t) start, (uintptr_t) length,
+ (uintptr_t) result);
+ */
+
+ if (result == 0)
+ {
+ /* Unregister each page as a heap object. */
+ size_t ps = getpagesize ();
+ uintptr_t base = (uintptr_t) start & (~ (ps - 1)); /* page align */
+ uintptr_t offset;
+
+ for (offset=0; offset<length; offset+=ps)
+ __mf_unregister ((void *) CLAMPADD (base, offset), ps);
+ }
+ return result;
+}
+#endif
+
+
+#ifdef WRAP_alloca
+
+/* This wrapper is a little different, as it's called indirectly from
+ __mf_fini also to clean up pending allocations. */
+void *
+__mf_wrap_alloca_indirect (size_t c)
+{
+ DECLARE (void *, malloc, size_t);
+ DECLARE (void, free, void *);
+
+ /* This struct, a linked list, tracks alloca'd objects. The newest
+ object is at the head of the list. If we detect that we've
+ popped a few levels of stack, then the listed objects are freed
+ as needed. NB: The tracking struct is allocated with
+ real_malloc; the user data with wrap_malloc.
+ */
+ struct alloca_tracking { void *ptr; void *stack; struct alloca_tracking* next; };
+ static struct alloca_tracking *alloca_history = NULL;
+
+ void *stack = __builtin_frame_address (0);
+ void *result;
+ struct alloca_tracking *track;
+
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ VERBOSE_TRACE ("alloca stack level %p\n", (void *) stack);
+
+ /* XXX: thread locking! */
+
+ /* Free any previously alloca'd blocks that belong to deeper-nested functions,
+ which must therefore have exited by now. */
+#define DEEPER_THAN < /* for x86 */
+ while (alloca_history &&
+ ((uintptr_t) alloca_history->stack DEEPER_THAN (uintptr_t) stack))
+ {
+ struct alloca_tracking *next = alloca_history->next;
+ __mf_unregister (alloca_history->ptr, 0);
+ CALL_REAL (free, alloca_history->ptr);
+ CALL_REAL (free, alloca_history);
+ alloca_history = next;
+ }
+
+ /* Allocate new block. */
+ result = NULL;
+ if (LIKELY (c > 0)) /* alloca(0) causes no allocation. */
+ {
+ track = (struct alloca_tracking *) CALL_REAL (malloc,
+ sizeof (struct alloca_tracking));
+ if (LIKELY (track != NULL))
+ {
+ result = CALL_REAL (malloc, c);
+ if (UNLIKELY (result == NULL))
+ {
+ CALL_REAL (free, track);
+ /* Too bad. XXX: What about errno? */
+ }
+ else
+ {
+ __mf_register (result, c, __MF_TYPE_HEAP, "alloca region");
+ track->ptr = result;
+ track->stack = stack;
+ track->next = alloca_history;
+ alloca_history = track;
+ }
+ }
+ }
+
+ return result;
+}
+
+
+#undef alloca
+WRAPPER(void *, alloca, size_t c)
+{
+ return __mf_wrap_alloca_indirect (c);
+}
+
+#endif
+
diff --git a/libmudflap/mf-hooks2.c b/libmudflap/mf-hooks2.c
new file mode 100644
index 00000000000..b0867729979
--- /dev/null
+++ b/libmudflap/mf-hooks2.c
@@ -0,0 +1,1767 @@
+/* Mudflap: narrow-pointer bounds-checking by tree rewriting.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Contributed by Frank Ch. Eigler <fche@redhat.com>
+ and Graydon Hoare <graydon@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+GCC 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. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+
+#include "config.h"
+
+#ifndef HAVE_SOCKLEN_T
+#define socklen_t int
+#endif
+
+/* These attempt to coax various unix flavours to declare all our
+ needed tidbits in the system headers. */
+#if !defined(__FreeBSD__) && !defined(__APPLE__)
+#define _POSIX_SOURCE
+#endif /* Some BSDs break <sys/socket.h> if this is defined. */
+#define _GNU_SOURCE
+#define _XOPEN_SOURCE
+#define _BSD_TYPES
+#define __EXTENSIONS__
+#define _ALL_SOURCE
+#define _LARGE_FILE_API
+#define _XOPEN_SOURCE_EXTENDED 1
+
+#include <string.h>
+#include <strings.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <time.h>
+
+#include "mf-runtime.h"
+#include "mf-impl.h"
+
+#ifdef _MUDFLAP
+#error "Do not compile this file with -fmudflap!"
+#endif
+
+
+/* A bunch of independent stdlib/unistd hook functions, all
+ intercepted by mf-runtime.h macros. */
+
+#ifdef __FreeBSD__
+#undef WRAP_memrchr
+#undef WRAP_memmem
+#include <dlfcn.h>
+static inline size_t (strnlen) (const char* str, size_t n)
+{
+ const char *s;
+
+ for (s = str; n && *s; ++s, --n)
+ ;
+ return (s - str);
+}
+#endif
+
+/* str*,mem*,b* */
+
+#ifdef WRAP_memcpy
+WRAPPER2(void *, memcpy, void *dest, const void *src, size_t n)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "memcpy source");
+ MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "memcpy dest");
+ return memcpy (dest, src, n);
+}
+#endif
+
+
+#ifdef WRAP_memmove
+WRAPPER2(void *, memmove, void *dest, const void *src, size_t n)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "memmove src");
+ MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "memmove dest");
+ return memmove (dest, src, n);
+}
+#endif
+
+#ifdef WRAP_memset
+WRAPPER2(void *, memset, void *s, int c, size_t n)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "memset dest");
+ return memset (s, c, n);
+}
+#endif
+
+#ifdef WRAP_memcmp
+WRAPPER2(int, memcmp, const void *s1, const void *s2, size_t n)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "memcmp 1st arg");
+ MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "memcmp 2nd arg");
+ return memcmp (s1, s2, n);
+}
+#endif
+
+#ifdef WRAP_memchr
+WRAPPER2(void *, memchr, const void *s, int c, size_t n)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, n, __MF_CHECK_READ, "memchr region");
+ return memchr (s, c, n);
+}
+#endif
+
+#ifdef WRAP_memrchr
+WRAPPER2(void *, memrchr, const void *s, int c, size_t n)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, n, __MF_CHECK_READ, "memrchr region");
+ return memrchr (s, c, n);
+}
+#endif
+
+#ifdef WRAP_strcpy
+WRAPPER2(char *, strcpy, char *dest, const char *src)
+{
+ /* nb: just because strlen(src) == n doesn't mean (src + n) or (src + n +
+ 1) are valid pointers. the allocated object might have size < n.
+ check anyways. */
+
+ size_t n = strlen (src);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(src, CLAMPADD(n, 1), __MF_CHECK_READ, "strcpy src");
+ MF_VALIDATE_EXTENT(dest, CLAMPADD(n, 1), __MF_CHECK_WRITE, "strcpy dest");
+ return strcpy (dest, src);
+}
+#endif
+
+#ifdef WRAP_strncpy
+WRAPPER2(char *, strncpy, char *dest, const char *src, size_t n)
+{
+ size_t len = strnlen (src, n);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(src, len, __MF_CHECK_READ, "strncpy src");
+ MF_VALIDATE_EXTENT(dest, len, __MF_CHECK_WRITE, "strncpy dest"); /* nb: strNcpy */
+ return strncpy (dest, src, n);
+}
+#endif
+
+#ifdef WRAP_strcat
+WRAPPER2(char *, strcat, char *dest, const char *src)
+{
+ size_t dest_sz;
+ size_t src_sz;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ dest_sz = strlen (dest);
+ src_sz = strlen (src);
+ MF_VALIDATE_EXTENT(src, CLAMPADD(src_sz, 1), __MF_CHECK_READ, "strcat src");
+ MF_VALIDATE_EXTENT(dest, CLAMPADD(dest_sz, CLAMPADD(src_sz, 1)),
+ __MF_CHECK_WRITE, "strcat dest");
+ return strcat (dest, src);
+}
+#endif
+
+#ifdef WRAP_strncat
+WRAPPER2(char *, strncat, char *dest, const char *src, size_t n)
+{
+
+ /* nb: validating the extents (s,n) might be a mistake for two reasons.
+
+ (1) the string s might be shorter than n chars, and n is just a
+ poor choice by the programmer. this is not a "true" error in the
+ sense that the call to strncat would still be ok.
+
+ (2) we could try to compensate for case (1) by calling strlen(s) and
+ using that as a bound for the extent to verify, but strlen might fall off
+ the end of a non-terminated string, leading to a false positive.
+
+ so we will call strnlen(s,n) and use that as a bound.
+
+ if strnlen returns a length beyond the end of the registered extent
+ associated with s, there is an error: the programmer's estimate for n is
+ too large _AND_ the string s is unterminated, in which case they'd be
+ about to touch memory they don't own while calling strncat.
+
+ this same logic applies to further uses of strnlen later down in this
+ file. */
+
+ size_t src_sz;
+ size_t dest_sz;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ src_sz = strnlen (src, n);
+ dest_sz = strnlen (dest, n);
+ MF_VALIDATE_EXTENT(src, src_sz, __MF_CHECK_READ, "strncat src");
+ MF_VALIDATE_EXTENT(dest, (CLAMPADD(dest_sz, CLAMPADD(src_sz, 1))),
+ __MF_CHECK_WRITE, "strncat dest");
+ return strncat (dest, src, n);
+}
+#endif
+
+#ifdef WRAP_strcmp
+WRAPPER2(int, strcmp, const char *s1, const char *s2)
+{
+ size_t s1_sz;
+ size_t s2_sz;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ s1_sz = strlen (s1);
+ s2_sz = strlen (s2);
+ MF_VALIDATE_EXTENT(s1, CLAMPADD(s1_sz, 1), __MF_CHECK_READ, "strcmp 1st arg");
+ MF_VALIDATE_EXTENT(s2, CLAMPADD(s2_sz, 1), __MF_CHECK_WRITE, "strcmp 2nd arg");
+ return strcmp (s1, s2);
+}
+#endif
+
+#ifdef WRAP_strcasecmp
+WRAPPER2(int, strcasecmp, const char *s1, const char *s2)
+{
+ size_t s1_sz;
+ size_t s2_sz;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ s1_sz = strlen (s1);
+ s2_sz = strlen (s2);
+ MF_VALIDATE_EXTENT(s1, CLAMPADD(s1_sz, 1), __MF_CHECK_READ, "strcasecmp 1st arg");
+ MF_VALIDATE_EXTENT(s2, CLAMPADD(s2_sz, 1), __MF_CHECK_READ, "strcasecmp 2nd arg");
+ return strcasecmp (s1, s2);
+}
+#endif
+
+#ifdef WRAP_strncmp
+WRAPPER2(int, strncmp, const char *s1, const char *s2, size_t n)
+{
+ size_t s1_sz;
+ size_t s2_sz;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ s1_sz = strnlen (s1, n);
+ s2_sz = strnlen (s2, n);
+ MF_VALIDATE_EXTENT(s1, s1_sz, __MF_CHECK_READ, "strncmp 1st arg");
+ MF_VALIDATE_EXTENT(s2, s2_sz, __MF_CHECK_READ, "strncmp 2nd arg");
+ return strncmp (s1, s2, n);
+}
+#endif
+
+#ifdef WRAP_strncasecmp
+WRAPPER2(int, strncasecmp, const char *s1, const char *s2, size_t n)
+{
+ size_t s1_sz;
+ size_t s2_sz;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ s1_sz = strnlen (s1, n);
+ s2_sz = strnlen (s2, n);
+ MF_VALIDATE_EXTENT(s1, s1_sz, __MF_CHECK_READ, "strncasecmp 1st arg");
+ MF_VALIDATE_EXTENT(s2, s2_sz, __MF_CHECK_READ, "strncasecmp 2nd arg");
+ return strncasecmp (s1, s2, n);
+}
+#endif
+
+#ifdef WRAP_strdup
+WRAPPER2(char *, strdup, const char *s)
+{
+ DECLARE(void *, malloc, size_t sz);
+ char *result;
+ size_t n = strlen (s);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, CLAMPADD(n,1), __MF_CHECK_READ, "strdup region");
+ result = (char *)CALL_REAL(malloc,
+ CLAMPADD(CLAMPADD(n,1),
+ CLAMPADD(__mf_opts.crumple_zone,
+ __mf_opts.crumple_zone)));
+
+ if (UNLIKELY(! result)) return result;
+
+ result += __mf_opts.crumple_zone;
+ memcpy (result, s, n);
+ result[n] = '\0';
+
+ __mf_register (result, CLAMPADD(n,1), __MF_TYPE_HEAP_I, "strdup region");
+ return result;
+}
+#endif
+
+#ifdef WRAP_strndup
+WRAPPER2(char *, strndup, const char *s, size_t n)
+{
+ DECLARE(void *, malloc, size_t sz);
+ char *result;
+ size_t sz = strnlen (s, n);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, sz, __MF_CHECK_READ, "strndup region"); /* nb: strNdup */
+
+ /* note: strndup still adds a \0, even with the N limit! */
+ result = (char *)CALL_REAL(malloc,
+ CLAMPADD(CLAMPADD(n,1),
+ CLAMPADD(__mf_opts.crumple_zone,
+ __mf_opts.crumple_zone)));
+
+ if (UNLIKELY(! result)) return result;
+
+ result += __mf_opts.crumple_zone;
+ memcpy (result, s, n);
+ result[n] = '\0';
+
+ __mf_register (result, CLAMPADD(n,1), __MF_TYPE_HEAP_I, "strndup region");
+ return result;
+}
+#endif
+
+#ifdef WRAP_strchr
+WRAPPER2(char *, strchr, const char *s, int c)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (s);
+ MF_VALIDATE_EXTENT(s, CLAMPADD(n,1), __MF_CHECK_READ, "strchr region");
+ return strchr (s, c);
+}
+#endif
+
+#ifdef WRAP_strrchr
+WRAPPER2(char *, strrchr, const char *s, int c)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (s);
+ MF_VALIDATE_EXTENT(s, CLAMPADD(n,1), __MF_CHECK_READ, "strrchr region");
+ return strrchr (s, c);
+}
+#endif
+
+#ifdef WRAP_strstr
+WRAPPER2(char *, strstr, const char *haystack, const char *needle)
+{
+ size_t haystack_sz;
+ size_t needle_sz;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ haystack_sz = strlen (haystack);
+ needle_sz = strlen (needle);
+ MF_VALIDATE_EXTENT(haystack, CLAMPADD(haystack_sz, 1), __MF_CHECK_READ, "strstr haystack");
+ MF_VALIDATE_EXTENT(needle, CLAMPADD(needle_sz, 1), __MF_CHECK_READ, "strstr needle");
+ return strstr (haystack, needle);
+}
+#endif
+
+#ifdef WRAP_memmem
+WRAPPER2(void *, memmem,
+ const void *haystack, size_t haystacklen,
+ const void *needle, size_t needlelen)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(haystack, haystacklen, __MF_CHECK_READ, "memmem haystack");
+ MF_VALIDATE_EXTENT(needle, needlelen, __MF_CHECK_READ, "memmem needle");
+ return memmem (haystack, haystacklen, needle, needlelen);
+}
+#endif
+
+#ifdef WRAP_strlen
+WRAPPER2(size_t, strlen, const char *s)
+{
+ size_t result = strlen (s);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, CLAMPADD(result, 1), __MF_CHECK_READ, "strlen region");
+ return result;
+}
+#endif
+
+#ifdef WRAP_strnlen
+WRAPPER2(size_t, strnlen, const char *s, size_t n)
+{
+ size_t result = strnlen (s, n);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, result, __MF_CHECK_READ, "strnlen region");
+ return result;
+}
+#endif
+
+#ifdef WRAP_bzero
+WRAPPER2(void, bzero, void *s, size_t n)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
+ bzero (s, n);
+}
+#endif
+
+#ifdef WRAP_bcopy
+#undef bcopy
+WRAPPER2(void, bcopy, const void *src, void *dest, size_t n)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
+ MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
+ bcopy (src, dest, n);
+}
+#endif
+
+#ifdef WRAP_bcmp
+#undef bcmp
+WRAPPER2(int, bcmp, const void *s1, const void *s2, size_t n)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
+ MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
+ return bcmp (s1, s2, n);
+}
+#endif
+
+#ifdef WRAP_index
+WRAPPER2(char *, index, const char *s, int c)
+{
+ size_t n = strlen (s);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
+ return index (s, c);
+}
+#endif
+
+#ifdef WRAP_rindex
+WRAPPER2(char *, rindex, const char *s, int c)
+{
+ size_t n = strlen (s);
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
+ return rindex (s, c);
+}
+#endif
+
+/* XXX: stpcpy, memccpy */
+
+
+/* XXX: *printf,*scanf */
+
+
+/* XXX: setjmp, longjmp */
+
+#ifdef WRAP_asctime
+WRAPPER2(char *, asctime, struct tm *tm)
+{
+ static char *reg_result = NULL;
+ char *result;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(tm, sizeof (struct tm), __MF_CHECK_READ, "asctime tm");
+ result = asctime (tm);
+ if (reg_result == NULL)
+ {
+ __mf_register (result, strlen (result)+1, __MF_TYPE_STATIC, "asctime string");
+ reg_result = result;
+ }
+ return result;
+}
+#endif
+
+#ifdef WRAP_ctime
+WRAPPER2(char *, ctime, const time_t *timep)
+{
+ static char *reg_result = NULL;
+ char *result;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(timep, sizeof (time_t), __MF_CHECK_READ, "ctime time");
+ result = ctime (timep);
+ if (reg_result == NULL)
+ {
+ /* XXX: what if asctime and ctime return the same static ptr? */
+ __mf_register (result, strlen (result)+1, __MF_TYPE_STATIC, "ctime string");
+ reg_result = result;
+ }
+ return result;
+}
+#endif
+
+
+#ifdef WRAP_localtime
+WRAPPER2(struct tm*, localtime, const time_t *timep)
+{
+ static struct tm *reg_result = NULL;
+ struct tm *result;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(timep, sizeof (time_t), __MF_CHECK_READ, "localtime time");
+ result = localtime (timep);
+ if (reg_result == NULL)
+ {
+ __mf_register (result, sizeof (struct tm), __MF_TYPE_STATIC, "localtime tm");
+ reg_result = result;
+ }
+ return result;
+}
+#endif
+
+#ifdef WRAP_gmtime
+WRAPPER2(struct tm*, gmtime, const time_t *timep)
+{
+ static struct tm *reg_result = NULL;
+ struct tm *result;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT(timep, sizeof (time_t), __MF_CHECK_READ, "gmtime time");
+ result = gmtime (timep);
+ if (reg_result == NULL)
+ {
+ __mf_register (result, sizeof (struct tm), __MF_TYPE_STATIC, "gmtime tm");
+ reg_result = result;
+ }
+ return result;
+}
+#endif
+
+
+
+/* EL start */
+
+/* The following indicate if the result of the corresponding function
+ * should be explicitly un/registered by the wrapper
+*/
+#define MF_REGISTER_strerror __MF_TYPE_STATIC
+#undef MF_REGISTER_fopen
+#define MF_RESULT_SIZE_fopen (sizeof (FILE))
+#undef MF_REGISTER_opendir
+#define MF_RESULT_SIZE_opendir 0 /* (sizeof (DIR)) */
+#undef MF_REGISTER_readdir
+#define MF_REGISTER_gethostbyname __MF_TYPE_STATIC
+#undef MF_REGISTER_gethostbyname_items
+#undef MF_REGISTER_dlopen
+#undef MF_REGISTER_dlerror
+#undef MF_REGISTER_dlsym
+#define MF_REGISTER_shmat __MF_TYPE_GUESS
+
+
+#ifdef WRAP_time
+#include <time.h>
+WRAPPER2(time_t, time, time_t *timep)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ if (NULL != timep)
+ MF_VALIDATE_EXTENT (timep, sizeof (*timep), __MF_CHECK_WRITE,
+ "time timep");
+ return time (timep);
+}
+#endif
+
+#ifdef WRAP_strerror
+WRAPPER2(char *, strerror, int errnum)
+{
+ char *p;
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ p = strerror (errnum);
+ if (NULL != p) {
+ n = strlen (p);
+ n = CLAMPADD(n, 1);
+#ifdef MF_REGISTER_strerror
+ __mf_register (p, n, MF_REGISTER_strerror, "strerror result");
+#endif
+ MF_VALIDATE_EXTENT (p, n, __MF_CHECK_WRITE, "strerror result");
+ }
+ return p;
+}
+#endif
+
+#ifdef WRAP_fopen
+WRAPPER2(FILE *, fopen, const char *path, const char *mode)
+{
+ size_t n;
+ FILE *p;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "fopen path");
+
+ n = strlen (mode);
+ MF_VALIDATE_EXTENT (mode, CLAMPADD(n, 1), __MF_CHECK_READ, "fopen mode");
+
+ p = fopen (path, mode);
+ if (NULL != p) {
+#ifdef MF_REGISTER_fopen
+ __mf_register (p, sizeof (*p), MF_REGISTER_fopen, "fopen result");
+#endif
+ MF_VALIDATE_EXTENT (p, sizeof (*p), __MF_CHECK_WRITE, "fopen result");
+ }
+
+ return p;
+}
+#endif
+
+#ifdef HAVE_FOPEN64
+#ifdef WRAP_fopen64
+WRAPPER2(FILE *, fopen64, const char *path, const char *mode)
+{
+ size_t n;
+ FILE *p;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "fopen64 path");
+
+ n = strlen (mode);
+ MF_VALIDATE_EXTENT (mode, CLAMPADD(n, 1), __MF_CHECK_READ, "fopen64 mode");
+
+ p = fopen64 (path, mode);
+ if (NULL != p) {
+#ifdef MF_REGISTER_fopen
+ __mf_register (p, sizeof (*p), MF_REGISTER_fopen, "fopen64 result");
+#endif
+ MF_VALIDATE_EXTENT (p, sizeof (*p), __MF_CHECK_WRITE, "fopen64 result");
+ }
+
+ return p;
+}
+#endif
+#endif
+
+#ifdef WRAP_fclose
+WRAPPER2(int, fclose, FILE *stream)
+{
+ int resp;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fclose stream");
+ resp = fclose (stream);
+#ifdef MF_REGISTER_fopen
+ __mf_unregister (stream, sizeof (*stream));
+#endif
+
+ return resp;
+}
+#endif
+
+#ifdef WRAP_fread
+WRAPPER2(size_t, fread, void *ptr, size_t size, size_t nmemb, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fread stream");
+ MF_VALIDATE_EXTENT (ptr, size * nmemb, __MF_CHECK_WRITE, "fread buffer");
+ return fread (ptr, size, nmemb, stream);
+}
+#endif
+
+#ifdef WRAP_fwrite
+WRAPPER2(size_t, fwrite, const void *ptr, size_t size, size_t nmemb,
+ FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fwrite stream");
+ MF_VALIDATE_EXTENT (ptr, size * nmemb, __MF_CHECK_READ, "fwrite buffer");
+ return fwrite (ptr, size, nmemb, stream);
+}
+#endif
+
+#ifdef WRAP_fgetc
+WRAPPER2(int, fgetc, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fgetc stream");
+ return fgetc (stream);
+}
+#endif
+
+#ifdef WRAP_fgets
+WRAPPER2(char *, fgets, char *s, int size, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fgets stream");
+ MF_VALIDATE_EXTENT (s, size, __MF_CHECK_WRITE, "fgets buffer");
+ return fgets (s, size, stream);
+}
+#endif
+
+#ifdef WRAP_getc
+WRAPPER2(int, getc, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "getc stream");
+ return getc (stream);
+}
+#endif
+
+#ifdef WRAP_gets
+WRAPPER2(char *, gets, char *s)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (s, 1, __MF_CHECK_WRITE, "gets buffer");
+ /* Avoid link-time warning... */
+ s = fgets (s, INT_MAX, stdin);
+ if (NULL != s) { /* better late than never */
+ size_t n = strlen (s);
+ MF_VALIDATE_EXTENT (s, CLAMPADD(n, 1), __MF_CHECK_WRITE, "gets buffer");
+ }
+ return s;
+}
+#endif
+
+#ifdef WRAP_ungetc
+WRAPPER2(int, ungetc, int c, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "ungetc stream");
+ return ungetc (c, stream);
+}
+#endif
+
+#ifdef WRAP_fputc
+WRAPPER2(int, fputc, int c, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fputc stream");
+ return fputc (c, stream);
+}
+#endif
+
+#ifdef WRAP_fputs
+WRAPPER2(int, fputs, const char *s, FILE *stream)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (s);
+ MF_VALIDATE_EXTENT (s, CLAMPADD(n, 1), __MF_CHECK_READ, "fputs buffer");
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fputs stream");
+ return fputs (s, stream);
+}
+#endif
+
+#ifdef WRAP_putc
+WRAPPER2(int, putc, int c, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "putc stream");
+ return putc (c, stream);
+}
+#endif
+
+#ifdef WRAP_puts
+WRAPPER2(int, puts, const char *s)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (s);
+ MF_VALIDATE_EXTENT (s, CLAMPADD(n, 1), __MF_CHECK_READ, "puts buffer");
+ return puts (s);
+}
+#endif
+
+#ifdef WRAP_clearerr
+WRAPPER2(void, clearerr, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "clearerr stream");
+ clearerr (stream);
+}
+#endif
+
+#ifdef WRAP_feof
+WRAPPER2(int, feof, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "feof stream");
+ return feof (stream);
+}
+#endif
+
+#ifdef WRAP_ferror
+WRAPPER2(int, ferror, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "ferror stream");
+ return ferror (stream);
+}
+#endif
+
+#ifdef WRAP_fileno
+#include <stdio.h>
+WRAPPER2(int, fileno, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fileno stream");
+ return fileno (stream);
+}
+#endif
+
+#ifdef WRAP_printf
+#include <stdio.h>
+#include <stdarg.h>
+WRAPPER2(int, printf, const char *format, ...)
+{
+ size_t n;
+ va_list ap;
+ int result;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (format);
+ MF_VALIDATE_EXTENT (format, CLAMPADD(n, 1), __MF_CHECK_READ,
+ "printf format");
+ va_start (ap, format);
+ result = vprintf (format, ap);
+ va_end (ap);
+ return result;
+}
+#endif
+
+#ifdef WRAP_fprintf
+#include <stdio.h>
+#include <stdarg.h>
+WRAPPER2(int, fprintf, FILE *stream, const char *format, ...)
+{
+ size_t n;
+ va_list ap;
+ int result;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fprintf stream");
+ n = strlen (format);
+ MF_VALIDATE_EXTENT (format, CLAMPADD(n, 1), __MF_CHECK_READ,
+ "fprintf format");
+ va_start (ap, format);
+ result = vfprintf (stream, format, ap);
+ va_end (ap);
+ return result;
+}
+#endif
+
+#ifdef WRAP_sprintf
+#include <stdio.h>
+#include <stdarg.h>
+WRAPPER2(int, sprintf, char *str, const char *format, ...)
+{
+ size_t n;
+ va_list ap;
+ int result;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (str, 1, __MF_CHECK_WRITE, "sprintf str");
+ n = strlen (format);
+ MF_VALIDATE_EXTENT (format, CLAMPADD(n, 1), __MF_CHECK_READ,
+ "sprintf format");
+ va_start (ap, format);
+ result = vsprintf (str, format, ap);
+ va_end (ap);
+ n = strlen (str);
+ MF_VALIDATE_EXTENT (str, CLAMPADD(n, 1), __MF_CHECK_WRITE, "sprintf str");
+ return result;
+}
+#endif
+
+#ifdef WRAP_snprintf
+#include <stdio.h>
+#include <stdarg.h>
+WRAPPER2(int, snprintf, char *str, size_t size, const char *format, ...)
+{
+ size_t n;
+ va_list ap;
+ int result;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (str, size, __MF_CHECK_WRITE, "snprintf str");
+ n = strlen (format);
+ MF_VALIDATE_EXTENT (format, CLAMPADD(n, 1), __MF_CHECK_READ,
+ "snprintf format");
+ va_start (ap, format);
+ result = vsnprintf (str, size, format, ap);
+ va_end (ap);
+ return result;
+}
+#endif
+
+#ifdef WRAP_vprintf
+#include <stdio.h>
+#include <stdarg.h>
+WRAPPER2(int, vprintf, const char *format, va_list ap)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (format);
+ MF_VALIDATE_EXTENT (format, CLAMPADD(n, 1), __MF_CHECK_READ,
+ "vprintf format");
+ return vprintf (format, ap);
+}
+#endif
+
+#ifdef WRAP_vfprintf
+#include <stdio.h>
+#include <stdarg.h>
+WRAPPER2(int, vfprintf, FILE *stream, const char *format, va_list ap)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "vfprintf stream");
+ n = strlen (format);
+ MF_VALIDATE_EXTENT (format, CLAMPADD(n, 1), __MF_CHECK_READ,
+ "vfprintf format");
+ return vfprintf (stream, format, ap);
+}
+#endif
+
+#ifdef WRAP_vsprintf
+#include <stdio.h>
+#include <stdarg.h>
+WRAPPER2(int, vsprintf, char *str, const char *format, va_list ap)
+{
+ size_t n;
+ int result;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (str, 1, __MF_CHECK_WRITE, "vsprintf str");
+ n = strlen (format);
+ MF_VALIDATE_EXTENT (format, CLAMPADD(n, 1), __MF_CHECK_READ,
+ "vsprintf format");
+ result = vsprintf (str, format, ap);
+ n = strlen (str);
+ MF_VALIDATE_EXTENT (str, CLAMPADD(n, 1), __MF_CHECK_WRITE, "vsprintf str");
+ return result;
+}
+#endif
+
+#ifdef WRAP_vsnprintf
+#include <stdio.h>
+#include <stdarg.h>
+WRAPPER2(int, vsnprintf, char *str, size_t size, const char *format,
+ va_list ap)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (str, size, __MF_CHECK_WRITE, "vsnprintf str");
+ n = strlen (format);
+ MF_VALIDATE_EXTENT (format, CLAMPADD(n, 1), __MF_CHECK_READ,
+ "vsnprintf format");
+ return vsnprintf (str, size, format, ap);
+}
+#endif
+
+#ifdef WRAP_access
+WRAPPER2(int , access, const char *path, int mode)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "access path");
+ return access (path, mode);
+}
+#endif
+
+#ifdef WRAP_remove
+WRAPPER2(int , remove, const char *path)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "remove path");
+ return remove (path);
+}
+#endif
+
+#ifdef WRAP_fflush
+WRAPPER2(int, fflush, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fflush stream");
+ return fflush (stream);
+}
+#endif
+
+#ifdef WRAP_fseek
+WRAPPER2(int, fseek, FILE *stream, long offset, int whence)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fseek stream");
+ return fseek (stream, offset, whence);
+}
+#endif
+
+#ifdef HAVE_FSEEKO64
+#ifdef WRAP_fseeko64
+WRAPPER2(int, fseeko64, FILE *stream, off64_t offset, int whence)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fseeko64 stream");
+ return fseeko64 (stream, offset, whence);
+}
+#endif
+#endif
+
+#ifdef WRAP_ftell
+WRAPPER2(long, ftell, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "ftell stream");
+ return ftell (stream);
+}
+#endif
+
+#ifdef HAVE_FTELLO64
+#ifdef WRAP_ftello64
+WRAPPER2(off64_t, ftello64, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "ftello64 stream");
+ return ftello64 (stream);
+}
+#endif
+#endif
+
+#ifdef WRAP_rewind
+WRAPPER2(void, rewind, FILE *stream)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "rewind stream");
+ rewind (stream);
+}
+#endif
+
+#ifdef WRAP_fgetpos
+WRAPPER2(int, fgetpos, FILE *stream, fpos_t *pos)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fgetpos stream");
+ MF_VALIDATE_EXTENT (pos, sizeof (*pos), __MF_CHECK_WRITE, "fgetpos pos");
+ return fgetpos (stream, pos);
+}
+#endif
+
+#ifdef WRAP_fsetpos
+WRAPPER2(int, fsetpos, FILE *stream, fpos_t *pos)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "fsetpos stream");
+ MF_VALIDATE_EXTENT (pos, sizeof (*pos), __MF_CHECK_READ, "fsetpos pos");
+ return fsetpos (stream, pos);
+}
+#endif
+
+#ifdef WRAP_stat
+#include <sys/stat.h>
+WRAPPER2(int , stat, const char *path, struct stat *buf)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "stat path");
+ MF_VALIDATE_EXTENT (buf, sizeof (*buf), __MF_CHECK_READ, "stat buf");
+ return stat (path, buf);
+}
+#endif
+
+#ifdef HAVE_STAT64
+#ifdef WRAP_stat64
+#include <sys/stat.h>
+WRAPPER2(int , stat64, const char *path, struct stat64 *buf)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "stat64 path");
+ MF_VALIDATE_EXTENT (buf, sizeof (*buf), __MF_CHECK_READ, "stat64 buf");
+ return stat64 (path, buf);
+}
+#endif
+#endif
+
+#ifdef WRAP_fstat
+#include <sys/stat.h>
+WRAPPER2(int , fstat, int filedes, struct stat *buf)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (buf, sizeof (*buf), __MF_CHECK_READ, "fstat buf");
+ return fstat (filedes, buf);
+}
+#endif
+
+#ifdef WRAP_lstat
+#include <sys/stat.h>
+WRAPPER2(int , lstat, const char *path, struct stat *buf)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "lstat path");
+ MF_VALIDATE_EXTENT (buf, sizeof (*buf), __MF_CHECK_READ, "lstat buf");
+ return lstat (path, buf);
+}
+#endif
+
+#ifdef WRAP_mkfifo
+#include <sys/stat.h>
+WRAPPER2(int , mkfifo, const char *path, mode_t mode)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "mkfifo path");
+ return mkfifo (path, mode);
+}
+#endif
+
+#ifdef WRAP_setvbuf
+WRAPPER2(int, setvbuf, FILE *stream, char *buf, int mode , size_t size)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "setvbuf stream");
+ if (NULL != buf)
+ MF_VALIDATE_EXTENT (buf, size, __MF_CHECK_READ, "setvbuf buf");
+ return setvbuf (stream, buf, mode, size);
+}
+#endif
+
+#ifdef WRAP_setbuf
+WRAPPER2(void, setbuf, FILE *stream, char *buf)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "setbuf stream");
+ if (NULL != buf)
+ MF_VALIDATE_EXTENT (buf, BUFSIZ, __MF_CHECK_READ, "setbuf buf");
+ setbuf (stream, buf);
+}
+#endif
+
+#ifdef WRAP_opendir
+#include <dirent.h>
+WRAPPER2(DIR *, opendir, const char *path)
+{
+ DIR *p;
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "opendir path");
+
+ p = opendir (path);
+ if (NULL != p) {
+#ifdef MF_REGISTER_opendir
+ __mf_register (p, MF_RESULT_SIZE_opendir, MF_REGISTER_opendir,
+ "opendir result");
+#endif
+ MF_VALIDATE_EXTENT (p, MF_RESULT_SIZE_opendir, __MF_CHECK_WRITE,
+ "opendir result");
+ }
+ return p;
+}
+#endif
+
+#ifdef WRAP_closedir
+#include <dirent.h>
+WRAPPER2(int, closedir, DIR *dir)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (dir, 0, __MF_CHECK_WRITE, "closedir dir");
+#ifdef MF_REGISTER_opendir
+ __mf_unregister (dir, MF_RESULT_SIZE_opendir);
+#endif
+ return closedir (dir);
+}
+#endif
+
+#ifdef WRAP_readdir
+#include <dirent.h>
+WRAPPER2(struct dirent *, readdir, DIR *dir)
+{
+ struct dirent *p;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (dir, 0, __MF_CHECK_READ, "readdir dir");
+ p = readdir (dir);
+ if (NULL != p) {
+#ifdef MF_REGISTER_readdir
+ __mf_register (p, sizeof (*p), MF_REGISTER_readdir, "readdir result");
+#endif
+ MF_VALIDATE_EXTENT (p, sizeof (*p), __MF_CHECK_WRITE, "readdir result");
+ }
+ return p;
+}
+#endif
+
+#ifdef WRAP_recv
+#include <sys/socket.h>
+WRAPPER2(int, recv, int s, void *buf, size_t len, int flags)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (buf, len, __MF_CHECK_WRITE, "recv buf");
+ return recv (s, buf, len, flags);
+}
+#endif
+
+#ifdef WRAP_recvfrom
+#include <sys/socket.h>
+WRAPPER2(int, recvfrom, int s, void *buf, size_t len, int flags,
+ struct sockaddr *from, socklen_t *fromlen)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (buf, len, __MF_CHECK_WRITE, "recvfrom buf");
+ MF_VALIDATE_EXTENT (from, (size_t)*fromlen, __MF_CHECK_WRITE,
+ "recvfrom from");
+ return recvfrom (s, buf, len, flags, from, fromlen);
+}
+#endif
+
+#ifdef WRAP_recvmsg
+#include <sys/socket.h>
+WRAPPER2(int, recvmsg, int s, struct msghdr *msg, int flags)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (msg, sizeof (*msg), __MF_CHECK_WRITE, "recvmsg msg");
+ return recvmsg (s, msg, flags);
+}
+#endif
+
+#ifdef WRAP_send
+#include <sys/socket.h>
+WRAPPER2(int, send, int s, const void *msg, size_t len, int flags)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (msg, len, __MF_CHECK_READ, "send msg");
+ return send (s, msg, len, flags);
+}
+#endif
+
+#ifdef WRAP_sendto
+#include <sys/socket.h>
+WRAPPER2(int, sendto, int s, const void *msg, size_t len, int flags,
+ const struct sockaddr *to, socklen_t tolen)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (msg, len, __MF_CHECK_READ, "sendto msg");
+ MF_VALIDATE_EXTENT (to, (size_t)tolen, __MF_CHECK_WRITE, "sendto to");
+ return sendto (s, msg, len, flags, to, tolen);
+}
+#endif
+
+#ifdef WRAP_sendmsg
+#include <sys/socket.h>
+WRAPPER2(int, sendmsg, int s, const void *msg, int flags)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (msg, sizeof (*msg), __MF_CHECK_READ, "sendmsg msg");
+ return sendmsg (s, msg, flags);
+}
+#endif
+
+#ifdef WRAP_setsockopt
+#include <sys/socket.h>
+WRAPPER2(int, setsockopt, int s, int level, int optname, const void *optval,
+ socklen_t optlen)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (optval, (size_t)optlen, __MF_CHECK_READ,
+ "setsockopt optval");
+ return setsockopt (s, level, optname, optval, optlen);
+}
+#endif
+
+#ifdef WRAP_getsockopt
+#include <sys/socket.h>
+WRAPPER2(int, getsockopt, int s, int level, int optname, void *optval,
+ socklen_t *optlen)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (optval, (size_t)*optlen, __MF_CHECK_WRITE,
+ "getsockopt optval");
+ return getsockopt (s, level, optname, optval, optlen);
+}
+#endif
+
+#ifdef WRAP_accept
+#include <sys/socket.h>
+WRAPPER2(int, accept, int s, struct sockaddr *addr, socklen_t *addrlen)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (addr, (size_t)*addrlen, __MF_CHECK_WRITE, "accept addr");
+ return accept (s, addr, addrlen);
+}
+#endif
+
+#ifdef WRAP_bind
+#include <sys/socket.h>
+WRAPPER2(int, bind, int sockfd, struct sockaddr *addr, socklen_t addrlen)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (addr, (size_t)addrlen, __MF_CHECK_WRITE, "bind addr");
+ return bind (sockfd, addr, addrlen);
+}
+#endif
+
+#ifdef WRAP_connect
+#include <sys/socket.h>
+WRAPPER2(int, connect, int sockfd, const struct sockaddr *addr,
+ socklen_t addrlen)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (addr, (size_t)addrlen, __MF_CHECK_READ,
+ "connect addr");
+ return connect (sockfd, addr, addrlen);
+}
+#endif
+
+#ifdef WRAP_gethostname
+WRAPPER2(int, gethostname, char *name, size_t len)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (name, len, __MF_CHECK_WRITE, "gethostname name");
+ return gethostname (name, len);
+}
+#endif
+
+#ifdef WRAP_sethostname
+WRAPPER2(int, sethostname, const char *name, size_t len)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (name, len, __MF_CHECK_READ, "sethostname name");
+ return sethostname (name, len);
+}
+#endif
+
+#ifdef WRAP_gethostbyname
+#include <netdb.h>
+WRAPPER2(struct hostent *, gethostbyname, const char *name)
+{
+ struct hostent *p;
+ char **ss;
+ char *s;
+ size_t n;
+ int nreg;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (name);
+ MF_VALIDATE_EXTENT (name, CLAMPADD(n, 1), __MF_CHECK_READ,
+ "gethostbyname name");
+ p = gethostbyname (name);
+ if (NULL != p) {
+#ifdef MF_REGISTER_gethostbyname
+ __mf_register (p, sizeof (*p), MF_REGISTER_gethostbyname,
+ "gethostbyname result");
+#endif
+ MF_VALIDATE_EXTENT (p, sizeof (*p), __MF_CHECK_WRITE,
+ "gethostbyname result");
+ if (NULL != (s = p->h_name)) {
+ n = strlen (s);
+ n = CLAMPADD(n, 1);
+#ifdef MF_REGISTER_gethostbyname_items
+ __mf_register (s, n, MF_REGISTER_gethostbyname_items,
+ "gethostbyname result->h_name");
+#endif
+ MF_VALIDATE_EXTENT (s, n, __MF_CHECK_WRITE,
+ "gethostbyname result->h_name");
+ }
+
+ if (NULL != (ss = p->h_aliases)) {
+ for (nreg = 1;; ++nreg) {
+ s = *ss++;
+ if (NULL == s)
+ break;
+ n = strlen (s);
+ n = CLAMPADD(n, 1);
+#ifdef MF_REGISTER_gethostbyname_items
+ __mf_register (s, n, MF_REGISTER_gethostbyname_items,
+ "gethostbyname result->h_aliases[]");
+#endif
+ MF_VALIDATE_EXTENT (s, n, __MF_CHECK_WRITE,
+ "gethostbyname result->h_aliases[]");
+ }
+ nreg *= sizeof (*p->h_aliases);
+#ifdef MF_REGISTER_gethostbyname_items
+ __mf_register (p->h_aliases, nreg, MF_REGISTER_gethostbyname_items,
+ "gethostbyname result->h_aliases");
+#endif
+ MF_VALIDATE_EXTENT (p->h_aliases, nreg, __MF_CHECK_WRITE,
+ "gethostbyname result->h_aliases");
+ }
+
+ if (NULL != (ss = p->h_addr_list)) {
+ for (nreg = 1;; ++nreg) {
+ s = *ss++;
+ if (NULL == s)
+ break;
+#ifdef MF_REGISTER_gethostbyname_items
+ __mf_register (s, p->h_length, MF_REGISTER_gethostbyname_items,
+ "gethostbyname result->h_addr_list[]");
+#endif
+ MF_VALIDATE_EXTENT (s, p->h_length, __MF_CHECK_WRITE,
+ "gethostbyname result->h_addr_list[]");
+ }
+ nreg *= sizeof (*p->h_addr_list);
+#ifdef MF_REGISTER_gethostbyname_items
+ __mf_register (p->h_addr_list, nreg, MF_REGISTER_gethostbyname_items,
+ "gethostbyname result->h_addr_list");
+#endif
+ MF_VALIDATE_EXTENT (p->h_addr_list, nreg, __MF_CHECK_WRITE,
+ "gethostbyname result->h_addr_list");
+ }
+ }
+ return p;
+}
+#endif
+
+#ifdef WRAP_wait
+#include <sys/wait.h>
+WRAPPER2(pid_t, wait, int *status)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ if (NULL != status)
+ MF_VALIDATE_EXTENT (status, sizeof (*status), __MF_CHECK_WRITE,
+ "wait status");
+ return wait (status);
+}
+#endif
+
+#ifdef WRAP_waitpid
+#include <sys/wait.h>
+WRAPPER2(pid_t, waitpid, pid_t pid, int *status, int options)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ if (NULL != status)
+ MF_VALIDATE_EXTENT (status, sizeof (*status), __MF_CHECK_WRITE,
+ "waitpid status");
+ return waitpid (pid, status, options);
+}
+#endif
+
+#ifdef WRAP_popen
+WRAPPER2(FILE *, popen, const char *command, const char *mode)
+{
+ size_t n;
+ FILE *p;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+
+ n = strlen (command);
+ MF_VALIDATE_EXTENT (command, CLAMPADD(n, 1), __MF_CHECK_READ, "popen path");
+
+ n = strlen (mode);
+ MF_VALIDATE_EXTENT (mode, CLAMPADD(n, 1), __MF_CHECK_READ, "popen mode");
+
+ p = popen (command, mode);
+ if (NULL != p) {
+#ifdef MF_REGISTER_fopen
+ __mf_register (p, sizeof (*p), MF_REGISTER_fopen, "popen result");
+#endif
+ MF_VALIDATE_EXTENT (p, sizeof (*p), __MF_CHECK_WRITE, "popen result");
+ }
+ return p;
+}
+#endif
+
+#ifdef WRAP_pclose
+WRAPPER2(int, pclose, FILE *stream)
+{
+ int resp;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (stream, sizeof (*stream), __MF_CHECK_WRITE,
+ "pclose stream");
+ resp = pclose (stream);
+#ifdef MF_REGISTER_fopen
+ __mf_unregister (stream, sizeof (*stream));
+#endif
+ return resp;
+}
+#endif
+
+#ifdef WRAP_execve
+WRAPPER2(int, execve, const char *path, char *const argv [],
+ char *const envp[])
+{
+ size_t n;
+ char *const *p;
+ const char *s;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "execve path");
+
+ for (p = argv;;) {
+ MF_VALIDATE_EXTENT (p, sizeof (*p), __MF_CHECK_READ, "execve *argv");
+ s = *p++;
+ if (NULL == s)
+ break;
+ n = strlen (s);
+ MF_VALIDATE_EXTENT (s, CLAMPADD(n, 1), __MF_CHECK_READ, "execve **argv");
+ }
+
+ for (p = envp;;) {
+ MF_VALIDATE_EXTENT (p, sizeof (*p), __MF_CHECK_READ, "execve *envp");
+ s = *p++;
+ if (NULL == s)
+ break;
+ n = strlen (s);
+ MF_VALIDATE_EXTENT (s, CLAMPADD(n, 1), __MF_CHECK_READ, "execve **envp");
+ }
+ return execve (path, argv, envp);
+}
+#endif
+
+#ifdef WRAP_execv
+WRAPPER2(int, execv, const char *path, char *const argv [])
+{
+ size_t n;
+ char *const *p;
+ const char *s;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "execv path");
+
+ for (p = argv;;) {
+ MF_VALIDATE_EXTENT (p, sizeof (*p), __MF_CHECK_READ, "execv *argv");
+ s = *p++;
+ if (NULL == s)
+ break;
+ n = strlen (s);
+ MF_VALIDATE_EXTENT (s, CLAMPADD(n, 1), __MF_CHECK_READ, "execv **argv");
+ }
+ return execv (path, argv);
+}
+#endif
+
+#ifdef WRAP_execvp
+WRAPPER2(int, execvp, const char *path, char *const argv [])
+{
+ size_t n;
+ char *const *p;
+ const char *s;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "execvp path");
+
+ for (p = argv;;) {
+ MF_VALIDATE_EXTENT (p, sizeof (*p), __MF_CHECK_READ, "execvp *argv");
+ s = *p++;
+ if (NULL == s)
+ break;
+ n = strlen (s);
+ MF_VALIDATE_EXTENT (s, CLAMPADD(n, 1), __MF_CHECK_READ, "execvp **argv");
+ }
+ return execvp (path, argv);
+}
+#endif
+
+#ifdef WRAP_system
+WRAPPER2(int, system, const char *string)
+{
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (string);
+ MF_VALIDATE_EXTENT (string, CLAMPADD(n, 1), __MF_CHECK_READ,
+ "system string");
+ return system (string);
+}
+#endif
+
+#ifdef WRAP_dlopen
+WRAPPER2(void *, dlopen, const char *path, int flags)
+{
+ void *p;
+ size_t n;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ n = strlen (path);
+ MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "dlopen path");
+ p = dlopen (path, flags);
+ if (NULL != p) {
+#ifdef MF_REGISTER_dlopen
+ __mf_register (p, 0, MF_REGISTER_dlopen, "dlopen result");
+#endif
+ MF_VALIDATE_EXTENT (p, 0, __MF_CHECK_WRITE, "dlopen result");
+ }
+ return p;
+}
+#endif
+
+#ifdef WRAP_dlclose
+WRAPPER2(int, dlclose, void *handle)
+{
+ int resp;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (handle, 0, __MF_CHECK_READ, "dlclose handle");
+ resp = dlclose (handle);
+#ifdef MF_REGISTER_dlopen
+ __mf_unregister (handle, 0);
+#endif
+ return resp;
+}
+#endif
+
+#ifdef WRAP_dlerror
+WRAPPER2(char *, dlerror)
+{
+ char *p;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ p = dlerror ();
+ if (NULL != p) {
+ size_t n;
+ n = strlen (p);
+ n = CLAMPADD(n, 1);
+#ifdef MF_REGISTER_dlerror
+ __mf_register (p, n, MF_REGISTER_dlerror, "dlerror result");
+#endif
+ MF_VALIDATE_EXTENT (p, n, __MF_CHECK_WRITE, "dlerror result");
+ }
+ return p;
+}
+#endif
+
+#ifdef WRAP_dlsym
+WRAPPER2(void *, dlsym, void *handle, char *symbol)
+{
+ size_t n;
+ void *p;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (handle, 0, __MF_CHECK_READ, "dlsym handle");
+ n = strlen (symbol);
+ MF_VALIDATE_EXTENT (symbol, CLAMPADD(n, 1), __MF_CHECK_READ, "dlsym symbol");
+ p = dlsym (handle, symbol);
+ if (NULL != p) {
+#ifdef MF_REGISTER_dlsym
+ __mf_register (p, 0, MF_REGISTER_dlsym, "dlsym result");
+#endif
+ MF_VALIDATE_EXTENT (p, 0, __MF_CHECK_WRITE, "dlsym result");
+ }
+ return p;
+}
+#endif
+
+#ifdef WRAP_semop
+#include <sys/ipc.h>
+#include <sys/sem.h>
+WRAPPER2(int, semop, int semid, struct sembuf *sops, unsigned nsops)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ MF_VALIDATE_EXTENT (sops, sizeof (*sops) * nsops, __MF_CHECK_READ,
+ "semop sops");
+ return semop (semid, sops, nsops);
+}
+#endif
+
+#ifdef WRAP_semctl
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#ifndef HAVE_UNION_SEMUN
+union semun {
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
+ unsigned short int *array; /* array for GETALL, SETALL */
+ struct seminfo *__buf; /* buffer for IPC_INFO */
+};
+#endif
+WRAPPER2(int, semctl, int semid, int semnum, int cmd, union semun arg)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ switch (cmd) {
+ case IPC_STAT:
+ MF_VALIDATE_EXTENT (arg.buf, sizeof (*arg.buf), __MF_CHECK_WRITE,
+ "semctl buf");
+ break;
+ case IPC_SET:
+ MF_VALIDATE_EXTENT (arg.buf, sizeof (*arg.buf), __MF_CHECK_READ,
+ "semctl buf");
+ break;
+ case GETALL:
+ MF_VALIDATE_EXTENT (arg.array, sizeof (*arg.array), __MF_CHECK_WRITE,
+ "semctl array");
+ case SETALL:
+ MF_VALIDATE_EXTENT (arg.array, sizeof (*arg.array), __MF_CHECK_READ,
+ "semctl array");
+ break;
+#ifdef IPC_INFO
+ /* FreeBSD 5.1 headers include IPC_INFO but not the __buf field. */
+#if !defined(__FreeBSD__)
+ case IPC_INFO:
+ MF_VALIDATE_EXTENT (arg.__buf, sizeof (*arg.__buf), __MF_CHECK_WRITE,
+ "semctl __buf");
+ break;
+#endif
+#endif
+ default:
+ break;
+ }
+ return semctl (semid, semnum, cmd, arg);
+}
+#endif
+
+#ifdef WRAP_shmctl
+#include <sys/ipc.h>
+#include <sys/shm.h>
+WRAPPER2(int, shmctl, int shmid, int cmd, struct shmid_ds *buf)
+{
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ switch (cmd) {
+ case IPC_STAT:
+ MF_VALIDATE_EXTENT (buf, sizeof (*buf), __MF_CHECK_WRITE,
+ "shmctl buf");
+ break;
+ case IPC_SET:
+ MF_VALIDATE_EXTENT (buf, sizeof (*buf), __MF_CHECK_READ,
+ "shmctl buf");
+ break;
+ default:
+ break;
+ }
+ return shmctl (shmid, cmd, buf);
+}
+#endif
+
+#ifdef WRAP_shmat
+#include <sys/ipc.h>
+#include <sys/shm.h>
+WRAPPER2(void *, shmat, int shmid, const void *shmaddr, int shmflg)
+{
+ void *p;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ p = shmat (shmid, shmaddr, shmflg);
+#ifdef MF_REGISTER_shmat
+ if (NULL != p) {
+ struct shmid_ds buf;
+ __mf_register (p, shmctl (shmid, IPC_STAT, &buf) ? 0 : buf.shm_segsz,
+ MF_REGISTER_shmat, "shmat result");
+ }
+#endif
+ return p;
+}
+#endif
+
+#ifdef WRAP_shmdt
+#include <sys/ipc.h>
+#include <sys/shm.h>
+WRAPPER2(int, shmdt, const void *shmaddr)
+{
+ int resp;
+ TRACE ("%s\n", __PRETTY_FUNCTION__);
+ resp = shmdt (shmaddr);
+#ifdef MF_REGISTER_shmat
+ __mf_unregister ((void *)shmaddr, 0);
+#endif
+ return resp;
+}
+#endif
+
diff --git a/libmudflap/mf-hooks3.c b/libmudflap/mf-hooks3.c
new file mode 100644
index 00000000000..838f3810db5
--- /dev/null
+++ b/libmudflap/mf-hooks3.c
@@ -0,0 +1,573 @@
+/* Mudflap: narrow-pointer bounds-checking by tree rewriting.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Contributed by Frank Ch. Eigler <fche@redhat.com>
+ and Graydon Hoare <graydon@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+GCC 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. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+
+#include "config.h"
+
+#ifndef HAVE_SOCKLEN_T
+#define socklen_t int
+#endif
+
+/* These attempt to coax various unix flavours to declare all our
+ needed tidbits in the system headers. */
+#if !defined(__FreeBSD__) && !defined(__APPLE__)
+#define _POSIX_SOURCE
+#endif /* Some BSDs break <sys/socket.h> if this is defined. */
+#define _GNU_SOURCE
+#define _XOPEN_SOURCE
+#define _BSD_TYPES
+#define __EXTENSIONS__
+#define _ALL_SOURCE
+#define _LARGE_FILE_API
+#define _XOPEN_SOURCE_EXTENDED 1
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <sched.h>
+
+#include "mf-runtime.h"
+#include "mf-impl.h"
+
+#ifdef _MUDFLAP
+#error "Do not compile this file with -fmudflap!"
+#endif
+
+
+/* Multithreading support hooks. */
+
+
+#ifdef WRAP_pthreadstuff
+
+
+#ifndef LIBMUDFLAPTH
+#error "pthreadstuff is to be included only in libmudflapth"
+#endif
+
+
+
+/* Describe a thread (dead or alive). */
+struct pthread_info
+{
+ short used_p; /* Is this slot in use? */
+ short dead_p; /* Is this thread dead? */
+ pthread_t self; /* The thread id. */
+
+ /* If libmudflapth allocated the stack, store its base/size. */
+ void *stack;
+ size_t stack_size;
+
+ int *thread_errno;
+ enum __mf_state_enum state;
+};
+
+
+/* Describe the startup information for a new user thread. */
+struct pthread_start_info
+{
+ /* The user's thread entry point and argument. */
+ void * (*user_fn)(void *);
+ void *user_arg;
+
+ /* Set by user thread when this startup struct may be disposed of. */
+ struct pthread_info *thread_info;
+};
+
+
+
+
+/* To avoid dynamic memory allocation, use static array to store these
+ thread description structs. The second (_idx) array is used as a
+ simple caching hash table, mapping PTHREAD_HASH(thread) to its
+ index in __mf_pthread_info[]. */
+
+#define LIBMUDFLAPTH_THREADS_MAX 1024
+static struct pthread_info __mf_pthread_info[LIBMUDFLAPTH_THREADS_MAX];
+static unsigned __mf_pthread_info_idx[LIBMUDFLAPTH_THREADS_MAX];
+#define PTHREAD_HASH(p) ((unsigned) (p) % LIBMUDFLAPTH_THREADS_MAX)
+
+
+/* Find any old empty entry in __mf_pthread_info; mark it used and
+ return it. Return NULL if there are no more available slots. */
+struct pthread_info*
+__mf_allocate_blank_threadinfo (unsigned* idx)
+{
+ static unsigned probe = LIBMUDFLAPTH_THREADS_MAX-1;
+ unsigned probe_at_start = probe;
+ static pthread_mutex_t mutex =
+#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+ PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+#else
+ PTHREAD_MUTEX_INITIALIZER;
+#endif
+ int rc;
+
+ rc = pthread_mutex_lock (& mutex);
+ assert (rc == 0);
+
+ /* Look for a blank spot starting one past the last one we found. */
+ do
+ {
+ probe = (probe + 1) % LIBMUDFLAPTH_THREADS_MAX;
+ struct pthread_info* pi = & __mf_pthread_info [probe];
+ if (! pi->used_p)
+ {
+ /* memset (pi, 0, sizeof (*pi)); */
+ pi->used_p = 1;
+ if (idx != NULL) *idx = probe;
+ /* VERBOSE_TRACE ("allocated threadinfo slot %u\n", probe); */
+ rc = pthread_mutex_unlock (& mutex);
+ assert (rc == 0);
+ return pi;
+ }
+ }
+ while (probe != probe_at_start);
+
+ rc = pthread_mutex_unlock (& mutex);
+ assert (rc == 0);
+ return NULL;
+}
+
+
+/* Find and return the pthread_info struct for the current thread.
+ There might already be one in __mf_pthread_info for this thread, in
+ which case return it. There may not be one (if this is a main
+ thread, an auxiliary -lpthread manager, or an actual user thread
+ making an early call into libmudflap. In these cases, create a new
+ entry. If not it's not the main thread, put it into reentrant
+ initial state.
+*/
+static struct pthread_info*
+__mf_find_threadinfo ()
+{
+ pthread_t it = pthread_self ();
+ unsigned *hash = & __mf_pthread_info_idx [PTHREAD_HASH (it)];
+ struct pthread_info *result = NULL;
+ static pthread_t last;
+ static int main_thread_seen_p;
+
+ /* Check out the lookup cache; failing that, do a linear search
+ around the table. */
+ {
+ struct pthread_info* pi = & __mf_pthread_info [*hash];
+ unsigned i;
+
+ if (pi->used_p && pi->self == it)
+ result = pi;
+ else for (i = 0; i < LIBMUDFLAPTH_THREADS_MAX; i++)
+ {
+ struct pthread_info* pi2 = & __mf_pthread_info [i];
+ if (pi2->used_p && pi2->self == it)
+ {
+ *hash = i;
+ result = pi2;
+ break;
+ }
+ }
+ }
+
+ if (result == NULL)
+ {
+ /* Create a __mf_pthread_info record for the main thread. It's
+ different from the auto-recognized worker bees because for
+ example we can assume that it's a fully stack/errno-equipped
+ thread. */
+
+ /* This must be the main thread, until now unseen in libmudflap. */
+ unsigned *hash = & __mf_pthread_info_idx [PTHREAD_HASH (it)];
+ struct pthread_info* pi = __mf_allocate_blank_threadinfo (hash);
+ assert (pi != NULL);
+ assert (pi->used_p);
+ result = pi;
+ result->self = it;
+
+ if (! main_thread_seen_p)
+ {
+ result->state = active;
+ /* NB: leave result->thread_errno unset, as main thread's errno
+ has already been registered in __mf_init. */
+ /* NB: leave stack-related fields unset, to avoid
+ deallocation. */
+ main_thread_seen_p = 1;
+ VERBOSE_TRACE ("identified self as main thread\n");
+ }
+ else
+ {
+ result->state = reentrant;
+ /* NB: leave result->thread_errno unset, as worker thread's
+ errno is unlikely to be used, and user threads fill them
+ in during __mf_pthread_spawn(). */
+ /* NB: leave stack-related fields unset, leaving pthread_create
+ to fill them in for user threads, leaving them empty for
+ other threads. */
+ VERBOSE_TRACE ("identified self as new aux or user thread\n");
+ }
+ }
+
+ if (last != it)
+ {
+ VERBOSE_TRACE ("found threadinfo for %u, slot %u\n",
+ (unsigned) it,
+ (unsigned) *hash);
+ last = it;
+ }
+
+ assert (result != NULL);
+ assert (result->self == it);
+
+ return result;
+}
+
+
+
+/* Return a pointer to the per-thread __mf_state variable. */
+enum __mf_state_enum *
+__mf_state_perthread ()
+{
+ assert (! __mf_starting_p);
+ return & (__mf_find_threadinfo()->state);
+}
+
+
+static void
+__mf_pthread_cleanup (void *arg)
+{
+ struct pthread_info *pi = arg;
+
+ /* XXX: This unregistration is not safe on platforms where distinct
+ threads share errno (or at least its virtual address). */
+ if (pi->thread_errno != NULL)
+ __mf_unregister (pi->thread_errno, sizeof (int));
+
+ /* XXX: Only detached threads should designate themselves as dead
+ here. Non-detached threads are marked dead after their
+ personalized pthread_join() call. */
+ pi->state = reentrant;
+ pi->dead_p = 1;
+
+ VERBOSE_TRACE ("thread pi %p exiting\n", pi);
+}
+
+
+static void *
+__mf_pthread_spawner (void *arg)
+{
+ struct pthread_info *pi = __mf_find_threadinfo ();
+ void *result = NULL;
+
+ /* Turn off reentrancy indications. */
+ assert (pi->state == reentrant);
+ pi->state = active;
+
+ VERBOSE_TRACE ("new user thread\n");
+
+ if (__mf_opts.heur_std_data)
+ {
+ pi->thread_errno = & errno;
+ __mf_register (pi->thread_errno, sizeof (int),
+ __MF_TYPE_GUESS, "errno area (thread)");
+ /* NB: we could use __MF_TYPE_STATIC above, but we guess that
+ the thread errno is coming out of some dynamically allocated
+ pool that we already know of as __MF_TYPE_HEAP. */
+ }
+
+ /* We considered using pthread_key_t objects instead of these
+ cleanup stacks, but they were less cooperative with the
+ interposed malloc hooks in libmudflap. */
+ pthread_cleanup_push (& __mf_pthread_cleanup, pi);
+
+ /* Call user thread */
+ {
+ /* Extract given entry point and argument. */
+ struct pthread_start_info *psi = arg;
+ void * (*user_fn)(void *) = psi->user_fn;
+ void *user_arg = psi->user_arg;
+
+ /* Signal the main thread to resume. */
+ psi->thread_info = pi;
+
+ result = (*user_fn)(user_arg);
+ }
+
+ pthread_cleanup_pop (1 /* execute */);
+
+ /* NB: there is a slight race here. The pthread_info field will now
+ say this thread is dead, but it may still be running .. right
+ here. We try to check for this possibility using the
+ pthread_kill test below. */
+
+ return result;
+}
+
+
+#if PIC
+/* A special bootstrap variant. */
+int
+__mf_0fn_pthread_create (pthread_t *thr, const pthread_attr_t *attr,
+ void * (*start) (void *), void *arg)
+{
+ return -1;
+}
+#endif
+
+
+#undef pthread_create
+WRAPPER(int, pthread_create, pthread_t *thr, const pthread_attr_t *attr,
+ void * (*start) (void *), void *arg)
+{
+ DECLARE(int, munmap, void *p, size_t l);
+ DECLARE(void *, mmap, void *p, size_t l, int prot, int flags, int fd, off_t of);
+ DECLARE(int, pthread_create, pthread_t *thr, const pthread_attr_t *attr,
+ void * (*start) (void *), void *arg);
+ int result;
+ pthread_attr_t override_attr;
+ void *override_stack;
+ size_t override_stacksize;
+ unsigned i;
+
+ TRACE ("pthread_create\n");
+
+ /* Garbage-collect dead threads' stacks. */
+ LOCKTH ();
+ for (i = 0; i < LIBMUDFLAPTH_THREADS_MAX; i++)
+ {
+ struct pthread_info *pi = & __mf_pthread_info [i];
+ if (! pi->used_p)
+ continue;
+ if (! pi->dead_p)
+ continue;
+
+ /* VERBOSE_TRACE ("thread %u pi %p stack cleanup deferred (%u)\n",
+ (unsigned) pi->self, pi, pi->dead_p); */
+
+ /* Delay actual deallocation by a few cycles, try to discourage the
+ race mentioned at the end of __mf_pthread_spawner(). */
+ if (pi->dead_p)
+ pi->dead_p ++;
+ if (pi->dead_p >= 10 /* XXX */)
+ {
+ if (pi->stack)
+ CALL_REAL (munmap, pi->stack, pi->stack_size);
+
+ VERBOSE_TRACE ("slot %u freed, stack %p\n", i, pi->stack);
+ memset (pi, 0, sizeof (*pi));
+
+ /* One round of garbage collection is enough. */
+ break;
+ }
+ }
+ UNLOCKTH ();
+
+ /* Let's allocate a stack for this thread, if one is not already
+ supplied by the caller. We don't want to let e.g. the
+ linuxthreads manager thread do this allocation. */
+ if (attr != NULL)
+ override_attr = *attr;
+ else
+ pthread_attr_init (& override_attr);
+
+ /* Get supplied attributes, if any. */
+ /* XXX: consider using POSIX2K attr_getstack() */
+ if (pthread_attr_getstackaddr (& override_attr, & override_stack) != 0 ||
+ pthread_attr_getstacksize (& override_attr, & override_stacksize) != 0)
+ {
+ override_stack = NULL;
+ override_stacksize = 0;
+ }
+
+ /* Do we need to allocate the new thread's stack? */
+ if (__mf_opts.thread_stack && override_stack == NULL)
+ {
+ uintptr_t alignment = 256; /* power of two */
+
+ /* Perturb the initial stack addresses slightly, to encourage
+ threads to have nonconflicting entries in the lookup cache
+ for their tracked stack objects. */
+ static unsigned perturb = 0;
+ const unsigned perturb_delta = 32;
+ const unsigned perturb_count = 16;
+ perturb += perturb_delta;
+ if (perturb > perturb_delta*perturb_count) perturb = 0;
+
+ /* Use glibc x86 defaults */
+/* Should have been defined in <limits.h> */
+#ifndef PTHREAD_STACK_MIN
+#define PTHREAD_STACK_MIN 65536
+#endif
+ override_stacksize = max (PTHREAD_STACK_MIN, __mf_opts.thread_stack * 1024);
+
+
+#if defined(MAP_ANONYMOUS)
+#define MF_MAP_ANON MAP_ANONYMOUS
+#elif defined(MAP_ANON)
+#define MF_MAP_ANON MAP_ANON
+#else
+#error "Cannot mmap anonymous memory."
+#endif
+
+ override_stack = CALL_REAL (mmap, NULL, override_stacksize,
+ PROT_READ|PROT_WRITE,
+ MAP_PRIVATE|MF_MAP_ANON,
+ 0, 0);
+ if (override_stack == 0 || override_stack == MAP_FAILED)
+ {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ VERBOSE_TRACE ("thread stack alloc %p size %lu\n",
+ override_stack, (unsigned long) override_stacksize);
+
+ /* The stackaddr pthreads attribute is a candidate stack pointer.
+ It must point near the top or the bottom of this buffer, depending
+ on whether stack grows downward or upward, and suitably aligned.
+ On the x86, it grows down, so we set stackaddr near the top. */
+ override_stack = (void *)
+ (((uintptr_t) override_stack + override_stacksize - alignment - perturb)
+ & (~(uintptr_t)(alignment-1)));
+
+ /* XXX: consider using POSIX2K attr_setstack() */
+ if (pthread_attr_setstackaddr (& override_attr, override_stack) != 0 ||
+ pthread_attr_setstacksize (& override_attr,
+ override_stacksize - alignment - perturb) != 0)
+ {
+ /* This should not happen. */
+ CALL_REAL (munmap, override_stack, override_stacksize);
+ errno = EAGAIN;
+ return -1;
+ }
+ }
+
+ /* Actually start the child thread. */
+ {
+ struct pthread_start_info psi;
+ struct pthread_info *pi = NULL;
+
+ /* Fill in startup-control fields. */
+ psi.user_fn = start;
+ psi.user_arg = arg;
+ psi.thread_info = NULL;
+
+ /* Actually create the thread. */
+ __mf_state = reentrant;
+ result = CALL_REAL (pthread_create, thr, & override_attr,
+ & __mf_pthread_spawner, (void *) & psi);
+ __mf_state = active;
+ /* We also hook pthread_join/pthread_exit to get into reentrant
+ mode during thread shutdown/cleanup. */
+
+ /* Wait until child thread has progressed far enough into its
+ __mf_pthread_spawner() call. */
+ while (1) /* XXX: timeout? */
+ {
+ volatile struct pthread_start_info *psip = & psi;
+ pi = psip->thread_info;
+ if (pi != NULL)
+ break;
+ sched_yield ();
+ }
+
+ /* Fill in remaining fields in pthread_info. */
+ pi->stack = override_stack;
+ pi->stack_size = override_stacksize;
+ /* XXX: this might be too late for future heuristics that attempt
+ to use thread stack bounds. We may need to put the new thread
+ to sleep. */
+ }
+
+
+ /* May need to clean up if we created a pthread_attr_t of our own. */
+ if (attr == NULL)
+ pthread_attr_destroy (& override_attr); /* NB: this shouldn't deallocate stack */
+
+ return result;
+}
+
+
+
+#if PIC
+/* A special bootstrap variant. */
+int
+__mf_0fn_pthread_join (pthread_t thr, void **rc)
+{
+ return -1;
+}
+#endif
+
+
+#undef pthread_join
+WRAPPER(int, pthread_join, pthread_t thr, void **rc)
+{
+ DECLARE(int, pthread_join, pthread_t thr, void **rc);
+ int result;
+
+ TRACE ("pthread_join\n");
+ __mf_state = reentrant;
+ result = CALL_REAL (pthread_join, thr, rc);
+ __mf_state = active;
+
+ return result;
+}
+
+
+#if PIC
+/* A special bootstrap variant. */
+void
+__mf_0fn_pthread_exit (void *rc)
+{
+}
+#endif
+
+
+#undef pthread_exit
+WRAPPER(void, pthread_exit, void *rc)
+{
+ DECLARE(void, pthread_exit, void *rc);
+
+ TRACE ("pthread_exit\n");
+ /* __mf_state = reentrant; */
+ CALL_REAL (pthread_exit, rc);
+ /* NOTREACHED */
+}
+
+
+
+
+
+
+
+#endif /* pthreadstuff */
diff --git a/libmudflap/mf-impl.h b/libmudflap/mf-impl.h
new file mode 100644
index 00000000000..05120bfe4b6
--- /dev/null
+++ b/libmudflap/mf-impl.h
@@ -0,0 +1,389 @@
+/* Implementation header for mudflap runtime library.
+ Mudflap: narrow-pointer bounds-checking by tree rewriting.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Contributed by Frank Ch. Eigler <fche@redhat.com>
+ and Graydon Hoare <graydon@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+GCC 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. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#ifndef __MF_IMPL_H
+#define __MF_IMPL_H
+
+#ifdef _MUDFLAP
+#error "Do not compile this file with -fmudflap!"
+#endif
+
+#if HAVE_PTHREAD_H
+#include <pthread.h>
+#elif LIBMUDFLAPTH
+#error "Cannot build libmudflapth without pthread.h."
+#endif
+
+
+/* Private definitions related to mf-runtime.h */
+
+#define __MF_TYPE_MAX_CEM __MF_TYPE_STACK /* largest type# for the cemetary */
+#define __MF_TYPE_MAX __MF_TYPE_GUESS
+
+
+#ifndef max
+#define max(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef min
+#define min(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+/* Address calculation macros. */
+
+#define MINPTR ((uintptr_t) 0)
+#define MAXPTR (~ (uintptr_t) 0)
+
+/* Clamp the addition/subtraction of uintptr_t's to [MINPTR,MAXPTR] */
+#define CLAMPSUB(ptr,offset) (((uintptr_t) ptr) >= (offset) ? ((uintptr_t) ptr)-((uintptr_t) offset) : MINPTR)
+#define CLAMPADD(ptr,offset) (((uintptr_t) ptr) <= MAXPTR-(offset) ? ((uintptr_t) ptr)+((uintptr_t) offset) : MAXPTR)
+#define CLAMPSZ(ptr,size) ((size) ? (((uintptr_t) ptr) <= MAXPTR-(size)+1 ? ((uintptr_t) ptr)+((uintptr_t) size) - 1 : MAXPTR) : ((uintptr_t) ptr))
+
+#define __MF_CACHE_INDEX(ptr) ((((uintptr_t) (ptr)) >> __mf_lc_shift) & __mf_lc_mask)
+#define __MF_CACHE_MISS_P(ptr,sz) ({ \
+ struct __mf_cache *elem = & __mf_lookup_cache[__MF_CACHE_INDEX((ptr))]; \
+ ((elem->low > (uintptr_t) (ptr)) || \
+ (elem->high < (CLAMPADD((uintptr_t) (ptr), (uintptr_t) CLAMPSUB(sz,1) )))); })
+/* XXX: the above should use CLAMPSZ () */
+
+
+
+/* Private functions. */
+
+extern void __mf_violation (void *ptr, size_t sz,
+ uintptr_t pc, const char *location,
+ int type);
+extern size_t __mf_backtrace (char ***, void *, unsigned);
+extern int __mf_heuristic_check (uintptr_t, uintptr_t);
+
+/* ------------------------------------------------------------------------ */
+/* Type definitions. */
+/* ------------------------------------------------------------------------ */
+
+/* The mf_state type codes describe recursion and initialization order. */
+
+enum __mf_state_enum { active, reentrant };
+
+/* The __mf_options structure records optional or tunable aspects of the
+ mudflap library's behavior. There is a single global instance of this
+ structure which is populated from user input (in an environment variable)
+ when the library initializes. */
+
+struct __mf_options
+{
+ /* Emit a trace message for each call. */
+ unsigned trace_mf_calls;
+
+ /* Collect and emit statistics. */
+ unsigned collect_stats;
+
+ /* Set up a SIGUSR1 -> __mf_report handler. */
+ unsigned sigusr1_report;
+
+ /* Execute internal checking code. */
+ unsigned internal_checking;
+
+ /* Age object liveness periodically. */
+ unsigned tree_aging;
+
+ /* Adapt the lookup cache to working set. */
+ unsigned adapt_cache;
+
+ /* Print list of leaked heap objects on shutdown. */
+ unsigned print_leaks;
+
+ /* Detect reads of uninitialized objects. */
+ unsigned check_initialization;
+
+ /* Print verbose description of violations. */
+ unsigned verbose_violations;
+
+ /* Abbreviate duplicate object descriptions. */
+ unsigned abbreviate;
+
+ /* Emit internal tracing message. */
+ unsigned verbose_trace;
+
+ /* Support multiple threads. XXX: not yet implemented. */
+ /* unsigned multi_threaded; */
+
+ /* Wipe stack/heap objects upon unwind. */
+ unsigned wipe_stack;
+ unsigned wipe_heap;
+
+ /* Maintain a queue of this many deferred free()s,
+ to trap use of freed memory. */
+ unsigned free_queue_length;
+
+ /* Maintain a history of this many past unregistered objects. */
+ unsigned persistent_count;
+
+ /* Pad allocated extents by this many bytes on either side. */
+ unsigned crumple_zone;
+
+ /* Maintain this many stack frames for contexts. */
+ unsigned backtrace;
+
+#ifdef LIBMUDFLAPTH
+ /* Thread stack size. */
+ unsigned thread_stack;
+#endif
+
+ /* Major operation mode */
+ enum
+ {
+ mode_nop, /* mudflaps do nothing */
+ mode_populate, /* mudflaps populate tree but do not check for violations */
+ mode_check, /* mudflaps populate and check for violations (normal) */
+ mode_violate /* mudflaps trigger a violation on every call (diagnostic) */
+ }
+ mudflap_mode;
+
+
+ /* How to handle a violation. */
+
+ enum
+ {
+ viol_nop, /* Return control to application. */
+ viol_segv, /* Signal self with segv. */
+ viol_abort, /* Call abort (). */
+ viol_gdb /* Fork a debugger on self */
+ }
+ violation_mode;
+
+ /* Violation heuristics selection. */
+ unsigned heur_stack_bound; /* allow current stack region */
+ unsigned heur_proc_map; /* allow & cache /proc/self/map regions. */
+ unsigned heur_start_end; /* allow _start .. _end */
+ unsigned heur_std_data; /* allow & cache stdlib data */
+};
+
+
+#ifdef PIC
+
+/* This is a table of dynamically resolved function pointers. */
+
+struct __mf_dynamic_entry
+{
+ void *pointer;
+ char *name;
+ char *version;
+};
+
+/* The definition of the array (mf-runtime.c) must match the enums! */
+extern struct __mf_dynamic_entry __mf_dynamic[];
+enum __mf_dynamic_index
+{
+ dyn_calloc, dyn_free, dyn_malloc, dyn_mmap,
+ dyn_munmap, dyn_realloc,
+ dyn_INITRESOLVE, /* Marker for last init-time resolution. */
+#ifdef LIBMUDFLAPTH
+ dyn_pthread_create,
+ dyn_pthread_join,
+ dyn_pthread_exit
+#endif
+};
+
+#endif /* PIC */
+
+/* ------------------------------------------------------------------------ */
+/* Private global variables. */
+/* ------------------------------------------------------------------------ */
+
+#ifdef LIBMUDFLAPTH
+extern pthread_mutex_t __mf_biglock;
+#define LOCKTH() do { extern unsigned long __mf_lock_contention; \
+ int rc = pthread_mutex_trylock (& __mf_biglock); \
+ if (rc) { __mf_lock_contention ++; \
+ rc = pthread_mutex_lock (& __mf_biglock); } \
+ assert (rc==0); } while (0)
+#define UNLOCKTH() do { int rc = pthread_mutex_unlock (& __mf_biglock); \
+ assert (rc==0); } while (0)
+#else
+#define LOCKTH() do {} while (0)
+#define UNLOCKTH() do {} while (0)
+#endif
+
+#ifdef LIBMUDFLAPTH
+extern enum __mf_state_enum *__mf_state_perthread ();
+#define __mf_state (* __mf_state_perthread ())
+#else
+extern enum __mf_state_enum __mf_state;
+#endif
+extern int __mf_starting_p;
+
+extern struct __mf_options __mf_opts;
+
+/* ------------------------------------------------------------------------ */
+/* Utility macros. */
+/* ------------------------------------------------------------------------ */
+
+#define UNLIKELY(e) (__builtin_expect (!!(e), 0))
+#define LIKELY(e) (__builtin_expect (!!(e), 1))
+#define STRINGIFY2(e) #e
+#define STRINGIFY(e) STRINGIFY2(e)
+
+#ifdef LIBMUDFLAPTH
+#define VERBOSE_TRACE(...) \
+ do { if (UNLIKELY (__mf_opts.verbose_trace)) { \
+ fprintf (stderr, "mf(%u): ", (unsigned) pthread_self ()); \
+ fprintf (stderr, __VA_ARGS__); \
+ } } while (0)
+#define TRACE(...) \
+ do { if (UNLIKELY (__mf_opts.trace_mf_calls)) { \
+ fprintf (stderr, "mf(%u): ", (unsigned) pthread_self ()); \
+ fprintf (stderr, __VA_ARGS__); \
+ } } while (0)
+#else
+#define VERBOSE_TRACE(...) \
+ do { if (UNLIKELY (__mf_opts.verbose_trace)) { \
+ fprintf (stderr, "mf: "); \
+ fprintf (stderr, __VA_ARGS__); \
+ } } while (0)
+#define TRACE(...) \
+ do { if (UNLIKELY (__mf_opts.trace_mf_calls)) { \
+ fprintf (stderr, "mf: "); \
+ fprintf (stderr, __VA_ARGS__); \
+ } } while (0)
+#endif
+
+
+#define __MF_PERSIST_MAX 256
+#define __MF_FREEQ_MAX 256
+
+/*
+ Wrapping and redirection:
+
+ Mudflap redirects a number of libc functions into itself, for "cheap"
+ verification (eg. strcpy, bzero, memcpy) and also to register /
+ unregister regions of memory as they are manipulated by the program
+ (eg. malloc/free, mmap/munmap).
+
+ There are two methods of wrapping.
+
+ (1) The static method involves a list of -wrap=foo flags being passed to
+ the linker, which then links references to "foo" to the symbol
+ "__wrap_foo", and links references to "__real_foo" to the symbol "foo".
+ When compiled without -DPIC, libmudflap.a contains such __wrap_foo
+ functions which delegate to __real_foo functions in libc to get their
+ work done.
+
+ (2) The dynamic method involves providing a definition of symbol foo in
+ libmudflap.so and linking it earlier in the compiler command line,
+ before libc.so. The function "foo" in libmudflap must then call
+ dlsym(RTLD_NEXT, "foo") to acquire a pointer to the "real" libc foo, or
+ at least the "next" foo in the dynamic link resolution order.
+
+ We switch between these two techniques by the presence of the -DPIC
+ #define passed in by libtool when building libmudflap.
+*/
+
+
+#ifdef PIC
+
+extern void __mf_resolve_single_dynamic (struct __mf_dynamic_entry *);
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+
+#define WRAPPER(ret, fname, ...) \
+ret __wrap_ ## fname (__VA_ARGS__) \
+ __attribute__ (( alias (#fname) )); \
+ret __real_ ## fname (__VA_ARGS__) \
+ __attribute__ (( alias (#fname) )); \
+ret fname (__VA_ARGS__)
+#define DECLARE(ty, fname, ...) \
+ typedef ty (*__mf_fn_ ## fname) (__VA_ARGS__); \
+ extern ty __mf_0fn_ ## fname (__VA_ARGS__);
+#define CALL_REAL(fname, ...) \
+ ({__mf_starting_p \
+ ? __mf_0fn_ ## fname (__VA_ARGS__) \
+ : (__mf_resolve_single_dynamic (& __mf_dynamic[dyn_ ## fname]), \
+ (((__mf_fn_ ## fname)(__mf_dynamic[dyn_ ## fname].pointer)) (__VA_ARGS__)));})
+#define CALL_BACKUP(fname, ...) \
+ __mf_0fn_ ## fname(__VA_ARGS__)
+
+#else /* not PIC --> static library */
+
+#define WRAPPER(ret, fname, ...) \
+ret __wrap_ ## fname (__VA_ARGS__)
+#define DECLARE(ty, fname, ...) \
+ extern ty __real_ ## fname (__VA_ARGS__)
+#define CALL_REAL(fname, ...) \
+ __real_ ## fname (__VA_ARGS__)
+#define CALL_BACKUP(fname, ...) \
+ __real_ ## fname(__VA_ARGS__)
+
+#endif /* PIC */
+
+/* WRAPPER2 is for functions intercepted via macros at compile time. */
+#define WRAPPER2(ret, fname, ...) \
+ret __mfwrap_ ## fname (__VA_ARGS__)
+
+
+/* Utility macros for mf-hooks*.c */
+
+#define MF_VALIDATE_EXTENT(value,size,acc,context) \
+ do { \
+ if (UNLIKELY (size > 0 && __MF_CACHE_MISS_P (value, size))) \
+ __mf_check ((void *) (value), (size), acc, "(" context ")"); \
+ } while (0)
+#define BEGIN_PROTECT(fname, ...) \
+ if (UNLIKELY (__mf_starting_p)) \
+ { \
+ return CALL_BACKUP(fname, __VA_ARGS__); \
+ } \
+ else if (UNLIKELY (__mf_state == reentrant)) \
+ { \
+ extern unsigned long __mf_reentrancy; \
+ if (UNLIKELY (__mf_opts.verbose_trace)) { \
+ write (2, "mf: reentrancy detected in `", 28); \
+ write (2, __PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__)); \
+ write (2, "'\n", 2); } \
+ __mf_reentrancy ++; \
+ return CALL_REAL(fname, __VA_ARGS__); \
+ } \
+ else \
+ { \
+ TRACE ("%s\n", __PRETTY_FUNCTION__); \
+ }
+
+
+/* Unlocked variants of main entry points from mf-runtime.h. */
+extern void __mfu_check (void *ptr, size_t sz, int type, const char *location);
+extern void __mfu_register (void *ptr, size_t sz, int type, const char *name);
+extern void __mfu_unregister (void *ptr, size_t sz);
+extern void __mfu_report ();
+extern int __mfu_set_options (const char *opts);
+
+
+#endif /* __MF_IMPL_H */
diff --git a/libmudflap/mf-runtime.c b/libmudflap/mf-runtime.c
new file mode 100644
index 00000000000..88a3682081c
--- /dev/null
+++ b/libmudflap/mf-runtime.c
@@ -0,0 +1,2431 @@
+/* Mudflap: narrow-pointer bounds-checking by tree rewriting.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Contributed by Frank Ch. Eigler <fche@redhat.com>
+ and Graydon Hoare <graydon@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+GCC 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. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include "config.h"
+
+/* These attempt to coax various unix flavours to declare all our
+ needed tidbits in the system headers. */
+#if !defined(__FreeBSD__)
+#define _POSIX_SOURCE
+#endif /* Some BSDs break <sys/socket.h> if this is defined. */
+#define _GNU_SOURCE
+#define _XOPEN_SOURCE
+#define _BSD_TYPES
+#define __EXTENSIONS__
+#define _ALL_SOURCE
+#define _LARGE_FILE_API
+#define _XOPEN_SOURCE_EXTENDED 1
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+#include <unistd.h>
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#include <assert.h>
+
+#include <string.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <errno.h>
+
+#include "mf-runtime.h"
+#include "mf-impl.h"
+
+
+/* ------------------------------------------------------------------------ */
+/* Utility macros */
+
+#define CTOR __attribute__ ((constructor))
+#define DTOR __attribute__ ((destructor))
+
+
+/* Codes to describe the context in which a violation occurs. */
+#define __MF_VIOL_UNKNOWN 0
+#define __MF_VIOL_READ 1
+#define __MF_VIOL_WRITE 2
+#define __MF_VIOL_REGISTER 3
+#define __MF_VIOL_UNREGISTER 4
+#define __MF_VIOL_WATCH 5
+
+/* Protect against recursive calls. */
+#define BEGIN_RECURSION_PROTECT() do { \
+ if (UNLIKELY (__mf_state == reentrant)) { \
+ write (2, "mf: erroneous reentrancy detected in `", 38); \
+ write (2, __PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__)); \
+ write (2, "'\n", 2); \
+ abort (); } \
+ __mf_state = reentrant; \
+ } while (0)
+
+#define END_RECURSION_PROTECT() do { \
+ __mf_state = active; \
+ } while (0)
+
+
+
+/* ------------------------------------------------------------------------ */
+/* Required globals. */
+
+#define LOOKUP_CACHE_MASK_DFL 1023
+#define LOOKUP_CACHE_SIZE_MAX 4096 /* Allows max CACHE_MASK 0x0FFF */
+#define LOOKUP_CACHE_SHIFT_DFL 2
+
+struct __mf_cache __mf_lookup_cache [LOOKUP_CACHE_SIZE_MAX];
+uintptr_t __mf_lc_mask = LOOKUP_CACHE_MASK_DFL;
+unsigned char __mf_lc_shift = LOOKUP_CACHE_SHIFT_DFL;
+#define LOOKUP_CACHE_SIZE (__mf_lc_mask + 1)
+
+struct __mf_options __mf_opts;
+
+int __mf_starting_p = 1;
+#ifndef LIBMUDFLAPTH
+enum __mf_state_enum __mf_state = active;
+#else
+/* See __mf_state_perthread() in mf-hooks.c. */
+#endif
+
+
+#ifdef LIBMUDFLAPTH
+pthread_mutex_t __mf_biglock =
+#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+ PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+#else
+ PTHREAD_MUTEX_INITIALIZER;
+#endif
+#endif
+
+/* Use HAVE_PTHREAD_H here instead of LIBMUDFLAPTH, so that even
+ the libmudflap.la (no threading support) can diagnose whether
+ the application is linked with -lpthread. See __mf_usage() below. */
+#if HAVE_PTHREAD_H
+#pragma weak pthread_join
+const void *threads_active_p = (void *) pthread_join;
+#endif
+
+
+/* ------------------------------------------------------------------------ */
+/* stats-related globals. */
+
+static unsigned long __mf_count_check;
+static unsigned long __mf_lookup_cache_reusecount [LOOKUP_CACHE_SIZE_MAX];
+static unsigned long __mf_treerot_left, __mf_treerot_right;
+static unsigned long __mf_count_register;
+static unsigned long __mf_total_register_size [__MF_TYPE_MAX+1];
+static unsigned long __mf_count_unregister;
+static unsigned long __mf_total_unregister_size;
+static unsigned long __mf_count_violation [__MF_VIOL_WATCH+1];
+static unsigned long __mf_sigusr1_received;
+static unsigned long __mf_sigusr1_handled;
+/* not static */ unsigned long __mf_reentrancy;
+#ifdef LIBMUDFLAPTH
+/* not static */ unsigned long __mf_lock_contention;
+#endif
+
+
+/* ------------------------------------------------------------------------ */
+/* mode-check-related globals. */
+
+typedef struct __mf_object
+{
+ uintptr_t low, high; /* __mf_register parameters */
+ const char *name;
+ char type; /* __MF_TYPE_something */
+ char watching_p; /* Trigger a VIOL_WATCH on access? */
+ unsigned read_count; /* Number of times __mf_check/read was called on this object. */
+ unsigned write_count; /* Likewise for __mf_check/write. */
+ unsigned liveness; /* A measure of recent checking activity. */
+ unsigned description_epoch; /* Last epoch __mf_describe_object printed this. */
+
+ uintptr_t alloc_pc;
+ struct timeval alloc_time;
+ char **alloc_backtrace;
+ size_t alloc_backtrace_size;
+#ifdef LIBMUDFLAPTH
+ pthread_t alloc_thread;
+#endif
+
+ int deallocated_p;
+ uintptr_t dealloc_pc;
+ struct timeval dealloc_time;
+ char **dealloc_backtrace;
+ size_t dealloc_backtrace_size;
+#ifdef LIBMUDFLAPTH
+ pthread_t dealloc_thread;
+#endif
+} __mf_object_t;
+
+
+typedef struct __mf_object_tree
+{
+ __mf_object_t data;
+ struct __mf_object_tree *left;
+ struct __mf_object_tree *right;
+} __mf_object_tree_t;
+
+/* Live objects: binary tree on __mf_object_t.low */
+static __mf_object_tree_t *__mf_object_root;
+
+/* Dead objects: circular arrays; _MIN_CEM .. _MAX_CEM only */
+static unsigned __mf_object_dead_head[__MF_TYPE_MAX_CEM+1]; /* next empty spot */
+static __mf_object_tree_t *__mf_object_cemetary[__MF_TYPE_MAX_CEM+1][__MF_PERSIST_MAX];
+
+
+/* ------------------------------------------------------------------------ */
+/* Forward function declarations */
+
+static void __mf_init () CTOR;
+static void __mf_sigusr1_respond ();
+static unsigned __mf_find_objects (uintptr_t ptr_low, uintptr_t ptr_high,
+ __mf_object_tree_t **objs, unsigned max_objs);
+static unsigned __mf_find_dead_objects (uintptr_t ptr_low, uintptr_t ptr_high,
+ __mf_object_tree_t **objs, unsigned max_objs);
+static void __mf_link_object (__mf_object_tree_t *obj);
+static void __mf_age_tree (__mf_object_tree_t *obj);
+static void __mf_adapt_cache ();
+static void __mf_unlink_object (__mf_object_tree_t *obj);
+static void __mf_describe_object (__mf_object_t *obj);
+static unsigned __mf_watch_or_not (void *ptr, size_t sz, char flag);
+
+
+
+/* ------------------------------------------------------------------------ */
+/* Configuration engine */
+
+static void
+__mf_set_default_options ()
+{
+ memset (& __mf_opts, 0, sizeof (__mf_opts));
+
+ __mf_opts.tree_aging = 13037;
+ __mf_opts.adapt_cache = 1000003;
+ __mf_opts.abbreviate = 1;
+ __mf_opts.verbose_violations = 1;
+ __mf_opts.free_queue_length = 4;
+ __mf_opts.persistent_count = 100;
+ __mf_opts.crumple_zone = 32;
+ __mf_opts.backtrace = 4;
+ __mf_opts.mudflap_mode = mode_check;
+ __mf_opts.violation_mode = viol_nop;
+ __mf_opts.heur_std_data = 1;
+#ifdef LIBMUDFLAPTH
+ __mf_opts.thread_stack = 0;
+#endif
+}
+
+static struct option
+{
+ char *name;
+ char *description;
+ enum
+ {
+ set_option,
+ read_integer_option,
+ } type;
+ int value;
+ int *target;
+}
+options [] =
+ {
+ {"mode-nop",
+ "mudflaps do nothing",
+ set_option, (int)mode_nop, (int *)&__mf_opts.mudflap_mode},
+ {"mode-populate",
+ "mudflaps populate object tree",
+ set_option, (int)mode_populate, (int *)&__mf_opts.mudflap_mode},
+ {"mode-check",
+ "mudflaps check for memory violations",
+ set_option, (int)mode_check, (int *)&__mf_opts.mudflap_mode},
+ {"mode-violate",
+ "mudflaps always cause violations (diagnostic)",
+ set_option, (int)mode_violate, (int *)&__mf_opts.mudflap_mode},
+
+ {"viol-nop",
+ "violations do not change program execution",
+ set_option, (int)viol_nop, (int *)&__mf_opts.violation_mode},
+ {"viol-abort",
+ "violations cause a call to abort()",
+ set_option, (int)viol_abort, (int *)&__mf_opts.violation_mode},
+ {"viol-segv",
+ "violations are promoted to SIGSEGV signals",
+ set_option, (int)viol_segv, (int *)&__mf_opts.violation_mode},
+ {"viol-gdb",
+ "violations fork a gdb process attached to current program",
+ set_option, (int)viol_gdb, (int *)&__mf_opts.violation_mode},
+ {"trace-calls",
+ "trace calls to mudflap runtime library",
+ set_option, 1, &__mf_opts.trace_mf_calls},
+ {"verbose-trace",
+ "trace internal events within mudflap runtime library",
+ set_option, 1, &__mf_opts.verbose_trace},
+ {"collect-stats",
+ "collect statistics on mudflap's operation",
+ set_option, 1, &__mf_opts.collect_stats},
+#if HAVE_SIGNAL
+ {"sigusr1-report",
+ "print report upon SIGUSR1",
+ set_option, 1, &__mf_opts.sigusr1_report},
+#endif
+ {"internal-checking",
+ "perform more expensive internal checking",
+ set_option, 1, &__mf_opts.internal_checking},
+ {"age-tree",
+ "age the object tree after N accesses for working set",
+ read_integer_option, 1000000, &__mf_opts.tree_aging},
+ {"print-leaks",
+ "print any memory leaks at program shutdown",
+ set_option, 1, &__mf_opts.print_leaks},
+ {"check-initialization",
+ "detect uninitialized object reads",
+ set_option, 1, &__mf_opts.check_initialization},
+ {"verbose-violations",
+ "print verbose messages when memory violations occur",
+ set_option, 1, &__mf_opts.verbose_violations},
+ {"abbreviate",
+ "abbreviate repetitive listings",
+ set_option, 1, &__mf_opts.abbreviate},
+ {"wipe-stack",
+ "wipe stack objects at unwind",
+ set_option, 1, &__mf_opts.wipe_stack},
+ {"wipe-heap",
+ "wipe heap objects at free",
+ set_option, 1, &__mf_opts.wipe_heap},
+ {"heur-proc-map",
+ "support /proc/self/map heuristics",
+ set_option, 1, &__mf_opts.heur_proc_map},
+ {"heur-stack-bound",
+ "enable a simple upper stack bound heuristic",
+ set_option, 1, &__mf_opts.heur_stack_bound},
+ {"heur-start-end",
+ "support _start.._end heuristics",
+ set_option, 1, &__mf_opts.heur_start_end},
+ {"heur-stdlib",
+ "register standard library data (argv, errno, stdin, ...)",
+ set_option, 1, &__mf_opts.heur_std_data},
+ {"free-queue-length",
+ "queue N deferred free() calls before performing them",
+ read_integer_option, 0, &__mf_opts.free_queue_length},
+ {"persistent-count",
+ "keep a history of N unregistered regions",
+ read_integer_option, 0, &__mf_opts.persistent_count},
+ {"crumple-zone",
+ "surround allocations with crumple zones of N bytes",
+ read_integer_option, 0, &__mf_opts.crumple_zone},
+ /* XXX: not type-safe.
+ {"lc-mask",
+ "set lookup cache size mask to N (2**M - 1)",
+ read_integer_option, 0, (int *)(&__mf_lc_mask)},
+ {"lc-shift",
+ "set lookup cache pointer shift",
+ read_integer_option, 0, (int *)(&__mf_lc_shift)},
+ */
+ {"lc-adapt",
+ "adapt mask/shift parameters after N cache misses",
+ read_integer_option, 1, &__mf_opts.adapt_cache},
+ {"backtrace",
+ "keep an N-level stack trace of each call context",
+ read_integer_option, 0, &__mf_opts.backtrace},
+#ifdef LIBMUDFLAPTH
+ {"thread-stack",
+ "override thread stacks allocation: N kB",
+ read_integer_option, 0, &__mf_opts.thread_stack},
+#endif
+ {0, 0, set_option, 0, NULL}
+ };
+
+static void
+__mf_usage ()
+{
+ struct option *opt;
+
+ fprintf (stderr,
+ "This is a %s%sGCC \"mudflap\" memory-checked binary.\n"
+ "Mudflap is Copyright (C) 2002-2003 Free Software Foundation, Inc.\n"
+ "\n"
+ "The mudflap code can be controlled by an environment variable:\n"
+ "\n"
+ "$ export MUDFLAP_OPTIONS='<options>'\n"
+ "$ <mudflapped_program>\n"
+ "\n"
+ "where <options> is a space-separated list of \n"
+ "any of the following options. Use `-no-OPTION' to disable options.\n"
+ "\n",
+#if HAVE_PTHREAD_H
+ (threads_active_p ? "multi-threaded " : "single-threaded "),
+#else
+ "",
+#endif
+#if LIBMUDFLAPTH
+ "thread-aware "
+#else
+ "thread-unaware "
+#endif
+ );
+ /* XXX: The multi-threaded thread-unaware combination is bad. */
+
+ for (opt = options; opt->name; opt++)
+ {
+ int default_p = (opt->value == * opt->target);
+
+ switch (opt->type)
+ {
+ char buf[128];
+ case set_option:
+ fprintf (stderr, "-%-23.23s %s", opt->name, opt->description);
+ if (default_p)
+ fprintf (stderr, " [active]\n");
+ else
+ fprintf (stderr, "\n");
+ break;
+ case read_integer_option:
+ strncpy (buf, opt->name, 128);
+ strncpy (buf + strlen (opt->name), "=N", 2);
+ fprintf (stderr, "-%-23.23s %s", buf, opt->description);
+ fprintf (stderr, " [%d]\n", * opt->target);
+ break;
+ default: abort();
+ }
+ }
+
+ fprintf (stderr, "\n");
+}
+
+
+int
+__mf_set_options (const char *optstr)
+{
+ int rc;
+ LOCKTH ();
+ BEGIN_RECURSION_PROTECT ();
+ rc = __mfu_set_options (optstr);
+ /* XXX: It's not really that easy. A change to a bunch of parameters
+ can require updating auxiliary state or risk crashing:
+ free_queue_length, crumple_zone ... */
+ END_RECURSION_PROTECT ();
+ UNLOCKTH ();
+ return rc;
+}
+
+
+int
+__mfu_set_options (const char *optstr)
+{
+ struct option *opts = 0;
+ char *nxt = 0;
+ long tmp = 0;
+ int rc = 0;
+ const char *saved_optstr = optstr;
+
+ /* XXX: bounds-check for optstr! */
+
+ while (*optstr)
+ {
+ switch (*optstr) {
+ case ' ':
+ case '\t':
+ case '\n':
+ optstr++;
+ break;
+
+ case '-':
+ if (*optstr+1)
+ {
+ int negate = 0;
+ optstr++;
+
+ if (*optstr == '?' ||
+ strncmp (optstr, "help", 4) == 0)
+ {
+ /* Caller will print help and exit. */
+ return -1;
+ }
+
+ if (strncmp (optstr, "no-", 3) == 0)
+ {
+ negate = 1;
+ optstr = & optstr[3];
+ }
+
+ for (opts = options; opts->name; opts++)
+ {
+ if (strncmp (optstr, opts->name, strlen (opts->name)) == 0)
+ {
+ optstr += strlen (opts->name);
+ assert (opts->target);
+ switch (opts->type)
+ {
+ case set_option:
+ if (negate)
+ *(opts->target) = 0;
+ else
+ *(opts->target) = opts->value;
+ break;
+ case read_integer_option:
+ if (! negate && (*optstr == '=' && *(optstr+1)))
+ {
+ optstr++;
+ tmp = strtol (optstr, &nxt, 10);
+ if ((optstr != nxt) && (tmp != LONG_MAX))
+ {
+ optstr = nxt;
+ *(opts->target) = (int)tmp;
+ }
+ }
+ else if (negate)
+ * opts->target = 0;
+ break;
+ }
+ }
+ }
+ }
+ break;
+
+ default:
+ fprintf (stderr,
+ "warning: unrecognized string '%s' in mudflap options\n",
+ optstr);
+ optstr += strlen (optstr);
+ rc = -1;
+ break;
+ }
+ }
+
+ /* Special post-processing: bound __mf_lc_mask and free_queue_length for security. */
+ __mf_lc_mask &= (LOOKUP_CACHE_SIZE_MAX - 1);
+ __mf_opts.free_queue_length &= (__MF_FREEQ_MAX - 1);
+
+ /* Clear the lookup cache, in case the parameters got changed. */
+ /* XXX: race */
+ memset (__mf_lookup_cache, 0, sizeof(__mf_lookup_cache));
+ /* void slot 0 */
+ __mf_lookup_cache[0].low = MAXPTR;
+
+ TRACE ("set options from `%s'\n", saved_optstr);
+
+ /* Call this unconditionally, in case -sigusr1-report was toggled. */
+ __mf_sigusr1_respond ();
+
+ return rc;
+}
+
+
+#ifdef PIC
+
+void
+__mf_resolve_single_dynamic (struct __mf_dynamic_entry *e)
+{
+ char *err;
+
+ assert (e);
+ if (e->pointer) return;
+
+#if HAVE_DLVSYM
+ if (e->version != NULL && e->version[0] != '\0') /* non-null/empty */
+ e->pointer = dlvsym (RTLD_NEXT, e->name, e->version);
+ else
+#endif
+ e->pointer = dlsym (RTLD_NEXT, e->name);
+
+ err = dlerror ();
+
+ if (err)
+ {
+ fprintf (stderr, "mf: error in dlsym(\"%s\"): %s\n",
+ e->name, err);
+ abort ();
+ }
+ if (! e->pointer)
+ {
+ fprintf (stderr, "mf: dlsym(\"%s\") = NULL\n", e->name);
+ abort ();
+ }
+}
+
+
+static void
+__mf_resolve_dynamics ()
+{
+ int i;
+ for (i = 0; i < dyn_INITRESOLVE; i++)
+ __mf_resolve_single_dynamic (& __mf_dynamic[i]);
+}
+
+
+/* NB: order must match enums in mf-impl.h */
+struct __mf_dynamic_entry __mf_dynamic [] =
+{
+ {NULL, "calloc", NULL},
+ {NULL, "free", NULL},
+ {NULL, "malloc", NULL},
+ {NULL, "mmap", NULL},
+ {NULL, "munmap", NULL},
+ {NULL, "realloc", NULL},
+ {NULL, "DUMMY", NULL}, /* dyn_INITRESOLVE */
+#ifdef LIBMUDFLAPTH
+ {NULL, "pthread_create", PTHREAD_CREATE_VERSION},
+ {NULL, "pthread_join", NULL},
+ {NULL, "pthread_exit", NULL}
+#endif
+};
+
+#endif /* PIC */
+
+
+
+/* ------------------------------------------------------------------------ */
+
+
+void __mf_init ()
+{
+ char *ov = 0;
+
+ /* This initial bootstrap phase requires that __mf_starting_p = 1. */
+#ifdef PIC
+ __mf_resolve_dynamics ();
+#endif
+ __mf_starting_p = 0;
+
+ __mf_set_default_options ();
+
+ ov = getenv ("MUDFLAP_OPTIONS");
+ if (ov)
+ {
+ int rc = __mfu_set_options (ov);
+ if (rc < 0)
+ {
+ __mf_usage ();
+ exit (1);
+ }
+ }
+
+ /* Initialize to a non-zero description epoch. */
+ __mf_describe_object (NULL);
+
+#define REG_RESERVED(obj) \
+ __mf_register (& obj, sizeof(obj), __MF_TYPE_NOACCESS, # obj)
+
+ REG_RESERVED (__mf_lookup_cache);
+ REG_RESERVED (__mf_lc_mask);
+ REG_RESERVED (__mf_lc_shift);
+ /* XXX: others of our statics? */
+
+ /* Prevent access to *NULL. */
+ __mf_register (MINPTR, 1, __MF_TYPE_NOACCESS, "NULL");
+ __mf_lookup_cache[0].low = (uintptr_t) -1;
+}
+
+
+
+int
+__wrap_main (int argc, char* argv[])
+{
+ extern char **environ;
+ extern int main ();
+ static int been_here = 0;
+
+ if (__mf_opts.heur_std_data && ! been_here)
+ {
+ unsigned i;
+
+ been_here = 1;
+ __mf_register (argv, sizeof(char *)*(argc+1), __MF_TYPE_STATIC, "argv[]");
+ for (i=0; i<argc; i++)
+ {
+ unsigned j = strlen (argv[i]);
+ __mf_register (argv[i], j+1, __MF_TYPE_STATIC, "argv element");
+ }
+
+ for (i=0; ; i++)
+ {
+ char *e = environ[i];
+ unsigned j;
+ if (e == NULL) break;
+ j = strlen (environ[i]);
+ __mf_register (environ[i], j+1, __MF_TYPE_STATIC, "environ element");
+ }
+ __mf_register (environ, sizeof(char *)*(i+1), __MF_TYPE_STATIC, "environ[]");
+
+ __mf_register (& errno, sizeof (errno), __MF_TYPE_STATIC, "errno area");
+
+ __mf_register (stdin, sizeof (*stdin), __MF_TYPE_STATIC, "stdin");
+ __mf_register (stdout, sizeof (*stdout), __MF_TYPE_STATIC, "stdout");
+ __mf_register (stderr, sizeof (*stderr), __MF_TYPE_STATIC, "stderr");
+ }
+
+#ifdef PIC
+ return main (argc, argv, environ);
+#else
+ return __real_main (argc, argv, environ);
+#endif
+}
+
+
+
+extern void __mf_fini () DTOR;
+void __mf_fini ()
+{
+ TRACE ("__mf_fini\n");
+ __mfu_report ();
+}
+
+
+
+/* ------------------------------------------------------------------------ */
+/* __mf_check */
+
+void __mf_check (void *ptr, size_t sz, int type, const char *location)
+{
+ LOCKTH ();
+ BEGIN_RECURSION_PROTECT ();
+ __mfu_check (ptr, sz, type, location);
+ END_RECURSION_PROTECT ();
+ UNLOCKTH ();
+}
+
+
+void __mfu_check (void *ptr, size_t sz, int type, const char *location)
+{
+ unsigned entry_idx = __MF_CACHE_INDEX (ptr);
+ struct __mf_cache *entry = & __mf_lookup_cache [entry_idx];
+ int judgement = 0; /* 0=undecided; <0=violation; >0=okay */
+ uintptr_t ptr_low = (uintptr_t) ptr;
+ uintptr_t ptr_high = CLAMPSZ (ptr, sz);
+ struct __mf_cache old_entry = *entry;
+
+ if (UNLIKELY (__mf_opts.sigusr1_report))
+ __mf_sigusr1_respond ();
+
+ TRACE ("check ptr=%p b=%u size=%lu %s location=`%s'\n",
+ ptr, entry_idx, (unsigned long)sz,
+ (type == 0 ? "read" : "write"), location);
+
+ switch (__mf_opts.mudflap_mode)
+ {
+ case mode_nop:
+ judgement = 1;
+ break;
+
+ case mode_populate:
+ entry->low = ptr_low;
+ entry->high = ptr_high;
+ judgement = 1;
+ break;
+
+ case mode_check:
+ {
+ unsigned heuristics = 0;
+
+ /* Advance aging/adaptation counters. */
+ if (__mf_object_root)
+ {
+ static unsigned aging_count;
+ static unsigned adapt_count;
+ aging_count ++;
+ adapt_count ++;
+ if (UNLIKELY (__mf_opts.tree_aging > 0 &&
+ aging_count > __mf_opts.tree_aging))
+ {
+ aging_count = 0;
+ __mf_age_tree (__mf_object_root);
+ }
+ if (UNLIKELY (__mf_opts.adapt_cache > 0 &&
+ adapt_count > __mf_opts.adapt_cache))
+ {
+ adapt_count = 0;
+ __mf_adapt_cache ();
+ }
+ }
+
+ /* Looping only occurs if heuristics were triggered. */
+ while (judgement == 0)
+ {
+ __mf_object_tree_t* ovr_obj[1];
+ unsigned obj_count;
+
+ obj_count = __mf_find_objects (ptr_low, ptr_high, ovr_obj, 1);
+
+ if (LIKELY (obj_count == 1)) /* A single hit! */
+ {
+ __mf_object_t *obj = & ovr_obj[0]->data;
+ assert (obj != NULL);
+ if (LIKELY (ptr_low >= obj->low && ptr_high <= obj->high))
+ {
+ /* XXX: hope for no overflow! */
+ if (type == __MF_CHECK_READ)
+ obj->read_count ++;
+ else
+ obj->write_count ++;
+
+ obj->liveness ++;
+
+ if (UNLIKELY (obj->type == __MF_TYPE_NOACCESS))
+ judgement = -1;
+ else if (UNLIKELY (obj->watching_p))
+ judgement = -2; /* trigger VIOL_WATCH */
+ else if (UNLIKELY (__mf_opts.check_initialization
+ /* reading */
+ && type == __MF_CHECK_READ
+ /* not written */
+ && obj->write_count == 0
+ /* uninitialized (heap) */
+ && obj->type == __MF_TYPE_HEAP))
+ judgement = -1;
+ else
+ {
+ /* Valid access. */
+ entry->low = obj->low;
+ entry->high = obj->high;
+ judgement = 1;
+ }
+ }
+ /* The object did not cover the entire accessed region. */
+ }
+ else if (LIKELY (obj_count > 1))
+ {
+ __mf_object_tree_t **all_ovr_objs;
+ unsigned n;
+ DECLARE (void *, malloc, size_t c);
+ DECLARE (void, free, void *p);
+
+ all_ovr_objs = CALL_REAL (malloc, (sizeof (__mf_object_tree_t *) *
+ obj_count));
+ if (all_ovr_objs == NULL) abort ();
+ n = __mf_find_objects (ptr_low, ptr_high, all_ovr_objs, obj_count);
+ assert (n == obj_count);
+
+ /* Confirm that accessed range is covered by first/last object. */
+ if (LIKELY ((ptr_low >= all_ovr_objs[0]->data.low) &&
+ (ptr_high <= all_ovr_objs[obj_count-1]->data.high)))
+ {
+ /* Presume valid access. */
+ judgement = 1;
+
+ /* Confirm that intermediate objects are
+ contiguous and share a single name. Thus they
+ are likely split up GUESS regions, or mmap
+ pages. The idea of the name check is to
+ prevent an oversize access to a
+ stack-registered object (followed by some GUESS
+ type) from being accepted as a hit. */
+ for (n=0; n<obj_count-1; n++)
+ {
+ __mf_object_t *obj = & (all_ovr_objs[n]->data);
+ __mf_object_t *nextobj = & (all_ovr_objs[n+1]->data);
+
+ if (UNLIKELY (obj->type == __MF_TYPE_NOACCESS))
+ judgement = -1; /* Force error. */
+
+ if (UNLIKELY (judgement == 1 &&
+ (obj->high + 1 != nextobj->low)))
+ judgement = 0; /* Cancel presumption. */
+
+ if (UNLIKELY (judgement == 1 &&
+ (obj->name != nextobj->name)))
+ judgement = 0; /* Cancel presumption. */
+ /* NB: strcmp above is not necessary since the
+ same literal string pointer is normally
+ used when creating regions. */
+
+ /* XXX: hope for no overflow! */
+ if (type == __MF_CHECK_READ)
+ obj->read_count ++;
+ else
+ obj->write_count ++;
+ obj->liveness ++;
+ }
+
+ /* If the access is otherwise successful, check whether
+ any of the covered objects are being watched. */
+ if (judgement > 0)
+ {
+ unsigned i;
+ for (i=0; i<obj_count; i++)
+ if (all_ovr_objs[i]->data.watching_p)
+ judgement = -2; /* trigger VIOL_WATCH */
+ }
+
+ /* Check for uninitialized reads. */
+ if (judgement > 0 &&
+ __mf_opts.check_initialization &&
+ type == __MF_CHECK_READ)
+ {
+ unsigned i;
+ unsigned written_count = 0;
+
+ for (i=0; i<obj_count; i++)
+ {
+ __mf_object_t *obj = & all_ovr_objs[i]->data;
+
+ if (obj->write_count
+ || obj->type == __MF_TYPE_HEAP_I
+ || obj->type == __MF_TYPE_GUESS)
+ written_count ++;
+ }
+
+ /* Check for ALL pieces having been written-to.
+ XXX: should this be ANY instead? */
+ if (written_count != obj_count)
+ judgement = -1;
+ }
+
+ /* Fill out the cache with the bounds of the first
+ object and the last object that covers this
+ cache line (== includes the same __MF_CACHE_INDEX).
+ This could let this cache line span *two* distinct
+ registered objects: a peculiar but reasonable
+ situation. The cache line may not include the
+ entire object though. */
+ if (judgement > 0)
+ {
+ unsigned i;
+ entry->low = all_ovr_objs[0]->data.low;
+ for (i=0; i<obj_count; i++)
+ {
+ uintptr_t high = all_ovr_objs[i]->data.high;
+ if (__MF_CACHE_INDEX (high) == entry_idx)
+ entry->high = high;
+ }
+ }
+ }
+
+ CALL_REAL (free, all_ovr_objs);
+ }
+
+ if (judgement == 0)
+ {
+ if (heuristics++ < 2) /* XXX parametrize this number? */
+ judgement = __mf_heuristic_check (ptr_low, ptr_high);
+ else
+ judgement = -1;
+ }
+ }
+
+ }
+ break;
+
+ case mode_violate:
+ judgement = -1;
+ break;
+ }
+
+ if (__mf_opts.collect_stats)
+ {
+ __mf_count_check ++;
+
+ if (LIKELY (old_entry.low != entry->low || old_entry.high != entry->high))
+ /* && (old_entry.low != 0) && (old_entry.high != 0)) */
+ __mf_lookup_cache_reusecount [entry_idx] ++;
+ }
+
+ if (UNLIKELY (judgement < 0))
+ __mf_violation (ptr, sz,
+ (uintptr_t) __builtin_return_address (0), location,
+ ((judgement == -1) ?
+ (type == __MF_CHECK_READ ? __MF_VIOL_READ : __MF_VIOL_WRITE) :
+ __MF_VIOL_WATCH));
+}
+
+
+static __mf_object_tree_t *
+__mf_insert_new_object (uintptr_t low, uintptr_t high, int type,
+ const char *name, uintptr_t pc)
+{
+ DECLARE (void *, calloc, size_t c, size_t n);
+
+ __mf_object_tree_t *new_obj;
+ new_obj = CALL_REAL (calloc, 1, sizeof(__mf_object_tree_t));
+ new_obj->data.low = low;
+ new_obj->data.high = high;
+ new_obj->data.type = type;
+ new_obj->data.name = name;
+ new_obj->data.alloc_pc = pc;
+#if HAVE_GETTIMEOFDAY
+ gettimeofday (& new_obj->data.alloc_time, NULL);
+#endif
+#if LIBMUDFLAPTH
+ new_obj->data.alloc_thread = pthread_self ();
+#endif
+
+ if (__mf_opts.backtrace > 0 && (type == __MF_TYPE_HEAP || type == __MF_TYPE_HEAP_I))
+ new_obj->data.alloc_backtrace_size =
+ __mf_backtrace (& new_obj->data.alloc_backtrace,
+ (void *) pc, 2);
+
+ __mf_link_object (new_obj);
+ return new_obj;
+}
+
+
+static void
+__mf_uncache_object (__mf_object_t *old_obj)
+{
+ /* Remove any low/high pointers for this object from the lookup cache. */
+
+ /* Can it possibly exist in the cache? */
+ if (LIKELY (old_obj->read_count + old_obj->write_count))
+ {
+ uintptr_t low = old_obj->low;
+ uintptr_t high = old_obj->high;
+ unsigned idx_low = __MF_CACHE_INDEX (low);
+ unsigned idx_high = __MF_CACHE_INDEX (high);
+ unsigned i;
+ for (i = idx_low; i <= idx_high; i++)
+ {
+ struct __mf_cache *entry = & __mf_lookup_cache [i];
+ /* NB: the "||" in the following test permits this code to
+ tolerate the situation introduced by __mf_check over
+ contiguous objects, where a cache entry spans several
+ objects. */
+ if (entry->low == low || entry->high == high)
+ {
+ entry->low = MAXPTR;
+ entry->high = MINPTR;
+ }
+ }
+ }
+}
+
+
+void
+__mf_register (void *ptr, size_t sz, int type, const char *name)
+{
+ LOCKTH ();
+ BEGIN_RECURSION_PROTECT ();
+ __mfu_register (ptr, sz, type, name);
+ END_RECURSION_PROTECT ();
+ UNLOCKTH ();
+}
+
+
+void
+__mfu_register (void *ptr, size_t sz, int type, const char *name)
+{
+ TRACE ("register ptr=%p size=%lu type=%x name='%s'\n",
+ ptr, (unsigned long) sz, type, name ? name : "");
+
+ if (__mf_opts.collect_stats)
+ {
+ __mf_count_register ++;
+ __mf_total_register_size [(type < 0) ? 0 :
+ (type > __MF_TYPE_MAX) ? 0 :
+ type] += sz;
+ }
+
+ if (UNLIKELY (__mf_opts.sigusr1_report))
+ __mf_sigusr1_respond ();
+
+ switch (__mf_opts.mudflap_mode)
+ {
+ case mode_nop:
+ break;
+
+ case mode_violate:
+ __mf_violation (ptr, sz, (uintptr_t) __builtin_return_address (0), NULL,
+ __MF_VIOL_REGISTER);
+ break;
+
+ case mode_populate:
+ /* Clear the cache. */
+ /* XXX: why the entire cache? */
+ /* XXX: race */
+ memset (__mf_lookup_cache, 0, sizeof(__mf_lookup_cache));
+ /* void slot 0 */
+ __mf_lookup_cache[0].low = MAXPTR;
+ break;
+
+ case mode_check:
+ {
+ __mf_object_tree_t *ovr_objs [1];
+ unsigned num_overlapping_objs;
+ uintptr_t low = (uintptr_t) ptr;
+ uintptr_t high = CLAMPSZ (ptr, sz);
+ uintptr_t pc = (uintptr_t) __builtin_return_address (0);
+
+ /* Treat unknown size indication as 1. */
+ if (UNLIKELY (sz == 0)) sz = 1;
+
+ num_overlapping_objs = __mf_find_objects (low, high, ovr_objs, 1);
+
+ /* Handle overlaps. */
+ if (UNLIKELY (num_overlapping_objs > 0))
+ {
+ __mf_object_tree_t *ovr_obj = ovr_objs[0];
+
+ /* Quietly accept a single duplicate registration for
+ static objects, since these may come from distinct
+ compilation units. */
+ if (type == __MF_TYPE_STATIC
+ && ovr_obj->data.type == __MF_TYPE_STATIC
+ && ovr_obj->data.low == low
+ && ovr_obj->data.high == high)
+ {
+ /* do nothing */
+ VERBOSE_TRACE ("duplicate static reg %p-%p `%s'\n",
+ (void *) low, (void *) high,
+ (ovr_obj->data.name ? ovr_obj->data.name : ""));
+ break;
+ }
+
+ /* Quietly accept a single duplicate registration for
+ guess objects too. */
+ if (type == __MF_TYPE_GUESS &&
+ ovr_obj->data.type == __MF_TYPE_GUESS &&
+ ovr_obj->data.low == low &&
+ ovr_obj->data.high == high)
+ {
+ /* do nothing */
+ VERBOSE_TRACE ("duplicate guess reg %p-%p\n",
+ (void *) low, (void *) high);
+ break;
+ }
+
+ /* Quietly accept new a guess registration that overlaps
+ at least one existing object. Trim it down to size. */
+ else if (type == __MF_TYPE_GUESS)
+ {
+ /* We need to split this new GUESS region into some
+ smaller ones. Or we may not need to insert it at
+ all if it is covered by the overlapping region. */
+
+ /* First, identify all the overlapping objects. */
+ __mf_object_tree_t **all_ovr_objs;
+ unsigned num_ovr_objs, n;
+ uintptr_t next_low;
+ DECLARE (void *, malloc, size_t c);
+ DECLARE (void, free, void *p);
+
+ all_ovr_objs = CALL_REAL (malloc, (sizeof (__mf_object_tree_t *) *
+ num_overlapping_objs));
+ if (all_ovr_objs == NULL) abort ();
+ num_ovr_objs = __mf_find_objects (low, high, all_ovr_objs,
+ num_overlapping_objs);
+ assert (num_ovr_objs == num_overlapping_objs);
+
+ VERBOSE_TRACE ("splitting guess %p-%p, # overlaps: %u\n",
+ (void *) low, (void *) high, num_ovr_objs);
+
+ /* Add GUESS regions between the holes: before each
+ overlapping region. */
+
+ next_low = low;
+ /* This makes use of the assumption that __mf_find_objects() returns
+ overlapping objects in an increasing sequence. */
+ for (n=0; n < min (num_ovr_objs, num_overlapping_objs); n++)
+ {
+ if (all_ovr_objs[n]->data.low > next_low) /* Gap? */
+ {
+ uintptr_t next_high = CLAMPSUB (all_ovr_objs[n]->data.low, 1);
+ __mfu_register ((void *) next_low, next_high-next_low+1,
+ __MF_TYPE_GUESS, name);
+ }
+ next_low = CLAMPADD (all_ovr_objs[n]->data.high, 1);
+ }
+ /* Add in any leftover room at the top. */
+ if (next_low <= high)
+ __mfu_register ((void *) next_low, high-next_low+1,
+ __MF_TYPE_GUESS, name);
+
+ /* XXX: future optimization: allow consecutive GUESS regions to
+ be glued together. */
+ CALL_REAL (free, all_ovr_objs);
+ return;
+ }
+
+ /* Quietly accept a non-GUESS region overlaying a GUESS
+ region. Handle it by removing the GUESS region
+ temporarily, then recursively adding this new object,
+ and then the GUESS back. The latter will be split up
+ by the recursive process above. */
+ else if (ovr_obj->data.type == __MF_TYPE_GUESS)
+ {
+ uintptr_t old_low = ovr_obj->data.low;
+ uintptr_t old_high = ovr_obj->data.high;
+ const char* old_name = ovr_obj->data.name;
+
+ /* Now to recursively remove the guess piece, and
+ reinsert them in the opposite order. Recursion
+ should bottom out if another non-GUESS overlapping
+ region is found for this new object (resulting in a
+ violation), or if no further overlap occurs. The
+ located GUESS region should end up being split up
+ in any case. */
+ __mfu_unregister ((void *) old_low, old_high-old_low+1);
+ __mfu_register ((void *) low, sz, type, name);
+ __mfu_register ((void *) old_low, old_high-old_low+1,
+ __MF_TYPE_GUESS, old_name);
+ return;
+ }
+
+ /* Alas, a genuine violation. */
+ else
+ {
+ /* Two or more *real* mappings here. */
+ __mf_violation ((void *) ptr, sz,
+ (uintptr_t) __builtin_return_address (0), NULL,
+ __MF_VIOL_REGISTER);
+ }
+ }
+
+ /* No overlapping objects: AOK. */
+ else
+ {
+ __mf_insert_new_object (low, high, type, name, pc);
+ }
+
+ /* We could conceivably call __mf_check() here to prime the cache,
+ but then the read_count/write_count field is not reliable. */
+
+ break;
+ }
+ } /* end switch (__mf_opts.mudflap_mode) */
+}
+
+
+void
+__mf_unregister (void *ptr, size_t sz)
+{
+ LOCKTH ();
+ BEGIN_RECURSION_PROTECT ();
+ __mfu_unregister (ptr, sz);
+ END_RECURSION_PROTECT ();
+ UNLOCKTH ();
+}
+
+
+void
+__mfu_unregister (void *ptr, size_t sz)
+{
+ DECLARE (void, free, void *ptr);
+
+ if (UNLIKELY (__mf_opts.sigusr1_report))
+ __mf_sigusr1_respond ();
+
+ TRACE ("unregister ptr=%p size=%lu\n", ptr, (unsigned long) sz);
+
+ switch (__mf_opts.mudflap_mode)
+ {
+ case mode_nop:
+ break;
+
+ case mode_violate:
+ __mf_violation (ptr, sz,
+ (uintptr_t) __builtin_return_address (0), NULL,
+ __MF_VIOL_UNREGISTER);
+ break;
+
+ case mode_populate:
+ /* Clear the cache. */
+ /* XXX: race */
+ memset (__mf_lookup_cache, 0, sizeof(__mf_lookup_cache));
+ /* void slot 0 */
+ __mf_lookup_cache[0].low = MAXPTR;
+ break;
+
+ case mode_check:
+ {
+ __mf_object_tree_t *old_obj = NULL;
+ __mf_object_tree_t *del_obj = NULL; /* Object to actually delete. */
+ __mf_object_tree_t *objs[1] = {NULL};
+ unsigned num_overlapping_objs;
+
+ /* Treat unknown size indication as 1. */
+ if (sz == 0) sz = 1;
+
+ num_overlapping_objs = __mf_find_objects ((uintptr_t) ptr,
+ CLAMPSZ (ptr, sz), objs, 1);
+
+ /* XXX: handle unregistration of big old GUESS region, that has since
+ been splintered. */
+ old_obj = objs[0];
+
+ if (UNLIKELY (num_overlapping_objs != 1 ||
+ (uintptr_t)ptr != old_obj->data.low)) /* XXX: what about sz? */
+ {
+ __mf_violation (ptr, sz,
+ (uintptr_t) __builtin_return_address (0), NULL,
+ __MF_VIOL_UNREGISTER);
+ break;
+ }
+
+ __mf_unlink_object (old_obj);
+ __mf_uncache_object (& old_obj->data);
+
+ /* Wipe buffer contents if desired. */
+ if ((__mf_opts.wipe_stack && old_obj->data.type == __MF_TYPE_STACK)
+ || (__mf_opts.wipe_heap && (old_obj->data.type == __MF_TYPE_HEAP
+ || old_obj->data.type == __MF_TYPE_HEAP_I)))
+ {
+ memset ((void *) old_obj->data.low,
+ 0,
+ (size_t) (old_obj->data.high - old_obj->data.low + 1));
+ }
+
+ /* Manage the object cemetary. */
+ if (__mf_opts.persistent_count > 0 &&
+ old_obj->data.type >= 0 &&
+ old_obj->data.type <= __MF_TYPE_MAX_CEM)
+ {
+ old_obj->data.deallocated_p = 1;
+ old_obj->left = old_obj->right = NULL;
+ old_obj->data.dealloc_pc = (uintptr_t) __builtin_return_address (0);
+#if HAVE_GETTIMEOFDAY
+ gettimeofday (& old_obj->data.dealloc_time, NULL);
+#endif
+#ifdef LIBMUDFLAPTH
+ old_obj->data.dealloc_thread = pthread_self ();
+#endif
+
+ if (__mf_opts.backtrace > 0 && old_obj->data.type == __MF_TYPE_HEAP)
+ old_obj->data.dealloc_backtrace_size =
+ __mf_backtrace (& old_obj->data.dealloc_backtrace,
+ NULL, 2);
+
+ /* Encourage this object to be displayed again in current epoch. */
+ old_obj->data.description_epoch --;
+
+ /* Put this object into the cemetary. This may require this plot to
+ be recycled, and the previous resident to be designated del_obj. */
+ {
+ unsigned row = old_obj->data.type;
+ unsigned plot = __mf_object_dead_head [row];
+
+ del_obj = __mf_object_cemetary [row][plot];
+ __mf_object_cemetary [row][plot] = old_obj;
+ plot ++;
+ if (plot == __mf_opts.persistent_count) plot = 0;
+ __mf_object_dead_head [row] = plot;
+ }
+ }
+ else
+ del_obj = old_obj;
+
+ if (__mf_opts.print_leaks)
+ {
+ if ((old_obj->data.read_count + old_obj->data.write_count) == 0 &&
+ (old_obj->data.type == __MF_TYPE_HEAP
+ || old_obj->data.type == __MF_TYPE_HEAP_I))
+ {
+ fprintf (stderr,
+ "*******\n"
+ "mudflap warning: unaccessed registered object:\n");
+ __mf_describe_object (& old_obj->data);
+ }
+ }
+
+ if (del_obj != NULL) /* May or may not equal old_obj. */
+ {
+ if (__mf_opts.backtrace > 0)
+ {
+ CALL_REAL(free, del_obj->data.alloc_backtrace);
+ if (__mf_opts.persistent_count > 0)
+ {
+ CALL_REAL(free, del_obj->data.dealloc_backtrace);
+ }
+ }
+ CALL_REAL(free, del_obj);
+ }
+
+ break;
+ }
+ } /* end switch (__mf_opts.mudflap_mode) */
+
+
+ if (__mf_opts.collect_stats)
+ {
+ __mf_count_unregister ++;
+ __mf_total_unregister_size += sz;
+ }
+}
+
+/* ------------------------------------------------------------------------ */
+/* __mf_validate_live_object_tree, _object_cemetary */
+
+static void
+__mf_validate_live_object_tree (__mf_object_tree_t *obj)
+{
+ assert (obj != NULL);
+
+ if (__mf_opts.persistent_count > 0)
+ assert (! obj->data.deallocated_p);
+
+ if (obj->left)
+ {
+ assert (obj->left->data.high < obj->data.low);
+ __mf_validate_live_object_tree (obj->left);
+ }
+ if (obj->right)
+ {
+ assert (obj->right->data.low > obj->data.high);
+ __mf_validate_live_object_tree (obj->right);
+ }
+}
+
+static void
+__mf_validate_object_cemetary ()
+{
+ unsigned cls;
+ unsigned i;
+
+ for (cls = 0; cls <= __MF_TYPE_MAX_CEM; cls++)
+ {
+ assert (__mf_object_dead_head [cls] >= 0 &&
+ __mf_object_dead_head [cls] < __mf_opts.persistent_count);
+ for (i = 0; i < __mf_opts.persistent_count; i++)
+ {
+ __mf_object_tree_t *obj = __mf_object_cemetary [cls][i];
+ if (obj != NULL)
+ {
+ assert (obj->data.deallocated_p);
+ assert (obj->left == NULL);
+ assert (obj->right == NULL);
+ }
+ }
+ }
+}
+
+static void
+__mf_validate_objects ()
+{
+ if (__mf_object_root)
+ __mf_validate_live_object_tree (__mf_object_root);
+
+ if (__mf_opts.persistent_count > 0)
+ __mf_validate_object_cemetary ();
+}
+
+
+static void
+__mf_age_tree (__mf_object_tree_t *obj)
+{
+ assert (obj != NULL);
+ obj->data.liveness = obj->data.liveness >> 1;
+
+ if (obj->left)
+ __mf_age_tree (obj->left);
+ if (obj->right)
+ __mf_age_tree (obj->right);
+}
+
+
+
+struct tree_stats
+{
+ unsigned obj_count;
+ unsigned long total_size;
+ unsigned live_obj_count;
+ double total_weight;
+ double weighted_size;
+ unsigned long weighted_address_bits [sizeof (uintptr_t) * 8][2];
+};
+
+
+static void
+__mf_tree_analyze (__mf_object_tree_t *obj, struct tree_stats* s)
+{
+ assert (obj != NULL);
+
+ if (obj->left)
+ __mf_tree_analyze (obj->left, s);
+
+ /* Exclude never-accessed objects. */
+ if (obj->data.read_count + obj->data.write_count)
+ {
+ s->obj_count ++;
+ s->total_size += (obj->data.high - obj->data.low + 1);
+
+ if (obj->data.liveness)
+ {
+ unsigned i;
+ uintptr_t addr;
+
+ VERBOSE_TRACE ("analyze low=%p live=%u name=`%s'\n",
+ (void *) obj->data.low, obj->data.liveness, obj->data.name);
+
+ s->live_obj_count ++;
+ s->total_weight += (double) obj->data.liveness;
+ s->weighted_size +=
+ (double) (obj->data.high - obj->data.low + 1) *
+ (double) obj->data.liveness;
+
+ addr = obj->data.low;
+ for (i=0; i<sizeof(uintptr_t) * 8; i++)
+ {
+ unsigned bit = addr & 1;
+ s->weighted_address_bits[i][bit] += obj->data.liveness;
+ addr = addr >> 1;
+ }
+ }
+ }
+
+ if (obj->right)
+ __mf_tree_analyze (obj->right, s);
+}
+
+
+static void
+__mf_adapt_cache ()
+{
+ struct tree_stats s;
+ uintptr_t new_mask = 0;
+ unsigned char new_shift;
+ float cache_utilization;
+ float max_value;
+ static float smoothed_new_shift = -1.0;
+ unsigned i;
+
+ memset (&s, 0, sizeof (s));
+ if (__mf_object_root)
+ __mf_tree_analyze (__mf_object_root, & s);
+
+ /* Maybe we're dealing with funny aging/adaptation parameters, or an
+ empty tree. Just leave the cache alone in such cases, rather
+ than risk dying by division-by-zero. */
+ if (! (s.obj_count > 0) && (s.live_obj_count > 0) && (s.total_weight > 0.0))
+ return;
+
+ /* Guess a good value for the shift parameter by finding an address bit that is a
+ good discriminant of lively objects. */
+ max_value = 0.0;
+ for (i=0; i<sizeof (uintptr_t)*8; i++)
+ {
+ float value = (float) s.weighted_address_bits[i][0] * (float) s.weighted_address_bits[i][1];
+ if (max_value < value) max_value = value;
+ }
+ for (i=0; i<sizeof (uintptr_t)*8; i++)
+ {
+ float shoulder_factor = 0.7; /* Include slightly less popular bits too. */
+ float value = (float) s.weighted_address_bits[i][0] * (float) s.weighted_address_bits[i][1];
+ if (value >= max_value * shoulder_factor)
+ break;
+ }
+ if (smoothed_new_shift < 0) smoothed_new_shift = __mf_lc_shift;
+ /* Converge toward this slowly to reduce flapping. */
+ smoothed_new_shift = 0.9*smoothed_new_shift + 0.1*i;
+ new_shift = (unsigned) (smoothed_new_shift + 0.5);
+ assert (new_shift < sizeof (uintptr_t)*8);
+
+ /* Count number of used buckets. */
+ cache_utilization = 0.0;
+ for (i = 0; i < (1 + __mf_lc_mask); i++)
+ if (__mf_lookup_cache[i].low != 0 || __mf_lookup_cache[i].high != 0)
+ cache_utilization += 1.0;
+ cache_utilization /= (1 + __mf_lc_mask);
+
+ new_mask |= 0x3ff; /* XXX: force a large cache. */
+ new_mask &= (LOOKUP_CACHE_SIZE_MAX - 1);
+
+ VERBOSE_TRACE ("adapt cache obj=%u/%u sizes=%lu/%.0f/%.0f => "
+ "util=%u%% m=%p s=%u\n",
+ s.obj_count, s.live_obj_count, s.total_size, s.total_weight, s.weighted_size,
+ (unsigned)(cache_utilization*100.0), (void *) new_mask, new_shift);
+
+ /* We should reinitialize cache if its parameters have changed. */
+ if (new_mask != __mf_lc_mask ||
+ new_shift != __mf_lc_shift)
+ {
+ __mf_lc_mask = new_mask;
+ __mf_lc_shift = new_shift;
+ /* XXX: race */
+ memset (__mf_lookup_cache, 0, sizeof(__mf_lookup_cache));
+ /* void slot 0 */
+ __mf_lookup_cache[0].low = MAXPTR;
+ }
+}
+
+
+
+
+/* __mf_find_object[s] */
+
+/* Find overlapping live objecs between [low,high]. Return up to
+ max_objs of their pointers in objs[]. Return total count of
+ overlaps (may exceed max_objs). */
+
+/* XXX: track traversal statistics, like average depth, balance. */
+
+static unsigned
+__mf_find_objects_rec (uintptr_t low, uintptr_t high, __mf_object_tree_t **nodep,
+ __mf_object_tree_t **objs, unsigned max_objs)
+{
+ unsigned count;
+ __mf_object_tree_t *node = *nodep;
+
+ assert (low <= high);
+ assert (max_objs == 0 || objs != NULL);
+
+ if (UNLIKELY (node == NULL)) return 0;
+
+ /* Traverse down left subtree. */
+ count = 0;
+ if (low < node->data.low)
+ count += __mf_find_objects_rec (low, min(high, node->data.low),
+ & node->left, objs, max_objs);
+
+ /* Track the used slots of objs[]. */
+ if (count < max_objs)
+ {
+ objs += count;
+ max_objs -= count;
+ }
+ else
+ {
+ max_objs = 0;
+ }
+
+ /* Check for overlap with this node. */
+ if (high >= node->data.low && low <= node->data.high)
+ {
+ count ++;
+ if (max_objs > 0) /* Any room left? */
+ {
+ objs[0] = node;
+ objs ++;
+ max_objs --;
+ }
+ }
+
+ /* Traverse down right subtree. */
+ if (high > node->data.high)
+ count += __mf_find_objects_rec (max (low, node->data.high), high,
+ & node->right, objs, max_objs);
+ /* There is no need to manipulate objs/max_objs any further. */
+
+
+ /* Rotate a child node up if its access count is higher. */
+ if (UNLIKELY ((node->left && node->left->data.liveness > node->data.liveness) &&
+ ((!node->right || (node->right &&
+ node->left->data.liveness >
+ node->right->data.liveness)))))
+ {
+ __mf_object_tree_t *l = node->left;
+ __mf_object_tree_t *l_r = l->right;
+
+ *nodep = l;
+ l->right = node;
+ node->left = l_r;
+ __mf_treerot_left ++;
+ }
+ else if (UNLIKELY ((node->right && node->right->data.liveness > node->data.liveness) &&
+ ((!node->left || (node->left &&
+ node->right->data.liveness >
+ node->left->data.liveness)))))
+ {
+ __mf_object_tree_t *r = node->right;
+ __mf_object_tree_t *r_l = r->left;
+
+ *nodep = r;
+ r->left = node;
+ node->right = r_l;
+ __mf_treerot_right ++;
+ }
+
+ return count;
+}
+
+
+unsigned
+__mf_find_objects (uintptr_t ptr_low, uintptr_t ptr_high,
+ __mf_object_tree_t **objs, unsigned max_objs)
+{
+ if (UNLIKELY(__mf_opts.internal_checking))
+ __mf_validate_objects ();
+
+ return __mf_find_objects_rec (ptr_low, ptr_high, & __mf_object_root, objs, max_objs);
+}
+
+/* __mf_link_object */
+
+static void
+__mf_link_object2 (__mf_object_tree_t *ptr, __mf_object_tree_t **link)
+{
+ __mf_object_tree_t *node = *link;
+
+ assert (ptr != NULL);
+ if (UNLIKELY(node == NULL))
+ {
+ *link = ptr;
+ return;
+ }
+
+ if (ptr->data.high < node->data.low)
+ return __mf_link_object2 (ptr, & node->left);
+ else if (ptr->data.low > node->data.high)
+ return __mf_link_object2 (ptr, & node->right);
+ else
+ abort (); /* XXX: duplicate object */
+}
+
+
+void
+__mf_link_object (__mf_object_tree_t *ptr)
+{
+ if (UNLIKELY(__mf_opts.internal_checking))
+ __mf_validate_objects ();
+
+ return __mf_link_object2 (ptr, & __mf_object_root);
+}
+
+/* __mf_unlink_object */
+
+static void
+__mf_unlink_object2 (__mf_object_tree_t *ptr, __mf_object_tree_t **link)
+{
+ __mf_object_tree_t *node = *link;
+
+ assert (ptr != NULL);
+ if (UNLIKELY(node == ptr))
+ {
+ static unsigned promote_left_p = 0;
+ promote_left_p = 1 - promote_left_p;
+
+ /* Alternate promoting the left & right subtrees. */
+ if (promote_left_p)
+ {
+ *link = ptr->left;
+ if (ptr->right != NULL)
+ __mf_link_object2 (ptr->right, link);
+ }
+ else
+ {
+ *link = ptr->right;
+ if (ptr->left != NULL)
+ __mf_link_object2 (ptr->left, link);
+ }
+
+ return;
+ }
+
+ if (ptr->data.high < node->data.low)
+ return __mf_unlink_object2 (ptr, & node->left);
+ else if (ptr->data.low > node->data.high)
+ return __mf_unlink_object2 (ptr, & node->right);
+ else
+ abort (); /* XXX: missing object; should fail more gracefully. */
+}
+
+static void
+__mf_unlink_object (__mf_object_tree_t *node)
+{
+ __mf_unlink_object2 (node, & __mf_object_root);
+}
+
+/* __mf_find_dead_objects */
+
+/* Find overlapping dead objecs between [low,high]. Return up to
+ max_objs of their pointers in objs[]. Return total count of
+ overlaps (may exceed max_objs). */
+
+static unsigned
+__mf_find_dead_objects (uintptr_t low, uintptr_t high,
+ __mf_object_tree_t **objs, unsigned max_objs)
+{
+ if (__mf_opts.persistent_count > 0)
+ {
+ unsigned count = 0;
+ unsigned recollection = 0;
+ unsigned row = 0;
+
+ assert (low <= high);
+ assert (max_objs == 0 || objs != NULL);
+
+ /* Widen the search from the most recent plots in each row, looking
+ backward in time. */
+ recollection = 0;
+ while (recollection < __mf_opts.persistent_count)
+ {
+ count = 0;
+
+ for (row = 0; row <= __MF_TYPE_MAX_CEM; row ++)
+ {
+ unsigned plot;
+ unsigned i;
+
+ plot = __mf_object_dead_head [row];
+ for (i = 0; i <= recollection; i ++)
+ {
+ __mf_object_tree_t *obj;
+
+ /* Look backward through row: it's a circular buffer. */
+ if (plot > 0) plot --;
+ else plot = __mf_opts.persistent_count - 1;
+
+ obj = __mf_object_cemetary [row][plot];
+ if (obj && obj->data.low <= high && obj->data.high >= low)
+ {
+ /* Found an overlapping dead object! */
+ if (count < max_objs)
+ objs [count] = obj;
+ count ++;
+ }
+ }
+ }
+
+ if (count)
+ break;
+
+ /* Look farther back in time. */
+ recollection = (recollection * 2) + 1;
+ }
+
+ return count;
+ } else {
+ return 0;
+ }
+}
+
+/* __mf_describe_object */
+
+static void
+__mf_describe_object (__mf_object_t *obj)
+{
+ static unsigned epoch = 0;
+ if (obj == NULL)
+ {
+ epoch ++;
+ return;
+ }
+
+ if (__mf_opts.abbreviate && obj->description_epoch == epoch)
+ {
+ fprintf (stderr,
+ "mudflap object %p: name=`%s'\n",
+ (void *) obj, (obj->name ? obj->name : ""));
+ return;
+ }
+ else
+ obj->description_epoch = epoch;
+
+ fprintf (stderr,
+ "mudflap object %p: name=`%s'\n"
+ "bounds=[%p,%p] size=%lu area=%s check=%ur/%uw liveness=%u%s\n"
+ "alloc time=%lu.%06lu pc=%p"
+#ifdef LIBMUDFLAPTH
+ " thread=%u"
+#endif
+ "\n",
+ (void *) obj, (obj->name ? obj->name : ""),
+ (void *) obj->low, (void *) obj->high,
+ (unsigned long) (obj->high - obj->low + 1),
+ (obj->type == __MF_TYPE_NOACCESS ? "no-access" :
+ obj->type == __MF_TYPE_HEAP ? "heap" :
+ obj->type == __MF_TYPE_HEAP_I ? "heap-init" :
+ obj->type == __MF_TYPE_STACK ? "stack" :
+ obj->type == __MF_TYPE_STATIC ? "static" :
+ obj->type == __MF_TYPE_GUESS ? "guess" :
+ "unknown"),
+ obj->read_count, obj->write_count, obj->liveness,
+ obj->watching_p ? " watching" : "",
+ obj->alloc_time.tv_sec, obj->alloc_time.tv_usec,
+ (void *) obj->alloc_pc
+#ifdef LIBMUDFLAPTH
+ , (unsigned) obj->alloc_thread
+#endif
+ );
+
+ if (__mf_opts.backtrace > 0)
+ {
+ unsigned i;
+ for (i=0; i<obj->alloc_backtrace_size; i++)
+ fprintf (stderr, " %s\n", obj->alloc_backtrace[i]);
+ }
+
+ if (__mf_opts.persistent_count > 0)
+ {
+ if (obj->deallocated_p)
+ {
+ fprintf (stderr, "dealloc time=%lu.%06lu pc=%p"
+#ifdef LIBMUDFLAPTH
+ " thread=%u"
+#endif
+ "\n",
+ obj->dealloc_time.tv_sec, obj->dealloc_time.tv_usec,
+ (void *) obj->dealloc_pc
+#ifdef LIBMUDFLAPTH
+ , (unsigned) obj->dealloc_thread
+#endif
+ );
+
+
+ if (__mf_opts.backtrace > 0)
+ {
+ unsigned i;
+ for (i=0; i<obj->dealloc_backtrace_size; i++)
+ fprintf (stderr, " %s\n", obj->dealloc_backtrace[i]);
+ }
+ }
+ }
+}
+
+static unsigned
+__mf_report_leaks (__mf_object_tree_t *node)
+{
+ /* The counter is amongst recursive calls, so
+ that cumulative numbers are printed below. */
+ static unsigned count = 0;
+
+ if (node == NULL) /* Reset */
+ {
+ count = 0;
+ return 0;
+ }
+
+ /* Inorder traversal. */
+ if (node->left)
+ __mf_report_leaks (node->left);
+ if (node->data.type == __MF_TYPE_HEAP
+ || node->data.type == __MF_TYPE_HEAP_I)
+ {
+ count ++;
+ fprintf (stderr, "Leaked object %u:\n", count);
+ __mf_describe_object (& node->data);
+ }
+ if (node->right)
+ __mf_report_leaks (node->right);
+
+ return count;
+}
+
+/* ------------------------------------------------------------------------ */
+/* __mf_report */
+
+void
+__mf_report ()
+{
+ LOCKTH ();
+ BEGIN_RECURSION_PROTECT ();
+ __mfu_report ();
+ END_RECURSION_PROTECT ();
+ UNLOCKTH ();
+}
+
+void
+__mfu_report ()
+{
+ if (__mf_opts.collect_stats)
+ {
+ fprintf (stderr,
+ "*******\n"
+ "mudflap stats:\n"
+ "calls to __mf_check: %lu rot: %lu/%lu\n"
+ " __mf_register: %lu [%luB, %luB, %luB, %luB, %luB]\n"
+ " __mf_unregister: %lu [%luB]\n"
+ " __mf_violation: [%lu, %lu, %lu, %lu, %lu]\n",
+ __mf_count_check, __mf_treerot_left, __mf_treerot_right,
+ __mf_count_register,
+ __mf_total_register_size[0], __mf_total_register_size[1],
+ __mf_total_register_size[2], __mf_total_register_size[3],
+ __mf_total_register_size[4], /* XXX */
+ __mf_count_unregister, __mf_total_unregister_size,
+ __mf_count_violation[0], __mf_count_violation[1],
+ __mf_count_violation[2], __mf_count_violation[3],
+ __mf_count_violation[4]);
+
+ fprintf (stderr,
+ "calls with reentrancy: %lu\n", __mf_reentrancy);
+#ifdef LIBMUDFLAPTH
+ fprintf (stderr,
+ " lock contention: %lu\n", __mf_lock_contention);
+#endif
+
+ /* Lookup cache stats. */
+ {
+ unsigned i;
+ unsigned max_reuse = 0;
+ unsigned num_used = 0;
+ unsigned num_unused = 0;
+
+ for (i = 0; i < LOOKUP_CACHE_SIZE; i++)
+ {
+ if (__mf_lookup_cache_reusecount[i])
+ num_used ++;
+ else
+ num_unused ++;
+ if (max_reuse < __mf_lookup_cache_reusecount[i])
+ max_reuse = __mf_lookup_cache_reusecount[i];
+ }
+ fprintf (stderr, "lookup cache slots used: %u unused: %u peak-reuse: %u\n",
+ num_used, num_unused, max_reuse);
+ }
+
+ {
+ unsigned live_count;
+ live_count = __mf_find_objects (MINPTR, MAXPTR, NULL, 0);
+ fprintf (stderr, "number of live objects: %u\n", live_count);
+ }
+
+ if (__mf_opts.persistent_count > 0)
+ {
+ unsigned dead_count = 0;
+ unsigned row, plot;
+ for (row = 0; row <= __MF_TYPE_MAX_CEM; row ++)
+ for (plot = 0 ; plot < __mf_opts.persistent_count; plot ++)
+ if (__mf_object_cemetary [row][plot] != 0)
+ dead_count ++;
+ fprintf (stderr, " zombie objects: %u\n", dead_count);
+ }
+ }
+ if (__mf_opts.print_leaks && (__mf_opts.mudflap_mode == mode_check))
+ {
+ unsigned l;
+ extern void * __mf_wrap_alloca_indirect (size_t c);
+
+ /* Free up any remaining alloca()'d blocks. */
+ __mf_wrap_alloca_indirect (0);
+ __mf_describe_object (NULL); /* Reset description epoch. */
+ __mf_report_leaks (NULL); /* Reset cumulative count. */
+ l = __mf_report_leaks (__mf_object_root);
+ fprintf (stderr, "number of leaked objects: %u\n", l);
+ }
+}
+
+/* __mf_backtrace */
+
+size_t
+__mf_backtrace (char ***symbols, void *guess_pc, unsigned guess_omit_levels)
+{
+ void ** pc_array;
+ unsigned pc_array_size = __mf_opts.backtrace + guess_omit_levels;
+ unsigned remaining_size;
+ unsigned omitted_size = 0;
+ unsigned i;
+ DECLARE (void, free, void *ptr);
+ DECLARE (void *, calloc, size_t c, size_t n);
+ DECLARE (void *, malloc, size_t n);
+
+ pc_array = CALL_REAL (calloc, pc_array_size, sizeof (void *) );
+#ifdef HAVE_BACKTRACE
+ pc_array_size = backtrace (pc_array, pc_array_size);
+#else
+#define FETCH(n) do { if (pc_array_size >= n) { \
+ pc_array[n] = __builtin_return_address(n); \
+ if (pc_array[n] == 0) pc_array_size = n; } } while (0)
+
+ /* Unroll some calls __builtin_return_address because this function
+ only takes a literal integer parameter. */
+ FETCH (0);
+#if 0
+ /* XXX: __builtin_return_address sometimes crashes (!) on >0 arguments,
+ rather than simply returning 0. :-( */
+ FETCH (1);
+ FETCH (2);
+ FETCH (3);
+ FETCH (4);
+ FETCH (5);
+ FETCH (6);
+ FETCH (7);
+ FETCH (8);
+ if (pc_array_size > 8) pc_array_size = 9;
+#else
+ if (pc_array_size > 0) pc_array_size = 1;
+#endif
+
+#undef FETCH
+#endif
+
+ /* We want to trim the first few levels of the stack traceback,
+ since they contain libmudflap wrappers and junk. If pc_array[]
+ ends up containing a non-NULL guess_pc, then trim everything
+ before that. Otherwise, omit the first guess_omit_levels
+ entries. */
+
+ if (guess_pc != NULL)
+ for (i=0; i<pc_array_size; i++)
+ if (pc_array [i] == guess_pc)
+ omitted_size = i;
+
+ if (omitted_size == 0) /* No match? */
+ if (pc_array_size > guess_omit_levels)
+ omitted_size = guess_omit_levels;
+
+ remaining_size = pc_array_size - omitted_size;
+
+#ifdef HAVE_BACKTRACE_SYMBOLS
+ *symbols = backtrace_symbols (pc_array + omitted_size, remaining_size);
+#else
+ {
+ /* Let's construct a buffer by hand. It will have <remaining_size>
+ char*'s at the front, pointing at individual strings immediately
+ afterwards. */
+ void *buffer;
+ char *chars;
+ char **pointers;
+ enum { perline = 30 };
+ buffer = CALL_REAL (malloc, remaining_size * (perline + sizeof(char *)));
+ pointers = (char **) buffer;
+ chars = (char *)buffer + (remaining_size * sizeof (char *));
+ for (i = 0; i < remaining_size; i++)
+ {
+ pointers[i] = chars;
+ sprintf (chars, "[0x%p]", pc_array [omitted_size + i]);
+ chars = chars + perline;
+ }
+ *symbols = pointers;
+ }
+#endif
+ CALL_REAL (free, pc_array);
+
+ return remaining_size;
+}
+
+/* ------------------------------------------------------------------------ */
+/* __mf_violation */
+
+void
+__mf_violation (void *ptr, size_t sz, uintptr_t pc,
+ const char *location, int type)
+{
+ char buf [128];
+ static unsigned violation_number;
+ DECLARE(void, free, void *ptr);
+
+ TRACE ("violation pc=%p location=%s type=%d ptr=%p size=%lu\n",
+ (void *) pc,
+ (location != NULL ? location : ""), type, ptr, (unsigned long) sz);
+
+ if (__mf_opts.collect_stats)
+ __mf_count_violation [(type < 0) ? 0 :
+ (type > __MF_VIOL_WATCH) ? 0 :
+ type] ++;
+
+ /* Print out a basic warning message. */
+ if (__mf_opts.verbose_violations)
+ {
+ unsigned dead_p;
+ unsigned num_helpful = 0;
+ struct timeval now;
+#if HAVE_GETTIMEOFDAY
+ gettimeofday (& now, NULL);
+#endif
+
+ violation_number ++;
+ fprintf (stderr,
+ "*******\n"
+ "mudflap violation %u (%s): time=%lu.%06lu "
+ "ptr=%p size=%lu\npc=%p%s%s%s\n",
+ violation_number,
+ ((type == __MF_VIOL_READ) ? "check/read" :
+ (type == __MF_VIOL_WRITE) ? "check/write" :
+ (type == __MF_VIOL_REGISTER) ? "register" :
+ (type == __MF_VIOL_UNREGISTER) ? "unregister" :
+ (type == __MF_VIOL_WATCH) ? "watch" : "unknown"),
+ now.tv_sec, now.tv_usec,
+ (void *) ptr, (unsigned long)sz, (void *) pc,
+ (location != NULL ? " location=`" : ""),
+ (location != NULL ? location : ""),
+ (location != NULL ? "'" : ""));
+
+ if (__mf_opts.backtrace > 0)
+ {
+ char ** symbols;
+ unsigned i, num;
+
+ num = __mf_backtrace (& symbols, (void *) pc, 2);
+ /* Note: backtrace_symbols calls malloc(). But since we're in
+ __mf_violation and presumably __mf_check, it'll detect
+ recursion, and not put the new string into the database. */
+
+ for (i=0; i<num; i++)
+ fprintf (stderr, " %s\n", symbols[i]);
+
+ /* Calling free() here would trigger a violation. */
+ CALL_REAL(free, symbols);
+ }
+
+
+ /* Look for nearby objects. For this, we start with s_low/s_high
+ pointing to the given area, looking for overlapping objects.
+ If none show up, widen the search area and keep looking. */
+
+ if (sz == 0) sz = 1;
+
+ for (dead_p = 0; dead_p <= 1; dead_p ++) /* for dead_p in 0 1 */
+ {
+ enum {max_objs = 3}; /* magic */
+ __mf_object_tree_t *objs[max_objs];
+ unsigned num_objs = 0;
+ uintptr_t s_low, s_high;
+ unsigned tries = 0;
+ unsigned i;
+
+ s_low = (uintptr_t) ptr;
+ s_high = CLAMPSZ (ptr, sz);
+
+ while (tries < 16) /* magic */
+ {
+ if (dead_p)
+ num_objs = __mf_find_dead_objects (s_low, s_high, objs, max_objs);
+ else
+ num_objs = __mf_find_objects (s_low, s_high, objs, max_objs);
+
+ if (num_objs) /* good enough */
+ break;
+
+ tries ++;
+
+ /* XXX: tune this search strategy. It's too dependent on
+ sz, which can vary from 1 to very big (when array index
+ checking) numbers. */
+ s_low = CLAMPSUB (s_low, (sz * tries * tries));
+ s_high = CLAMPADD (s_high, (sz * tries * tries));
+ }
+
+ for (i = 0; i < min (num_objs, max_objs); i++)
+ {
+ __mf_object_t *obj = & objs[i]->data;
+ uintptr_t low = (uintptr_t) ptr;
+ uintptr_t high = CLAMPSZ (ptr, sz);
+ unsigned before1 = (low < obj->low) ? obj->low - low : 0;
+ unsigned after1 = (low > obj->high) ? low - obj->high : 0;
+ unsigned into1 = (high >= obj->low && low <= obj->high) ? low - obj->low : 0;
+ unsigned before2 = (high < obj->low) ? obj->low - high : 0;
+ unsigned after2 = (high > obj->high) ? high - obj->high : 0;
+ unsigned into2 = (high >= obj->low && low <= obj->high) ? high - obj->low : 0;
+
+ fprintf (stderr, "Nearby object %u: checked region begins %uB %s and ends %uB %s\n",
+ num_helpful + i + 1,
+ (before1 ? before1 : after1 ? after1 : into1),
+ (before1 ? "before" : after1 ? "after" : "into"),
+ (before2 ? before2 : after2 ? after2 : into2),
+ (before2 ? "before" : after2 ? "after" : "into"));
+ __mf_describe_object (obj);
+ }
+ num_helpful += num_objs;
+ }
+
+ fprintf (stderr, "number of nearby objects: %u\n", num_helpful);
+ }
+
+ /* How to finally handle this violation? */
+ switch (__mf_opts.violation_mode)
+ {
+ case viol_nop:
+ break;
+ case viol_segv:
+ kill (getpid(), SIGSEGV);
+ break;
+ case viol_abort:
+ abort ();
+ break;
+ case viol_gdb:
+ snprintf (buf, 128, "gdb --pid=%d", getpid ());
+ system (buf);
+ /* XXX: should probably fork() && sleep(GDB_WAIT_PARAMETER)
+ instead, and let the forked child execlp() gdb. That way, this
+ subject process can be resumed under the supervision of gdb.
+ This can't happen now, since system() only returns when gdb
+ dies. In that case, we need to beware of starting a second
+ concurrent gdb child upon the next violation. (But if the first
+ gdb dies, then starting a new one is appropriate.) */
+ break;
+ }
+}
+
+/* ------------------------------------------------------------------------ */
+
+
+unsigned __mf_watch (void *ptr, size_t sz)
+{
+ unsigned rc;
+ LOCKTH ();
+ BEGIN_RECURSION_PROTECT ();
+ rc = __mf_watch_or_not (ptr, sz, 1);
+ END_RECURSION_PROTECT ();
+ UNLOCKTH ();
+ return rc;
+}
+
+unsigned __mf_unwatch (void *ptr, size_t sz)
+{
+ unsigned rc;
+ LOCKTH ();
+ rc = __mf_watch_or_not (ptr, sz, 0);
+ UNLOCKTH ();
+ return rc;
+}
+
+
+static unsigned
+__mf_watch_or_not (void *ptr, size_t sz, char flag)
+{
+ uintptr_t ptr_high = CLAMPSZ (ptr, sz);
+ uintptr_t ptr_low = (uintptr_t) ptr;
+ unsigned count = 0;
+
+ TRACE ("%s ptr=%p size=%lu\n",
+ (flag ? "watch" : "unwatch"), ptr, (unsigned long) sz);
+
+ switch (__mf_opts.mudflap_mode)
+ {
+ case mode_nop:
+ case mode_populate:
+ case mode_violate:
+ count = 0;
+ break;
+
+ case mode_check:
+ {
+ __mf_object_tree_t **all_ovr_objs;
+ unsigned obj_count;
+ unsigned n;
+ DECLARE (void *, malloc, size_t c);
+ DECLARE (void, free, void *p);
+
+ obj_count = __mf_find_objects (ptr_low, ptr_high, NULL, 0);
+ VERBOSE_TRACE (" %u:", obj_count);
+
+ all_ovr_objs = CALL_REAL (malloc, (sizeof (__mf_object_tree_t *) *
+ obj_count));
+ if (all_ovr_objs == NULL) abort ();
+ n = __mf_find_objects (ptr_low, ptr_high, all_ovr_objs, obj_count);
+ assert (n == obj_count);
+
+ for (n = 0; n < obj_count; n ++)
+ {
+ __mf_object_t *obj = & (all_ovr_objs[n]->data);
+
+ VERBOSE_TRACE (" [%p]", (void *) obj);
+ if (obj->watching_p != flag)
+ {
+ obj->watching_p = flag;
+ count ++;
+
+ /* Remove object from cache, to ensure next access
+ goes through __mf_check(). */
+ if (flag)
+ __mf_uncache_object (obj);
+ }
+ }
+ CALL_REAL (free, all_ovr_objs);
+ }
+ break;
+ }
+
+ return count;
+}
+
+
+void
+__mf_sigusr1_handler (int num)
+{
+ __mf_sigusr1_received ++;
+}
+
+/* Install or remove SIGUSR1 handler as necessary.
+ Also, respond to a received pending SIGUSR1. */
+void
+__mf_sigusr1_respond ()
+{
+ static int handler_installed;
+
+#if HAVE_SIGNAL
+ /* Manage handler */
+ if (__mf_opts.sigusr1_report && ! handler_installed)
+ {
+ signal (SIGUSR1, __mf_sigusr1_handler);
+ handler_installed = 1;
+ }
+ else if(! __mf_opts.sigusr1_report && handler_installed)
+ {
+ signal (SIGUSR1, SIG_DFL);
+ handler_installed = 0;
+ }
+#endif
+
+ /* Manage enqueued signals */
+ if (__mf_sigusr1_received > __mf_sigusr1_handled)
+ {
+ __mf_sigusr1_handled ++;
+ assert (__mf_state == reentrant);
+ __mfu_report ();
+ handler_installed = 0; /* We may need to re-enable signal; this might be a SysV library. */
+ }
+}
+
+
+/* XXX: provide an alternative __assert_fail function that cannot
+ fail due to libmudflap infinite recursion. */
+#ifndef NDEBUG
+
+static void
+write_itoa (int fd, unsigned n)
+{
+ enum x { bufsize = sizeof(n)*4 };
+ char buf [bufsize];
+ unsigned i;
+
+ for (i=0; i<bufsize-1; i++)
+ {
+ unsigned digit = n % 10;
+ buf[bufsize-2-i] = digit + '0';
+ n /= 10;
+ if (n == 0)
+ {
+ char *m = & buf [bufsize-2-i];
+ buf[bufsize-1] = '\0';
+ write (fd, m, strlen(m));
+ break;
+ }
+ }
+}
+
+
+void
+__assert_fail (const char *msg, const char *file, unsigned line, const char *func)
+{
+#define write2(string) write (2, (string), strlen ((string)));
+ write2("mf");
+#ifdef LIBMUDFLAPTH
+ write2("(");
+ write_itoa (2, (unsigned) pthread_self ());
+ write2(")");
+#endif
+ write2(": assertion failure: `");
+ write (2, msg, strlen (msg));
+ write2("' in ");
+ write (2, func, strlen (func));
+ write2(" at ");
+ write (2, file, strlen (file));
+ write2(":");
+ write_itoa (2, line);
+ write2("\n");
+#undef write2
+ abort ();
+}
+
+
+#endif
diff --git a/libmudflap/mf-runtime.h.in b/libmudflap/mf-runtime.h.in
new file mode 100644
index 00000000000..11f1f8de5fe
--- /dev/null
+++ b/libmudflap/mf-runtime.h.in
@@ -0,0 +1,191 @@
+/* Public libmudflap declarations -*- C -*- */
+
+#ifndef MF_RUNTIME_H
+#define MF_RUNTIME_H
+
+#if @MF_HAVE_STDINT_H@ /* autoconf HAVE_STDINT_H */
+#include <stdint.h>
+#endif
+#include <sys/types.h>
+#if ! @MF_HAVE_UINTPTR_T@
+typedef unsigned long uintptr_t;
+#define HAVE_UINTPTR_T 1
+/* Define this here, in case an autoconf application was run
+ without CFLAGS=-fmudflap but is being compiled with -fmudflap. */
+#endif
+
+
+/* Global declarations used by instrumentation. */
+
+struct __mf_cache { uintptr_t low; uintptr_t high; };
+extern struct __mf_cache __mf_lookup_cache [];
+extern uintptr_t __mf_lc_mask;
+extern unsigned char __mf_lc_shift;
+
+/* Multithreading support. */
+#ifdef _MUDFLAPTH
+/* extern pthread_mutex_t __mf_biglock; */
+#define _REENTRANT
+#define _THREAD_SAFE
+#endif
+
+/* Codes to describe the type of access to check: __mf_check arg 3 */
+
+#define __MF_CHECK_READ 0
+#define __MF_CHECK_WRITE 1
+
+
+/* Codes to describe a region of memory being registered: __mf_*register arg 3 */
+
+#define __MF_TYPE_NOACCESS 0
+#define __MF_TYPE_HEAP 1
+#define __MF_TYPE_HEAP_I 2
+#define __MF_TYPE_STACK 3
+#define __MF_TYPE_STATIC 4
+#define __MF_TYPE_GUESS 5
+
+
+/* The public mudflap API */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void __mf_check (void *ptr, size_t sz, int type, const char *location)
+ __attribute((nothrow));
+extern void __mf_register (void *ptr, size_t sz, int type, const char *name)
+ __attribute((nothrow));
+extern void __mf_unregister (void *ptr, size_t sz) __attribute((nothrow));
+extern unsigned __mf_watch (void *ptr, size_t sz);
+extern unsigned __mf_unwatch (void *ptr, size_t sz);
+extern void __mf_report ();
+extern int __mf_set_options (const char *opts);
+
+
+/* Redirect some standard library functions to libmudflap. These are
+ done by simple #define rather than linker wrapping, since only
+ instrumented modules are meant to be affected. */
+
+#ifdef _MUDFLAP
+#pragma redefine_extname memcpy __mfwrap_memcpy
+#pragma redefine_extname memmove __mfwrap_memmove
+#pragma redefine_extname memset __mfwrap_memset
+#pragma redefine_extname memcmp __mfwrap_memcmp
+#pragma redefine_extname memchr __mfwrap_memchr
+#pragma redefine_extname memrchr __mfwrap_memrchr
+#pragma redefine_extname strcpy __mfwrap_strcpy
+#pragma redefine_extname strncpy __mfwrap_strncpy
+#pragma redefine_extname strcat __mfwrap_strcat
+#pragma redefine_extname strncat __mfwrap_strncat
+#pragma redefine_extname strcmp __mfwrap_strcmp
+#pragma redefine_extname strcasecmp __mfwrap_strcasecmp
+#pragma redefine_extname strncmp __mfwrap_strncmp
+#pragma redefine_extname strncasecmp __mfwrap_strncasecmp
+#pragma redefine_extname strdup __mfwrap_strdup
+#pragma redefine_extname strndup __mfwrap_strndup
+#pragma redefine_extname strchr __mfwrap_strchr
+#pragma redefine_extname strrchr __mfwrap_strrchr
+#pragma redefine_extname strstr __mfwrap_strstr
+#pragma redefine_extname memmem __mfwrap_memmem
+#pragma redefine_extname strlen __mfwrap_strlen
+#pragma redefine_extname strnlen __mfwrap_strnlen
+#pragma redefine_extname bzero __mfwrap_bzero
+#pragma redefine_extname bcopy __mfwrap_bcopy
+#pragma redefine_extname bcmp __mfwrap_bcmp
+#pragma redefine_extname index __mfwrap_index
+#pragma redefine_extname rindex __mfwrap_rindex
+#pragma redefine_extname asctime __mfwrap_asctime
+#pragma redefine_extname ctime __mfwrap_ctime
+#pragma redefine_extname gmtime __mfwrap_gmtime
+#pragma redefine_extname localtime __mfwrap_localtime
+#pragma redefine_extname time __mfwrap_time
+#pragma redefine_extname strerror __mfwrap_strerror
+#pragma redefine_extname fopen __mfwrap_fopen
+#pragma redefine_extname fclose __mfwrap_fclose
+#pragma redefine_extname fread __mfwrap_fread
+#pragma redefine_extname fwrite __mfwrap_fwrite
+#pragma redefine_extname fgetc __mfwrap_fgetc
+#pragma redefine_extname fgets __mfwrap_fgets
+#pragma redefine_extname getc __mfwrap_getc
+#pragma redefine_extname gets __mfwrap_gets
+#pragma redefine_extname ungetc __mfwrap_ungetc
+#pragma redefine_extname fputc __mfwrap_fputc
+#pragma redefine_extname fputs __mfwrap_fputs
+#pragma redefine_extname putc __mfwrap_putc
+#pragma redefine_extname puts __mfwrap_puts
+#pragma redefine_extname clearerr __mfwrap_clearerr
+#pragma redefine_extname feof __mfwrap_feof
+#pragma redefine_extname ferror __mfwrap_ferror
+#pragma redefine_extname fileno __mfwrap_fileno
+#pragma redefine_extname printf __mfwrap_printf
+#pragma redefine_extname fprintf __mfwrap_fprintf
+#pragma redefine_extname sprintf __mfwrap_sprintf
+#pragma redefine_extname snprintf __mfwrap_snprintf
+#pragma redefine_extname vprintf __mfwrap_vprintf
+#pragma redefine_extname vfprintf __mfwrap_vfprintf
+#pragma redefine_extname vsprintf __mfwrap_vsprintf
+#pragma redefine_extname vsnprintf __mfwrap_vsnprintf
+#pragma redefine_extname access __mfwrap_access
+#pragma redefine_extname remove __mfwrap_remove
+#pragma redefine_extname fflush __mfwrap_fflush
+#pragma redefine_extname fseek __mfwrap_fseek
+#pragma redefine_extname ftell __mfwrap_ftell
+#pragma redefine_extname rewind __mfwrap_rewind
+#pragma redefine_extname fgetpos __mfwrap_fgetpos
+#pragma redefine_extname fsetpos __mfwrap_fsetpos
+#pragma redefine_extname stat __mfwrap_stat
+#pragma redefine_extname fstat __mfwrap_fstat
+#pragma redefine_extname lstat __mfwrap_lstat
+#pragma redefine_extname mkfifo __mfwrap_mkfifo
+#pragma redefine_extname setvbuf __mfwrap_setvbuf
+#pragma redefine_extname setbuf __mfwrap_setbuf
+#pragma redefine_extname opendir __mfwrap_opendir
+#pragma redefine_extname closedir __mfwrap_closedir
+#pragma redefine_extname readdir __mfwrap_readdir
+#pragma redefine_extname recv __mfwrap_recv
+#pragma redefine_extname recvfrom __mfwrap_recvfrom
+#pragma redefine_extname recvmsg __mfwrap_recvmsg
+#pragma redefine_extname send __mfwrap_send
+#pragma redefine_extname sendto __mfwrap_sendto
+#pragma redefine_extname sendmsg __mfwrap_sendmsg
+#pragma redefine_extname setsockopt __mfwrap_setsockopt
+#pragma redefine_extname getsockopt __mfwrap_getsockopt
+#pragma redefine_extname accept __mfwrap_accept
+#pragma redefine_extname bind __mfwrap_bind
+#pragma redefine_extname connect __mfwrap_connect
+#pragma redefine_extname gethostname __mfwrap_gethostname
+#pragma redefine_extname sethostname __mfwrap_sethostname
+#pragma redefine_extname gethostbyname __mfwrap_gethostbyname
+#pragma redefine_extname wait __mfwrap_wait
+#pragma redefine_extname waitpid __mfwrap_waitpid
+#pragma redefine_extname popen __mfwrap_popen
+#pragma redefine_extname pclose __mfwrap_pclose
+#pragma redefine_extname execve __mfwrap_execve
+#pragma redefine_extname execv __mfwrap_execv
+#pragma redefine_extname execvp __mfwrap_execvp
+#pragma redefine_extname system __mfwrap_system
+#pragma redefine_extname dlopen __mfwrap_dlopen
+#pragma redefine_extname dlerror __mfwrap_dlerror
+#pragma redefine_extname dlsym __mfwrap_dlsym
+#pragma redefine_extname dlclose __mfwrap_dlclose
+#pragma redefine_extname fopen64 __mfwrap_fopen64
+#pragma redefine_extname stat64 __mfwrap_stat64
+#pragma redefine_extname fseeko64 __mfwrap_fseeko64
+#pragma redefine_extname ftello64 __mfwrap_ftello64
+#pragma redefine_extname semop __mfwrap_semop
+#pragma redefine_extname semctl __mfwrap_semctl
+#pragma redefine_extname shmctl __mfwrap_shmctl
+#pragma redefine_extname shmat __mfwrap_shmat
+#pragma redefine_extname shmdt __mfwrap_shmdt
+
+/* Disable glibc macros. */
+#define __NO_STRING_INLINES
+
+#endif /* _MUDFLAP */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MF_RUNTIME_H */
diff --git a/libmudflap/stamp-h.in b/libmudflap/stamp-h.in
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/libmudflap/stamp-h.in
diff --git a/libmudflap/testsuite/Makefile.am b/libmudflap/testsuite/Makefile.am
new file mode 100644
index 00000000000..11938e6cf65
--- /dev/null
+++ b/libmudflap/testsuite/Makefile.am
@@ -0,0 +1,18 @@
+## Process this with automake to create Makefile.in
+
+AUTOMAKE_OPTIONS = foreign dejagnu
+
+EXPECT = `if [ -f ../../expect/expect ] ; then \
+ echo ../../expect/expect ; \
+ else echo expect ; fi`
+
+RUNTEST = `if [ -f ${srcdir}/../../dejagnu/runtest ] ; then \
+ echo ${srcdir}/../../dejagnu/runtest ; \
+ else echo runtest ; fi`
+
+all-local: site.exp
+if LIBMUDFLAPTH
+ echo 'set libmudflapth 1' >> site.exp
+else
+ echo 'set libmudflapth 0' >> site.exp
+endif
diff --git a/libmudflap/testsuite/Makefile.in b/libmudflap/testsuite/Makefile.in
new file mode 100644
index 00000000000..30e1763ccdd
--- /dev/null
+++ b/libmudflap/testsuite/Makefile.in
@@ -0,0 +1,249 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AS = @AS@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MF_HAVE_STDINT_H = @MF_HAVE_STDINT_H@
+MF_HAVE_UINTPTR_T = @MF_HAVE_UINTPTR_T@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+libtool_VERSION = @libtool_VERSION@
+
+AUTOMAKE_OPTIONS = foreign dejagnu
+
+EXPECT = `if [ -f ../../expect/expect ] ; then \
+ echo ../../expect/expect ; \
+ else echo expect ; fi`
+
+
+RUNTEST = `if [ -f ${srcdir}/../../dejagnu/runtest ] ; then \
+ echo ${srcdir}/../../dejagnu/runtest ; \
+ else echo runtest ; fi`
+
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+tags: TAGS
+TAGS:
+
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = testsuite
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign testsuite/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+
+RUNTESTFLAGS =
+
+DEJATOOL = $(PACKAGE)
+
+RUNTESTDEFAULTFLAGS = --tool $(DEJATOOL) --srcdir $$srcdir
+
+check-DEJAGNU: site.exp
+ srcdir=`cd $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ runtest=$(RUNTEST); \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ $$runtest $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+ else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ fi
+site.exp: Makefile
+ @echo 'Making a new site.exp file...'
+ @test ! -f site.bak || rm -f site.bak
+ @echo '## these variables are automatically generated by make ##' > $@-t
+ @echo '# Do not edit here. If you wish to override these values' >> $@-t
+ @echo '# edit the last section' >> $@-t
+ @echo 'set tool $(DEJATOOL)' >> $@-t
+ @echo 'set srcdir $(srcdir)' >> $@-t
+ @echo 'set objdir' `pwd` >> $@-t
+ @echo 'set host_alias $(host_alias)' >> $@-t
+ @echo 'set host_triplet $(host_triplet)' >> $@-t
+ @echo 'set target_alias $(target_alias)' >> $@-t
+ @echo 'set target_triplet $(target_triplet)' >> $@-t
+ @echo 'set build_alias $(build_alias)' >> $@-t
+ @echo 'set build_triplet $(build_triplet)' >> $@-t
+ @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
+ @test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
+ @test ! -f site.exp || mv site.exp site.bak
+ @mv $@-t site.exp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile all-local
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-generic clean-am
+ -rm -f libtool
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: tags distdir check-DEJAGNU info-am info dvi-am dvi check \
+check-am installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-local all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+all-local: site.exp
+@LIBMUDFLAPTH_TRUE@ echo 'set libmudflapth 1' >> site.exp
+@LIBMUDFLAPTH_FALSE@ echo 'set libmudflapth 0' >> site.exp
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libmudflap/testsuite/config/default.exp b/libmudflap/testsuite/config/default.exp
new file mode 100644
index 00000000000..b19491c547c
--- /dev/null
+++ b/libmudflap/testsuite/config/default.exp
@@ -0,0 +1,2 @@
+load_lib standard.exp
+load_lib libmudflap.exp
diff --git a/libmudflap/testsuite/lib/libmudflap.exp b/libmudflap/testsuite/lib/libmudflap.exp
new file mode 100644
index 00000000000..1d1e22ffb28
--- /dev/null
+++ b/libmudflap/testsuite/lib/libmudflap.exp
@@ -0,0 +1,237 @@
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Define libmudflap callbacks for dg.exp.
+# This file is a copy of libstdc++-v3's dejagnu driver, with minor changes.
+
+
+load_lib mfdg.exp
+load_lib libgloss.exp
+
+proc libmudflap-init { compiler } {
+ global srcdir
+ global outdir
+ global blddir
+ global cxx
+ global includes
+ global libs
+ global cxxflags
+ global objdir
+ global gluefile wrap_flags
+ global ld_library_path
+ global tool_root_dir
+
+ verbose "libmudflap-init $compiler"
+
+ set blddir [lookfor_file [get_multilibs] libmudflap]
+
+ # By default, we assume we want to run program images.
+ global dg-do-what-default
+ set dg-do-what-default run
+
+ # set LD_LIBRARY_PATH so that libgcc_s, libstdc++ binaries can be found.
+ # locate libgcc.a so we don't need to account for different values of
+ # SHLIB_EXT on different platforms
+ set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
+ if {$gccdir != ""} {
+ set gccdir [file dirname $gccdir]
+ }
+
+ set ld_library_path "."
+ append ld_library_path ":${gccdir}"
+ append ld_library_path ":../../libstdc++-v3/src/.libs"
+ if {[is_remote host] == 0} {
+ foreach i "[exec ${gccdir}/xgcc --print-multi-lib]" {
+ set mldir ""
+ regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
+ set mldir [string trimright $mldir "\;@"]
+ if { "$mldir" == "." } {
+ continue
+ }
+ if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] == 1 } {
+ append ld_library_path ":${gccdir}/${mldir}"
+ append ld_library_path ":../../libstdc++-v3/${mldir}/src/.libs"
+ }
+ }
+ }
+ append ld_library_path ":${blddir}/.libs"
+ set cxx $compiler
+ set libs "-L../.libs -L../../libstdc++-v3/src/.libs -L../../../gcc"
+ set cxxflags "-ggdb3 -DDEBUG_ASSERT"
+ set includes "-I${srcdir} -I.."
+
+ verbose "ld_library_path=$ld_library_path"
+ setenv LD_LIBRARY_PATH $ld_library_path
+ setenv SHLIB_PATH $ld_library_path
+ setenv LD_LIBRARYN32_PATH $ld_library_path
+ setenv LD_LIBRARY64_PATH $ld_library_path
+
+ if { [target_info needs_status_wrapper]!=""} {
+ file delete ${objdir}/testglue.o;
+ set gluefile ${objdir}/testglue.o;
+ set result [build_wrapper $gluefile];
+ if { $result != "" } {
+ set gluefile [lindex $result 0];
+ set wrap_flags [lindex $result 1];
+ } else {
+ unset gluefile
+ }
+ }
+}
+
+proc libmudflap-dg-test { prog do_what extra_tool_flags } {
+ # Set up the compiler flags, based on what we're going to do.
+
+ switch $do_what {
+ "preprocess" {
+ set compile_type "preprocess"
+ set output_file "[file rootname [file tail $prog]].i"
+ }
+ "compile" {
+ set compile_type "assembly"
+ set output_file "[file rootname [file tail $prog]].s"
+ }
+ "assemble" {
+ set compile_type "object"
+ set output_file "[file rootname [file tail $prog]].o"
+ }
+ "link" {
+ set compile_type "executable"
+ set output_file "./[file rootname [file tail $prog]].exe"
+ }
+ "run" {
+ set compile_type "executable"
+ # FIXME: "./" is to cope with "." not being in $PATH.
+ # Should this be handled elsewhere?
+ # YES.
+ set output_file "./[file rootname [file tail $prog]].exe"
+ # This is the only place where we care if an executable was
+ # created or not. If it was, dg.exp will try to run it.
+ remote_file build delete $output_file;
+ }
+ default {
+ perror "$do_what: not a valid dg-do keyword"
+ return ""
+ }
+ }
+ set options ""
+ if { $extra_tool_flags != "" } {
+ lappend options "additional_flags=$extra_tool_flags"
+ }
+
+ set comp_output [libmudflap_target_compile "$prog" "$output_file" "$compile_type" $options];
+ set comp_output [prune_gcc_output $comp_output ];
+
+ return [list $comp_output $output_file]
+}
+
+
+proc libmudflap_target_compile { source dest type options } {
+ global gluefile
+ global wrap_flags
+ global cxx
+ global cxxflags
+ global includes
+ global libs
+ global blddir
+
+ if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
+ lappend options "libs=${gluefile}"
+ lappend options "ldflags=${wrap_flags}"
+ }
+
+ set cxx_final $cxx
+ set cxxlibglossflags [libgloss_link_flags]
+ set cxx_final [concat $cxx_final $cxxlibglossflags]
+ set cxx_final [concat $cxx_final $cxxflags]
+ set cxx_final [concat $cxx_final $includes]
+ set cxx_final [concat $cxx_final $libs]
+
+ lappend options "compiler=$cxx_final"
+
+ # Picks up the freshly-built testsuite library corresponding to the
+ # multilib under test.
+ lappend options "ldflags=-L${blddir}/testsuite"
+
+ return [target_compile $source $dest $type $options]
+}
+
+
+# A bit sloppy... Returns a list of source files (full pathnames) to
+# compile. We mimic the mkcheck script in that the first time this is run,
+# all existing files are listed in "testsuite_files" in the output
+# directory. Subsequent runs pull the list from that file, allowing users
+# to trim the list down to problematic tests.
+### This is supposed to be done via RUNTESTFLAGS, but that doesn't work.
+proc libmudflap-list-sourcefiles { } {
+ global srcdir
+ global outdir
+
+ set files_file "${outdir}/testsuite_files"
+ set sfiles ""
+ if { [file exists $files_file] } {
+ set f [open $files_file]
+ while { ! [eof $f] } {
+ set t [gets $f]
+ if { [string length "$t"] != 0 } {
+ lappend sfiles ${srcdir}/${t}
+ }
+ }
+ } else {
+ set f [open $files_file "w"]
+ set where_we_were [pwd]
+ cd $srcdir
+ foreach s [lsort [glob -nocomplain "*/*.cc" "*/*/*.cc" "{,*/}*/*/*/*.cc" ]] {
+ lappend sfiles ${srcdir}/${s}
+ puts $f $s
+ }
+ cd $where_we_were
+ }
+ close $f
+
+ # Disable wchar_t tests if library not configured to support
+ # wchar_t testing.
+ set wchar_file "${outdir}/testsuite_wchar_t"
+ if { [file exists $wchar_file] } {
+ return $sfiles
+ } else {
+ # Remove wchar_t tests files from list.
+ set res {}
+ foreach w $sfiles {
+ if [regexp "wchar_t" $w] {
+ verbose "element out list is $w"
+ } else {
+ verbose "element in list is $w"
+ lappend res $w
+ }
+ }
+ return $res
+ }
+}
+
+
+proc prune_gcc_output { text } {
+
+ regsub -all {(^|\n)[^\n]*ld: warning: libgcc_s[^\n]*not found[^\n]*try using[^\n]*} $text "" text
+
+ regsub -all {(^|\n)[^\n]*In function.*pthread_create[^\n]*} $text "" text
+
+ regsub -all {(^|\n)[^\n]*the use of .pthread.*is deprecated[^\n]*} $text "" text
+
+ regsub -all {(^|\n)[^\n]*Dwarf Error:.*FORM value: 14[^\n]*} $text "" text
+
+ return $text
+}
diff --git a/libmudflap/testsuite/lib/mfdg.exp b/libmudflap/testsuite/lib/mfdg.exp
new file mode 100644
index 00000000000..25473d61269
--- /dev/null
+++ b/libmudflap/testsuite/lib/mfdg.exp
@@ -0,0 +1,377 @@
+# `mfdg' - overrides parts of general purpose testcase driver.
+# Copyright (C) 1994 - 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+# This is a modified excerpt of dejagnu/lib/dg.exp.
+
+load_lib dg.exp
+
+
+# dg-test -- runs a new style DejaGnu test
+#
+# Syntax: dg-test [-keep-output] prog tool_flags default_extra_tool_flags
+#
+# PROG is the full path name of the file to pass to the tool (eg: compiler).
+# TOOL_FLAGS is a set of options to always pass.
+# DEFAULT_EXTRA_TOOL_FLAGS are additional options if the testcase has none.
+
+#proc dg-test { prog tool_flags default_extra_tool_flags } {
+proc dg-test { args } {
+ global dg-do-what-default dg-interpreter-batch-mode dg-linenum-format
+ global errorCode errorInfo
+ global tool
+ global srcdir ;# eg: /calvin/dje/build/gcc/./testsuite/
+ global host_triplet target_triplet
+
+ set keep 0
+ set i 0
+ set dg-repetitions 1 ;# may be overridden by { dg-repetitions N }
+ global dg-timeout
+ set dg-timeout 0 ;# likewise by { dg-timeout N }
+
+ if { [string index [lindex $args 0] 0] == "-" } {
+ for { set i 0 } { $i < [llength $args] } { incr i } {
+ if { [lindex $args $i] == "--" } {
+ incr i
+ break
+ } elseif { [lindex $args $i] == "-keep-output" } {
+ set keep 1
+ } elseif { [string index [lindex $args $i] 0] == "-" } {
+ clone_output "ERROR: dg-test: illegal argument: [lindex $args $i]"
+ return
+ } else {
+ break
+ }
+ }
+ }
+
+ if { $i + 3 != [llength $args] } {
+ clone_output "ERROR: dg-test: missing arguments in call"
+ return
+ }
+ set prog [lindex $args $i]
+ set tool_flags [lindex $args [expr $i + 1]]
+ set default_extra_tool_flags [lindex $args [expr $i + 2]]
+
+ set text "\[- A-Za-z0-9\.\;\"\_\:\'\`\(\)\!\#\=\+\?\&\*]*"
+
+ set name [dg-trim-dirname $srcdir $prog]
+ # If we couldn't rip $srcdir out of `prog' then just do the best we can.
+ # The point is to reduce the unnecessary noise in the logs. Don't strip
+ # out too much because different testcases with the same name can confuse
+ # `test-tool'.
+ if [string match "/*" $name] {
+ set name "[file tail [file dirname $prog]]/[file tail $prog]"
+ }
+
+ if {$tool_flags != ""} {
+ append name " ($tool_flags)"
+ }
+
+ # Process any embedded dg options in the testcase.
+
+ # Use "" for the second element of dg-do-what so we can tell if it's been
+ # explicitly set to "S".
+ set dg-do-what [list ${dg-do-what-default} "" P]
+ set dg-excess-errors-flag 0
+ set dg-messages ""
+ set dg-extra-tool-flags $default_extra_tool_flags
+ set dg-final-code ""
+
+ # `dg-output-text' is a list of two elements: pass/fail and text.
+ # Leave second element off for now (indicates "don't perform test")
+ set dg-output-text "P"
+
+ # Define our own "special function" `unknown' so we catch spelling errors.
+ # But first rename the existing one so we can restore it afterwards.
+ catch {rename dg-save-unknown ""}
+ rename unknown dg-save-unknown
+ proc unknown { args } {
+ return -code error "unknown dg option: $args"
+ }
+
+ set tmp [dg-get-options $prog]
+ foreach op $tmp {
+ verbose "Processing option: $op" 3
+ set status [catch "$op" errmsg]
+ if { $status != 0 } {
+ if { 0 && [info exists errorInfo] } {
+ # This also prints a backtrace which will just confuse
+ # testcase writers, so it's disabled.
+ perror "$name: $errorInfo\n"
+ } else {
+ perror "$name: $errmsg for \"$op\"\n"
+ }
+ # ??? The call to unresolved here is necessary to clear `errcnt'.
+ # What we really need is a proc like perror that doesn't set errcnt.
+ # It should also set exit_status to 1.
+ unresolved "$name: $errmsg for \"$op\""
+ return
+ }
+ }
+
+ # Restore normal error handling.
+ rename unknown ""
+ rename dg-save-unknown unknown
+
+ # If we're not supposed to try this test on this target, we're done.
+ if { [lindex ${dg-do-what} 1] == "N" } {
+ unsupported "$name"
+ verbose "$name not supported on this target, skipping it" 3
+ return
+ }
+
+ # Run the tool and analyze the results.
+ # The result of ${tool}-dg-test is in a bit of flux.
+ # Currently it is the name of the output file (or "" if none).
+ # If we need more than this it will grow into a list of things.
+ # No intention is made (at this point) to preserve upward compatibility
+ # (though at some point we'll have to).
+
+ set results [${tool}-dg-test $prog [lindex ${dg-do-what} 0] "$tool_flags ${dg-extra-tool-flags}"];
+
+ set comp_output [lindex $results 0];
+ set output_file [lindex $results 1];
+
+ #send_user "\nold_dejagnu.exp: comp_output1 = :$comp_output:\n\n"
+ #send_user "\nold_dejagnu.exp: message = :$message:\n\n"
+ #send_user "\nold_dejagnu.exp: message length = [llength $message]\n\n"
+
+ foreach i ${dg-messages} {
+ verbose "Scanning for message: $i" 4
+
+ # Remove all error messages for the line [lindex $i 0]
+ # in the source file. If we find any, success!
+ set line [lindex $i 0]
+ set pattern [lindex $i 2]
+ set comment [lindex $i 3]
+ #send_user "Before:\n$comp_output\n"
+ if [regsub -all "(^|\n)(\[^\n\]+$line\[^\n\]*($pattern)\[^\n\]*\n?)+" $comp_output "\n" comp_output] {
+ set comp_output [string trimleft $comp_output]
+ set ok pass
+ set uhoh fail
+ } else {
+ set ok fail
+ set uhoh pass
+ }
+ #send_user "After:\n$comp_output\n"
+
+ # $line will either be a formatted line number or a number all by
+ # itself. Delete the formatting.
+ scan $line ${dg-linenum-format} line
+ switch [lindex $i 1] {
+ "ERROR" {
+ $ok "$name $comment (test for errors, line $line)"
+ }
+ "XERROR" {
+ x$ok "$name $comment (test for errors, line $line)"
+ }
+ "WARNING" {
+ $ok "$name $comment (test for warnings, line $line)"
+ }
+ "XWARNING" {
+ x$ok "$name $comment (test for warnings, line $line)"
+ }
+ "BOGUS" {
+ $uhoh "$name $comment (test for bogus messages, line $line)"
+ }
+ "XBOGUS" {
+ x$uhoh "$name $comment (test for bogus messages, line $line)"
+ }
+ "BUILD" {
+ $uhoh "$name $comment (test for build failure, line $line)"
+ }
+ "XBUILD" {
+ x$uhoh "$name $comment (test for build failure, line $line)"
+ }
+ "EXEC" { }
+ "XEXEC" { }
+ }
+ #send_user "\nold_dejagnu.exp: comp_output2= :$comp_output:\n\n"
+ }
+ #send_user "\nold_dejagnu.exp: comp_output3 = :$comp_output:\n\n"
+
+ # Remove messages from the tool that we can ignore.
+ #send_user "comp_output: $comp_output\n"
+ set comp_output [prune_warnings $comp_output]
+
+ if { [info proc ${tool}-dg-prune] != "" } {
+ set comp_output [${tool}-dg-prune $target_triplet $comp_output]
+ switch -glob $comp_output {
+ "::untested::*" {
+ regsub "::untested::" $comp_output "" message
+ untested "$name: $message"
+ return
+ }
+ "::unresolved::*" {
+ regsub "::unresolved::" $comp_output "" message
+ unresolved "$name: $message"
+ return
+ }
+ "::unsupported::*" {
+ regsub "::unsupported::" $comp_output "" message
+ unsupported "$name: $message"
+ return
+ }
+ }
+ }
+
+ # See if someone forgot to delete the extra lines.
+ regsub -all "\n+" $comp_output "\n" comp_output
+ regsub "^\n+" $comp_output "" comp_output
+ #send_user "comp_output: $comp_output\n"
+
+ # Don't do this if we're testing an interpreter.
+ # FIXME: why?
+ if { ${dg-interpreter-batch-mode} == 0 } {
+ # Catch excess errors (new bugs or incomplete testcases).
+ if ${dg-excess-errors-flag} {
+ setup_xfail "*-*-*"
+ }
+ if ![string match "" $comp_output] {
+ fail "$name (test for excess errors)"
+ send_log "Excess errors:\n$comp_output\n"
+ } else {
+ pass "$name (test for excess errors)"
+ }
+ }
+
+ # Run the executable image if asked to do so.
+ # FIXME: This is the only place where we assume a standard meaning to
+ # the `keyword' argument of dg-do. This could be cleaned up.
+ if { [lindex ${dg-do-what} 0] == "run" } {
+ if ![file exists $output_file] {
+ warning "$name compilation failed to produce executable"
+ } else {
+ set testname $name
+ for {set rep 0} {$rep < ${dg-repetitions}} {incr rep} {
+ # include repetition number in test name
+ if {$rep > 0} { set name "$testname (rerun $rep)" }
+
+ set status -1
+ set result [${tool}_load $output_file]
+ set status [lindex $result 0];
+ set output [lindex $result 1];
+ #send_user "After exec, status: $status\n"
+
+ if { "$status" == "pass" } {
+ verbose "Exec succeeded." 3
+ } elseif { "$status" == "fail" } {
+ # It would be nice to get some info out of errorCode.
+ if [info exists errorCode] {
+ verbose "Exec failed, errorCode: $errorCode" 3
+ } else {
+ verbose "Exec failed, errorCode not defined!" 3
+ }
+ }
+
+ if { [lindex ${dg-do-what} 2] == "F" } {
+ # Instead of modelling this as an xfail (via setup_xfail),
+ # treat an expected crash as a success.
+ if { $status == "pass" } then { set status fail } else { set status pass }
+ set testtype "crash"
+ } else { set testtype "execution" }
+
+ $status "$name $testtype test"
+
+ if { [llength ${dg-output-text}] > 1 } {
+ #send_user "${dg-output-text}\n"
+ if { [lindex ${dg-output-text} 0] == "F" } {
+ setup_xfail "*-*-*"
+ }
+ set texttmp [lindex ${dg-output-text} 1]
+ if { ![regexp $texttmp ${output}] } {
+ fail "$name output pattern test"
+ } else {
+ pass "$name output pattern test"
+ }
+ verbose -log "Output pattern $texttmp"
+ unset texttmp
+ }
+ }
+ }
+ }
+
+ # Are there any further tests to perform?
+ # Note that if the program has special run-time requirements, running
+ # of the program can be delayed until here. Ditto for other situations.
+ # It would be a bit cumbersome though.
+
+ if ![string match ${dg-final-code} ""] {
+ regsub -all "\\\\(\[{}\])" ${dg-final-code} "\\1" dg-final-code
+ # Note that the use of `args' here makes this a varargs proc.
+ proc dg-final-proc { args } ${dg-final-code}
+ verbose "Running dg-final tests." 3
+ verbose "dg-final-proc:\n[info body dg-final-proc]" 4
+ if [catch "dg-final-proc $prog" errmsg] {
+ perror "$name: error executing dg-final: $errmsg"
+ # ??? The call to unresolved here is necessary to clear `errcnt'.
+ # What we really need is a proc like perror that doesn't set errcnt.
+ # It should also set exit_status to 1.
+ unresolved "$name: error executing dg-final: $errmsg"
+ }
+ }
+
+ # Do some final clean up.
+ # When testing an interpreter, we don't compile something and leave an
+ # output file.
+ if { ! ${keep} && ${dg-interpreter-batch-mode} == 0 } {
+ catch "exec rm -f $output_file"
+ }
+}
+
+
+
+#
+# Indicate that this test case is to be rerun several times. This
+# is useful if it is nondeterministic. This applies to rerunning the
+# test program only, not rebuilding it.
+# The embedded format is "{ dg-repetitions N }", where N is the number
+# of repetitions. It better be greater than zero.
+#
+proc dg-repetitions { line value } {
+ upvar dg-repetitions repetitions
+ set repetitions $value
+}
+
+
+#
+# Indicate that this test case is to be run with a short timeout.
+# The embedded format is "{ dg-timeout N }", where N is in seconds.
+#
+proc dg-timeout { line value } {
+ global dg-timeout
+ set dg-timeout $value
+}
+
+
+# dejagnu's config/unix.exp hard-codes 300 seconds as the timeout
+# for any natively run executable. That's too long for tests run
+# multiple times and that may possibly hang. So we override it here
+# to provide some degree of control.
+rename standard_wait hooked_standard_wait
+proc standard_wait { dest timeout } {
+ global dg-timeout
+ if {[info exists dg-timeout]} {
+ if {${dg-timeout} > 0} {
+ verbose -log "Overriding timeout = ${dg-timeout}"
+ set timeout ${dg-timeout}
+ }
+ }
+
+ hooked_standard_wait $dest $timeout
+}
diff --git a/libmudflap/testsuite/libmudflap.c++/c++frags.exp b/libmudflap/testsuite/libmudflap.c++/c++frags.exp
new file mode 100644
index 00000000000..5d8be05245c
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c++/c++frags.exp
@@ -0,0 +1,16 @@
+
+libmudflap-init [find_g++]
+
+dg-init
+
+global srcdir
+
+foreach flags [list {} {-static} {-O2} {-O3}] {
+ foreach srcfile [lsort [glob -nocomplain ${srcdir}/libmudflap.c++/*.cxx]] {
+ set bsrc [file tail $srcfile]
+ setenv MUDFLAP_OPTIONS "-no-heur-proc-map -viol-segv"
+ dg-runtest $srcfile $flags "-fmudflap"
+ }
+}
+
+dg-finish
diff --git a/libmudflap/testsuite/libmudflap.c++/fail24-frag.cxx b/libmudflap/testsuite/libmudflap.c++/fail24-frag.cxx
new file mode 100644
index 00000000000..e3467ddaf1a
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c++/fail24-frag.cxx
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char zoo [10];
+
+int main ()
+{
+int i = strlen ("twelve") + strlen ("zero") + strlen ("seventeen");
+zoo[i] = 'a';
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*zoo.*static.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c++/pass27-frag.cxx b/libmudflap/testsuite/libmudflap.c++/pass27-frag.cxx
new file mode 100644
index 00000000000..aca2ea3a3b6
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c++/pass27-frag.cxx
@@ -0,0 +1,12 @@
+class foo {
+ char z [10];
+public:
+ char *get_z () { return & this->z[0]; }
+};
+
+int main ()
+{
+foo x;
+x.get_z()[9] = 'a';
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c++/pass28-frag.cxx b/libmudflap/testsuite/libmudflap.c++/pass28-frag.cxx
new file mode 100644
index 00000000000..75e14ba1460
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c++/pass28-frag.cxx
@@ -0,0 +1,20 @@
+class foo {
+ char z [10];
+public:
+ virtual char *get_z () { return & this->z[0]; }
+};
+
+class bar: public foo {
+ char q [20];
+public:
+ char *get_z () { return & this->q[0]; }
+};
+
+int main () {
+foo *x = new bar ();
+
+x->get_z()[9] = 'a';
+
+delete x;
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c++/pass31-frag.cxx b/libmudflap/testsuite/libmudflap.c++/pass31-frag.cxx
new file mode 100644
index 00000000000..6c4b9f9a7f8
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c++/pass31-frag.cxx
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char zoo [10];
+
+int main ()
+{
+int i = strlen ("eight") + strlen ("one");
+zoo[i] = 'a';
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx b/libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx
new file mode 100644
index 00000000000..d15b98f1cdd
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx
@@ -0,0 +1,10 @@
+#include <string>
+#include <iostream>
+
+int
+main (int argc, char *argv[])
+{
+ std::string myStr = "Hello, World!";
+ std::cout << myStr << std::endl;
+ return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/cfrags.exp b/libmudflap/testsuite/libmudflap.c/cfrags.exp
new file mode 100644
index 00000000000..bef2f91c312
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/cfrags.exp
@@ -0,0 +1,15 @@
+
+libmudflap-init [find_gcc]
+
+dg-init
+
+global srcdir
+foreach flags [list {} {-static} {-O2} {-O3}] {
+ foreach srcfile [lsort [glob -nocomplain ${srcdir}/libmudflap.c/*.c]] {
+ set bsrc [file tail $srcfile]
+ setenv MUDFLAP_OPTIONS "-viol-segv"
+ dg-runtest $srcfile $flags "-fmudflap"
+ }
+}
+
+dg-finish
diff --git a/libmudflap/testsuite/libmudflap.c/fail1-frag.c b/libmudflap/testsuite/libmudflap.c/fail1-frag.c
new file mode 100644
index 00000000000..1e48fff8771
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail1-frag.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+volatile int foo [10];
+foo[10] = 0;
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.main. foo.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail10-frag.c b/libmudflap/testsuite/libmudflap.c/fail10-frag.c
new file mode 100644
index 00000000000..db135d5c451
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail10-frag.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+volatile int foo[10];
+int sz = sizeof (int);
+
+volatile char *bar = (char *)foo;
+bar [sz * 10] = 0;
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.main. foo.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail11-frag.c b/libmudflap/testsuite/libmudflap.c/fail11-frag.c
new file mode 100644
index 00000000000..72038fdba30
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail11-frag.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+int i = 10;
+char *x = (char *) malloc (i * sizeof (char));
+
+while (i--)
+{
+ ++x;
+ *x = 0;
+}
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*malloc region.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail12-frag.c b/libmudflap/testsuite/libmudflap.c/fail12-frag.c
new file mode 100644
index 00000000000..da8bfb7c046
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail12-frag.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+int i = 10;
+int *x = (int *) malloc (i * sizeof (int));
+
+while (i--)
+{
+ ++x;
+ *x = 0;
+}
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*malloc region.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail13-frag.c b/libmudflap/testsuite/libmudflap.c/fail13-frag.c
new file mode 100644
index 00000000000..9fd3e255712
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail13-frag.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct a {
+ int x;
+ int y;
+ char z;
+};
+
+struct b {
+ int x;
+ int y;
+};
+
+struct b k;
+
+(*((volatile struct a *) &k)).z = 'q';
+
+return 0;
+}
+/* { dg-output "mudflap violation 1..check/write.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.main. k.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail14-frag.c b/libmudflap/testsuite/libmudflap.c/fail14-frag.c
new file mode 100644
index 00000000000..e66cc94c49b
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail14-frag.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct a {
+ int x;
+ int y;
+ char z;
+};
+
+struct b {
+ int x;
+ int y;
+};
+
+volatile struct b k;
+volatile struct a *p;
+
+p = (struct a*) &k;
+
+p->z = 'q';
+
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.main. k.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail15-frag.c b/libmudflap/testsuite/libmudflap.c/fail15-frag.c
new file mode 100644
index 00000000000..5d7ae744973
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail15-frag.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct base {
+ int basic;
+};
+
+struct derived {
+ struct base common;
+ char extra;
+};
+
+volatile struct base b;
+volatile struct base *bp;
+
+bp = (struct base *)&b;
+
+bp->basic = 10;
+((struct derived volatile *)bp)->extra = 'x';
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.main. b.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail16-frag.c b/libmudflap/testsuite/libmudflap.c/fail16-frag.c
new file mode 100644
index 00000000000..317e2744731
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail16-frag.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct base {
+ int basic;
+};
+
+struct derived {
+ struct base common;
+ char extra;
+};
+
+struct base *bp;
+
+bp = (struct base *) malloc (sizeof (struct base));;
+
+bp->basic = 10;
+((struct derived *)bp)->extra = 'x';
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.malloc region.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail17-frag.c b/libmudflap/testsuite/libmudflap.c/fail17-frag.c
new file mode 100644
index 00000000000..5af67f13858
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail17-frag.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+
+char * x;
+int foo;
+x = (char *) malloc (10);
+strcpy (x, "123456789");
+foo = strlen (x+10);
+x [foo] = 1; /* we just just use foo to force execution of strlen */
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.malloc region.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail18-frag.c b/libmudflap/testsuite/libmudflap.c/fail18-frag.c
new file mode 100644
index 00000000000..dde150a8457
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail18-frag.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+/* One cannot redeclare __mf_lc_mask in proper C from instrumented
+ code, because of the way the instrumentation code emits its decls. */
+extern unsigned foo __asm__ ("__mf_lc_mask");
+unsigned *bar = &foo;
+*bar = 4;
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.__mf_lc_mask.*no-access.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail19-frag.c b/libmudflap/testsuite/libmudflap.c/fail19-frag.c
new file mode 100644
index 00000000000..7e446b40503
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail19-frag.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct foo {
+ int bar [10];
+};
+
+struct foo *k = (struct foo *) malloc (2 * sizeof(int));
+k->bar[5] = 9;
+free (k);
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.malloc region.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail2-frag.c b/libmudflap/testsuite/libmudflap.c/fail2-frag.c
new file mode 100644
index 00000000000..7672e60c602
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail2-frag.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+volatile int foo [10][10];
+foo[10][0] = 0;
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.main. foo.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail20-frag.c b/libmudflap/testsuite/libmudflap.c/fail20-frag.c
new file mode 100644
index 00000000000..0dd8bb7f983
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail20-frag.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+volatile char *p = (char *) 0;
+*p = 5;
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.NULL.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail21-frag.c b/libmudflap/testsuite/libmudflap.c/fail21-frag.c
new file mode 100644
index 00000000000..4ab4a09f3b0
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail21-frag.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+ int *bar = (int *) malloc (sizeof (int));
+/* Make an access here to get &foo into the lookup cache. */
+*bar = 5;
+__mf_watch (bar, sizeof(int));
+/* This access should trigger the watch violation. */
+*bar = 10;
+/* NOTREACHED */
+return 0;
+}
+/* { dg-output "mudflap violation 1.*watch.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*malloc region.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail22-frag.c b/libmudflap/testsuite/libmudflap.c/fail22-frag.c
new file mode 100644
index 00000000000..7dd7103d359
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail22-frag.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct boo { int a; };
+int c;
+struct boo *b = malloc (sizeof (struct boo));
+__mf_set_options ("-check-initialization");
+c = b->a;
+(void) malloc (c); /* some dummy use of c */
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.malloc region.*1r/0w.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail23-frag.c b/libmudflap/testsuite/libmudflap.c/fail23-frag.c
new file mode 100644
index 00000000000..bb1b52ec7e0
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail23-frag.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char zoo [10];
+
+int main ()
+{
+int i = strlen ("012345") + strlen ("6789") + strlen ("01"); /* 11 */
+zoo[i] = 'a';
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*zoo.*static.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail25-frag.c b/libmudflap/testsuite/libmudflap.c/fail25-frag.c
new file mode 100644
index 00000000000..acac5236b42
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail25-frag.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char *foo;
+char *bar;
+__mf_set_options ("-check-initialization");
+foo = (char *)malloc (10);
+bar = (char *)malloc (10);
+/* bar[2] = 'z'; */ /* don't touch memcpy source */
+memcpy(foo+1, bar+1, 9);
+return 0;
+}
+/* { dg-output "mudflap violation 1.*check.read.*memcpy source.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*malloc region.*alloc time.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail26-frag.c b/libmudflap/testsuite/libmudflap.c/fail26-frag.c
new file mode 100644
index 00000000000..88484d6adc4
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail26-frag.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char *foo;
+
+__mf_set_options ("-check-initialization");
+foo = (char *)malloc (1);
+
+/* These two operations each expand to a read-modify-write.
+ * Even though the end result is that every bit of foo[0] is
+ * eventually written to deterministically, the first read
+ * triggers an uninit error. Ideally, it shouldn't, so this
+ * should be treated more like a regular XFAIL. */
+foo[0] &= 0xfe;
+foo[0] |= 0x01;
+
+return foo[0];
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*malloc region.*1r/0w.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail27-frag.c b/libmudflap/testsuite/libmudflap.c/fail27-frag.c
new file mode 100644
index 00000000000..7168dfc61b2
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail27-frag.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char volatile *
+__attribute__((noinline))
+foo (unsigned i)
+{
+ char volatile buffer[10];
+ char volatile *k = i ? & buffer[i] : NULL; /* defeat addr-of-local-returned warning */
+ return k;
+}
+
+int main ()
+{
+char volatile *f = foo (5);
+f[0] = 'b';
+
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*buffer.*alloc.*dealloc" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail28-frag.c b/libmudflap/testsuite/libmudflap.c/fail28-frag.c
new file mode 100644
index 00000000000..7d61c57f34b
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail28-frag.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int foo (int *u, int i)
+{
+ return u[i]; /* this dereference should be instrumented */
+}
+
+int main ()
+{
+int *k = malloc (6);
+return foo (k, 8);
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*malloc region.*alloc" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail29-frag.c b/libmudflap/testsuite/libmudflap.c/fail29-frag.c
new file mode 100644
index 00000000000..2024064dc73
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail29-frag.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int foo (int u[10])
+{
+ return u[8]; /* this dereference should be instrumented */
+}
+
+int main ()
+{
+int *k = malloc (6);
+return foo (k);
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*malloc region.*alloc" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail3-frag.c b/libmudflap/testsuite/libmudflap.c/fail3-frag.c
new file mode 100644
index 00000000000..98c1dbae165
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail3-frag.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+volatile int foo [10][10][10];
+foo[9][10][0] = 0;
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.main. foo.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail30-frag.c b/libmudflap/testsuite/libmudflap.c/fail30-frag.c
new file mode 100644
index 00000000000..8bfea61cbb2
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail30-frag.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int foo (int u)
+{
+ return u*u;
+}
+
+int main ()
+{
+int *k = malloc(5);
+int j = foo (k[8]); /* this call argument should be instrumented */
+return j;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*malloc region.*alloc" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail31-frag.c b/libmudflap/testsuite/libmudflap.c/fail31-frag.c
new file mode 100644
index 00000000000..b15056c970c
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail31-frag.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+extern int h (int i, int j);
+
+int main ()
+{
+ int z = h (4, 10);
+ return 0;
+}
+
+int h (int i, int j)
+{
+ int k[i];
+ k[j] = i;
+ return j;
+}
+
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*\(h\).*k" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail4-frag.c b/libmudflap/testsuite/libmudflap.c/fail4-frag.c
new file mode 100644
index 00000000000..a3423e6c36b
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail4-frag.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char foo [10];
+strcpy(foo, "1234567890");
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.main. foo.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail5-frag.c b/libmudflap/testsuite/libmudflap.c/fail5-frag.c
new file mode 100644
index 00000000000..a08569fe773
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail5-frag.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char foo [15];
+char bar [10];
+memcpy(foo, bar, 11);
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*.main. bar.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail6-frag.c b/libmudflap/testsuite/libmudflap.c/fail6-frag.c
new file mode 100644
index 00000000000..1904a88711a
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail6-frag.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char *foo;
+char *bar;
+foo = (char *)malloc (10);
+bar = (char *)malloc (15);
+
+memcpy(foo, bar, 11);
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*malloc region.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail7-frag.c b/libmudflap/testsuite/libmudflap.c/fail7-frag.c
new file mode 100644
index 00000000000..580d045386d
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail7-frag.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char *foo;
+char *bar;
+foo = (char *)malloc (12);
+bar = (char *)malloc (10);
+
+memcpy(foo+1, bar+1, 10);
+return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object 1.*" } */
+/* { dg-output "mudflap object.*malloc region.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail8-frag.c b/libmudflap/testsuite/libmudflap.c/fail8-frag.c
new file mode 100644
index 00000000000..cc2fbdaac4c
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail8-frag.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char *foo;
+char *bar;
+foo = (char *)malloc (10);
+bar = (char *)malloc (10);
+
+free(bar);
+
+memcpy(foo, bar, 10);
+return 0;
+}
+/* { dg-output "mudflap violation 1.*memcpy source.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*malloc region.*alloc time.*dealloc time.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/fail9-frag.c b/libmudflap/testsuite/libmudflap.c/fail9-frag.c
new file mode 100644
index 00000000000..029fda5d4d0
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail9-frag.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char *foo;
+char *bar;
+foo = (char *)malloc (10);
+bar = (char *)malloc (10);
+
+free(foo);
+
+bar[4] = 'a'; /* touch source buffer */
+memcpy(foo, bar, 10);
+return 0;
+}
+
+/* { dg-output "mudflap violation 1.*memcpy dest.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*malloc region.*alloc time.*dealloc time.*" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/hook-allocstuff.c b/libmudflap/testsuite/libmudflap.c/hook-allocstuff.c
new file mode 100644
index 00000000000..dc25375488d
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/hook-allocstuff.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main ()
+{
+ char *foo = (char *) malloc (10);
+ strcpy (foo, "hello");
+ foo = (char *) realloc (foo, 20);
+ printf ("%s", foo);
+ if (strcmp (foo, "hello"))
+ abort ();
+ free (foo);
+ printf (" world\n");
+ return 0;
+}
+/* { dg-output "hello world" } */
diff --git a/libmudflap/testsuite/libmudflap.c/pass-stratcliff.c b/libmudflap/testsuite/libmudflap.c/pass-stratcliff.c
new file mode 100644
index 00000000000..894f10ffa96
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass-stratcliff.c
@@ -0,0 +1,319 @@
+/* Test for string function add boundaries of usable memory.
+ Copyright (C) 1996,1997,1999,2000,2001,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C 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. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define _GNU_SOURCE 1
+#define __USE_GNU
+
+/* Make sure we don't test the optimized inline functions if we want to
+ test the real implementation. */
+#undef __USE_STRING_INLINES
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+
+#ifndef MAX
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
+int
+main (int argc, char *argv[])
+{
+ int size = sysconf (_SC_PAGESIZE);
+ char *adr, *dest;
+ int result = 0;
+
+ adr = (char *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
+ dest = (char *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
+ if (adr == MAP_FAILED || dest == MAP_FAILED)
+ {
+ if (errno == ENOSYS)
+ puts ("No test, mmap not available.");
+ else
+ {
+ printf ("mmap failed: %m");
+ result = 1;
+ }
+ }
+ else
+ {
+ int inner, middle, outer;
+
+ mprotect(adr, size, PROT_NONE);
+ mprotect(adr + 2 * size, size, PROT_NONE);
+ adr += size;
+
+ mprotect(dest, size, PROT_NONE);
+ mprotect(dest + 2 * size, size, PROT_NONE);
+ dest += size;
+
+ memset (adr, 'T', size);
+
+ /* strlen test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (inner = MAX (outer, size - 64); inner < size; ++inner)
+ {
+ adr[inner] = '\0';
+
+ if (strlen (&adr[outer]) != (size_t) (inner - outer))
+ {
+ printf ("strlen flunked for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+
+ adr[inner] = 'T';
+ }
+ }
+
+ /* strchr test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (middle = MAX (outer, size - 64); middle < size; ++middle)
+ {
+ for (inner = middle; inner < size; ++inner)
+ {
+ char *cp;
+ adr[middle] = 'V';
+ adr[inner] = '\0';
+
+ cp = strchr (&adr[outer], 'V');
+
+ if ((inner == middle && cp != NULL)
+ || (inner != middle
+ && (cp - &adr[outer]) != middle - outer))
+ {
+ printf ("strchr flunked for outer = %d, middle = %d, "
+ "inner = %d\n", outer, middle, inner);
+ result = 1;
+ }
+
+ adr[inner] = 'T';
+ adr[middle] = 'T';
+ }
+ }
+ }
+
+ /* Special test. */
+ adr[size - 1] = '\0';
+ if (strchr (&adr[size - 1], '\n') != NULL)
+ {
+ puts ("strchr flunked for test of empty string at end of page");
+ result = 1;
+ }
+
+ /* strrchr test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (middle = MAX (outer, size - 64); middle < size; ++middle)
+ {
+ for (inner = middle; inner < size; ++inner)
+ {
+ char *cp;
+ adr[middle] = 'V';
+ adr[inner] = '\0';
+
+ cp = strrchr (&adr[outer], 'V');
+
+ if ((inner == middle && cp != NULL)
+ || (inner != middle
+ && (cp - &adr[outer]) != middle - outer))
+ {
+ printf ("strrchr flunked for outer = %d, middle = %d, "
+ "inner = %d\n", outer, middle, inner);
+ result = 1;
+ }
+
+ adr[inner] = 'T';
+ adr[middle] = 'T';
+ }
+ }
+ }
+
+#ifndef __FreeBSD__
+ /* rawmemchr test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (middle = MAX (outer, size - 64); middle < size; ++middle)
+ {
+ char *cp;
+ adr[middle] = 'V';
+
+ cp = (char *) rawmemchr (&adr[outer], 'V');
+
+ if (cp - &adr[outer] != middle - outer)
+ {
+ printf ("rawmemchr flunked for outer = %d, middle = %d\n",
+ outer, middle);
+ result = 1;
+ }
+
+ adr[middle] = 'T';
+ }
+ }
+#endif
+
+ /* strcpy test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (inner = MAX (outer, size - 64); inner < size; ++inner)
+ {
+ adr[inner] = '\0';
+
+ if (strcpy (dest, &adr[outer]) != dest
+ || strlen (dest) != (size_t) (inner - outer))
+ {
+ printf ("strcpy flunked for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+
+ adr[inner] = 'T';
+ }
+ }
+
+ /* strncpy tests */
+ adr[size-1] = 'T';
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ size_t len;
+
+ for (len = 0; len < size - outer; ++len)
+ {
+ if (strncpy (dest, &adr[outer], len) != dest
+ || memcmp (dest, &adr[outer], len) != 0)
+ {
+ printf ("outer strncpy flunked for outer = %d, len = %Zd\n",
+ outer, len);
+ result = 1;
+ }
+ }
+ }
+ adr[size-1] = '\0';
+
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (inner = MAX (outer, size - 64); inner < size; ++inner)
+ {
+ size_t len;
+
+ adr[inner] = '\0';
+
+ for (len = 0; len < size - outer + 64; ++len)
+ {
+ if (strncpy (dest, &adr[outer], len) != dest
+ || memcmp (dest, &adr[outer],
+ MIN (inner - outer, len)) != 0
+ || (inner - outer < len
+ && strlen (dest) != (inner - outer)))
+ {
+ printf ("strncpy flunked for outer = %d, inner = %d, len = %Zd\n",
+ outer, inner, len);
+ result = 1;
+ }
+ if (strncpy (dest + 1, &adr[outer], len) != dest + 1
+ || memcmp (dest + 1, &adr[outer],
+ MIN (inner - outer, len)) != 0
+ || (inner - outer < len
+ && strlen (dest + 1) != (inner - outer)))
+ {
+ printf ("strncpy+1 flunked for outer = %d, inner = %d, len = %Zd\n",
+ outer, inner, len);
+ result = 1;
+ }
+ }
+
+ adr[inner] = 'T';
+ }
+ }
+
+#ifndef __FreeBSD__
+ /* stpcpy test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (inner = MAX (outer, size - 64); inner < size; ++inner)
+ {
+ adr[inner] = '\0';
+
+ if ((stpcpy (dest, &adr[outer]) - dest) != inner - outer)
+ {
+ printf ("stpcpy flunked for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+
+ adr[inner] = 'T';
+ }
+ }
+
+ /* stpncpy test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (middle = MAX (outer, size - 64); middle < size; ++middle)
+ {
+ adr[middle] = '\0';
+
+ for (inner = 0; inner < size - outer; ++ inner)
+ {
+ if ((stpncpy (dest, &adr[outer], inner) - dest)
+ != MIN (inner, middle - outer))
+ {
+ printf ("stpncpy flunked for outer = %d, middle = %d, "
+ "inner = %d\n", outer, middle, inner);
+ result = 1;
+ }
+ }
+
+ adr[middle] = 'T';
+ }
+ }
+#endif
+
+ /* memcpy test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ for (inner = 0; inner < size - outer; ++inner)
+ if (memcpy (dest, &adr[outer], inner) != dest)
+ {
+ printf ("memcpy flunked for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+
+#ifndef __FreeBSD__
+ /* mempcpy test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ for (inner = 0; inner < size - outer; ++inner)
+ if (mempcpy (dest, &adr[outer], inner) != dest + inner)
+ {
+ printf ("mempcpy flunked for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+#endif
+ }
+
+ return result;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass1-frag.c b/libmudflap/testsuite/libmudflap.c/pass1-frag.c
new file mode 100644
index 00000000000..40f629b56da
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass1-frag.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+int foo [10];
+foo[9] = 0;
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass10-frag.c b/libmudflap/testsuite/libmudflap.c/pass10-frag.c
new file mode 100644
index 00000000000..f05650da515
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass10-frag.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+int foo[10];
+int sz = sizeof (int);
+
+char *bar = (char *)foo;
+bar [sz * 9] = 0;
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass11-frag.c b/libmudflap/testsuite/libmudflap.c/pass11-frag.c
new file mode 100644
index 00000000000..ab7ee38c4f8
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass11-frag.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+int i = 10;
+char *x = (char *) malloc (i * sizeof (char));
+
+while (--i)
+{
+ ++x;
+ *x = 0;
+}
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass12-frag.c b/libmudflap/testsuite/libmudflap.c/pass12-frag.c
new file mode 100644
index 00000000000..53630d9971d
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass12-frag.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+int i = 10;
+int *x = (int *) malloc (i * sizeof (int));
+
+while (--i)
+{
+ ++x;
+ *x = 0;
+}
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass13-frag.c b/libmudflap/testsuite/libmudflap.c/pass13-frag.c
new file mode 100644
index 00000000000..c2b820d0f43
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass13-frag.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct a {
+ int x;
+ int y;
+ char z;
+};
+
+struct a k;
+
+k.z = 'q';
+
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass14-frag.c b/libmudflap/testsuite/libmudflap.c/pass14-frag.c
new file mode 100644
index 00000000000..26456432979
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass14-frag.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct a {
+ int x;
+ int y;
+ char z;
+};
+
+struct a k;
+struct a *p;
+
+p = &k;
+
+p->z = 'q';
+
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass15-frag.c b/libmudflap/testsuite/libmudflap.c/pass15-frag.c
new file mode 100644
index 00000000000..5e1fee8eb9c
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass15-frag.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct base {
+ int basic;
+};
+
+struct derived {
+ struct base common;
+ char extra;
+};
+
+struct derived d;
+struct base *bp;
+
+bp = (struct base *)&d;
+
+bp->basic = 10;
+((struct derived *)bp)->extra = 'x';
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass16-frag.c b/libmudflap/testsuite/libmudflap.c/pass16-frag.c
new file mode 100644
index 00000000000..99ede3f2138
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass16-frag.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct base {
+ int basic;
+};
+
+struct derived {
+ struct base common;
+ char extra;
+};
+
+struct base *bp;
+
+bp = (struct base *) malloc (sizeof (struct derived));
+
+bp->basic = 10;
+((struct derived *)bp)->extra = 'x';
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass17-frag.c b/libmudflap/testsuite/libmudflap.c/pass17-frag.c
new file mode 100644
index 00000000000..b840dc98746
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass17-frag.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+
+strlen("123456789");
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass18-frag.c b/libmudflap/testsuite/libmudflap.c/pass18-frag.c
new file mode 100644
index 00000000000..c5d5af0fe12
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass18-frag.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+int t;
+char foo[3] = { 'b', 'c', 'd' };
+int bar[3] = {1, 2, 0};
+t = 1;
+
+/* These tests check expression evaluation rules, such as
+ ensuring that side-effect expression (++) get executed the
+ right number of times; that array lookup checks nest correctly. */
+foo[t++] = 'a';
+if (foo[0] != 'b' || foo[1] != 'a' || foo[2] != 'd' || t != 2) abort ();
+if (bar[0] != 1 || bar[1] != 2 || bar[2] != 0) abort();
+
+foo[bar[t--]] = 'e';
+if (foo[0] != 'e' || foo[1] != 'a' || foo[2] != 'd' || t != 1) abort ();
+if (bar[0] != 1 || bar[1] != 2 || bar[2] != 0) abort();
+
+foo[bar[++t]--] = 'g';
+if (foo[0] != 'g' || foo[1] != 'a' || foo[2] != 'd' || t != 2) abort ();
+if (bar[0] != 1 || bar[1] != 2 || bar[2] != -1) abort();
+
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass19-frag.c b/libmudflap/testsuite/libmudflap.c/pass19-frag.c
new file mode 100644
index 00000000000..0b00845d412
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass19-frag.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct foo {int base; char variable[1]; }; /* a common idiom for variable-size structs */
+
+struct foo * b = (struct foo *) malloc (sizeof (int)); /* enough for base */
+b->base = 4;
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass2-frag.c b/libmudflap/testsuite/libmudflap.c/pass2-frag.c
new file mode 100644
index 00000000000..7e71e0cd7b5
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass2-frag.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+int foo [10][10];
+foo[9][0] = 0;
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass20-frag.c b/libmudflap/testsuite/libmudflap.c/pass20-frag.c
new file mode 100644
index 00000000000..98431168548
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass20-frag.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct bar {int stuff; int array[10]; };
+
+struct bar *foo = (struct bar *) malloc (sizeof (struct bar));
+foo->array[5] = 4;
+free (foo);
+
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass21-frag.c b/libmudflap/testsuite/libmudflap.c/pass21-frag.c
new file mode 100644
index 00000000000..231055a236f
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass21-frag.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifndef __FreeBSD__
+#include <alloca.h>
+#endif
+int main ()
+{
+char *boo, *foo;
+boo = (char *) alloca (100);
+boo[99] = 'a';
+foo = (char *) __builtin_alloca (200);
+foo[44] = 'b';
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass22-frag.c b/libmudflap/testsuite/libmudflap.c/pass22-frag.c
new file mode 100644
index 00000000000..b092ea0b277
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass22-frag.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct foo {
+ unsigned base:8;
+ unsigned flag1:1;
+ unsigned flag2:3;
+ unsigned flag3:4;
+ char nothing[0];
+};
+
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
+
+struct foo* f = (struct foo *) malloc (offsetof (struct foo, nothing));
+f->base = 1;
+f->flag1 = 1;
+free (f);
+
+
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass23-frag.c b/libmudflap/testsuite/libmudflap.c/pass23-frag.c
new file mode 100644
index 00000000000..f27c223614b
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass23-frag.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct foo {
+ int part1: 8;
+ int nothing : 1;
+ int part2 : 5;
+ int lots_more_nothing : 3;
+ int some_padding; /* for 64-bit hosts */
+ float some_more_nothing;
+ double yet_more_nothing;
+};
+
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
+
+struct foo* q = (struct foo *) malloc (offsetof (struct foo, some_more_nothing));
+q->nothing = 1; /* touch q */
+/* The RHS of the following expression is meant to trigger a
+ fold-const.c mapping the expression to a BIT_FIELD_REF. It glues
+ together the accesses to the two non-neighbouring bitfields into a
+ single bigger boolean test. */
+q->lots_more_nothing = (q->part1 == 13 && q->part2 == 7);
+free (q);
+
+
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass24-frag.c b/libmudflap/testsuite/libmudflap.c/pass24-frag.c
new file mode 100644
index 00000000000..00385822130
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass24-frag.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct foo {
+ int zoo;
+ int bar [10];
+ float baz;
+};
+
+#define offsetof(S,F) ((size_t) & (((S *) 0)->F))
+
+struct foo *k = (struct foo *) malloc (offsetof (struct foo, bar[4]));
+k->bar[1] = 9;
+free (k);
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass25-frag.c b/libmudflap/testsuite/libmudflap.c/pass25-frag.c
new file mode 100644
index 00000000000..c5a75e3338e
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass25-frag.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+int *foo = malloc (10 * sizeof(int));
+int *bar = & foo[3];
+/* Watching occurs at the object granularity, which is in this case
+ the entire array. */
+__mf_watch (& foo[1], sizeof(foo[1]));
+__mf_unwatch (& foo[6], sizeof(foo[6]));
+*bar = 10;
+free (foo);
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass26-frag.c b/libmudflap/testsuite/libmudflap.c/pass26-frag.c
new file mode 100644
index 00000000000..5a72f5b790c
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass26-frag.c
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+volatile int *p;
+
+__mf_set_options ("-wipe-stack -no-check-initialization");
+
+{
+ volatile int array [10];
+ p = & array[0];
+
+ array[0] = 2;
+ array[9] = 5;
+
+ /* Array[] should be wiped clean at this point. */
+}
+
+__mf_set_options ("-no-wipe-stack");
+
+{
+ volatile int array2[10];
+
+ /* hope that this is allocated on top of old array[] */
+ if (p != & array2[0])
+ exit (0); /* Test is not applicable. */
+
+ array2[5] = 6;
+
+ /* Old values shouldn't still be around; the new one should. */
+ if (p[0] == 2 || p[9] == 5 || p[5] != 6)
+ abort() ;
+
+ /* array2[] should not be wiped at this point! */
+}
+
+{
+ volatile int array3[10];
+
+ /* hope that this is allocated on top of old array[] and array2[]*/
+ if (p != & array3[0])
+ exit (0); /* Test is not applicable. */
+
+ array3[1] = 2;
+
+ /* Check that old assignment is still around. */
+ if (p[5] != 6 || p[1] != 2)
+ abort() ;
+}
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass29-frag.c b/libmudflap/testsuite/libmudflap.c/pass29-frag.c
new file mode 100644
index 00000000000..97bed6eb373
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass29-frag.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+struct boo { int a; };
+int c;
+struct boo *b = malloc (sizeof (struct boo));
+__mf_set_options ("-check-initialization");
+b->a = 0;
+/* That __mf_set_options call could be here instead. */
+c = b->a;
+(void) malloc (c); /* some dummy use of c */
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass3-frag.c b/libmudflap/testsuite/libmudflap.c/pass3-frag.c
new file mode 100644
index 00000000000..4e950a2c5d8
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass3-frag.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+int foo [10][10][10];
+foo[9][9][0] = 0;
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass30-frag.c b/libmudflap/testsuite/libmudflap.c/pass30-frag.c
new file mode 100644
index 00000000000..6c4b9f9a7f8
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass30-frag.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char zoo [10];
+
+int main ()
+{
+int i = strlen ("eight") + strlen ("one");
+zoo[i] = 'a';
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass32-frag.c b/libmudflap/testsuite/libmudflap.c/pass32-frag.c
new file mode 100644
index 00000000000..83f121d4fa2
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass32-frag.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct foo { char z[10]; };
+
+char * get_z (struct foo *this)
+{
+ return & this->z[0] /* the `this' pointer is not dereferenced! */;
+}
+
+int main ()
+{
+struct foo k;
+char *n = get_z (& k);
+srand ((int)(uintptr_t) n); /* use the pointer value */
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass33-frag.c b/libmudflap/testsuite/libmudflap.c/pass33-frag.c
new file mode 100644
index 00000000000..95d762cc1aa
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass33-frag.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+void test (int *k)
+{
+ if (*k > 5) { *k --; }
+}
+
+int main ()
+{
+int z;
+/* z is initialized, but not via a pointer, so not instrumented */
+z = rand ();
+test (& z);
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass34-frag.c b/libmudflap/testsuite/libmudflap.c/pass34-frag.c
new file mode 100644
index 00000000000..2dfd0ca2113
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass34-frag.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+void test (int *k)
+{
+ if (*k > 5) { *k --; }
+}
+
+int z;
+
+int main ()
+{
+/* z is initialized, but not via a pointer, so not instrumented */
+z = rand ();
+test (& z);
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass35-frag.c b/libmudflap/testsuite/libmudflap.c/pass35-frag.c
new file mode 100644
index 00000000000..4744ecdbe99
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass35-frag.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+extern char end []; /* Any old symbol we're sure will be defined. */
+/* { dg-warning "cannot track lifetime of `end'" "cannot track lifetime" { target *-*-* } 0 } */
+
+int main ()
+{
+/* dummy register */
+__mf_register ((void *) end, 1, __MF_TYPE_GUESS, "end");
+char z = end[0];
+return z & 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass36-frag.c b/libmudflap/testsuite/libmudflap.c/pass36-frag.c
new file mode 100644
index 00000000000..68d1a7f8080
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass36-frag.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+int main ()
+{
+char *k;
+__mf_set_options ("-sigusr1-report -print-leaks");
+k = (char *) malloc (100);
+raise (SIGUSR1);
+free (k);
+return 0;
+}
+/* { dg-output "Leaked object.*name=.malloc region.*objects: 1" } */
diff --git a/libmudflap/testsuite/libmudflap.c/pass38-frag.c b/libmudflap/testsuite/libmudflap.c/pass38-frag.c
new file mode 100644
index 00000000000..a250234da8a
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass38-frag.c
@@ -0,0 +1,9 @@
+/* Test an odd construct for compilability. */
+static void *fwd;
+void *bwd = &fwd;
+static void *fwd = &bwd;
+
+int main ()
+{
+ return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass4-frag.c b/libmudflap/testsuite/libmudflap.c/pass4-frag.c
new file mode 100644
index 00000000000..0a40d1c425a
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass4-frag.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char foo[10];
+strcpy (foo, "123456789");
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass42-frag.c b/libmudflap/testsuite/libmudflap.c/pass42-frag.c
new file mode 100644
index 00000000000..1045c47c37a
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass42-frag.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+void
+foo ()
+{
+ putc ('h', stdout);
+ putc ('i', stdout);
+ putc ('\n', stdout);
+}
+
+int
+main (int argc, char *argv[])
+{
+ foo ();
+ return 0;
+}
+/* { dg-output "hi" } */
diff --git a/libmudflap/testsuite/libmudflap.c/pass43-frag.c b/libmudflap/testsuite/libmudflap.c/pass43-frag.c
new file mode 100644
index 00000000000..4fec3306eb1
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass43-frag.c
@@ -0,0 +1,11 @@
+void
+foo ()
+{
+}
+
+int
+main (int argc, char *argv[])
+{
+ foo ();
+ return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass44-frag.c b/libmudflap/testsuite/libmudflap.c/pass44-frag.c
new file mode 100644
index 00000000000..338d6da63bf
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass44-frag.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+void
+foo ()
+{
+ return; /* accept value-less return statement */
+}
+
+int
+main (int argc, char *argv[])
+{
+ foo ();
+ return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass45-frag.c b/libmudflap/testsuite/libmudflap.c/pass45-frag.c
new file mode 100644
index 00000000000..c6bfeb5048c
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass45-frag.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+extern void h (const char *p, const char *f);
+int
+main (void)
+{
+ h (0, "foo");
+ return 0;
+}
+
+void
+h (const char *p, const char *f)
+{
+ size_t pl = p == NULL ? 0 : strlen (p);
+ size_t fl = strlen (f) + 1;
+ char a[pl + 1 + fl];
+ char *cp = a;
+ char b[pl + 5 + fl * 2];
+ char *cccp = b;
+ if (p != NULL)
+ {
+ cp = memcpy (cp, p, pl);
+ *cp++ = ':';
+ }
+ memcpy (cp, f, fl);
+ strcpy (b, a);
+ puts (a);
+}
+/* { dg-output "foo" } */
diff --git a/libmudflap/testsuite/libmudflap.c/pass46-frag.c b/libmudflap/testsuite/libmudflap.c/pass46-frag.c
new file mode 100644
index 00000000000..a1f24be1dc0
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass46-frag.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int foo (int *u, int i)
+{
+ return u[i]; /* this dereference should not be instrumented */
+}
+
+int main ()
+{
+ int *k = malloc (6);
+ int l = foo (k, 8);
+ int boo [8];
+ int m = boo [l % 2 + 12]; /* should not be instrumented */
+ return m & strlen (""); /* a fancy way of saying "0" */
+}
+/* { dg-options "-fmudflap -fmudflapir -Wall" } */
diff --git a/libmudflap/testsuite/libmudflap.c/pass5-frag.c b/libmudflap/testsuite/libmudflap.c/pass5-frag.c
new file mode 100644
index 00000000000..6d3408a4e52
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass5-frag.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char foo [10];
+char bar [10];
+bar[4] = 'k'; /* touch memcpy source */
+memcpy(foo, bar, 10);
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass6-frag.c b/libmudflap/testsuite/libmudflap.c/pass6-frag.c
new file mode 100644
index 00000000000..9b07fe2de22
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass6-frag.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char *foo;
+char *bar;
+
+foo = (char *)malloc (10);
+bar = (char *)malloc (10);
+bar[2] = 'z'; /* touch memcpy source */
+memcpy(foo, bar, 10);
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass7-frag.c b/libmudflap/testsuite/libmudflap.c/pass7-frag.c
new file mode 100644
index 00000000000..36197339e88
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass7-frag.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char *foo;
+char *bar;
+foo = (char *)malloc (10);
+bar = (char *)malloc (10);
+bar[2] = 'z'; /* touch memcpy source */
+memcpy(foo+1, bar+1, 9);
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass8-frag.c b/libmudflap/testsuite/libmudflap.c/pass8-frag.c
new file mode 100644
index 00000000000..6be4e93f000
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass8-frag.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char *foo;
+char *bar;
+foo = (char *)malloc (10);
+bar = (char *)malloc (10);
+
+free(bar);
+bar = (char *)malloc (10);
+bar[6] = 'k'; /* touch memcpy source */
+memcpy(foo, bar, 10);
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass9-frag.c b/libmudflap/testsuite/libmudflap.c/pass9-frag.c
new file mode 100644
index 00000000000..9186e062ff8
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass9-frag.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+int main ()
+{
+char *foo;
+char *bar;
+foo = (char *)malloc (10);
+bar = (char *)malloc (10);
+
+free(foo);
+foo = (char *)malloc (10);
+bar[3] = 'w'; /* touch memcpy source */
+memcpy(foo, bar, 10);
+return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.cth/cthfrags.exp b/libmudflap/testsuite/libmudflap.cth/cthfrags.exp
new file mode 100644
index 00000000000..508d8eced10
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.cth/cthfrags.exp
@@ -0,0 +1,23 @@
+
+libmudflap-init [find_gcc]
+
+dg-init
+
+global srcdir
+foreach flags [list {} {-static -DSTATIC} {-O2} {-O3}] {
+ foreach srcfile [lsort [glob -nocomplain ${srcdir}/libmudflap.cth/*.c]] {
+ set bsrc [file tail $srcfile]
+ setenv MUDFLAP_OPTIONS "-viol-segv"
+ if {$libmudflapth} then {
+ # --noinhibit-exec works around a ld problem that causes
+ # "Dwarf Error: Invalid or unhandled FORM value: 14"
+ # to fail builds unnecessarily.
+ dg-runtest $srcfile $flags "-fmudflapth -Wl,--noinhibit-exec"
+ } else {
+ if {$flags != ""} {set f " ($flags)"} {set f ""}
+ untested "libmudflap.cth/$bsrc$f"
+ }
+ }
+}
+
+dg-finish
diff --git a/libmudflap/testsuite/libmudflap.cth/pass37-frag.c b/libmudflap/testsuite/libmudflap.cth/pass37-frag.c
new file mode 100644
index 00000000000..bfa2c7c02ab
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.cth/pass37-frag.c
@@ -0,0 +1,58 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <sched.h>
+
+static void *
+func (void *p)
+{
+ int *counter = (int *) p;
+ unsigned i;
+
+ for (i=0; i<100; i++)
+ {
+ (*counter) ++;
+ {
+ int array[17];
+ unsigned x = i % (sizeof(array)/sizeof(array[0]));
+ /* VRP could prove that x is within [0,16], but until then, the
+ following access will ensure that array[] is registered to
+ libmudflap. */
+ array[x] = i;
+ }
+ sched_yield (); /* sleep (1); */
+ }
+
+ return (NULL);
+}
+
+
+int main ()
+{
+ int rc;
+ unsigned i;
+ enum foo { NT=10 };
+ pthread_t threads[NT];
+ int counts[NT];
+
+
+ for (i=0; i<NT; i++)
+ {
+ counts[i] = 0;
+ rc = pthread_create (& threads[i], NULL, func, (void *) & counts[i]);
+ if (rc) abort();
+ }
+
+ for (i=0; i<NT; i++)
+ {
+ rc = pthread_join (threads[i], NULL);
+ if (rc) abort();
+ printf ("%d%s", counts[i], (i==NT-1) ? "\n" : " ");
+ }
+
+ return 0;
+}
+
+/* { dg-output "100 100 100 100 100 100 100 100 100 100" } */
+/* { dg-repetitions 20 } */
+/* { dg-timeout 3 } */
diff --git a/libmudflap/testsuite/libmudflap.cth/pass39-frag.c b/libmudflap/testsuite/libmudflap.cth/pass39-frag.c
new file mode 100644
index 00000000000..eb3449e9d8b
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.cth/pass39-frag.c
@@ -0,0 +1,57 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <sched.h>
+#include <assert.h>
+
+static void *
+func (void *p)
+{
+ int *counter = (int *) p;
+ unsigned i;
+ enum { numarrays = 100, numels = 17 };
+ char *arrays [numarrays];
+
+ for (i=0; i<numarrays; i++)
+ {
+ (*counter) ++;
+ unsigned x = i % numels;
+ arrays[i] = calloc (numels, sizeof(arrays[i][0]));
+ assert (arrays[i] != NULL);
+ arrays[i][x] = i;
+ free (arrays[i]);
+ sched_yield (); /* sleep (1); */
+ }
+
+ return (NULL);
+}
+
+
+int main ()
+{
+ int rc;
+ unsigned i;
+ enum foo { NT=10 };
+ pthread_t threads[NT];
+ int counts[NT];
+
+
+ for (i=0; i<NT; i++)
+ {
+ counts[i] = 0;
+ rc = pthread_create (& threads[i], NULL, func, (void *) & counts[i]);
+ if (rc) abort();
+ }
+
+ for (i=0; i<NT; i++)
+ {
+ rc = pthread_join (threads[i], NULL);
+ if (rc) abort();
+ printf ("%d%s", counts[i], (i==NT-1) ? "\n" : " ");
+ }
+
+ return 0;
+}
+/* { dg-output "100 100 100 100 100 100 100 100 100 100" } */
+/* { dg-repetitions 20 } */
+/* { dg-timeout 3 } */
diff --git a/libmudflap/testsuite/libmudflap.cth/pass40-frag.c b/libmudflap/testsuite/libmudflap.cth/pass40-frag.c
new file mode 100644
index 00000000000..4bba4d350ae
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.cth/pass40-frag.c
@@ -0,0 +1,59 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <pthread.h>
+
+static void *
+func (void *p)
+{
+ return (NULL);
+}
+
+static void
+test (void)
+{
+ int rc;
+ pthread_attr_t my_pthread_attr;
+ pthread_t h;
+ long i;
+
+ rc = pthread_attr_init (&my_pthread_attr);
+
+ for (i = 1; i <= 10000; ++i) {
+ if (i%100 == 0) fprintf (stderr, "%i ", i);
+ if (i%1000 == 0) fprintf (stderr, "\n");
+#ifndef STATIC
+ /* Some glibc versions don't like static multithreaded programs doing this. */
+ if (i==5000) __mf_set_options ("-thread-stack=192");
+#endif
+ rc = pthread_create (&h, &my_pthread_attr,
+ func, NULL);
+ if (rc)
+ break;
+
+ rc = pthread_join (h, NULL);
+ if (rc)
+ break;
+ }
+
+ rc = pthread_attr_destroy (&my_pthread_attr);
+}
+
+int main ()
+{
+ test ();
+
+ return (0);
+}
+
+/* { dg-timeout 20 } */
+/* { dg-output "100 200 300 400 500 600 700 800 900 1000 \n" } */
+/* { dg-output "1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 \n" } */
+/* { dg-output "2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 \n" } */
+/* { dg-output "3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 \n" } */
+/* { dg-output "4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 \n" } */
+/* { dg-output "5100 5200 5300 5400 5500 5600 5700 5800 5900 6000 \n" } */
+/* { dg-output "6100 6200 6300 6400 6500 6600 6700 6800 6900 7000 \n" } */
+/* { dg-output "7100 7200 7300 7400 7500 7600 7700 7800 7900 8000 \n" } */
+/* { dg-output "8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 \n" } */
+/* { dg-output "9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 \n" } */
+