This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Triton Repository". The branch, master has been updated via 047e6c5d12a04f15d03344c8ec0a6b32e0136480 (commit) from 3805b7cceaffa679cbd3cf5be7ee7d72c04699ca (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 047e6c5d12a04f15d03344c8ec0a6b32e0136480 Author: Samuel Lang <[email protected]> Date: Mon Mar 1 10:30:24 2010 -0600 first commit of code ----------------------------------------------------------------------- Summary of changes: code/.exrc | 51 + code/Makefile.in | 603 ++ code/aclocal.m4 | 15 + code/autom4te.cache/output.0 | 7798 ++++++++++++++++++++ code/autom4te.cache/output.1 | 7798 ++++++++++++++++++++ code/autom4te.cache/requests | 95 + code/autom4te.cache/traces.0 | 635 ++ code/autom4te.cache/traces.1 | 563 ++ code/configure | 7798 ++++++++++++++++++++ code/configure.ac | 153 + {oldcode => code}/maint/config/bdb.m4 | 0 {oldcode => code}/maint/config/install-sh | 0 code/maint/config/sqlite.m4 | 185 + .../src/gsl => code}/maint/hs/alex-2.3.1.tar.gz | Bin 78951 -> 78951 bytes .../src/gsl => code}/maint/hs/happy-1.18.4.tar.gz | Bin 157585 -> 157585 bytes .../gsl => code}/maint/hs/language-c-0.3.3.tar.gz | Bin 103493 -> 103493 bytes .../src/gsl => code}/maint/hs/language-c.patch | 0 .../src/gsl => code}/maint/hs/mtl-1.1.0.2.tar.gz | Bin 18901 -> 18901 bytes code/maint/hs/regex-base-0.93.1.tar.gz | Bin 0 -> 9212 bytes .../hs/regex-pcre-builtin-0.94.2.1.7.7.tar.gz | Bin 0 -> 223037 bytes code/maint/hs/regex-posix-0.94.1.tar.gz | Bin 0 -> 13015 bytes {oldcode/src/gsl => code}/maint/hs/setup-hs-debian | 0 code/maint/hs/setup-hs-local | 66 + code/maint/hs/setup-langc | 46 + {oldcode/src/gsl => code}/prepare | 0 code/src/aesop/ae-blocking-parser.h | 221 + code/src/aesop/ae-remote-parser.h | 384 + code/src/aesop/aesop.c | 24 + code/src/aesop/aesop.h | 20 + {oldcode/src/gsl => code/src/aesop}/examples/TODO | 0 code/src/aesop/examples/module.mk.in | 5 + code/src/aesop/examples/rpc-invoke.ae | 133 + code/src/aesop/module.mk.in | 6 + code/src/aesop/op.h | 88 + code/src/aesop/opcache.c | 151 + code/src/aesop/opcache.h | 49 + code/src/aesop/parser/BlockingContext.lhs | 364 + code/src/aesop/parser/CGen.lhs | 588 ++ code/src/aesop/parser/CParse.lhs | 412 ++ .../src/gsl => code/src/aesop}/parser/CUtils.lhs | 0 code/src/aesop/parser/ContextGen.lhs | 126 + code/src/aesop/parser/Header.lhs | 99 + code/src/aesop/parser/README | 25 + .../src/gsl => code/src/aesop}/parser/Serialize.hs | 0 code/src/aesop/parser/Walker.lhs | 371 + code/src/aesop/parser/ae-blocking-parser.lhs | 1738 +++++ code/src/aesop/parser/ae-remote-parser.lhs | 853 +++ code/src/aesop/parser/ae-test.lhs | 38 + code/src/aesop/parser/module.mk.in | 18 + .../src/aesop/parser/tests/blocking}/TODO | 0 code/src/aesop/parser/tests/blocking/afterwhile.ae | 55 + code/src/aesop/parser/tests/blocking/basic.ae | 50 + code/src/aesop/parser/tests/blocking/btest-impl.c | 382 + code/src/aesop/parser/tests/blocking/btest.hae | 56 + code/src/aesop/parser/tests/blocking/compound.ae | 73 + code/src/aesop/parser/tests/blocking/forloop.ae | 53 + code/src/aesop/parser/tests/blocking/funptrs.ae | 116 + code/src/aesop/parser/tests/blocking/icpfor.ae | 56 + code/src/aesop/parser/tests/blocking/if.ae | 66 + code/src/aesop/parser/tests/blocking/ifnbelse.ae | 56 + code/src/aesop/parser/tests/blocking/ifnoelse.ae | 52 + code/src/aesop/parser/tests/blocking/ifnoelse2.ae | 54 + code/src/aesop/parser/tests/blocking/mixed.ae | 101 + code/src/aesop/parser/tests/blocking/module.mk.in | 58 + code/src/aesop/parser/tests/blocking/multif.ae | 93 + code/src/aesop/parser/tests/blocking/nbfun.ae | 83 + code/src/aesop/parser/tests/blocking/nested.ae | 50 + code/src/aesop/parser/tests/blocking/parallel1.ae | 65 + code/src/aesop/parser/tests/blocking/parallel2.ae | 74 + code/src/aesop/parser/tests/blocking/parallel3.ae | 92 + code/src/aesop/parser/tests/blocking/parallel4.ae | 90 + .../src/aesop/parser/tests/blocking/parallelfor.ae | 65 + .../aesop/parser/tests/blocking/parallelfor2.ae | 72 + code/src/aesop/parser/tests/blocking/params.ae | 46 + .../parser/tests/blocking/pbranch-with-return.ae | 53 + code/src/aesop/parser/tests/blocking/pbreak.ae | 74 + code/src/aesop/parser/tests/blocking/pbreak2.ae | 68 + code/src/aesop/parser/tests/blocking/pbreak3.ae | 77 + code/src/aesop/parser/tests/blocking/pbreak4.ae | 86 + code/src/aesop/parser/tests/blocking/pbreak5.ae | 82 + code/src/aesop/parser/tests/blocking/pbreak6.ae | 76 + code/src/aesop/parser/tests/blocking/pbreak7.ae | 102 + code/src/aesop/parser/tests/blocking/pbreak8.ae | 103 + code/src/aesop/parser/tests/blocking/pprivate.ae | 79 + code/src/aesop/parser/tests/blocking/pshared.ae | 97 + code/src/aesop/parser/tests/blocking/tcpfor.ae | 56 + code/src/aesop/parser/tests/blocking/threefors.ae | 115 + code/src/aesop/parser/tests/blocking/twofors.ae | 99 + code/src/aesop/parser/tests/blocking/whilebreak.ae | 52 + .../src/aesop/parser/tests/blocking/whilebreak2.ae | 50 + .../src/aesop/parser/tests/blocking/whilebreak3.ae | 57 + code/src/aesop/parser/tests/blocking/whileloop.ae | 53 + code/src/aesop/parser/tests/remote/module.mk.in | 13 + code/src/aesop/parser/tests/remote/test-remote.aer | 31 + code/src/aesop/resource.c | 335 + code/src/aesop/resource.h | 81 + code/src/common/.triton-hash.h.swp | Bin 0 -> 16572 bytes code/src/common/jenkins-hash.h | 20 + code/src/common/lookup3.c | 1004 +++ code/src/common/module.mk.in | 8 + code/src/common/old | 157 + code/src/common/resources/scheduling/module.mk.in | 5 + code/src/common/resources/scheduling/sched.c | 183 + code/src/common/resources/scheduling/sched.hae | 76 + .../common/resources/scheduling/test/coalesce.ae | 111 + .../common/resources/scheduling/test/limitqueue.ae | 112 + .../common/resources/scheduling/test/module.mk.in | 7 + .../resources/scheduling/test/pthread-compare.ae | 125 + code/src/common/resources/timer/module.mk.in | 5 + code/src/common/resources/timer/test/module.mk.in | 6 + .../common/resources/timer/test/pthread-compare.ae | 112 + code/src/common/resources/timer/test/timer1.ae | 70 + code/src/common/resources/timer/timer.c | 223 + code/src/common/resources/timer/timer.hae | 12 + code/src/common/tests/module.mk.in | 5 + code/src/common/tests/testlist.c | 160 + code/src/common/triton-base.h | 32 + code/src/common/triton-bitarray.h | 73 + code/src/common/triton-buffer.h | 74 + code/src/common/triton-debug.c | 323 + code/src/common/triton-debug.h | 107 + code/src/common/triton-error.c | 160 + code/src/common/triton-error.h | 103 + code/src/common/triton-error.h1 | 93 + code/src/common/triton-hash.h | 291 + code/src/common/triton-list.h | 218 + code/src/common/triton-log.c | 40 + code/src/common/triton-log.h | 82 + code/src/common/triton-string.c | 4 + code/src/common/triton-string.h | 108 + code/src/common/triton-thread.h | 52 + code/src/common/triton-types.h | 27 + .../src/cosd/prototype}/README | 0 code/src/cosd/prototype/cosd-prototype.c | 1994 +++++ code/src/cosd/prototype/cosd-prototype.hae | 116 + code/src/cosd/prototype/module.mk.in | 6 + .../src/cosd/prototype}/test/4M-w-serial.txt | 0 .../src/cosd/prototype}/test/README | 0 .../cosd/prototype/test/cosd-bench-concurrent.ae | 235 + code/src/cosd/prototype/test/cosd1.ae | 236 + code/src/cosd/prototype/test/module.mk.in | 8 + code/src/cosd/prototype/test/workload-gen.ae | 122 + code/src/encoding-notes | 109 + code/src/net/module.mk.in | 8 + code/src/net/mpi/errors.c | 11 + code/src/net/mpi/errors.h | 9 + code/src/net/mpi/module.mk.in | 24 + code/src/net/mpi/mpi-method.ae | 247 + code/src/net/mpi/mpi-method.c | 200 + code/src/net/mpi/mpi.c | 596 ++ code/src/net/mpi/mpi.hae | 35 + code/src/net/mpi/test/module.mk.in | 19 + code/src/net/mpi/test/pthread-compare.ae | 198 + code/src/net/mpi/test/send-recv.ae | 72 + code/src/net/triton-message-internal.hae | 12 + code/src/net/triton-message-method.hae | 35 + code/src/net/triton-message.ae | 153 + code/src/net/triton-message.hae | 54 + code/src/net/triton-node.ae | 30 + code/src/net/triton-node.h | 31 + code/src/remote/byteswap.h | 112 + code/src/remote/encoding-pw.h | 585 ++ code/src/remote/encoding.h | 19 + code/src/remote/error-encoding.h | 181 + code/src/remote/message.ae | 9 + code/src/remote/message.hae | 29 + code/src/remote/module.mk.in | 7 + code/src/remote/node-encoding.h | 32 + code/src/remote/remote.hae | 10 + code/src/remote/service.ae | 94 + code/src/remote/service.hae | 19 + code/triton-config.h.in | 89 + 172 files changed, 45250 insertions(+), 0 deletions(-) create mode 100644 code/.exrc create mode 100644 code/Makefile.in create mode 100644 code/aclocal.m4 create mode 100644 code/autom4te.cache/output.0 create mode 100644 code/autom4te.cache/output.1 create mode 100644 code/autom4te.cache/requests create mode 100644 code/autom4te.cache/traces.0 create mode 100644 code/autom4te.cache/traces.1 create mode 100755 code/configure create mode 100644 code/configure.ac copy {oldcode => code}/maint/config/bdb.m4 (100%) copy {oldcode => code}/maint/config/install-sh (100%) create mode 100644 code/maint/config/sqlite.m4 copy {oldcode/src/gsl => code}/maint/hs/alex-2.3.1.tar.gz (100%) copy {oldcode/src/gsl => code}/maint/hs/happy-1.18.4.tar.gz (100%) copy {oldcode/src/gsl => code}/maint/hs/language-c-0.3.3.tar.gz (100%) copy {oldcode/src/gsl => code}/maint/hs/language-c.patch (100%) copy {oldcode/src/gsl => code}/maint/hs/mtl-1.1.0.2.tar.gz (100%) create mode 100644 code/maint/hs/regex-base-0.93.1.tar.gz create mode 100644 code/maint/hs/regex-pcre-builtin-0.94.2.1.7.7.tar.gz create mode 100644 code/maint/hs/regex-posix-0.94.1.tar.gz copy {oldcode/src/gsl => code}/maint/hs/setup-hs-debian (100%) create mode 100755 code/maint/hs/setup-hs-local create mode 100755 code/maint/hs/setup-langc copy {oldcode/src/gsl => code}/prepare (100%) create mode 100644 code/src/aesop/ae-blocking-parser.h create mode 100644 code/src/aesop/ae-remote-parser.h create mode 100644 code/src/aesop/aesop.c create mode 100644 code/src/aesop/aesop.h copy {oldcode/src/gsl => code/src/aesop}/examples/TODO (100%) create mode 100644 code/src/aesop/examples/module.mk.in create mode 100644 code/src/aesop/examples/rpc-invoke.ae create mode 100644 code/src/aesop/module.mk.in create mode 100644 code/src/aesop/op.h create mode 100644 code/src/aesop/opcache.c create mode 100644 code/src/aesop/opcache.h create mode 100644 code/src/aesop/parser/BlockingContext.lhs create mode 100644 code/src/aesop/parser/CGen.lhs create mode 100644 code/src/aesop/parser/CParse.lhs copy {oldcode/src/gsl => code/src/aesop}/parser/CUtils.lhs (100%) create mode 100644 code/src/aesop/parser/ContextGen.lhs create mode 100644 code/src/aesop/parser/Header.lhs create mode 100644 code/src/aesop/parser/README copy {oldcode/src/gsl => code/src/aesop}/parser/Serialize.hs (100%) create mode 100644 code/src/aesop/parser/Walker.lhs create mode 100644 code/src/aesop/parser/ae-blocking-parser.lhs create mode 100644 code/src/aesop/parser/ae-remote-parser.lhs create mode 100644 code/src/aesop/parser/ae-test.lhs create mode 100644 code/src/aesop/parser/module.mk.in copy {oldcode/src/gsl/tests/correctness => code/src/aesop/parser/tests/blocking}/TODO (100%) create mode 100644 code/src/aesop/parser/tests/blocking/afterwhile.ae create mode 100644 code/src/aesop/parser/tests/blocking/basic.ae create mode 100644 code/src/aesop/parser/tests/blocking/btest-impl.c create mode 100644 code/src/aesop/parser/tests/blocking/btest.hae create mode 100644 code/src/aesop/parser/tests/blocking/compound.ae create mode 100644 code/src/aesop/parser/tests/blocking/forloop.ae create mode 100644 code/src/aesop/parser/tests/blocking/funptrs.ae create mode 100644 code/src/aesop/parser/tests/blocking/icpfor.ae create mode 100644 code/src/aesop/parser/tests/blocking/if.ae create mode 100644 code/src/aesop/parser/tests/blocking/ifnbelse.ae create mode 100644 code/src/aesop/parser/tests/blocking/ifnoelse.ae create mode 100644 code/src/aesop/parser/tests/blocking/ifnoelse2.ae create mode 100644 code/src/aesop/parser/tests/blocking/mixed.ae create mode 100644 code/src/aesop/parser/tests/blocking/module.mk.in create mode 100644 code/src/aesop/parser/tests/blocking/multif.ae create mode 100644 code/src/aesop/parser/tests/blocking/nbfun.ae create mode 100644 code/src/aesop/parser/tests/blocking/nested.ae create mode 100644 code/src/aesop/parser/tests/blocking/parallel1.ae create mode 100644 code/src/aesop/parser/tests/blocking/parallel2.ae create mode 100644 code/src/aesop/parser/tests/blocking/parallel3.ae create mode 100644 code/src/aesop/parser/tests/blocking/parallel4.ae create mode 100644 code/src/aesop/parser/tests/blocking/parallelfor.ae create mode 100644 code/src/aesop/parser/tests/blocking/parallelfor2.ae create mode 100644 code/src/aesop/parser/tests/blocking/params.ae create mode 100644 code/src/aesop/parser/tests/blocking/pbranch-with-return.ae create mode 100644 code/src/aesop/parser/tests/blocking/pbreak.ae create mode 100644 code/src/aesop/parser/tests/blocking/pbreak2.ae create mode 100644 code/src/aesop/parser/tests/blocking/pbreak3.ae create mode 100644 code/src/aesop/parser/tests/blocking/pbreak4.ae create mode 100644 code/src/aesop/parser/tests/blocking/pbreak5.ae create mode 100644 code/src/aesop/parser/tests/blocking/pbreak6.ae create mode 100644 code/src/aesop/parser/tests/blocking/pbreak7.ae create mode 100644 code/src/aesop/parser/tests/blocking/pbreak8.ae create mode 100644 code/src/aesop/parser/tests/blocking/pprivate.ae create mode 100644 code/src/aesop/parser/tests/blocking/pshared.ae create mode 100644 code/src/aesop/parser/tests/blocking/tcpfor.ae create mode 100644 code/src/aesop/parser/tests/blocking/threefors.ae create mode 100644 code/src/aesop/parser/tests/blocking/twofors.ae create mode 100644 code/src/aesop/parser/tests/blocking/whilebreak.ae create mode 100644 code/src/aesop/parser/tests/blocking/whilebreak2.ae create mode 100644 code/src/aesop/parser/tests/blocking/whilebreak3.ae create mode 100644 code/src/aesop/parser/tests/blocking/whileloop.ae create mode 100644 code/src/aesop/parser/tests/remote/module.mk.in create mode 100644 code/src/aesop/parser/tests/remote/test-remote.aer create mode 100644 code/src/aesop/resource.c create mode 100644 code/src/aesop/resource.h create mode 100644 code/src/common/.triton-hash.h.swp create mode 100644 code/src/common/jenkins-hash.h create mode 100644 code/src/common/lookup3.c create mode 100644 code/src/common/module.mk.in create mode 100644 code/src/common/old create mode 100644 code/src/common/resources/scheduling/module.mk.in create mode 100644 code/src/common/resources/scheduling/sched.c create mode 100644 code/src/common/resources/scheduling/sched.hae create mode 100644 code/src/common/resources/scheduling/test/coalesce.ae create mode 100644 code/src/common/resources/scheduling/test/limitqueue.ae create mode 100644 code/src/common/resources/scheduling/test/module.mk.in create mode 100644 code/src/common/resources/scheduling/test/pthread-compare.ae create mode 100644 code/src/common/resources/timer/module.mk.in create mode 100644 code/src/common/resources/timer/test/module.mk.in create mode 100644 code/src/common/resources/timer/test/pthread-compare.ae create mode 100644 code/src/common/resources/timer/test/timer1.ae create mode 100644 code/src/common/resources/timer/timer.c create mode 100644 code/src/common/resources/timer/timer.hae create mode 100644 code/src/common/tests/module.mk.in create mode 100644 code/src/common/tests/testlist.c create mode 100644 code/src/common/triton-base.h create mode 100644 code/src/common/triton-bitarray.h create mode 100644 code/src/common/triton-buffer.h create mode 100644 code/src/common/triton-debug.c create mode 100644 code/src/common/triton-debug.h create mode 100644 code/src/common/triton-error.c create mode 100644 code/src/common/triton-error.h create mode 100644 code/src/common/triton-error.h1 create mode 100644 code/src/common/triton-hash.h create mode 100644 code/src/common/triton-list.h create mode 100644 code/src/common/triton-log.c create mode 100644 code/src/common/triton-log.h create mode 100644 code/src/common/triton-string.c create mode 100644 code/src/common/triton-string.h create mode 100644 code/src/common/triton-thread.h create mode 100644 code/src/common/triton-types.h copy {oldcode/src/gsl/resources/cosd-prototype => code/src/cosd/prototype}/README (100%) create mode 100644 code/src/cosd/prototype/cosd-prototype.c create mode 100644 code/src/cosd/prototype/cosd-prototype.hae create mode 100644 code/src/cosd/prototype/module.mk.in copy {oldcode/src/gsl/resources/cosd-prototype => code/src/cosd/prototype}/test/4M-w-serial.txt (100%) copy {oldcode/src/gsl/resources/cosd-prototype => code/src/cosd/prototype}/test/README (100%) create mode 100644 code/src/cosd/prototype/test/cosd-bench-concurrent.ae create mode 100644 code/src/cosd/prototype/test/cosd1.ae create mode 100644 code/src/cosd/prototype/test/module.mk.in create mode 100644 code/src/cosd/prototype/test/workload-gen.ae create mode 100644 code/src/encoding-notes create mode 100644 code/src/net/module.mk.in create mode 100644 code/src/net/mpi/errors.c create mode 100644 code/src/net/mpi/errors.h create mode 100644 code/src/net/mpi/module.mk.in create mode 100644 code/src/net/mpi/mpi-method.ae create mode 100644 code/src/net/mpi/mpi-method.c create mode 100644 code/src/net/mpi/mpi.c create mode 100644 code/src/net/mpi/mpi.hae create mode 100644 code/src/net/mpi/test/module.mk.in create mode 100644 code/src/net/mpi/test/pthread-compare.ae create mode 100644 code/src/net/mpi/test/send-recv.ae create mode 100644 code/src/net/triton-message-internal.hae create mode 100644 code/src/net/triton-message-method.hae create mode 100644 code/src/net/triton-message.ae create mode 100644 code/src/net/triton-message.hae create mode 100644 code/src/net/triton-node.ae create mode 100644 code/src/net/triton-node.h create mode 100644 code/src/remote/byteswap.h create mode 100644 code/src/remote/encoding-pw.h create mode 100644 code/src/remote/encoding.h create mode 100644 code/src/remote/error-encoding.h create mode 100644 code/src/remote/message.ae create mode 100644 code/src/remote/message.hae create mode 100644 code/src/remote/module.mk.in create mode 100644 code/src/remote/node-encoding.h create mode 100644 code/src/remote/remote.hae create mode 100644 code/src/remote/service.ae create mode 100644 code/src/remote/service.hae create mode 100644 code/triton-config.h.in Diff of changes: diff --git a/code/.exrc b/code/.exrc new file mode 100644 index 0000000..d52dd56 --- /dev/null +++ b/code/.exrc @@ -0,0 +1,51 @@ +if &cp | set nocp | endif +nmap d :cs find d =expand("<cword>") +nmap i :cs find i ^=expand("<cfile>") $ +nmap f :cs find f =expand("<cfile>") +nmap e :cs find e =expand("<cword>") +nmap t :cs find t =expand("<cword>") +nmap c :cs find c =expand("<cword>") +nmap g :cs find g =expand("<cword>") +nmap s :cs find s =expand("<cword>") +noremap :call InsertMacroBackquote() +let s:cpo_save=&cpo +set cpo&vim +nmap gx <Plug>NetrwBrowseX +nnoremap <silent> <Plug>NetrwBrowseX :call netrw#NetrwBrowseX(expand("<cWORD>"),0) +nmap <Nul><Nul>d :vert scs find d =expand("<cword>") +nmap <Nul><Nul>i :vert scs find i ^=expand("<cfile>") $ +nmap <Nul><Nul>f :vert scs find f =expand("<cfile>") +nmap <Nul><Nul>e :vert scs find e =expand("<cword>") +nmap <Nul><Nul>t :vert scs find t =expand("<cword>") +nmap <Nul><Nul>c :vert scs find c =expand("<cword>") +nmap <Nul><Nul>g :vert scs find g =expand("<cword>") +nmap <Nul><Nul>s :vert scs find s =expand("<cword>") +nmap <Nul>d :scs find d =expand("<cword>") +nmap <Nul>i :scs find i ^=expand("<cfile>") $ +nmap <Nul>f :scs find f =expand("<cfile>") +nmap <Nul>e :scs find e =expand("<cword>") +nmap <Nul>t :scs find t =expand("<cword>") +nmap <Nul>c :scs find c =expand("<cword>") +nmap <Nul>g :scs find g =expand("<cword>") +nmap <Nul>s :scs find s =expand("<cword>") +let &cpo=s:cpo_save +unlet s:cpo_save +set backspace=indent,eol,start +set cindent +set cinoptions=(0,W4 +set cscopetag +set cscopeverbose +set expandtab +set fileencodings=ucs-bom,utf-8,default,latin1 +set helplang=en +set history=1000 +set incsearch +set nomodeline +set previewheight=6 +set printoptions=paper:letter +set ruler +set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim71,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after +set shiftwidth=4 +set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc +set viminfo='20,\"50 +" vim: set ft=vim : diff --git a/code/Makefile.in b/code/Makefile.in new file mode 100644 index 0000000..92c3eb7 --- /dev/null +++ b/code/Makefile.in @@ -0,0 +1,603 @@ +############################################################### +# General documentation +# +# This is a single makefile that runs the entire pvfs2 build +# process. There are no makefiles in subdirectories. For a +# general introduction to this approach, please read this document +# by Peter Miller: +# +# http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html +# +# Each subdirectory contains a module.mk file that gets included +# when make is executed. These module.mk files tell make about the +# files in each subdirectory that must be built, including any +# special case rules. Make uses this information to generate a +# sinle dependency graph and orchestrate the build process from this +# top level directory. +# +# We categorize our source depending on what it will be used for. +# For example, there are lists of source files for building the +# server, building the library, building documentation, etc. +# + +############################################################### +# Generic makefile setup + +# define a few generic variables that we need to use; DESTDIR may +# be overridden on the command line during make install +DESTDIR = +srcdir = @srcdir@ +builddir = @BUILD_ABSOLUTE_TOP@ +prefix = @prefix@ +datarootdir = @datarootdir@ +exec_prefix = @exec_prefix@ +includedir = $(DESTDIR)@includedir@ +mandir = $(DESTDIR)@mandir@ +sbindir = $(DESTDIR)@sbindir@ +bindir = $(DESTDIR)@bindir@ +libdir = $(DESTDIR)@libdir@ + +VPATH = $(srcdir) +AEPRETTY = +AEDEBUG = +ifneq (,@AE_DEBUG@) + AEPRETTY = --pretty + AEDEBUG = @AE_DEBUG@ +endif + + +# for now assume ghc is installed and in path. +GHC = @GHC@ + +CC = @CC@ +LD = @LD@ +BUILD_CC = @BUILD_CC@ +BUILD_LD = @BUILD_LD@ +BUILD_CFLAGS = @BUILD_CFLAGS@ +BUILD_LDFLAGS = @BUILD_LDFLAGS@ + +STRICT_CFLAGS = @STRICT_CFLAGS@ + +CFLAGS= -I$(srcdir)/include -I. -I$(srcdir) @CFLAGS@ @CPPFLAGS@ +CWARNS= +ifneq (,$(STRICT_CFLAGS)) + CWARNS += -Wcast-align -Wbad-function-cast + CWARNS += -Wmissing-prototypes -Wmissing-declarations + CWARNS += -Wundef -Wpointer-arith + CWARNS += -Wnested-externs + CWARNS += -Wredundant-decls + # Very noisy, too strict + CWARNS += -W -Wno-unused -Wno-sign-compare + CWARNS += -Wcast-qual + CWARNS += -Wshadow + CWARNS += -Wwrite-strings +endif + +LIBCFLAGS=@LIBCFLAGS@ +LDFLAGS += @LDFLAGS@ +LIBS += @LIBS@ + +DEPLIBS += @THREAD_LIB@ + +CPPDEFS=$(filter -D%,$(LIBCFLAGS) $(CFLAGS)) +CPPINCS=$(filter -I%,$(LIBCFLAGS) $(CFLAGS)) + +MPICC = @MPICC@ +MPICFLAGS = @MPICFLAGS@ +MPILDFLAGS = @MPILDFLAGS@ +MPILIBS = @MPILIBS@ +BUILD_MPI = @BUILD_MPI@ +BUILD_OSD = @BUILD_OSD@ + +INSTALL = @INSTALL@ + +AELIBSRC := +LIBSRC := +AETESTSRC := +AESOP_HDR := +REMOTE_HDR := +AETESTLIBSRC := +TESTLIBSRC := +HSSRC := +HSBINSRC := +LIBOSDSRC := +TESTSRC := + +REMOTE_LIBSRC := +REMOTE_LIB_MODULES := + +REMOTE_TESTSRC := +REMOTE_TESTLIBSRC := +REMOTE_TESTLIB_MODULES := + +# Eliminate all default suffixes. We want explicit control. +.SUFFIXES: + +QUIET_COMPILE = @QUIET_COMPILE@ + +ifdef V + QUIET_COMPILE = 0 +endif + +ifeq ($(QUIET_COMPILE),1) + # say a one-line description of the action, do not echo the command + Q=@echo + E=@ +else + # do not say the short Q lines, but do echo the entire command + Q=@echo >/dev/null + E= +endif + +# PHONEY targets are targets that do not result in the generation +# of a file that has the same name as the target. Listing them +# here keeps make from accidentally doing too much work (see GNU +# make manual). +.PHONY: all clean + +################################################################ +# Find project subdirectories + +# MODULES is a list of subdirectories that we wish to operate on. +# They are identified by the presence of module.mk files (makefile +# includes). +MODULES := $(shell find src -name "*.mk" | sed -e 's/^.\///;s/module.mk//') + +################################################################ +# Default target forward pointer, to avoid other targets in make stubs +all:: + +################################################################ +# Makefile includes + +# this is how we pull build information from all of the project +# subdirectories, make sure to catch top level module.mk as well +include $(patsubst %, %/module.mk, $(MODULES)) + +# Just like dir, but strip the slash off the end, to be pretty. +dirname = $(patsubst %/,%,$(dir $(1))) + +# Generate the canonical in-tree location of a file, given a possible out +# of tree reference. +canonname = $(patsubst $(srcdir)/%,%,$(call dirname,$(1))) + +canonfname = $(patsubst $(srcdir)/%,%,$(1)) + +bname = $(lastword $(subst /, ,$(1))) + +################################################################ +# Derived file lists + +# NOTES: At this point, the subdirectory makefile includes have informed +# us what the source files are. Now we want to generate some +# other lists (such as objects, executables, and dependency files) +# by manipulating the lists of source files + +# Grab any CFLAGS defined by the make stub for a particular file, and +# for the directory in which the source resides. +# Always add the source directory in question for "local" includes. +# Similar for ldflags. +modcflags = $(MODCFLAGS_$(call canonname,$(1))) \ + $(MODCFLAGS_$(patsubst $(srcdir)/%,%,$(1))) \ + -I$(srcdir)/$(call dirname,$(1)) + +MODCFLAGS_AE = $(call modcflags,$(patsubst %.o,%.ae,$(1))) +MODCFLAGS_C = $(call modcflags,$(patsubst %.o,%.c,$(1))) + +modldflags = $(MODLDFLAGS_$(call canonname,$(1))) \ + $(MODLDFLAGS_$(patsubst $(srcdir)/%,%,$(1))) + +MODLDFLAGS_AE = $(call modldflags,$(patsubst %.o,%.ae,$(1))) +MODLDFLAGS_C = $(call modldflags,$(patsubst %.o,%.c,$(1))) + +modlibs = $(MODLIBS_$(call canonname,$(1))) \ + $(MODLIBS_$(patsubst $(srcdir)/%,%,$(1))) + +MODLIBS_AE = $(call modlibs,$(patsubst %.o,%.ae,$(1))) +MODLIBS_C = $(call modlibs,$(patsubst %.o,%.c,$(1))) + +modname = $(MODNAME_$(call canonname,$(1))) \ + $(MODNAME_$(patsubst $(srcdir)/%,%,$(1))) + +modcc = $(if $(MODCC_$(1)), \ + $(MODCC_$(1)),$(CC)) + +MCC_AE = $(call modcc,$(patsubst %.o,%.ae,$(1))) +MCC_C = $(call modcc,$(patsubst %.o,%.c,$(1))) + +RMOD_FILES = $(patsubst %.aer,%.aer.i,$(REMOTE_MODSRC_$(call canonfname,$(1)))) +TESTRMOD_FILES = $(patsubst %.aer,%.aer.i,$(REMOTE_TESTMODSRC_$(call canonfname,$(1)))) + +# Get the parameters for a given test +testparams = $(TESTPARAMS_$(1)) + +# The object files for the gs library generated from .ae files +AELIBOBJS=$(patsubst %.ae,%.o,$(AELIBSRC)) +AELIBOBJS_DEPENDS=$(patsubst %.ae,%.d,$(AELIBSRC)) + +# The object files for the gs library generated from .c files +LIBOBJS=$(patsubst %.c,%.o,$(LIBSRC)) + +LIBOBJS_DEPENDS=$(patsubst %.c,%.d,$(LIBSRC)) + +# The object files for the osc osd library generated from .c files +LIBOSDOBJS=$(patsubst %.c,%.o,$(LIBOSDSRC)) + +LIBOSDOBJS_DEPENDS=$(patsubst %.c,%.d,$(LIBOSDSRC)) + +TESTOBJS=$(patsubst %.c,%.o,$(TESTSRC)) +TESTOBJS_DEPENDS=$(patsubst %.c,%.d,$(TESTSRC)) +TEST=$(patsubst %.c,%,$(TESTSRC)) + +# The object files for binary tests generated from .ae files +AETESTOBJS=$(patsubst %.ae,%.o,$(AETESTSRC)) + +AETESTOBJS_DEPENDS=$(patsubst %.ae,%.d,$(AETESTSRC)) + +# The binary files from .ae test files +AETEST=$(patsubst %.ae,%,$(AETESTSRC)) + +# The C header files generated from .hae files +AESOP_TRHDR=$(patsubst %.hae,%.h,$(AESOP_HDR)) +AESOP_TRHDR_CPP=$(patsubst %.hae,%.hae.i,$(AESOP_HDR)) + +AESOP_TRHDR_DEPENDS=$(patsubst %.hae,%.hae.d,$(AESOP_HDR)) + +# The C header files generated from .haer files +REMOTE_TRHDR=$(patsubst %.haer,%.h,$(REMOTE_HDR)) +REMOTE_TRHDR_CPP=$(patsubst %.haer,%.haer.i,$(REMOTE_HDR)) +REMOTE_TRHDR_INTERM=$(patsubst %.haer,%.haer.i.r,$(REMOTE_HDR)) + +REMOTE_TRHDR_DEPENDS=$(patsubst %.haer,%.haer.d,$(REMOTE_HDR)) + +# The object files for the gs test library generated from .ae files +AETESTLIBOBJS=$(patsubst %.ae,%.o,$(AETESTLIBSRC)) + +AETESTLIBOBJS_DEPENDS=$(patsubst %.ae,%.d,$(AETESTLIBSRC)) + +AEOBJS=$(AETESTLIBOBJS) $(AETESTOBJS) $(AELIBOBJS) +AEOBJS_DEPENDS=$(AETESTLIBOJS_DEPENDS) \ + $(AETESTOBJS_DEPENDS) \ + $(AELIBOBJS_DEPENDS) + + +REMOTE_LIBOBJS=$(patsubst %.aer,%.o,$(REMOTE_LIBSRC)) +REMOTE_LIBOBJS_DEPENDS=$(patsubst %.aer,%.d,$(REMOTE_LIBSRC)) + +REMOTE_TESTOBJS=$(patsubst %.aer,%.o,$(REMOTE_TESTSRC)) +REMOTE_TESTOBJS_DEPENDS=$(patsubst %.aer,%.d,$(REMOTE_TESTSRC)) + +REMOTE_TESTLIBOBJS=$(patsubst %.aer,%.o,$(REMOTE_TESTLIBSRC)) +REMOTE_TESTLIBOBJS_DEPENDS=$(patsubst %.aer,%.d,$(REMOTE_TESTLIBSRC)) + +REMOTE_TEST=$(patsubst %.aer,%,$(REMOTE_TESTSRC)) + +# these are the files within each remote module +REMOTE_LIB_MODSRC=$(patsubst %,%.ae,$(REMOTE_LIB_MODULES)) +REMOTE_LIB_MODOBJS=$(patsubst %,%.o,$(REMOTE_LIB_MODULES)) +REMOTE_LIB_MODOBJS_DEPENDS=$(patsubst %,%_module.d,$(REMOTE_LIB_MODULES)) +REMOTE_LIB_MODSRC_DEPENDS=$(patsubst %,%_module.ae.d,$(REMOTE_LIB_MODULES)) + +# these are the files within each remote test module +REMOTE_TESTLIB_MODSRC=$(patsubst %,%_module.ae,$(REMOTE_TESTLIB_MODULES)) +REMOTE_TESTLIB_MODOBJS=$(patsubst %,%_module.o,$(REMOTE_TESTLIB_MODULES)) +REMOTE_TESTLIB_MODOBJS_DEPENDS=$(patsubst %,%_module.d,$(REMOTE_TESTLIB_MODULES)) +REMOTE_TESTLIB_MODSRC_DEPENDS=$(patsubst %,%_module.ae.d,$(REMOTE_TESTLIB_MODULES)) + +REMOTE_SRC=$(REMOTE_LIBSRC) $(REMOTE_TESTLIBSRC) +REMOTE_OBJS=$(REMOTE_TESTLIBOBJS) $(REMOTE_TESTOBJS) $(REMOTE_LIBOBJS) +REMOTE_OBJS_DEPENDS=$(REMOTE_TESTLIBOBJS_DEPENDS) \ + $(REMOTE_TESTOBJS_DEPENDS) \ + $(REMOTE_LIBOBJS_DEPENDS) +REMOTE_MODOBJS_DEPENDS= $(REMOTE_LIB_MODOBJS_DEPENDS) \ + $(REMOTE_TESTLIB_MODOBJS_DEPENDS) + +REMOTE_MODSRC_DEPENDS= $(REMOTE_LIB_MODSRC_DEPENDS) \ + $(REMOTE_TESTLIB_MODSRC_DEPENDS) + +# The object files for the test library generated from .c files +TESTLIBOBJS=$(patsubst %.c,%.o,$(TESTLIBSRC)) + +TESTLIBOBJS_DEPENDS=$(patsubst %.c,%.d,$(TESTLIBSRC)) + +HSBIN=$(patsubst %.lhs,%,$(call canonfname,$(HSBINSRC))) +HSOBJ=$(patsubst %.lhs,%.o,$(filter %.lhs,$(HSSRC))) \ + $(patsubst %.hs,%.o,$(filter %.hs,$(HSSRC))) +HSINT=$(patsubst %.lhs,%.hi,$(filter %.lhs,$(HSSRC))) \ + $(patsubst %.hs,%.hi,$(filter %.lhs,$(HSSRC))) + +AEBLOCKINGP=$(builddir)/src/aesop/parser/ae-blocking-parser +AEREMOTEP=$(builddir)/src/aesop/parser/ae-remote-parser + + +DEPENDS = $(LIBOBJS_DEPENDS) \ + $(TESTLIBOBJS_DEPENDS) \ + $(TESTOBJS_DEPENDS) \ + $(AEOBJS_DEPENDS) \ + $(REMOTE_OBJS_DEPENDS) \ + $(REMOTE_MODOBJS_DEPENDS) \ + $(REMOTE_MODSRC_DEPENDS) \ + $(AESOP_TRHDR_DEPENDS) \ + $(REMOTE_TRHDR_DEPENDS) + +TESTS = $(AETEST) $(TEST) +runTESTS = $(patsubst %,run%,$(TESTS)) +runVALGRIND = $(patsubst %,valgrind%,$(TESTS)) + +#################################################################### +# Rules and dependencies + +# First normal rules + +$(TESTOBJS_DEPENDS) $(LIBOBJS_DEPENDS) $(TESTLIBOBJS_DEPENDS): %.d: %.c + $(Q) " DEP $@" + $(E)$(CC) -MT $(patsubst %.d,%.o,$@) -MM -MG -MF $@ $< $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS,$<) + +$(TEST): %: %.o lib/libgs.a lib/libgstest.a + $(Q) " LD $@" + $(E)$(call MCC_C,$<) \ + -o $@ $< $(LDFLAGS) $(LIBS) \ + -L$(builddir)/lib -lgstest -lgs + +$(AETEST): %: %.o lib/libgs.a lib/libgstest.a + $(Q) " LD $@" + $(E)$(call MCC_AE,$<) \ + -o $@ $< $(LDFLAGS) $(LIBS) \ + -L$(builddir)/lib -lgstest -lgs \ + $(call MODLDFLAGS_AE,$<) $(call MODLIBS_AE,$<) + +$(LIBOBJS) $(TESTOBJS): %.o: %.d + $(Q) " CC $@" + $(E)$(call MCC_C,$(patsubst %.d,%.c,$<)) -c -o $@ \ + $(LIBCFLAGS) $(CFLAGS) $(CWARNS) \ + $(call MODCFLAGS_C,$(patsubst %.d,%.c,$<)) \ + $(srcdir)/$(patsubst %.d,%.c,$<) + +$(LIBOSDOBJS): %.o: %.c + $(Q) " CC $@" + $(E)$(call MCC_C,$<) -c -o $@ $(LIBCFLAGS) $(CFLAGS) $(CWARNS) \ + $(call modcflags,$<) $< + +$(TESTLIBOBJS): %.o: %.d + $(Q) " CC $@" + $(E)$(call MCC_C,$(patsubst %.d,%.c,$<)) -c -o $@ \ + $(LIBCFLAGS) $(CFLAGS) $(CWARNS) \ + $(call MODCFLAGS_C,$(patsubst %.d,%.c,$<)) \ + $(srcdir)/$(patsubst %.d,%.c,$<) + +LIBRARIES=lib/libgs.a lib/libgstest.a + +lib/libgs.a: $(AELIBOBJS) $(REMOTE_LIBOBJS) $(REMOTE_LIB_MODOBJS) $(LIBOBJS) + $(Q) " RANLIB $@" + $(E)$(INSTALL) -d lib + $(E)ar rcs $@ $(AELIBOBJS) $(REMOTE_LIBOBJS) $(REMOTE_LIB_MODOBJS) $(LIBOBJS) + +lib/libgstest.a: $(AETESTLIBOBJS) $(REMOTE_TESTLIBOBJS) $(REMOTE_TESTLIB_MODOBJS) $(TESTLIBOBJS) + $(Q) " RANLIB $@" + $(E)$(INSTALL) -d lib + $(E)ar rcs $@ $(AETESTLIBOBJS) $(REMOTE_TESTLIBOBJS) $(REMOTE_TESTLIB_MODOBJS) $(TESTLIBOBJS) + +ifneq (,$(BUILD_OSD)) +lib/libosc-osd.a: $(LIBOSDOBJS) + $(Q) " RANLIB $@" + $(E)$(INSTALL) -d lib + $(E)ar rcs $@ $(LIBOSDOBJS) +endif + +# AE rules compile *.ae files to object files: *.ae -> *.ae.i -> *.ae.s -> *.o +# Also compile a dummy object to verify syntax: *.ae -> *.dummyobj + +$(AEOBJS_DEPENDS): %.d: %.ae + $(Q) " DEP $@" + $(E)$(CC) -x c -MT $(patsubst %.d,%.o,$@) -MM -MG -MF $@ $< $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) + +$(AEOBJS): %.o: $(HSBIN) %.d %.ae.s + $(E)$(call MCC_AE,$<) -I$(srcdir)/include/ -x c -c -o $@ \ + $(LIBCFLAGS) \ + $(CFLAGS) $(CWARNS) -Wno-redundant-decls $(call MODCFLAGS_AE,$*) $*.ae.s + +%.ae.s: %.ae.i + $(E)$(AEBLOCKINGP) -I$(srcdir)/src/aesop $(CPPINCS) $(CPPDEFS) -o $@ -r $*.ae $(AEPRETTY) $*.ae.i + +ifneq (,@AE_DEBUG@) +.SECONDARY: %.ae.s +endif + +%.ae.dummyobj: %.d + $(Q) " AECC $*" + $(E)$(call MCC_AE,$<) -D__blocking="" \ + -Dpwait="while(0)" -Dpbranch="" -Dpbreak="break" -Dpprivate="" -Dpshared=""\ + -I$(srcdir)/include/ -x c -c -o $@ $(LIBCFLAGS) \ + -Wall -Wno-implicit -Wno-unused -Werror \ + $(CFLAGS) $(call MODCFLAGS_AE,$*) $(srcdir)/$*.ae + +%.ae.i: %.ae.dummyobj + $(E)$(call MCC_AE,$<) -I$(srcdir)/include/ -x c -E -o $*.ae.i \ + $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) $(srcdir)/$*.ae + +# Generate header files (%.h) from AE header files (include __blocking functions) +# + +$(AESOP_TRHDR_DEPENDS): %.hae.d: %.hae + $(Q) " DEP $@" + $(E)$(CC) -x c -MT $(patsubst %.hae.d,%.h,$@) -MM -MG -MF $@ $< $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) + +%.hae.i: %.hae.d + $(Q) " AECC $*.hae" + $(E)$(call MCC_AE,$<) -I$(srcdir)/include/ -x c -E -o $*.hae.i \ + $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) $(srcdir)/$*.hae + +$(AESOP_TRHDR): %.h: %.hae.i $(HSBIN) + $(E)$(AEBLOCKINGP) -I$(srcdir)/src/aesop $(CPPINCS) $(CPPDEFS) -j -r $(srcdir)/$*.hae -o $@ $(AEPRETTY) $*.hae.i + +# Generate header files (%.h) from AE remote header files +# + +$(REMOTE_TRHDR_DEPENDS): %.haer.d: %.haer + $(Q) " DEP $@" + $(E)$(CC) -x c -MT $(patsubst %.haer.d,%.h,$@) -MM -MG -MF $@ $< $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) + +%.haer.i: %.haer.d + $(Q) " AERCC $*.haer" + $(E)$(call MCC_AE,$<) -I$(srcdir)/include/ -x c -E -o $*.hae.i \ + $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) $(srcdir)/$*.hae + +%.haer.r: %.haer.i + $(E)$(AEREMOTEP) -I$(srcdir)/src/aesop $(CPPINCS) $(CPPDEFS) -o $@ -r $(srcdir)/$*.haer $(AEPRETTY) + +$(REMOTE_TRHDR): %.h: %.haer.r $(HSBIN) + $(E)$(AEBLOCKINGP) -I$(srcdir)/src/aesop $(CPPINCS) $(CPPDEFS) -j -r $(srcdir)/$*.haer -o $@ $(AEPRETTY) $*.haer.r + +# AER rules compile sources with remote specifiers into ae sources: +# +# cpp ae-remote-parser ae-blocking-parser gcc +# %.aer -> %.aer.i -> %.aer.r -> %.aer.r.s -> %.aer.o +# + +$(REMOTE_OBJS_DEPENDS): %.d: %.aer + $(Q) " DEP $@" + $(E)$(CC) -x c -MT $(patsubst %.d,%.o,$@) -MM -MG -MF $@ $< $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) + +$(REMOTE_TESTOBJS) $(REMOTE_OBJS): %.o: $(HSBIN) %.d %.aer.r.s + $(E)$(call MCC_AE,$<) -I$(srcdir)/include/ -x c -c -o $@ \ + $(LIBCFLAGS) \ + $(CFLAGS) $(CWARNS) -Wno-redundant-decls $(call MODCFLAGS_AE,$*) $*.aer.r.s + +%.aer.dummyobj: %.d + $(Q) " REMOTECC $*" + $(E)$(call MCC_AE,$<) -D__remote="" -D__blocking="" \ + -Dpwait="while(0)" -Dpbranch="" -Dpbreak="break" -Dpprivate="" -Dpshared=""\ + -I$(srcdir)/include/ -x c -c -o $@ $(LIBCFLAGS) \ + -Wall -Wno-implicit -Wno-unused -Werror \ + $(CFLAGS) $(call MODCFLAGS_AE,$*) $(srcdir)/$*.aer + +%.aer.i: %.aer.dummyobj + $(E)$(call MCC_AE,$<) -I$(srcdir)/include/ -x c -E -o $*.aer.i \ + $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) $(srcdir)/$*.aer + +%.aer.r: %.aer.i $(HSBIN) + $(E)$(AEREMOTEP) -I$(srcdir)/src/aesop $(CPPINCS) $(CPPDEFS) -o $@ -r $*.aer $(AEPRETTY) $*.aer.i + +%.aer.r.s: %.aer.r $(HSBIN) + $(E)$(AEBLOCKINGP) -I$(srcdir)/src/aesop $(CPPINCS) $(CPPDEFS) -o $@ -r $*.aer $(AEPRETTY) $*.aer.r + +ifneq (,@AE_DEBUG@) +.SECONDARY: %.aer.r %.aer.r.s +endif + +# Remote module files are also generated from a set of *.aer files: +# ae-remote-parser gcc +# module_name + [*.aer.i] -> <module_name>_module.c,<module_name>_module.h -> <module_name>_module.o + +$(REMOTE_TESTLIB_MODOBJS_DEPENDS): %_module.d: %_module.ae + $(Q) " DEP $@" + $(E)$(CC) -x c -MT $(patsubst %.d,%.o,$@) -MM -MG -MF $@ $< $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) + +$(REMOTE_TESTLIB_MODSRC_DEPENDS): %_module.ae.d: + $(Q) " DEP $@" + $(E)echo $*_module.ae $*_module.h: $(call TESTRMOD_FILES,$*) > $@ + + $(E)echo " "$(E)$(AEREMOTEP) -I$(srcdir)/src/aesop $(CPPINCS) $(CPPDEFS) -n $(call bname,$*) -d $(call dirname,$*) $(call TESTRMOD_FILES,$*) >> $@ + +#$(REMOTE_TESTLIB_MODSRC): %_module.ae: $(HSBIN) %_module.ae.d +# $(E)$(AEREMOTEP) -I$(srcdir)/src/aesop $(CPPINCS) $(CPPDEFS) -n $(call bname,$*) -d $(call dirname,$@) $(call TESTRMOD_FILES,$*) + +$(REMOTE_LIB_MODSRC): %_module.ae: $(HSBIN) %_module.ae.d + $(E)$(AEREMOTEP) -I$(srcdir)/src/aesop $(CPPINCS) $(CPPDEFS) -n $(call bname,$*) -d $(call dirname,$@) $(call RMOD_FILES,$*) + +$(REMOTE_TESTLIB_MODOBJS) $(REMOTE_LIB_MODOBJS): %.o: %.ae.s + $(E)$(call MCC_AE,$<) -I$(srcdir)/include/ -x c -c -o $@ \ + $(LIBCFLAGS) \ + $(CFLAGS) $(CWARNS) -Wno-redundant-decls $(call MODCFLAGS_AE,$*) $< + +REMOTE_TESTLIB_DUMMYOBJS = $(patsubst %.o,%.ae.dummyobj,$(REMOTE_TESTLIB_MODOBJS)) +REMOTE_LIB_DUMMYOBJS = $(patsubst %.o,%.ae.dummyobj,$(REMOTE_LIB_MODOBJS)) + +$(REMOTE_TESTLIB_DUMMYOBJS) $(REMOTE_LIB_DUMMYOBJS): %_module.ae.dummyobj: %_module.ae + $(E)$(call MCC_AE,$<) -D__blocking="" -D__remote="" \ + -Dpwait="while(0)" -Dpbranch="" -Dpbreak="break" -Dpprivate="" -Dpshared="" \ + -I$(srcdir)/include/ -x c -c -o $@ $(LIBCFLAGS) \ + -Wall -Wno-implicit -Wno-unused -Werror \ + $(CFLAGS) $(call MODCFLAGS_AE,$*) $*_module.ae + +REMOTE_TESTLIB_INCIM = $(patsubst %.o,%.ae.i,$(REMOTE_TESTLIB_MODOBJS)) +REMOTE_LIB_INCIM = $(patsubst %.o,%.ae.i,$(REMOTE_LIB_MODOBJS)) + +$(REMOTE_TESTLIB_INCIM) $(REMOTE_LIB_INCIM): %_module.ae.i: %_module.ae.dummyobj + $(E)$(call MCC_AE,$<) -I$(srcdir)/include/ -x c -E -o $*_module.ae.i \ + $(LIBCFLAGS) $(CFLAGS) $(CWARNS) $(call MODCFLAGS_AE,$*) $*_module.ae + +# Compile parsers from haskell source using GHC + +$(HSBIN): %: $(srcdir)/%.lhs $(HSSRC) + $(Q) " GHC $@" + $(E)$(GHC) -odir $(call canonname,$<) \ + -hidir $(call canonname,$<) \ + -o $@ \ + -main-is $(call modname,$<) \ + -i$(call dir,$<) --make $< >/dev/null + +# User targets + +all:: $(TESTS) $(LIBRARIES) $(AETHDR) + +$(runTESTS): run%: % + @if test -n "$(call testparams,$<)"; then \ + for p in $(call testparams,$<); do \ + echo -n "Running $< $$p..."; \ + ./$< $$p > /dev/null; \ + echo "done."; \ + done \ + else \ + echo -n "Running $<..."; \ + ./$< > /dev/null; \ + echo "done."; \ + fi + +runtests: $(runTESTS) + +$(runVALGRIND): valgrind%: % + @if test -n "$(call testparams,$<)"; then \ + for p in $(call testparams,$<); do \ + echo -n "Running valgrind $< $$p..."; \ + valgrind --error-exitcode=1 ./$< $$p > /dev/null 2>./.vout; \ + grep "All heap blocks were freed" ./.vout >/dev/null 2>&1; \ + if test $$? != 0; then \ + echo "\nErrors found in $<. Rerun valgrind ./$<"; \ + exit 1; \ + fi; \ + echo "done."; \ + done; \ + else \ + echo -n "Running valgrind $<..."; \ + valgrind --error-exitcode=1 ./$< > /dev/null 2>./.vout; \ + grep "All heap blocks were freed" ./.vout >/dev/null 2>&1; \ + if test $$? != 0; then \ + echo "\nErrors found in $<. Rerun valgrind ./$<"; \ + exit 1; \ + fi; \ + echo "done."; \ + fi + +runvalgrind: $(runVALGRIND) + +clean:: + $(Q) " CLEAN" + $(E)rm -f $(AEOBJS) $(AEOBJS_CPP) $(AEOBJS_INTERM) $(AEOBJS_DUMMY) \ + $(LIBOBJS) $(AETEST) \ + $(AESOP_TRHDR) $(REMOTE_TRHDR) $(TESTLIBOBJS) \ + $(LIBRARIES) $(DEPENDS) + +parserclean: + $(Q) " PARSER CLEAN" + $(E)rm -f $(HSBIN) $(HSOBJ) $(HSINT) + +# this is where we include all of our automatic dependencies. +# NOTE: we wrap this in ifneq's in order to prevent the dependencies +# from being generated for special targets that don't require them +ifeq (,$(filter clean nodep,$(MAKECMDGOALS))) +-include $(DEPENDS) +endif +# add this as a make goal to disable rebuilding deps +.PHONY: nodep +.nodep:; @: diff --git a/code/aclocal.m4 b/code/aclocal.m4 new file mode 100644 index 0000000..71ffa59 --- /dev/null +++ b/code/aclocal.m4 @@ -0,0 +1,15 @@ +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This file 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. + +m4_include([maint/config/bdb.m4]) +m4_include([maint/config/sqlite.m4]) diff --git a/code/autom4te.cache/output.0 b/code/autom4te.cache/output.0 new file mode 100644 index 0000000..bea933f --- /dev/null +++ b/code/autom4te.cache/output.0 @@ -0,0 +1,7798 @@ +@%:@! /bin/sh +@%:@ Guess values for system-dependent variables and create Makefiles. +@%:@ Generated by GNU Autoconf 2.61 for grayskull 0.1.1. +@%:@ +@%:@ Report bugs to <[email protected]>. +@%:@ +@%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +@%:@ 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +@%:@ This configure script is free software; the Free Software Foundation +@%:@ gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell [email protected] about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 </dev/null 6>&1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIB@&t@OBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='grayskull' +PACKAGE_TARNAME='grayskull' +PACKAGE_VERSION='0.1.1' +PACKAGE_STRING='grayskull 0.1.1' +PACKAGE_BUGREPORT='[email protected]' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#ifdef HAVE_STRINTRITON_H +# include <strings.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +TRITON_VERSION +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +CPP +GREP +EGREP +GHC +DB_CFLAGS +DB_LIB +MPICC +MPICFLAGS +MPILDFLAGS +MPILIBS +BUILD_MPI +BUILD_ABSOLUTE_TOP +SRC_RELATIVE_TOP +SRC_ABSOLUTE_TOP +QUIET_COMPILE +STRICT_CFLAGS +AE_DEBUG +ENABLE_COVERAGE +LIBCFLAGS +THREAD_LIB +TRITON_SQLITE_INCLUDES +TRITON_SQLITE_LIBS +BUILD_OSD +LIB@&t@OBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + 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 | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 | -n) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + 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 "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + 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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # 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 <<_ACEOF +\`configure' configures grayskull 0.1.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root @<:@DATAROOTDIR/doc/grayskull@:>@ + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of grayskull 0.1.1:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-verbose Enables verbose output during build process + --enable-strict Turn on strict compiler warnings + --enable-aesop-debug Turn on debugging of the gs-parser + --enable-coverage Enable coverage analysis (disables optimizations) + --disable-thread-safety Disables thread safety in the client library + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-ghc=<dir> Location of installed ghc + --with-db=<dir> Location of installed DB package +(default=/usr) + --with-mpi=<dir> Location of the MPI installation + --with-sqlite=PREFIX Use installed SQLite library or amalgamation file. + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to <[email protected]>. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +grayskull configure 0.1.1 +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by grayskull $as_me 0.1.1, which was +generated by GNU Autoconf 2.61. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +@%:@@%:@ --------- @%:@@%:@ +@%:@@%:@ Platform. @%:@@%:@ +@%:@@%:@ --------- @%:@@%:@ + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +@%:@@%:@ ----------- @%:@@%:@ +@%:@@%:@ Core tests. @%:@@%:@ +@%:@@%:@ ----------- @%:@@%:@ + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +@%:@@%:@ ---------------- @%:@@%:@ +@%:@@%:@ Cache variables. @%:@@%:@ +@%:@@%:@ ---------------- @%:@@%:@ +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +@%:@@%:@ ----------------- @%:@@%:@ +@%:@@%:@ Output variables. @%:@@%:@ +@%:@@%:@ ----------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +@%:@@%:@ ------------------- @%:@@%:@ +@%:@@%:@ File substitutions. @%:@@%:@ +@%:@@%:@ ------------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +@%:@@%:@ ----------- @%:@@%:@ +@%:@@%:@ confdefs.h. @%:@@%:@ +@%:@@%:@ ----------- @%:@@%:@ +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + +cat >>confdefs.h <<_ACEOF +@%:@define TRITON_VERSION_MAJOR $TRITON_MAJOR +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define TRITON_VERSION_MINOR $TRITON_MINOR +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define TRITON_VERSION_SUB $TRITON_SUB +_ACEOF + + +ac_config_headers="$ac_config_headers gs-config.h" + +ac_aux_dir= +for ac_dir in maint/config "$srcdir"/maint/config; 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 + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in maint/config \"$srcdir\"/maint/config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in maint/config \"$srcdir\"/maint/config" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +# 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 +# AmigaOS /C/install, which installs bootblocks on floppy discs +# 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" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /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 + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_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. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&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}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +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 "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_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 $@%:@ != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&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 +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include <limits.h> +@%:@else +@%:@ include <assert.h> +@%:@endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include <limits.h> +@%:@else +@%:@ include <assert.h> +@%:@endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ctype.h> +#include <stdlib.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +@%:@define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +@%:@include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_bigendian=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +@%:@define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + +{ echo "$as_me:$LINENO: checking for long int" >&5 +echo $ECHO_N "checking for long int... $ECHO_C" >&6; } +if test "${ac_cv_type_long_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long int ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_int=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_int" >&5 +echo "${ECHO_T}$ac_cv_type_long_int" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of long int" >&5 +echo $ECHO_N "checking size of long int... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_long_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long_int=$ac_lo;; +'') if test "$ac_cv_type_long_int" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_long_int=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +@%:@include <stdio.h> +@%:@include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long_int=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_long_int" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_long_int=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +@%:@define SIZEOF_LONG_INT $ac_cv_sizeof_long_int +_ACEOF + + +{ echo "$as_me:$LINENO: checking for void *" >&5 +echo $ECHO_N "checking for void *... $ECHO_C" >&6; } +if test "${ac_cv_type_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef void * ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_void_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_void_p=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 +echo "${ECHO_T}$ac_cv_type_void_p" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of void *" >&5 +echo $ECHO_N "checking size of void *... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_void_p=$ac_lo;; +'') if test "$ac_cv_type_void_p" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_void_p=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +@%:@include <stdio.h> +@%:@include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_void_p=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_void_p" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_void_p=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6; } + + + +cat >>confdefs.h <<_ACEOF +@%:@define SIZEOF_VOID_P $ac_cv_sizeof_void_p +_ACEOF + + + +{ echo "$as_me:$LINENO: checking for required gcc" >&5 +echo $ECHO_N "checking for required gcc... $ECHO_C" >&6; } +if test "x$GCC" = "x"; then + { { echo "$as_me:$LINENO: error: no" >&5 +echo "$as_me: error: no" >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + + +# Check whether --with-ghc was given. +if test "${with_ghc+set}" = set; then + withval=$with_ghc; # Extract the first word of "${withval}/bin/ghc", so it can be a program name with args. +set dummy ${withval}/bin/ghc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GHC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GHC in + [\\/]* | ?:[\\/]*) + ac_cv_path_GHC="$GHC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GHC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +GHC=$ac_cv_path_GHC +if test -n "$GHC"; then + { echo "$as_me:$LINENO: result: $GHC" >&5 +echo "${ECHO_T}$GHC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +else + # Extract the first word of "ghc", so it can be a program name with args. +set dummy ghc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GHC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GHC in + [\\/]* | ?:[\\/]*) + ac_cv_path_GHC="$GHC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GHC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +GHC=$ac_cv_path_GHC +if test -n "$GHC"; then + { echo "$as_me:$LINENO: result: $GHC" >&5 +echo "${ECHO_T}$GHC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi + + + + +# Check whether --with-db was given. +if test "${with_db+set}" = set; then + withval=$with_db; + dbpath=${withval} + + DB_LDFLAGS= + { echo "$as_me:$LINENO: checking for db library" >&5 +echo $ECHO_N "checking for db library... $ECHO_C" >&6; } + oldlibs=$LIBS + lib=notfound + + if test "x$dbpath" != "x" ; then + oldcflags=$CFLAGS + for dbheader in db4 db3 notfound; do + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/$dbheader/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/$dbheader/" + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + + if test "x$dbheader" = "xnotfound"; then + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { echo "$as_me:$LINENO: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&5 +echo "$as_me: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + DB_LDFLAGS="-L${dbpath}/lib" + LDFLAGS="$DB_LDFLAGS ${LDFLAGS}" + + LIBS="${oldlibs} -ldb -lpthread" + DB_LIB="-ldb" + CFLAGS="$DB_CFLAGS $oldcflags" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + lib=db +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$oldcflags + + else + for lib in db4 db3 db notfound; do + LIBS="${oldlibs} -l$lib -lpthread" + DB_LIB="-l$lib" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + done + fi + + LIBS=$oldlibs + if test "x$lib" = "xnotfound" ; then + { { echo "$as_me:$LINENO: error: could not find DB libraries" >&5 +echo "$as_me: error: could not find DB libraries" >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: result: $lib" >&5 +echo "${ECHO_T}$lib" >&6; } + fi + + + + + { echo "$as_me:$LINENO: checking for dbenv parameter to DB error callback function" >&5 +echo $ECHO_N "checking for dbenv parameter to DB error callback function... $ECHO_C" >&6; } + oldcflags=$CFLAGS + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + const char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + + have_dbenv_parameter_to_db_error_callback=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_dbenv_parameter_to_db_error_callback=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_dbenv_parameter_to_db_error_callback" = "xyes" ; then + { echo "$as_me:$LINENO: checking if third parameter to error callback function is const" >&5 +echo $ECHO_N "checking if third parameter to error callback function is const... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + { echo "$as_me:$LINENO: checking for DB stat with malloc function ptr" >&5 +echo $ECHO_N "checking for DB stat with malloc function ptr... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + #include <stdlib.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + int dummy = 0; + u_int32_t flags = 0; + + ret = db->stat(db, &dummy, malloc, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_UNKNOWN_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_db_stat_malloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_db_stat_malloc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_db_stat_malloc" = "xno" ; then + + { echo "$as_me:$LINENO: checking for txnid parameter to DB stat function" >&5 +echo $ECHO_N "checking for txnid parameter to DB stat function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + DB_TXN *txnid = txnid; + u_int32_t flags = 0; + + ret = db->stat(db, txnid, NULL, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_TXNID_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_txnid_param_to_stat=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_txnid_param_to_stat=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi + + { echo "$as_me:$LINENO: checking for txnid parameter to DB open function" >&5 +echo $ECHO_N "checking for txnid parameter to DB open function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + DB_TXN *txnid = NULL; + char *file = NULL; + char *database = NULL; + DBTYPE type = 0; + u_int32_t flags = 0; + int mode = 0; + + ret = db->open(db, txnid, file, database, type, flags, mode); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_TXNID_PARAMETER_TO_DB_OPEN 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_DIRTY_READ flag" >&5 +echo $ECHO_N "checking for DB_DIRTY_READ flag... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + u_int32_t flags = DB_DIRTY_READ; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_DIRTY_READ 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_BUFFER_SMALL error" >&5 +echo $ECHO_N "checking for DB_BUFFER_SMALL error... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int res = DB_BUFFER_SMALL; + res++; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_BUFFER_SMALL 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for berkeley db get_pagesize function" >&5 +echo $ECHO_N "checking for berkeley db get_pagesize function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + int pagesize; + + ret = db->get_pagesize(db, &pagesize); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_GET_PAGESIZE 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + CFLAGS="$oldcflags" + +else + + dbpath="" + + DB_LDFLAGS= + { echo "$as_me:$LINENO: checking for db library" >&5 +echo $ECHO_N "checking for db library... $ECHO_C" >&6; } + oldlibs=$LIBS + lib=notfound + + if test "x$dbpath" != "x" ; then + oldcflags=$CFLAGS + for dbheader in db4 db3 notfound; do + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/$dbheader/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/$dbheader/" + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + + if test "x$dbheader" = "xnotfound"; then + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { echo "$as_me:$LINENO: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&5 +echo "$as_me: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + DB_LDFLAGS="-L${dbpath}/lib" + LDFLAGS="$DB_LDFLAGS ${LDFLAGS}" + + LIBS="${oldlibs} -ldb -lpthread" + DB_LIB="-ldb" + CFLAGS="$DB_CFLAGS $oldcflags" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + lib=db +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$oldcflags + + else + for lib in db4 db3 db notfound; do + LIBS="${oldlibs} -l$lib -lpthread" + DB_LIB="-l$lib" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + done + fi + + LIBS=$oldlibs + if test "x$lib" = "xnotfound" ; then + { { echo "$as_me:$LINENO: error: could not find DB libraries" >&5 +echo "$as_me: error: could not find DB libraries" >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: result: $lib" >&5 +echo "${ECHO_T}$lib" >&6; } + fi + + + + + { echo "$as_me:$LINENO: checking for dbenv parameter to DB error callback function" >&5 +echo $ECHO_N "checking for dbenv parameter to DB error callback function... $ECHO_C" >&6; } + oldcflags=$CFLAGS + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + const char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + + have_dbenv_parameter_to_db_error_callback=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_dbenv_parameter_to_db_error_callback=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_dbenv_parameter_to_db_error_callback" = "xyes" ; then + { echo "$as_me:$LINENO: checking if third parameter to error callback function is const" >&5 +echo $ECHO_N "checking if third parameter to error callback function is const... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + { echo "$as_me:$LINENO: checking for DB stat with malloc function ptr" >&5 +echo $ECHO_N "checking for DB stat with malloc function ptr... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + #include <stdlib.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + int dummy = 0; + u_int32_t flags = 0; + + ret = db->stat(db, &dummy, malloc, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_UNKNOWN_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_db_stat_malloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_db_stat_malloc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_db_stat_malloc" = "xno" ; then + + { echo "$as_me:$LINENO: checking for txnid parameter to DB stat function" >&5 +echo $ECHO_N "checking for txnid parameter to DB stat function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + DB_TXN *txnid = txnid; + u_int32_t flags = 0; + + ret = db->stat(db, txnid, NULL, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_TXNID_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_txnid_param_to_stat=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_txnid_param_to_stat=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi + + { echo "$as_me:$LINENO: checking for txnid parameter to DB open function" >&5 +echo $ECHO_N "checking for txnid parameter to DB open function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + DB_TXN *txnid = NULL; + char *file = NULL; + char *database = NULL; + DBTYPE type = 0; + u_int32_t flags = 0; + int mode = 0; + + ret = db->open(db, txnid, file, database, type, flags, mode); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_TXNID_PARAMETER_TO_DB_OPEN 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_DIRTY_READ flag" >&5 +echo $ECHO_N "checking for DB_DIRTY_READ flag... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + u_int32_t flags = DB_DIRTY_READ; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_DIRTY_READ 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_BUFFER_SMALL error" >&5 +echo $ECHO_N "checking for DB_BUFFER_SMALL error... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int res = DB_BUFFER_SMALL; + res++; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_BUFFER_SMALL 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for berkeley db get_pagesize function" >&5 +echo $ECHO_N "checking for berkeley db get_pagesize function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + int pagesize; + + ret = db->get_pagesize(db, &pagesize); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_GET_PAGESIZE 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + CFLAGS="$oldcflags" + +fi + + + +# Check whether --with-mpi was given. +if test "${with_mpi+set}" = set; then + withval=$with_mpi; if test x$withval = xyes; then + { { echo "$as_me:$LINENO: error: --with-mpi must be given a pathname" >&5 +echo "$as_me: error: --with-mpi must be given a pathname" >&2;} + { (exit 1); exit 1; }; } + else + MPICC="${withval}/bin/mpicc" + MPICFLAGS="-I${withval}/include" + MPILDFLAGS="-L${withval}/lib" + MPILIBS="-lmpich" + BUILD_MPI="1" + fi + +fi + + + + + + + +BUILD_ABSOLUTE_TOP=${PWD} +SRC_RELATIVE_TOP=$srcdir +SRC_ABSOLUTE_TOP=`cd $srcdir; pwd` + + + + + + + + + + +# Check whether --enable-verbose was given. +if test "${enable_verbose+set}" = set; then + enableval=$enable_verbose; QUIET_COMPILE=0 +else + QUIET_COMPILE=1 +fi + + + +STRICT_CFLAGS= +# Check whether --enable-strict was given. +if test "${enable_strict+set}" = set; then + enableval=$enable_strict; STRICT_CFLAGS=1 +fi + + + +AE_DEBUG= +# Check whether --enable-aesop-debug was given. +if test "${enable_aesop_debug+set}" = set; then + enableval=$enable_aesop_debug; AE_DEBUG=1 +fi + + + +# Check whether --enable-coverage was given. +if test "${enable_coverage+set}" = set; then + enableval=$enable_coverage; CFLAGS="$CFLAGS -g -pg -ftest-coverage -O0" + ENABLE_COVERAGE=1 +fi + + + +{ echo "$as_me:$LINENO: checking for client library thread safety support" >&5 +echo $ECHO_N "checking for client library thread safety support... $ECHO_C" >&6; } +# Check whether --enable-thread-safety was given. +if test "${enable_thread_safety+set}" = set; then + enableval=$enable_thread_safety; if test "x$enableval" = "xno" ; then + LIBCFLAGS="$LIBCFLAGS -D__TRITON_NULL_LOCKING__" + THREAD_LIB="" + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +else + LIBCFLAGS="$LIBCFLAGS -D__TRITON_POSIX_LOCKING__" + THREAD_LIB="-lpthread" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +fi + + + + + + + SQLITE_MINIMUM_VER="3.0.0" + SQLITE_PKGNAME="sqlite3" + BUILD_OSD= + + + sqlite_min_major=`expr $SQLITE_MINIMUM_VER : '\([0-9]*\)'` + sqlite_min_minor=`expr $SQLITE_MINIMUM_VER : '[0-9]*\.\([0-9]*\)'` + sqlite_min_micro=`expr $SQLITE_MINIMUM_VER : '[0-9]*\.[0-9]*\.\([0-9]*\)'` + sqlite_min_ver_num=`expr $sqlite_min_major \* 1000000 \ + \+ $sqlite_min_minor \* 1000 \ + \+ $sqlite_min_micro` + + + { echo "$as_me:$LINENO: checking sqlite library" >&5 +echo "$as_me: checking sqlite library" >&6;} + + +# Check whether --with-sqlite was given. +if test "${with_sqlite+set}" = set; then + withval=$with_sqlite; + if test "$withval" = "yes" ; then + { { echo "$as_me:$LINENO: error: --with-sqlite requires an argument." >&5 +echo "$as_me: error: --with-sqlite requires an argument." >&2;} + { (exit 1); exit 1; }; } + else + sqlite_dir="$withval" + fi + + if test -d $sqlite_dir; then + + if test -z "$sqlite_dir"; then + sqlite_dir="" + sqlite_include="sqlite3.h" + else + sqlite_dir="$sqlite_dir" + sqlite_include="$sqlite_dir/include/sqlite3.h" + fi + + save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + + if test ! -z "$sqlite_dir"; then + CPPFLAGS="$CPPFLAGS -I$sqlite_dir/include" + LDFLAGS="$LDFLAGS -L$sqlite_dir/lib" + fi + + if test "${ac_cv_header_sqlite3_h+set}" = set; then + { echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking sqlite3.h usability" >&5 +echo $ECHO_N "checking sqlite3.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +@%:@include <sqlite3.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking sqlite3.h presence" >&5 +echo $ECHO_N "checking sqlite3.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include <sqlite3.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sqlite3.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sqlite3.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sqlite3.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +@%:@@%:@ ---------------------------------- @%:@@%:@ +@%:@@%:@ Report this to [email protected] @%:@@%:@ +@%:@@%:@ ---------------------------------- @%:@@%:@ +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sqlite3_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } + +fi +if test $ac_cv_header_sqlite3_h = yes; then + + { echo "$as_me:$LINENO: checking sqlite library version (via header)" >&5 +echo $ECHO_N "checking sqlite library version (via header)... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "$sqlite_include" +#if SQLITE_VERSION_NUMBER >= $sqlite_min_ver_num +SQLITE_VERSION_OKAY +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "SQLITE_VERSION_OKAY" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: result: okay" >&5 +echo "${ECHO_T}okay" >&6; } + { echo "$as_me:$LINENO: checking for sqlite3_close in -lsqlite3" >&5 +echo $ECHO_N "checking for sqlite3_close in -lsqlite3... $ECHO_C" >&6; } +if test "${ac_cv_lib_sqlite3_sqlite3_close+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsqlite3 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sqlite3_close (); +int +main () +{ +return sqlite3_close (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_sqlite3_sqlite3_close=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_sqlite3_sqlite3_close=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite3_sqlite3_close" >&5 +echo "${ECHO_T}$ac_cv_lib_sqlite3_sqlite3_close" >&6; } +if test $ac_cv_lib_sqlite3_sqlite3_close = yes; then + + triton_lib_sqlite="yes" + if test -z "$sqlite_dir" -o ! -d "$sqlite_dir"; then + TRITON_SQLITE_LIBS="-lsqlite3" + else + TRITON_SQLITE_INCLUDES="-I$sqlite_dir/include" + TRITON_SQLITE_LIBS="-L$sqlite_dir/lib -lsqlite3" + fi + +fi + +else + { echo "$as_me:$LINENO: result: unsupported SQLite version" >&5 +echo "${ECHO_T}unsupported SQLite version" >&6; } +fi +rm -f conftest* + + +fi + + + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + + else + { { echo "$as_me:$LINENO: error: $sqlite_dir is not a directory." >&5 +echo "$as_me: error: $sqlite_dir is not a directory." >&2;} + { (exit 1); exit 1; }; } + fi + + # if a --with-sqlite argument was given, then we should complain if we + # can't find it there + if test -z "$triton_lib_sqlite"; then + { { echo "$as_me:$LINENO: error: no suitable sqlite found in $sqlite_dir" >&5 +echo "$as_me: error: no suitable sqlite found in $sqlite_dir" >&2;} + { (exit 1); exit 1; }; } + else + BUILD_OSD=1 + fi + +else + + if test -z "$triton_lib_sqlite"; then + + if test -z ""; then + sqlite_dir="" + sqlite_include="sqlite3.h" + else + sqlite_dir="" + sqlite_include="/include/sqlite3.h" + fi + + save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + + if test ! -z ""; then + CPPFLAGS="$CPPFLAGS -I$sqlite_dir/include" + LDFLAGS="$LDFLAGS -L$sqlite_dir/lib" + fi + + if test "${ac_cv_header_sqlite3_h+set}" = set; then + { echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking sqlite3.h usability" >&5 +echo $ECHO_N "checking sqlite3.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +@%:@include <sqlite3.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking sqlite3.h presence" >&5 +echo $ECHO_N "checking sqlite3.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include <sqlite3.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sqlite3.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sqlite3.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sqlite3.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +@%:@@%:@ ---------------------------------- @%:@@%:@ +@%:@@%:@ Report this to [email protected] @%:@@%:@ +@%:@@%:@ ---------------------------------- @%:@@%:@ +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sqlite3_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } + +fi +if test $ac_cv_header_sqlite3_h = yes; then + + { echo "$as_me:$LINENO: checking sqlite library version (via header)" >&5 +echo $ECHO_N "checking sqlite library version (via header)... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "$sqlite_include" +#if SQLITE_VERSION_NUMBER >= $sqlite_min_ver_num +SQLITE_VERSION_OKAY +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "SQLITE_VERSION_OKAY" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: result: okay" >&5 +echo "${ECHO_T}okay" >&6; } + { echo "$as_me:$LINENO: checking for sqlite3_close in -lsqlite3" >&5 +echo $ECHO_N "checking for sqlite3_close in -lsqlite3... $ECHO_C" >&6; } +if test "${ac_cv_lib_sqlite3_sqlite3_close+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsqlite3 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sqlite3_close (); +int +main () +{ +return sqlite3_close (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_sqlite3_sqlite3_close=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_sqlite3_sqlite3_close=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite3_sqlite3_close" >&5 +echo "${ECHO_T}$ac_cv_lib_sqlite3_sqlite3_close" >&6; } +if test $ac_cv_lib_sqlite3_sqlite3_close = yes; then + + triton_lib_sqlite="yes" + if test -z "$sqlite_dir" -o ! -d "$sqlite_dir"; then + TRITON_SQLITE_LIBS="-lsqlite3" + else + TRITON_SQLITE_INCLUDES="-I$sqlite_dir/include" + TRITON_SQLITE_LIBS="-L$sqlite_dir/lib -lsqlite3" + fi + +fi + +else + { echo "$as_me:$LINENO: result: unsupported SQLite version" >&5 +echo "${ECHO_T}unsupported SQLite version" >&6; } +fi +rm -f conftest* + + +fi + + + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + + fi + + if test -z "$triton_lib_sqlite"; then + + if test -n "$PKG_CONFIG"; then + { echo "$as_me:$LINENO: checking sqlite library version (via pkg-config)" >&5 +echo $ECHO_N "checking sqlite library version (via pkg-config)... $ECHO_C" >&6; } + sqlite_version=`$PKG_CONFIG $SQLITE_PKGNAME --modversion --silence-errors` + + if test -n "$sqlite_version"; then + + sqlite_major=`expr $sqlite_version : '\([0-9]*\)'` + sqlite_minor=`expr $sqlite_version : '[0-9]*\.\([0-9]*\)'` + sqlite_micro=`expr $sqlite_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'` + if test -z "$sqlite_micro"; then + sqlite_micro=0 + fi + sqlite_ver_num=`expr $sqlite_major \* 1000000 \ + \+ $sqlite_minor \* 1000 \ + \+ $sqlite_micro` + + + if test "$sqlite_ver_num" -ge "$sqlite_min_ver_num"; then + { echo "$as_me:$LINENO: result: $sqlite_version" >&5 +echo "${ECHO_T}$sqlite_version" >&6; } + triton_lib_sqlite="yes" + TRITON_SQLITE_INCLUDES="`$PKG_CONFIG $SQLITE_PKGNAME --cflags`" + TRITON_SQLITE_LIBS="`$PKG_CONFIG $SQLITE_PKGNAME --libs`" + else + { echo "$as_me:$LINENO: result: none or unsupported $sqlite_version" >&5 +echo "${ECHO_T}none or unsupported $sqlite_version" >&6; } + fi + fi + fi + + if test -z "$triton_lib_sqlite"; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + fi + + fi + +# if test -z "$triton_lib_sqlite"; then +# TRITON_DOWNLOAD_SQLITE +# fi + if test -n "$triton_lib_sqlite"; then + BUILD_OSD=1 + fi + +fi + + + + + + + + +ac_config_files="$ac_config_files Makefile src/common/module.mk src/common/tests/module.mk src/common/resources/timer/test/module.mk src/common/resources/timer/module.mk src/common/resources/scheduling/module.mk src/common/resources/scheduling/test/module.mk src/net/module.mk src/net/mpi/module.mk src/net/mpi/test/module.mk src/remote/module.mk src/aesop/module.mk src/aesop/parser/module.mk src/aesop/examples/module.mk src/aesop/parser/tests/remote/module.mk src/aesop/parser/tests/blocking/module.mk" + +cat >confcache <<\_ACEOF +# 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, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIB@&t@OBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by grayskull $as_me 0.1.1, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to <[email protected]>." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +grayskull config.status 0.1.1 +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX +@%:@@%:@ Running $as_me. @%:@@%:@ +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "gs-config.h") CONFIG_HEADERS="$CONFIG_HEADERS gs-config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/common/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/module.mk" ;; + "src/common/tests/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/tests/module.mk" ;; + "src/common/resources/timer/test/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/timer/test/module.mk" ;; + "src/common/resources/timer/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/timer/module.mk" ;; + "src/common/resources/scheduling/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/scheduling/module.mk" ;; + "src/common/resources/scheduling/test/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/scheduling/test/module.mk" ;; + "src/net/module.mk") CONFIG_FILES="$CONFIG_FILES src/net/module.mk" ;; + "src/net/mpi/module.mk") CONFIG_FILES="$CONFIG_FILES src/net/mpi/module.mk" ;; + "src/net/mpi/test/module.mk") CONFIG_FILES="$CONFIG_FILES src/net/mpi/test/module.mk" ;; + "src/remote/module.mk") CONFIG_FILES="$CONFIG_FILES src/remote/module.mk" ;; + "src/aesop/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/module.mk" ;; + "src/aesop/parser/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/parser/module.mk" ;; + "src/aesop/examples/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/examples/module.mk" ;; + "src/aesop/parser/tests/remote/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/parser/tests/remote/module.mk" ;; + "src/aesop/parser/tests/blocking/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/parser/tests/blocking/module.mk" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +TRITON_VERSION!$TRITON_VERSION$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +GHC!$GHC$ac_delim +DB_CFLAGS!$DB_CFLAGS$ac_delim +DB_LIB!$DB_LIB$ac_delim +MPICC!$MPICC$ac_delim +MPICFLAGS!$MPICFLAGS$ac_delim +MPILDFLAGS!$MPILDFLAGS$ac_delim +MPILIBS!$MPILIBS$ac_delim +BUILD_MPI!$BUILD_MPI$ac_delim +BUILD_ABSOLUTE_TOP!$BUILD_ABSOLUTE_TOP$ac_delim +SRC_RELATIVE_TOP!$SRC_RELATIVE_TOP$ac_delim +SRC_ABSOLUTE_TOP!$SRC_ABSOLUTE_TOP$ac_delim +QUIET_COMPILE!$QUIET_COMPILE$ac_delim +STRICT_CFLAGS!$STRICT_CFLAGS$ac_delim +AE_DEBUG!$AE_DEBUG$ac_delim +ENABLE_COVERAGE!$ENABLE_COVERAGE$ac_delim +LIBCFLAGS!$LIBCFLAGS$ac_delim +THREAD_LIB!$THREAD_LIB$ac_delim +TRITON_SQLITE_INCLUDES!$TRITON_SQLITE_INCLUDES$ac_delim +TRITON_SQLITE_LIBS!$TRITON_SQLITE_LIBS$ac_delim +BUILD_OSD!$BUILD_OSD$ac_delim +LIB@&t@OBJS!$LIB@&t@OBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS <conf$$subs.sed +rm -f conf$$subs.sed +cat >>$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # +_ACEOF + +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #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. +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : +do + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines conftest.tail + +echo "ac_result=$ac_in" >>$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" + ;; + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/code/autom4te.cache/output.1 b/code/autom4te.cache/output.1 new file mode 100644 index 0000000..bea933f --- /dev/null +++ b/code/autom4te.cache/output.1 @@ -0,0 +1,7798 @@ +@%:@! /bin/sh +@%:@ Guess values for system-dependent variables and create Makefiles. +@%:@ Generated by GNU Autoconf 2.61 for grayskull 0.1.1. +@%:@ +@%:@ Report bugs to <[email protected]>. +@%:@ +@%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +@%:@ 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +@%:@ This configure script is free software; the Free Software Foundation +@%:@ gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell [email protected] about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 </dev/null 6>&1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIB@&t@OBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='grayskull' +PACKAGE_TARNAME='grayskull' +PACKAGE_VERSION='0.1.1' +PACKAGE_STRING='grayskull 0.1.1' +PACKAGE_BUGREPORT='[email protected]' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#ifdef HAVE_STRINTRITON_H +# include <strings.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +TRITON_VERSION +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +CPP +GREP +EGREP +GHC +DB_CFLAGS +DB_LIB +MPICC +MPICFLAGS +MPILDFLAGS +MPILIBS +BUILD_MPI +BUILD_ABSOLUTE_TOP +SRC_RELATIVE_TOP +SRC_ABSOLUTE_TOP +QUIET_COMPILE +STRICT_CFLAGS +AE_DEBUG +ENABLE_COVERAGE +LIBCFLAGS +THREAD_LIB +TRITON_SQLITE_INCLUDES +TRITON_SQLITE_LIBS +BUILD_OSD +LIB@&t@OBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + 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 | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 | -n) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + 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 "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + 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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # 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 <<_ACEOF +\`configure' configures grayskull 0.1.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root @<:@DATAROOTDIR/doc/grayskull@:>@ + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of grayskull 0.1.1:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-verbose Enables verbose output during build process + --enable-strict Turn on strict compiler warnings + --enable-aesop-debug Turn on debugging of the gs-parser + --enable-coverage Enable coverage analysis (disables optimizations) + --disable-thread-safety Disables thread safety in the client library + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-ghc=<dir> Location of installed ghc + --with-db=<dir> Location of installed DB package +(default=/usr) + --with-mpi=<dir> Location of the MPI installation + --with-sqlite=PREFIX Use installed SQLite library or amalgamation file. + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to <[email protected]>. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +grayskull configure 0.1.1 +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by grayskull $as_me 0.1.1, which was +generated by GNU Autoconf 2.61. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +@%:@@%:@ --------- @%:@@%:@ +@%:@@%:@ Platform. @%:@@%:@ +@%:@@%:@ --------- @%:@@%:@ + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +@%:@@%:@ ----------- @%:@@%:@ +@%:@@%:@ Core tests. @%:@@%:@ +@%:@@%:@ ----------- @%:@@%:@ + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +@%:@@%:@ ---------------- @%:@@%:@ +@%:@@%:@ Cache variables. @%:@@%:@ +@%:@@%:@ ---------------- @%:@@%:@ +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +@%:@@%:@ ----------------- @%:@@%:@ +@%:@@%:@ Output variables. @%:@@%:@ +@%:@@%:@ ----------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +@%:@@%:@ ------------------- @%:@@%:@ +@%:@@%:@ File substitutions. @%:@@%:@ +@%:@@%:@ ------------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +@%:@@%:@ ----------- @%:@@%:@ +@%:@@%:@ confdefs.h. @%:@@%:@ +@%:@@%:@ ----------- @%:@@%:@ +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + +cat >>confdefs.h <<_ACEOF +@%:@define TRITON_VERSION_MAJOR $TRITON_MAJOR +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define TRITON_VERSION_MINOR $TRITON_MINOR +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define TRITON_VERSION_SUB $TRITON_SUB +_ACEOF + + +ac_config_headers="$ac_config_headers gs-config.h" + +ac_aux_dir= +for ac_dir in maint/config "$srcdir"/maint/config; 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 + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in maint/config \"$srcdir\"/maint/config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in maint/config \"$srcdir\"/maint/config" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +# 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 +# AmigaOS /C/install, which installs bootblocks on floppy discs +# 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" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /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 + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_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. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&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}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +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 "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_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 $@%:@ != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&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 +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include <limits.h> +@%:@else +@%:@ include <assert.h> +@%:@endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include <limits.h> +@%:@else +@%:@ include <assert.h> +@%:@endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ctype.h> +#include <stdlib.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +@%:@define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +@%:@include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_bigendian=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +@%:@define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + +{ echo "$as_me:$LINENO: checking for long int" >&5 +echo $ECHO_N "checking for long int... $ECHO_C" >&6; } +if test "${ac_cv_type_long_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long int ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_int=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_int" >&5 +echo "${ECHO_T}$ac_cv_type_long_int" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of long int" >&5 +echo $ECHO_N "checking size of long int... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_long_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long_int=$ac_lo;; +'') if test "$ac_cv_type_long_int" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_long_int=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +@%:@include <stdio.h> +@%:@include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long_int=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_long_int" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_long_int=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +@%:@define SIZEOF_LONG_INT $ac_cv_sizeof_long_int +_ACEOF + + +{ echo "$as_me:$LINENO: checking for void *" >&5 +echo $ECHO_N "checking for void *... $ECHO_C" >&6; } +if test "${ac_cv_type_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef void * ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_void_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_void_p=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 +echo "${ECHO_T}$ac_cv_type_void_p" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of void *" >&5 +echo $ECHO_N "checking size of void *... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array @<:@1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)@:>@; +test_array @<:@0@:>@ = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_void_p=$ac_lo;; +'') if test "$ac_cv_type_void_p" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_void_p=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +@%:@include <stdio.h> +@%:@include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_void_p=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_void_p" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_void_p=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6; } + + + +cat >>confdefs.h <<_ACEOF +@%:@define SIZEOF_VOID_P $ac_cv_sizeof_void_p +_ACEOF + + + +{ echo "$as_me:$LINENO: checking for required gcc" >&5 +echo $ECHO_N "checking for required gcc... $ECHO_C" >&6; } +if test "x$GCC" = "x"; then + { { echo "$as_me:$LINENO: error: no" >&5 +echo "$as_me: error: no" >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + + +# Check whether --with-ghc was given. +if test "${with_ghc+set}" = set; then + withval=$with_ghc; # Extract the first word of "${withval}/bin/ghc", so it can be a program name with args. +set dummy ${withval}/bin/ghc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GHC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GHC in + [\\/]* | ?:[\\/]*) + ac_cv_path_GHC="$GHC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GHC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +GHC=$ac_cv_path_GHC +if test -n "$GHC"; then + { echo "$as_me:$LINENO: result: $GHC" >&5 +echo "${ECHO_T}$GHC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +else + # Extract the first word of "ghc", so it can be a program name with args. +set dummy ghc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GHC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GHC in + [\\/]* | ?:[\\/]*) + ac_cv_path_GHC="$GHC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GHC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +GHC=$ac_cv_path_GHC +if test -n "$GHC"; then + { echo "$as_me:$LINENO: result: $GHC" >&5 +echo "${ECHO_T}$GHC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi + + + + +# Check whether --with-db was given. +if test "${with_db+set}" = set; then + withval=$with_db; + dbpath=${withval} + + DB_LDFLAGS= + { echo "$as_me:$LINENO: checking for db library" >&5 +echo $ECHO_N "checking for db library... $ECHO_C" >&6; } + oldlibs=$LIBS + lib=notfound + + if test "x$dbpath" != "x" ; then + oldcflags=$CFLAGS + for dbheader in db4 db3 notfound; do + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/$dbheader/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/$dbheader/" + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + + if test "x$dbheader" = "xnotfound"; then + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { echo "$as_me:$LINENO: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&5 +echo "$as_me: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + DB_LDFLAGS="-L${dbpath}/lib" + LDFLAGS="$DB_LDFLAGS ${LDFLAGS}" + + LIBS="${oldlibs} -ldb -lpthread" + DB_LIB="-ldb" + CFLAGS="$DB_CFLAGS $oldcflags" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + lib=db +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$oldcflags + + else + for lib in db4 db3 db notfound; do + LIBS="${oldlibs} -l$lib -lpthread" + DB_LIB="-l$lib" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + done + fi + + LIBS=$oldlibs + if test "x$lib" = "xnotfound" ; then + { { echo "$as_me:$LINENO: error: could not find DB libraries" >&5 +echo "$as_me: error: could not find DB libraries" >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: result: $lib" >&5 +echo "${ECHO_T}$lib" >&6; } + fi + + + + + { echo "$as_me:$LINENO: checking for dbenv parameter to DB error callback function" >&5 +echo $ECHO_N "checking for dbenv parameter to DB error callback function... $ECHO_C" >&6; } + oldcflags=$CFLAGS + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + const char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + + have_dbenv_parameter_to_db_error_callback=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_dbenv_parameter_to_db_error_callback=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_dbenv_parameter_to_db_error_callback" = "xyes" ; then + { echo "$as_me:$LINENO: checking if third parameter to error callback function is const" >&5 +echo $ECHO_N "checking if third parameter to error callback function is const... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + { echo "$as_me:$LINENO: checking for DB stat with malloc function ptr" >&5 +echo $ECHO_N "checking for DB stat with malloc function ptr... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + #include <stdlib.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + int dummy = 0; + u_int32_t flags = 0; + + ret = db->stat(db, &dummy, malloc, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_UNKNOWN_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_db_stat_malloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_db_stat_malloc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_db_stat_malloc" = "xno" ; then + + { echo "$as_me:$LINENO: checking for txnid parameter to DB stat function" >&5 +echo $ECHO_N "checking for txnid parameter to DB stat function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + DB_TXN *txnid = txnid; + u_int32_t flags = 0; + + ret = db->stat(db, txnid, NULL, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_TXNID_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_txnid_param_to_stat=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_txnid_param_to_stat=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi + + { echo "$as_me:$LINENO: checking for txnid parameter to DB open function" >&5 +echo $ECHO_N "checking for txnid parameter to DB open function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + DB_TXN *txnid = NULL; + char *file = NULL; + char *database = NULL; + DBTYPE type = 0; + u_int32_t flags = 0; + int mode = 0; + + ret = db->open(db, txnid, file, database, type, flags, mode); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_TXNID_PARAMETER_TO_DB_OPEN 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_DIRTY_READ flag" >&5 +echo $ECHO_N "checking for DB_DIRTY_READ flag... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + u_int32_t flags = DB_DIRTY_READ; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_DIRTY_READ 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_BUFFER_SMALL error" >&5 +echo $ECHO_N "checking for DB_BUFFER_SMALL error... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int res = DB_BUFFER_SMALL; + res++; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_BUFFER_SMALL 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for berkeley db get_pagesize function" >&5 +echo $ECHO_N "checking for berkeley db get_pagesize function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + int pagesize; + + ret = db->get_pagesize(db, &pagesize); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_GET_PAGESIZE 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + CFLAGS="$oldcflags" + +else + + dbpath="" + + DB_LDFLAGS= + { echo "$as_me:$LINENO: checking for db library" >&5 +echo $ECHO_N "checking for db library... $ECHO_C" >&6; } + oldlibs=$LIBS + lib=notfound + + if test "x$dbpath" != "x" ; then + oldcflags=$CFLAGS + for dbheader in db4 db3 notfound; do + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/$dbheader/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/$dbheader/" + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + + if test "x$dbheader" = "xnotfound"; then + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { echo "$as_me:$LINENO: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&5 +echo "$as_me: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + DB_LDFLAGS="-L${dbpath}/lib" + LDFLAGS="$DB_LDFLAGS ${LDFLAGS}" + + LIBS="${oldlibs} -ldb -lpthread" + DB_LIB="-ldb" + CFLAGS="$DB_CFLAGS $oldcflags" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + lib=db +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$oldcflags + + else + for lib in db4 db3 db notfound; do + LIBS="${oldlibs} -l$lib -lpthread" + DB_LIB="-l$lib" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + done + fi + + LIBS=$oldlibs + if test "x$lib" = "xnotfound" ; then + { { echo "$as_me:$LINENO: error: could not find DB libraries" >&5 +echo "$as_me: error: could not find DB libraries" >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: result: $lib" >&5 +echo "${ECHO_T}$lib" >&6; } + fi + + + + + { echo "$as_me:$LINENO: checking for dbenv parameter to DB error callback function" >&5 +echo $ECHO_N "checking for dbenv parameter to DB error callback function... $ECHO_C" >&6; } + oldcflags=$CFLAGS + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + const char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + + have_dbenv_parameter_to_db_error_callback=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_dbenv_parameter_to_db_error_callback=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_dbenv_parameter_to_db_error_callback" = "xyes" ; then + { echo "$as_me:$LINENO: checking if third parameter to error callback function is const" >&5 +echo $ECHO_N "checking if third parameter to error callback function is const... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + { echo "$as_me:$LINENO: checking for DB stat with malloc function ptr" >&5 +echo $ECHO_N "checking for DB stat with malloc function ptr... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + #include <stdlib.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + int dummy = 0; + u_int32_t flags = 0; + + ret = db->stat(db, &dummy, malloc, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_UNKNOWN_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_db_stat_malloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_db_stat_malloc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_db_stat_malloc" = "xno" ; then + + { echo "$as_me:$LINENO: checking for txnid parameter to DB stat function" >&5 +echo $ECHO_N "checking for txnid parameter to DB stat function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + DB_TXN *txnid = txnid; + u_int32_t flags = 0; + + ret = db->stat(db, txnid, NULL, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_TXNID_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_txnid_param_to_stat=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_txnid_param_to_stat=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi + + { echo "$as_me:$LINENO: checking for txnid parameter to DB open function" >&5 +echo $ECHO_N "checking for txnid parameter to DB open function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + DB_TXN *txnid = NULL; + char *file = NULL; + char *database = NULL; + DBTYPE type = 0; + u_int32_t flags = 0; + int mode = 0; + + ret = db->open(db, txnid, file, database, type, flags, mode); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_TXNID_PARAMETER_TO_DB_OPEN 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_DIRTY_READ flag" >&5 +echo $ECHO_N "checking for DB_DIRTY_READ flag... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + u_int32_t flags = DB_DIRTY_READ; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_DIRTY_READ 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_BUFFER_SMALL error" >&5 +echo $ECHO_N "checking for DB_BUFFER_SMALL error... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int res = DB_BUFFER_SMALL; + res++; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_BUFFER_SMALL 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for berkeley db get_pagesize function" >&5 +echo $ECHO_N "checking for berkeley db get_pagesize function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + int pagesize; + + ret = db->get_pagesize(db, &pagesize); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DB_GET_PAGESIZE 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + CFLAGS="$oldcflags" + +fi + + + +# Check whether --with-mpi was given. +if test "${with_mpi+set}" = set; then + withval=$with_mpi; if test x$withval = xyes; then + { { echo "$as_me:$LINENO: error: --with-mpi must be given a pathname" >&5 +echo "$as_me: error: --with-mpi must be given a pathname" >&2;} + { (exit 1); exit 1; }; } + else + MPICC="${withval}/bin/mpicc" + MPICFLAGS="-I${withval}/include" + MPILDFLAGS="-L${withval}/lib" + MPILIBS="-lmpich" + BUILD_MPI="1" + fi + +fi + + + + + + + +BUILD_ABSOLUTE_TOP=${PWD} +SRC_RELATIVE_TOP=$srcdir +SRC_ABSOLUTE_TOP=`cd $srcdir; pwd` + + + + + + + + + + +# Check whether --enable-verbose was given. +if test "${enable_verbose+set}" = set; then + enableval=$enable_verbose; QUIET_COMPILE=0 +else + QUIET_COMPILE=1 +fi + + + +STRICT_CFLAGS= +# Check whether --enable-strict was given. +if test "${enable_strict+set}" = set; then + enableval=$enable_strict; STRICT_CFLAGS=1 +fi + + + +AE_DEBUG= +# Check whether --enable-aesop-debug was given. +if test "${enable_aesop_debug+set}" = set; then + enableval=$enable_aesop_debug; AE_DEBUG=1 +fi + + + +# Check whether --enable-coverage was given. +if test "${enable_coverage+set}" = set; then + enableval=$enable_coverage; CFLAGS="$CFLAGS -g -pg -ftest-coverage -O0" + ENABLE_COVERAGE=1 +fi + + + +{ echo "$as_me:$LINENO: checking for client library thread safety support" >&5 +echo $ECHO_N "checking for client library thread safety support... $ECHO_C" >&6; } +# Check whether --enable-thread-safety was given. +if test "${enable_thread_safety+set}" = set; then + enableval=$enable_thread_safety; if test "x$enableval" = "xno" ; then + LIBCFLAGS="$LIBCFLAGS -D__TRITON_NULL_LOCKING__" + THREAD_LIB="" + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +else + LIBCFLAGS="$LIBCFLAGS -D__TRITON_POSIX_LOCKING__" + THREAD_LIB="-lpthread" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +fi + + + + + + + SQLITE_MINIMUM_VER="3.0.0" + SQLITE_PKGNAME="sqlite3" + BUILD_OSD= + + + sqlite_min_major=`expr $SQLITE_MINIMUM_VER : '\([0-9]*\)'` + sqlite_min_minor=`expr $SQLITE_MINIMUM_VER : '[0-9]*\.\([0-9]*\)'` + sqlite_min_micro=`expr $SQLITE_MINIMUM_VER : '[0-9]*\.[0-9]*\.\([0-9]*\)'` + sqlite_min_ver_num=`expr $sqlite_min_major \* 1000000 \ + \+ $sqlite_min_minor \* 1000 \ + \+ $sqlite_min_micro` + + + { echo "$as_me:$LINENO: checking sqlite library" >&5 +echo "$as_me: checking sqlite library" >&6;} + + +# Check whether --with-sqlite was given. +if test "${with_sqlite+set}" = set; then + withval=$with_sqlite; + if test "$withval" = "yes" ; then + { { echo "$as_me:$LINENO: error: --with-sqlite requires an argument." >&5 +echo "$as_me: error: --with-sqlite requires an argument." >&2;} + { (exit 1); exit 1; }; } + else + sqlite_dir="$withval" + fi + + if test -d $sqlite_dir; then + + if test -z "$sqlite_dir"; then + sqlite_dir="" + sqlite_include="sqlite3.h" + else + sqlite_dir="$sqlite_dir" + sqlite_include="$sqlite_dir/include/sqlite3.h" + fi + + save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + + if test ! -z "$sqlite_dir"; then + CPPFLAGS="$CPPFLAGS -I$sqlite_dir/include" + LDFLAGS="$LDFLAGS -L$sqlite_dir/lib" + fi + + if test "${ac_cv_header_sqlite3_h+set}" = set; then + { echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking sqlite3.h usability" >&5 +echo $ECHO_N "checking sqlite3.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +@%:@include <sqlite3.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking sqlite3.h presence" >&5 +echo $ECHO_N "checking sqlite3.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include <sqlite3.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sqlite3.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sqlite3.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sqlite3.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +@%:@@%:@ ---------------------------------- @%:@@%:@ +@%:@@%:@ Report this to [email protected] @%:@@%:@ +@%:@@%:@ ---------------------------------- @%:@@%:@ +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sqlite3_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } + +fi +if test $ac_cv_header_sqlite3_h = yes; then + + { echo "$as_me:$LINENO: checking sqlite library version (via header)" >&5 +echo $ECHO_N "checking sqlite library version (via header)... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "$sqlite_include" +#if SQLITE_VERSION_NUMBER >= $sqlite_min_ver_num +SQLITE_VERSION_OKAY +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "SQLITE_VERSION_OKAY" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: result: okay" >&5 +echo "${ECHO_T}okay" >&6; } + { echo "$as_me:$LINENO: checking for sqlite3_close in -lsqlite3" >&5 +echo $ECHO_N "checking for sqlite3_close in -lsqlite3... $ECHO_C" >&6; } +if test "${ac_cv_lib_sqlite3_sqlite3_close+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsqlite3 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sqlite3_close (); +int +main () +{ +return sqlite3_close (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_sqlite3_sqlite3_close=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_sqlite3_sqlite3_close=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite3_sqlite3_close" >&5 +echo "${ECHO_T}$ac_cv_lib_sqlite3_sqlite3_close" >&6; } +if test $ac_cv_lib_sqlite3_sqlite3_close = yes; then + + triton_lib_sqlite="yes" + if test -z "$sqlite_dir" -o ! -d "$sqlite_dir"; then + TRITON_SQLITE_LIBS="-lsqlite3" + else + TRITON_SQLITE_INCLUDES="-I$sqlite_dir/include" + TRITON_SQLITE_LIBS="-L$sqlite_dir/lib -lsqlite3" + fi + +fi + +else + { echo "$as_me:$LINENO: result: unsupported SQLite version" >&5 +echo "${ECHO_T}unsupported SQLite version" >&6; } +fi +rm -f conftest* + + +fi + + + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + + else + { { echo "$as_me:$LINENO: error: $sqlite_dir is not a directory." >&5 +echo "$as_me: error: $sqlite_dir is not a directory." >&2;} + { (exit 1); exit 1; }; } + fi + + # if a --with-sqlite argument was given, then we should complain if we + # can't find it there + if test -z "$triton_lib_sqlite"; then + { { echo "$as_me:$LINENO: error: no suitable sqlite found in $sqlite_dir" >&5 +echo "$as_me: error: no suitable sqlite found in $sqlite_dir" >&2;} + { (exit 1); exit 1; }; } + else + BUILD_OSD=1 + fi + +else + + if test -z "$triton_lib_sqlite"; then + + if test -z ""; then + sqlite_dir="" + sqlite_include="sqlite3.h" + else + sqlite_dir="" + sqlite_include="/include/sqlite3.h" + fi + + save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + + if test ! -z ""; then + CPPFLAGS="$CPPFLAGS -I$sqlite_dir/include" + LDFLAGS="$LDFLAGS -L$sqlite_dir/lib" + fi + + if test "${ac_cv_header_sqlite3_h+set}" = set; then + { echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking sqlite3.h usability" >&5 +echo $ECHO_N "checking sqlite3.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +@%:@include <sqlite3.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking sqlite3.h presence" >&5 +echo $ECHO_N "checking sqlite3.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include <sqlite3.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sqlite3.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sqlite3.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sqlite3.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +@%:@@%:@ ---------------------------------- @%:@@%:@ +@%:@@%:@ Report this to [email protected] @%:@@%:@ +@%:@@%:@ ---------------------------------- @%:@@%:@ +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sqlite3_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } + +fi +if test $ac_cv_header_sqlite3_h = yes; then + + { echo "$as_me:$LINENO: checking sqlite library version (via header)" >&5 +echo $ECHO_N "checking sqlite library version (via header)... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "$sqlite_include" +#if SQLITE_VERSION_NUMBER >= $sqlite_min_ver_num +SQLITE_VERSION_OKAY +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "SQLITE_VERSION_OKAY" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: result: okay" >&5 +echo "${ECHO_T}okay" >&6; } + { echo "$as_me:$LINENO: checking for sqlite3_close in -lsqlite3" >&5 +echo $ECHO_N "checking for sqlite3_close in -lsqlite3... $ECHO_C" >&6; } +if test "${ac_cv_lib_sqlite3_sqlite3_close+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsqlite3 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sqlite3_close (); +int +main () +{ +return sqlite3_close (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_sqlite3_sqlite3_close=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_sqlite3_sqlite3_close=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite3_sqlite3_close" >&5 +echo "${ECHO_T}$ac_cv_lib_sqlite3_sqlite3_close" >&6; } +if test $ac_cv_lib_sqlite3_sqlite3_close = yes; then + + triton_lib_sqlite="yes" + if test -z "$sqlite_dir" -o ! -d "$sqlite_dir"; then + TRITON_SQLITE_LIBS="-lsqlite3" + else + TRITON_SQLITE_INCLUDES="-I$sqlite_dir/include" + TRITON_SQLITE_LIBS="-L$sqlite_dir/lib -lsqlite3" + fi + +fi + +else + { echo "$as_me:$LINENO: result: unsupported SQLite version" >&5 +echo "${ECHO_T}unsupported SQLite version" >&6; } +fi +rm -f conftest* + + +fi + + + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + + fi + + if test -z "$triton_lib_sqlite"; then + + if test -n "$PKG_CONFIG"; then + { echo "$as_me:$LINENO: checking sqlite library version (via pkg-config)" >&5 +echo $ECHO_N "checking sqlite library version (via pkg-config)... $ECHO_C" >&6; } + sqlite_version=`$PKG_CONFIG $SQLITE_PKGNAME --modversion --silence-errors` + + if test -n "$sqlite_version"; then + + sqlite_major=`expr $sqlite_version : '\([0-9]*\)'` + sqlite_minor=`expr $sqlite_version : '[0-9]*\.\([0-9]*\)'` + sqlite_micro=`expr $sqlite_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'` + if test -z "$sqlite_micro"; then + sqlite_micro=0 + fi + sqlite_ver_num=`expr $sqlite_major \* 1000000 \ + \+ $sqlite_minor \* 1000 \ + \+ $sqlite_micro` + + + if test "$sqlite_ver_num" -ge "$sqlite_min_ver_num"; then + { echo "$as_me:$LINENO: result: $sqlite_version" >&5 +echo "${ECHO_T}$sqlite_version" >&6; } + triton_lib_sqlite="yes" + TRITON_SQLITE_INCLUDES="`$PKG_CONFIG $SQLITE_PKGNAME --cflags`" + TRITON_SQLITE_LIBS="`$PKG_CONFIG $SQLITE_PKGNAME --libs`" + else + { echo "$as_me:$LINENO: result: none or unsupported $sqlite_version" >&5 +echo "${ECHO_T}none or unsupported $sqlite_version" >&6; } + fi + fi + fi + + if test -z "$triton_lib_sqlite"; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + fi + + fi + +# if test -z "$triton_lib_sqlite"; then +# TRITON_DOWNLOAD_SQLITE +# fi + if test -n "$triton_lib_sqlite"; then + BUILD_OSD=1 + fi + +fi + + + + + + + + +ac_config_files="$ac_config_files Makefile src/common/module.mk src/common/tests/module.mk src/common/resources/timer/test/module.mk src/common/resources/timer/module.mk src/common/resources/scheduling/module.mk src/common/resources/scheduling/test/module.mk src/net/module.mk src/net/mpi/module.mk src/net/mpi/test/module.mk src/remote/module.mk src/aesop/module.mk src/aesop/parser/module.mk src/aesop/examples/module.mk src/aesop/parser/tests/remote/module.mk src/aesop/parser/tests/blocking/module.mk" + +cat >confcache <<\_ACEOF +# 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, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIB@&t@OBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by grayskull $as_me 0.1.1, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to <[email protected]>." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +grayskull config.status 0.1.1 +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX +@%:@@%:@ Running $as_me. @%:@@%:@ +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "gs-config.h") CONFIG_HEADERS="$CONFIG_HEADERS gs-config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/common/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/module.mk" ;; + "src/common/tests/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/tests/module.mk" ;; + "src/common/resources/timer/test/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/timer/test/module.mk" ;; + "src/common/resources/timer/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/timer/module.mk" ;; + "src/common/resources/scheduling/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/scheduling/module.mk" ;; + "src/common/resources/scheduling/test/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/scheduling/test/module.mk" ;; + "src/net/module.mk") CONFIG_FILES="$CONFIG_FILES src/net/module.mk" ;; + "src/net/mpi/module.mk") CONFIG_FILES="$CONFIG_FILES src/net/mpi/module.mk" ;; + "src/net/mpi/test/module.mk") CONFIG_FILES="$CONFIG_FILES src/net/mpi/test/module.mk" ;; + "src/remote/module.mk") CONFIG_FILES="$CONFIG_FILES src/remote/module.mk" ;; + "src/aesop/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/module.mk" ;; + "src/aesop/parser/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/parser/module.mk" ;; + "src/aesop/examples/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/examples/module.mk" ;; + "src/aesop/parser/tests/remote/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/parser/tests/remote/module.mk" ;; + "src/aesop/parser/tests/blocking/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/parser/tests/blocking/module.mk" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +TRITON_VERSION!$TRITON_VERSION$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +GHC!$GHC$ac_delim +DB_CFLAGS!$DB_CFLAGS$ac_delim +DB_LIB!$DB_LIB$ac_delim +MPICC!$MPICC$ac_delim +MPICFLAGS!$MPICFLAGS$ac_delim +MPILDFLAGS!$MPILDFLAGS$ac_delim +MPILIBS!$MPILIBS$ac_delim +BUILD_MPI!$BUILD_MPI$ac_delim +BUILD_ABSOLUTE_TOP!$BUILD_ABSOLUTE_TOP$ac_delim +SRC_RELATIVE_TOP!$SRC_RELATIVE_TOP$ac_delim +SRC_ABSOLUTE_TOP!$SRC_ABSOLUTE_TOP$ac_delim +QUIET_COMPILE!$QUIET_COMPILE$ac_delim +STRICT_CFLAGS!$STRICT_CFLAGS$ac_delim +AE_DEBUG!$AE_DEBUG$ac_delim +ENABLE_COVERAGE!$ENABLE_COVERAGE$ac_delim +LIBCFLAGS!$LIBCFLAGS$ac_delim +THREAD_LIB!$THREAD_LIB$ac_delim +TRITON_SQLITE_INCLUDES!$TRITON_SQLITE_INCLUDES$ac_delim +TRITON_SQLITE_LIBS!$TRITON_SQLITE_LIBS$ac_delim +BUILD_OSD!$BUILD_OSD$ac_delim +LIB@&t@OBJS!$LIB@&t@OBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS <conf$$subs.sed +rm -f conf$$subs.sed +cat >>$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # +_ACEOF + +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #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. +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : +do + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines conftest.tail + +echo "ac_result=$ac_in" >>$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" + ;; + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/code/autom4te.cache/requests b/code/autom4te.cache/requests new file mode 100644 index 0000000..8078591 --- /dev/null +++ b/code/autom4te.cache/requests @@ -0,0 +1,95 @@ +# This file was generated by Autom4te Sat Apr 28 03:44:04 GMT 2007. +# It contains the lists of macros which have been traced. +# It can be safely removed. + +@request = ( + bless( [ + '0', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + 'maint/config/bdb.m4', + 'maint/config/sqlite.m4', + 'configure.ac' + ], + { + 'm4_pattern_allow' => 1, + '_AM_AUTOCONF_VERSION' => 1, + 'TRITON_DOWNLOAD_SQLITE' => 1, + 'm4_pattern_forbid' => 1, + 'TRITON_SQLITE_PKG_CONFIG' => 1, + 'include' => 1, + 'AC_DEFUN_ONCE' => 1, + 'TRITON_SQLITE_DIR_CONFIG' => 1, + 'm4_include' => 1, + 'AC_DEFUN' => 1, + 'AX_BERKELEY_DB' => 1, + '_m4_warn' => 1, + 'TRITON_SQLITE_VERNUM_PARSE' => 1, + 'TRITON_SQLITE_MIN_VERNUM_PARSE' => 1, + 'AU_DEFUN' => 1, + 'TRITON_LIB_SQLITE' => 1 + } + ], 'Autom4te::Request' ), + bless( [ + '1', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + 'aclocal.m4', + 'configure.ac' + ], + { + '_LT_AC_TAGCONFIG' => 1, + 'AM_PROG_F77_C_O' => 1, + 'AC_INIT' => 1, + 'm4_pattern_forbid' => 1, + 'AC_CANONICAL_TARGET' => 1, + 'AC_SUBST' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'AC_FC_SRCEXT' => 1, + 'AC_CANONICAL_HOST' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_CONFIG_SUBDIRS' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, + 'AC_REQUIRE_AUX_FILE' => 1, + 'AC_CONFIG_LINKS' => 1, + 'm4_sinclude' => 1, + 'LT_SUPPORTED_TAG' => 1, + 'AM_MAINTAINER_MODE' => 1, + 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, + '_m4_warn' => 1, + 'AM_PROG_CXX_C_O' => 1, + 'AM_ENABLE_MULTILIB' => 1, + 'AC_CONFIG_FILES' => 1, + 'include' => 1, + 'LT_INIT' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AC_LIBSOURCE' => 1, + 'AM_PROG_FC_C_O' => 1, + 'AC_CANONICAL_BUILD' => 1, + 'AC_FC_FREEFORM' => 1, + 'AH_OUTPUT' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + 'sinclude' => 1, + 'AM_PROG_CC_C_O' => 1, + 'm4_pattern_allow' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AM_CONDITIONAL' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'm4_include' => 1, + 'AC_SUBST_TRACE' => 1 + } + ], 'Autom4te::Request' ) + ); + diff --git a/code/autom4te.cache/traces.0 b/code/autom4te.cache/traces.0 new file mode 100644 index 0000000..9b2bf29 --- /dev/null +++ b/code/autom4te.cache/traces.0 @@ -0,0 +1,635 @@ +m4trace:maint/config/bdb.m4:2: -1- AC_DEFUN([AX_BERKELEY_DB], [ + dbpath=ifelse([$1], ,,$1) + + DB_LDFLAGS= + dnl + dnl if the db is specified, try to link with -ldb + dnl otherwise try -ldb4, then -ldb3, then -ldb + dnl $lib set to notfound on link failure + dnl + AC_MSG_CHECKING([for db library]) + oldlibs=$LIBS + lib=notfound + + if test "x$dbpath" != "x" ; then + oldcflags=$CFLAGS + for dbheader in db4 db3 notfound; do + AC_COMPILE_IFELSE( + [#include "$dbpath/include/$dbheader/db.h"], + [DB_CFLAGS="-I$dbpath/include/$dbheader/" + break]) + done + + if test "x$dbheader" = "xnotfound"; then + AC_COMPILE_IFELSE( + [#include "$dbpath/include/db.h"], + [DB_CFLAGS="-I$dbpath/include/"], + [AC_MSG_FAILURE( + Invalid libdb path specified. No db.h found.)]) + fi + + DB_LDFLAGS="-L${dbpath}/lib" + LDFLAGS="$DB_LDFLAGS ${LDFLAGS}" + + LIBS="${oldlibs} -ldb -lpthread" + DB_LIB="-ldb" + CFLAGS="$DB_CFLAGS $oldcflags" + AC_TRY_LINK( + [#include <db.h>], + [DB *dbp; db_create(&dbp, NULL, 0);], + lib=db) + CFLAGS=$oldcflags + + else + for lib in db4 db3 db notfound; do + LIBS="${oldlibs} -l$lib -lpthread" + DB_LIB="-l$lib" + AC_TRY_LINK( + [#include <db.h>], + [DB *dbp; db_create(&dbp, NULL, 0);], + [break]) + done + fi + + dnl reset LIBS value and just report through DB_LIB + LIBS=$oldlibs + if test "x$lib" = "xnotfound" ; then + AC_MSG_ERROR(could not find DB libraries) + else + AC_MSG_RESULT($lib) + fi + AC_SUBST(DB_CFLAGS) + AC_SUBST(DB_LIB) + + dnl See if we have a new enough version of Berkeley DB; needed for + dnl compilation of trove-dbpf component + dnl AC_MSG_CHECKING(whether version of Berkeley DB is new enough) + dnl AC_TRY_COMPILE([ + dnl #include <db.h> + dnl ], [ + dnl #if DB_VERSION_MAJOR < 4 + dnl #error "DB_VERSION_MAJOR < 4; need newer Berkeley DB implementation" + dnl #endif + dnl ], AC_MSG_RESULT(yes), + dnl AC_MSG_RESULT(no) + dnl AC_MSG_ERROR(Need newer (4.x.x or later) version of Berkeley DB. + dnl try: http://www.sleepycat.com/download/index.shtml + dnl or: /parl/pcarns/rpms/db4-4.0.14-1mdk.src.rpm (to build rpm)) + dnl ) + + dnl Test to check for DB_ENV variable to error callback fn. Then + dnl test to see if third parameter must be const (related but not + dnl exactly the same). + AC_MSG_CHECKING(for dbenv parameter to DB error callback function) + oldcflags=$CFLAGS + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + AC_TRY_COMPILE([ + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + const char *message) + { + return; + } + ], [ + DB *db; + + db->set_errcall(db, error_callback_fn); + ], AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK, 1, + Define if DB error callback function takes dbenv parameter) + have_dbenv_parameter_to_db_error_callback=yes, + AC_MSG_RESULT(no) + have_dbenv_parameter_to_db_error_callback=no) + + if test "x$have_dbenv_parameter_to_db_error_callback" = "xyes" ; then + dnl Test if compilation succeeds without const; we expect that it will + dnl not. + dnl NOTE: still using -Werror! + AC_MSG_CHECKING(if third parameter to error callback function is const) + AC_TRY_COMPILE([ + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + char *message) + { + return; + } + ], [ + DB *db; + + db->set_errcall(db, error_callback_fn); + ], AC_MSG_RESULT(no), + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK, 1, + Define if third param (message) to DB error callback function is const)) + fi + + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + dnl Test to check for unknown third param to DB stat (four params + dnl total). The unknown parameter is a function ptr so that the + dnl the user can pass in a replcaement for malloc. + dnl Note: this is a holdover from relatively old DB implementations, + dnl while the txnid parameter is new. So we don't test for the old + dnl unknown parameter if we found the new one. + AC_MSG_CHECKING(for DB stat with malloc function ptr) + AC_TRY_COMPILE([ + #include <db.h> + #include <stdlib.h> + ], [ + int ret = 0; + DB *db = db; + int dummy = 0; + u_int32_t flags = 0; + + ret = db->stat(db, &dummy, malloc, flags); + ], AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_UNKNOWN_PARAMETER_TO_DB_STAT, 1, + Define if DB stat function takes malloc function ptr) + have_db_stat_malloc=yes, + AC_MSG_RESULT(no) + have_db_stat_malloc=no) + + dnl Test to check for txnid parameter to DB stat (DB 4.3.xx+) + if test "x$have_db_stat_malloc" = "xno" ; then + + AC_MSG_CHECKING(for txnid parameter to DB stat function) + AC_TRY_COMPILE([ + #include <db.h> + ], [ + int ret = 0; + DB *db = db; + DB_TXN *txnid = txnid; + u_int32_t flags = 0; + + ret = db->stat(db, txnid, NULL, flags); + ], AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_TXNID_PARAMETER_TO_DB_STAT, 1, + Define if DB stat function takes txnid parameter) + have_txnid_param_to_stat=yes, + AC_MSG_RESULT(no) + have_txnid_param_to_stat=no) + + fi + + dnl Test to check for txnid parameter to DB open (DB4.1+) + AC_MSG_CHECKING(for txnid parameter to DB open function) + AC_TRY_COMPILE([ + #include <db.h> + ], [ + int ret = 0; + DB *db = NULL; + DB_TXN *txnid = NULL; + char *file = NULL; + char *database = NULL; + DBTYPE type = 0; + u_int32_t flags = 0; + int mode = 0; + + ret = db->open(db, txnid, file, database, type, flags, mode); + ], AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_TXNID_PARAMETER_TO_DB_OPEN, 1, + Define if DB open function takes a txnid parameter), + AC_MSG_RESULT(no)) + + dnl check for DB_DIRTY_READ (it is not in db-3.2.9, for example) + AC_MSG_CHECKING(for DB_DIRTY_READ flag) + AC_TRY_COMPILE([ + #include <db.h> + ], [ + u_int32_t flags = DB_DIRTY_READ; + ], AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DB_DIRTY_READ, 1, [Define if db library has DB_DIRTY_READ flag]), + AC_MSG_RESULT(no)) + + dnl check for DB_BUFFER_SMALL (it is returned by dbp->get in db-4.4 and up) + AC_MSG_CHECKING(for DB_BUFFER_SMALL error) + AC_TRY_COMPILE([ + #include <db.h> + ], [ + int res = DB_BUFFER_SMALL; + res++; + ], AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DB_BUFFER_SMALL, 1, [Define if db library has DB_BUFFER_SMALL error]), + AC_MSG_RESULT(no)) + + dnl Test to check for db->get_pagesize + AC_MSG_CHECKING(for berkeley db get_pagesize function) + AC_TRY_COMPILE([ + #include <db.h> + ], [ + int ret = 0; + DB *db = NULL; + int pagesize; + + ret = db->get_pagesize(db, &pagesize); + ], AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DB_GET_PAGESIZE, 1, [Define if DB has get_pagesize function]), + AC_MSG_RESULT(no)) + + CFLAGS="$oldcflags" +]) +m4trace:maint/config/sqlite.m4:12: -1- AC_DEFUN([TRITON_LIB_SQLITE], [ + SQLITE_MINIMUM_VER="$1" + SQLITE_PKGNAME="sqlite3" + BUILD_OSD= + + TRITON_SQLITE_MIN_VERNUM_PARSE + + AC_MSG_NOTICE([checking sqlite library]) + + AC_ARG_WITH(sqlite, + AS_HELP_STRING([--with-sqlite=PREFIX], + [Use installed SQLite library or amalgamation file.]), + [ + if test "$withval" = "yes" ; then + AC_MSG_ERROR([--with-sqlite requires an argument.]) + else + sqlite_dir="$withval" + fi + + if test -d $sqlite_dir; then + dnl pointed at an sqlite installation + TRITON_SQLITE_DIR_CONFIG($sqlite_dir) + else + AC_MSG_ERROR([$sqlite_dir is not a directory.]) + fi + + # if a --with-sqlite argument was given, then we should complain if we + # can't find it there + if test -z "$triton_lib_sqlite"; then + AC_MSG_ERROR([no suitable sqlite found in $sqlite_dir]) + else + BUILD_OSD=1 + fi + ], + [ + if test -z "$triton_lib_sqlite"; then + dnl check the "standard" location of /usr + TRITON_SQLITE_DIR_CONFIG() + fi + + if test -z "$triton_lib_sqlite"; then + dnl no --with-sqlite switch, and no sqlite subdir, look in PATH + TRITON_SQLITE_PKG_CONFIG + fi + +# if test -z "$triton_lib_sqlite"; then +# TRITON_DOWNLOAD_SQLITE +# fi + if test -n "$triton_lib_sqlite"; then + BUILD_OSD=1 + fi + ]) + + AC_SUBST(TRITON_SQLITE_INCLUDES) + AC_SUBST(TRITON_SQLITE_LIBS) + AC_SUBST(BUILD_OSD) +]) +m4trace:maint/config/sqlite.m4:74: -1- AC_DEFUN([TRITON_SQLITE_PKG_CONFIG], [ + if test -n "$PKG_CONFIG"; then + AC_MSG_CHECKING([sqlite library version (via pkg-config)]) + sqlite_version=`$PKG_CONFIG $SQLITE_PKGNAME --modversion --silence-errors` + + if test -n "$sqlite_version"; then + TRITON_SQLITE_VERNUM_PARSE + + if test "$sqlite_ver_num" -ge "$sqlite_min_ver_num"; then + AC_MSG_RESULT([$sqlite_version]) + triton_lib_sqlite="yes" + TRITON_SQLITE_INCLUDES="`$PKG_CONFIG $SQLITE_PKGNAME --cflags`" + TRITON_SQLITE_LIBS="`$PKG_CONFIG $SQLITE_PKGNAME --libs`" + else + AC_MSG_RESULT([none or unsupported $sqlite_version]) + fi + fi + fi + + if test -z "$triton_lib_sqlite"; then + AC_MSG_RESULT(no) + fi +]) +m4trace:maint/config/sqlite.m4:103: -1- AC_DEFUN([TRITON_SQLITE_DIR_CONFIG], [ + if test -z "$1"; then + sqlite_dir="" + sqlite_include="sqlite3.h" + else + sqlite_dir="$1" + sqlite_include="$1/include/sqlite3.h" + fi + + save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + + if test ! -z "$1"; then + CPPFLAGS="$CPPFLAGS -I$sqlite_dir/include" + LDFLAGS="$LDFLAGS -L$sqlite_dir/lib" + fi + + AC_CHECK_HEADER(sqlite3.h, + [ + AC_MSG_CHECKING([sqlite library version (via header)]) + AC_EGREP_CPP(SQLITE_VERSION_OKAY,[ +#include "$sqlite_include" +#if SQLITE_VERSION_NUMBER >= $sqlite_min_ver_num +SQLITE_VERSION_OKAY +#endif], + [AC_MSG_RESULT([okay]) + AC_CHECK_LIB(sqlite3, sqlite3_close, [ + triton_lib_sqlite="yes" + if test -z "$sqlite_dir" -o ! -d "$sqlite_dir"; then + TRITON_SQLITE_LIBS="-lsqlite3" + else + TRITON_SQLITE_INCLUDES="-I$sqlite_dir/include" + TRITON_SQLITE_LIBS="-L$sqlite_dir/lib -lsqlite3" + fi + ])], [AC_MSG_RESULT([unsupported SQLite version])]) + ]) + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" +]) +m4trace:maint/config/sqlite.m4:148: -1- AC_DEFUN([TRITON_SQLITE_VERNUM_PARSE], [ + sqlite_major=`expr $sqlite_version : '\([[0-9]]*\)'` + sqlite_minor=`expr $sqlite_version : '[[0-9]]*\.\([[0-9]]*\)'` + sqlite_micro=`expr $sqlite_version : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` + if test -z "$sqlite_micro"; then + sqlite_micro=0 + fi + sqlite_ver_num=`expr $sqlite_major \* 1000000 \ + \+ $sqlite_minor \* 1000 \ + \+ $sqlite_micro` +]) +m4trace:maint/config/sqlite.m4:165: -1- AC_DEFUN([TRITON_SQLITE_MIN_VERNUM_PARSE], [ + sqlite_min_major=`expr $SQLITE_MINIMUM_VER : '\([[0-9]]*\)'` + sqlite_min_minor=`expr $SQLITE_MINIMUM_VER : '[[0-9]]*\.\([[0-9]]*\)'` + sqlite_min_micro=`expr $SQLITE_MINIMUM_VER : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` + sqlite_min_ver_num=`expr $sqlite_min_major \* 1000000 \ + \+ $sqlite_min_minor \* 1000 \ + \+ $sqlite_min_micro` +]) +m4trace:maint/config/sqlite.m4:177: -1- AC_DEFUN([TRITON_DOWNLOAD_SQLITE], [ + echo "" + echo "An appropriate version of sqlite could not be found. We require" + echo "at least ${SQLITE_MINIMUM_VER}. Please install a newer sqlite " + echo "on this system." + echo "" + AC_MSG_ERROR([Grayskull requires SQLite]) +]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([^_?A[CHUM]_]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([_AC_]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) +m4trace:configure.ac:16: -1- m4_pattern_allow([^AS_FLAGS$]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([^_?m4_]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([^dnl$]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([^_?AS_]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^SHELL$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PATH_SEPARATOR$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^exec_prefix$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^prefix$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^program_transform_name$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^bindir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^sbindir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^libexecdir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^datarootdir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^datadir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^sysconfdir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^sharedstatedir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^localstatedir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^includedir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^oldincludedir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^docdir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^infodir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^htmldir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^dvidir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^pdfdir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^psdir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^libdir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^localedir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^mandir$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^DEFS$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^ECHO_C$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^ECHO_N$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^ECHO_T$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^build_alias$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^host_alias$]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^target_alias$]) +m4trace:configure.ac:18: -1- m4_pattern_allow([^TRITON_VERSION$]) +m4trace:configure.ac:20: -1- m4_pattern_allow([^TRITON_VERSION_MAJOR$]) +m4trace:configure.ac:21: -1- m4_pattern_allow([^TRITON_VERSION_MINOR$]) +m4trace:configure.ac:22: -1- m4_pattern_allow([^TRITON_VERSION_SUB$]) +m4trace:configure.ac:27: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) +m4trace:configure.ac:27: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) +m4trace:configure.ac:27: -1- m4_pattern_allow([^INSTALL_DATA$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^ac_ct_CC$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^EXEEXT$]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^OBJEXT$]) +m4trace:configure.ac:29: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:29: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:29: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^STDC_HEADERS$]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^WORDS_BIGENDIAN$]) +m4trace:configure.ac:33: -1- m4_pattern_allow([^SIZEOF_LONG_INT$]) +m4trace:configure.ac:34: -1- m4_pattern_allow([^SIZEOF_VOID_P$]) +m4trace:configure.ac:42: -1- m4_pattern_allow([^GHC$]) +m4trace:configure.ac:42: -1- m4_pattern_allow([^GHC$]) +m4trace:configure.ac:46: -1- m4_pattern_allow([^GHC$]) +m4trace:configure.ac:52: -1- AX_BERKELEY_DB([${withval}]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2414: AC_TRY_LINK is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2414: AC_TRY_LINK is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^DB_CFLAGS$]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^DB_LIB$]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_UNKNOWN_PARAMETER_TO_DB_STAT$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_TXNID_PARAMETER_TO_DB_STAT$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_TXNID_PARAMETER_TO_DB_OPEN$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_DIRTY_READ$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_BUFFER_SMALL$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_GET_PAGESIZE$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -1- AX_BERKELEY_DB([""]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2414: AC_TRY_LINK is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2414: AC_TRY_LINK is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^DB_CFLAGS$]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^DB_LIB$]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_UNKNOWN_PARAMETER_TO_DB_STAT$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_TXNID_PARAMETER_TO_DB_STAT$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_TXNID_PARAMETER_TO_DB_OPEN$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_DIRTY_READ$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_BUFFER_SMALL$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_GET_PAGESIZE$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:70: -1- m4_pattern_allow([^MPICC$]) +m4trace:configure.ac:71: -1- m4_pattern_allow([^MPICFLAGS$]) +m4trace:configure.ac:72: -1- m4_pattern_allow([^MPILDFLAGS$]) +m4trace:configure.ac:73: -1- m4_pattern_allow([^MPILIBS$]) +m4trace:configure.ac:74: -1- m4_pattern_allow([^BUILD_MPI$]) +m4trace:configure.ac:80: -1- m4_pattern_allow([^BUILD_ABSOLUTE_TOP$]) +m4trace:configure.ac:81: -1- m4_pattern_allow([^SRC_RELATIVE_TOP$]) +m4trace:configure.ac:82: -1- m4_pattern_allow([^SRC_ABSOLUTE_TOP$]) +m4trace:configure.ac:84: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.ac:85: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:86: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.ac:87: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:93: -1- m4_pattern_allow([^QUIET_COMPILE$]) +m4trace:configure.ac:99: -1- m4_pattern_allow([^STRICT_CFLAGS$]) +m4trace:configure.ac:105: -1- m4_pattern_allow([^AE_DEBUG$]) +m4trace:configure.ac:112: -1- m4_pattern_allow([^ENABLE_COVERAGE$]) +m4trace:configure.ac:127: -1- m4_pattern_allow([^LIBCFLAGS$]) +m4trace:configure.ac:128: -1- m4_pattern_allow([^THREAD_LIB$]) +m4trace:configure.ac:130: -1- TRITON_LIB_SQLITE([3.0.0]) +m4trace:configure.ac:130: -1- TRITON_SQLITE_MIN_VERNUM_PARSE +m4trace:configure.ac:130: -1- TRITON_SQLITE_DIR_CONFIG([$sqlite_dir]) +m4trace:configure.ac:130: -1- TRITON_SQLITE_DIR_CONFIG([]) +m4trace:configure.ac:130: -1- TRITON_SQLITE_PKG_CONFIG +m4trace:configure.ac:130: -1- TRITON_SQLITE_VERNUM_PARSE +m4trace:configure.ac:130: -1- m4_pattern_allow([^TRITON_SQLITE_INCLUDES$]) +m4trace:configure.ac:130: -1- m4_pattern_allow([^TRITON_SQLITE_LIBS$]) +m4trace:configure.ac:130: -1- m4_pattern_allow([^BUILD_OSD$]) +m4trace:configure.ac:138: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments. +You should run autoupdate.], []) +m4trace:configure.ac:138: -1- m4_pattern_allow([^LIB@&t@OBJS$]) +m4trace:configure.ac:138: -1- m4_pattern_allow([^LTLIBOBJS$]) diff --git a/code/autom4te.cache/traces.1 b/code/autom4te.cache/traces.1 new file mode 100644 index 0000000..0a9a6b2 --- /dev/null +++ b/code/autom4te.cache/traces.1 @@ -0,0 +1,563 @@ +m4trace:aclocal.m4:14: -1- m4_include([maint/config/bdb.m4]) +m4trace:aclocal.m4:15: -1- m4_include([maint/config/sqlite.m4]) +m4trace:configure.ac:16: -1- AC_INIT([grayskull], [0.1.1], [[email protected]]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([^_?A[CHUM]_]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([_AC_]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) +m4trace:configure.ac:16: -1- m4_pattern_allow([^AS_FLAGS$]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([^_?m4_]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([^dnl$]) +m4trace:configure.ac:16: -1- m4_pattern_forbid([^_?AS_]) +m4trace:configure.ac:16: -1- AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([SHELL]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^SHELL$]) +m4trace:configure.ac:16: -1- AC_SUBST([PATH_SEPARATOR]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([PATH_SEPARATOR]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PATH_SEPARATOR$]) +m4trace:configure.ac:16: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([PACKAGE_NAME]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.ac:16: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([PACKAGE_TARNAME]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.ac:16: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([PACKAGE_VERSION]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.ac:16: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([PACKAGE_STRING]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.ac:16: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.ac:16: -1- AC_SUBST([exec_prefix], [NONE]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([exec_prefix]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^exec_prefix$]) +m4trace:configure.ac:16: -1- AC_SUBST([prefix], [NONE]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([prefix]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^prefix$]) +m4trace:configure.ac:16: -1- AC_SUBST([program_transform_name], [s,x,x,]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([program_transform_name]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^program_transform_name$]) +m4trace:configure.ac:16: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([bindir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^bindir$]) +m4trace:configure.ac:16: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([sbindir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^sbindir$]) +m4trace:configure.ac:16: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([libexecdir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^libexecdir$]) +m4trace:configure.ac:16: -1- AC_SUBST([datarootdir], ['${prefix}/share']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([datarootdir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^datarootdir$]) +m4trace:configure.ac:16: -1- AC_SUBST([datadir], ['${datarootdir}']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([datadir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^datadir$]) +m4trace:configure.ac:16: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([sysconfdir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^sysconfdir$]) +m4trace:configure.ac:16: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([sharedstatedir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^sharedstatedir$]) +m4trace:configure.ac:16: -1- AC_SUBST([localstatedir], ['${prefix}/var']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([localstatedir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^localstatedir$]) +m4trace:configure.ac:16: -1- AC_SUBST([includedir], ['${prefix}/include']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([includedir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^includedir$]) +m4trace:configure.ac:16: -1- AC_SUBST([oldincludedir], ['/usr/include']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([oldincludedir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^oldincludedir$]) +m4trace:configure.ac:16: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], + ['${datarootdir}/doc/${PACKAGE_TARNAME}'], + ['${datarootdir}/doc/${PACKAGE}'])]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([docdir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^docdir$]) +m4trace:configure.ac:16: -1- AC_SUBST([infodir], ['${datarootdir}/info']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([infodir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^infodir$]) +m4trace:configure.ac:16: -1- AC_SUBST([htmldir], ['${docdir}']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([htmldir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^htmldir$]) +m4trace:configure.ac:16: -1- AC_SUBST([dvidir], ['${docdir}']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([dvidir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^dvidir$]) +m4trace:configure.ac:16: -1- AC_SUBST([pdfdir], ['${docdir}']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([pdfdir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^pdfdir$]) +m4trace:configure.ac:16: -1- AC_SUBST([psdir], ['${docdir}']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([psdir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^psdir$]) +m4trace:configure.ac:16: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([libdir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^libdir$]) +m4trace:configure.ac:16: -1- AC_SUBST([localedir], ['${datarootdir}/locale']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([localedir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^localedir$]) +m4trace:configure.ac:16: -1- AC_SUBST([mandir], ['${datarootdir}/man']) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([mandir]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^mandir$]) +m4trace:configure.ac:16: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.ac:16: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ +#undef PACKAGE_NAME]) +m4trace:configure.ac:16: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.ac:16: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME]) +m4trace:configure.ac:16: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.ac:16: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ +#undef PACKAGE_VERSION]) +m4trace:configure.ac:16: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.ac:16: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING]) +m4trace:configure.ac:16: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.ac:16: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT]) +m4trace:configure.ac:16: -1- AC_SUBST([DEFS]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([DEFS]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^DEFS$]) +m4trace:configure.ac:16: -1- AC_SUBST([ECHO_C]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([ECHO_C]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^ECHO_C$]) +m4trace:configure.ac:16: -1- AC_SUBST([ECHO_N]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([ECHO_N]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^ECHO_N$]) +m4trace:configure.ac:16: -1- AC_SUBST([ECHO_T]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([ECHO_T]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^ECHO_T$]) +m4trace:configure.ac:16: -1- AC_SUBST([LIBS]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.ac:16: -1- AC_SUBST([build_alias]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([build_alias]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^build_alias$]) +m4trace:configure.ac:16: -1- AC_SUBST([host_alias]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([host_alias]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^host_alias$]) +m4trace:configure.ac:16: -1- AC_SUBST([target_alias]) +m4trace:configure.ac:16: -1- AC_SUBST_TRACE([target_alias]) +m4trace:configure.ac:16: -1- m4_pattern_allow([^target_alias$]) +m4trace:configure.ac:18: -1- AC_SUBST([TRITON_VERSION]) +m4trace:configure.ac:18: -1- AC_SUBST_TRACE([TRITON_VERSION]) +m4trace:configure.ac:18: -1- m4_pattern_allow([^TRITON_VERSION$]) +m4trace:configure.ac:20: -1- AC_DEFINE_TRACE_LITERAL([TRITON_VERSION_MAJOR]) +m4trace:configure.ac:20: -1- m4_pattern_allow([^TRITON_VERSION_MAJOR$]) +m4trace:configure.ac:20: -1- AH_OUTPUT([TRITON_VERSION_MAJOR], [/* major version number */ +#undef TRITON_VERSION_MAJOR]) +m4trace:configure.ac:21: -1- AC_DEFINE_TRACE_LITERAL([TRITON_VERSION_MINOR]) +m4trace:configure.ac:21: -1- m4_pattern_allow([^TRITON_VERSION_MINOR$]) +m4trace:configure.ac:21: -1- AH_OUTPUT([TRITON_VERSION_MINOR], [/* minor version number */ +#undef TRITON_VERSION_MINOR]) +m4trace:configure.ac:22: -1- AC_DEFINE_TRACE_LITERAL([TRITON_VERSION_SUB]) +m4trace:configure.ac:22: -1- m4_pattern_allow([^TRITON_VERSION_SUB$]) +m4trace:configure.ac:22: -1- AH_OUTPUT([TRITON_VERSION_SUB], [/* sub version number */ +#undef TRITON_VERSION_SUB]) +m4trace:configure.ac:24: -1- AC_CONFIG_HEADERS([gs-config.h]) +m4trace:configure.ac:25: -1- AC_CONFIG_AUX_DIR([maint/config]) +m4trace:configure.ac:27: -1- AC_REQUIRE_AUX_FILE([install-sh]) +m4trace:configure.ac:27: -1- AC_SUBST([INSTALL_PROGRAM]) +m4trace:configure.ac:27: -1- AC_SUBST_TRACE([INSTALL_PROGRAM]) +m4trace:configure.ac:27: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) +m4trace:configure.ac:27: -1- AC_SUBST([INSTALL_SCRIPT]) +m4trace:configure.ac:27: -1- AC_SUBST_TRACE([INSTALL_SCRIPT]) +m4trace:configure.ac:27: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) +m4trace:configure.ac:27: -1- AC_SUBST([INSTALL_DATA]) +m4trace:configure.ac:27: -1- AC_SUBST_TRACE([INSTALL_DATA]) +m4trace:configure.ac:27: -1- m4_pattern_allow([^INSTALL_DATA$]) +m4trace:configure.ac:28: -1- AC_SUBST([CC]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:28: -1- AC_SUBST([CFLAGS]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([CFLAGS]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.ac:28: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:28: -1- AC_SUBST([LIBS]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.ac:28: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:28: -1- AC_SUBST([CC]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:28: -1- AC_SUBST([CC]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:28: -1- AC_SUBST([CC]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:28: -1- AC_SUBST([CC]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^CC$]) +m4trace:configure.ac:28: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([ac_ct_CC]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^ac_ct_CC$]) +m4trace:configure.ac:28: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([EXEEXT]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^EXEEXT$]) +m4trace:configure.ac:28: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) +m4trace:configure.ac:28: -1- AC_SUBST_TRACE([OBJEXT]) +m4trace:configure.ac:28: -1- m4_pattern_allow([^OBJEXT$]) +m4trace:configure.ac:29: -1- AC_SUBST([CPP]) +m4trace:configure.ac:29: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.ac:29: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:29: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.ac:29: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.ac:29: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:29: -1- AC_SUBST([CPP]) +m4trace:configure.ac:29: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.ac:29: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.ac:31: -1- AC_SUBST([GREP]) +m4trace:configure.ac:31: -1- AC_SUBST_TRACE([GREP]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.ac:31: -1- AC_SUBST([GREP]) +m4trace:configure.ac:31: -1- AC_SUBST_TRACE([GREP]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.ac:31: -1- AC_SUBST([EGREP]) +m4trace:configure.ac:31: -1- AC_SUBST_TRACE([EGREP]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.ac:31: -1- AC_SUBST([EGREP]) +m4trace:configure.ac:31: -1- AC_SUBST_TRACE([EGREP]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.ac:31: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^STDC_HEADERS$]) +m4trace:configure.ac:31: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS]) +m4trace:configure.ac:31: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H]) +m4trace:configure.ac:31: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H]) +m4trace:configure.ac:31: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H]) +m4trace:configure.ac:31: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H]) +m4trace:configure.ac:31: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H]) +m4trace:configure.ac:31: -1- AH_OUTPUT([HAVE_STRINTRITON_H], [/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINTRITON_H]) +m4trace:configure.ac:31: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H]) +m4trace:configure.ac:31: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H]) +m4trace:configure.ac:31: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H]) +m4trace:configure.ac:31: -1- AC_DEFINE_TRACE_LITERAL([WORDS_BIGENDIAN]) +m4trace:configure.ac:31: -1- m4_pattern_allow([^WORDS_BIGENDIAN$]) +m4trace:configure.ac:31: -1- AH_OUTPUT([WORDS_BIGENDIAN], [/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN]) +m4trace:configure.ac:33: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_LONG_INT]) +m4trace:configure.ac:33: -1- m4_pattern_allow([^SIZEOF_LONG_INT$]) +m4trace:configure.ac:33: -1- AH_OUTPUT([SIZEOF_LONG_INT], [/* The size of `long int\', as computed by sizeof. */ +#undef SIZEOF_LONG_INT]) +m4trace:configure.ac:34: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_VOID_P]) +m4trace:configure.ac:34: -1- m4_pattern_allow([^SIZEOF_VOID_P$]) +m4trace:configure.ac:34: -1- AH_OUTPUT([SIZEOF_VOID_P], [/* The size of `void *\', as computed by sizeof. */ +#undef SIZEOF_VOID_P]) +m4trace:configure.ac:42: -1- AC_SUBST([GHC]) +m4trace:configure.ac:42: -1- AC_SUBST_TRACE([GHC]) +m4trace:configure.ac:42: -1- m4_pattern_allow([^GHC$]) +m4trace:configure.ac:42: -1- AC_SUBST([GHC]) +m4trace:configure.ac:42: -1- AC_SUBST_TRACE([GHC]) +m4trace:configure.ac:42: -1- m4_pattern_allow([^GHC$]) +m4trace:configure.ac:46: -1- AC_SUBST([GHC]) +m4trace:configure.ac:46: -1- AC_SUBST_TRACE([GHC]) +m4trace:configure.ac:46: -1- m4_pattern_allow([^GHC$]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2414: AC_TRY_LINK is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2414: AC_TRY_LINK is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -1- AC_SUBST([DB_CFLAGS]) +m4trace:configure.ac:52: -1- AC_SUBST_TRACE([DB_CFLAGS]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^DB_CFLAGS$]) +m4trace:configure.ac:52: -1- AC_SUBST([DB_LIB]) +m4trace:configure.ac:52: -1- AC_SUBST_TRACE([DB_LIB]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^DB_LIB$]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK], [/* Define if DB error callback function takes dbenv parameter */ +#undef HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK], [/* Define if third param (message) to DB error callback function is const */ +#undef HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_UNKNOWN_PARAMETER_TO_DB_STAT]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_UNKNOWN_PARAMETER_TO_DB_STAT$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_UNKNOWN_PARAMETER_TO_DB_STAT], [/* Define if DB stat function takes malloc function ptr */ +#undef HAVE_UNKNOWN_PARAMETER_TO_DB_STAT]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_TXNID_PARAMETER_TO_DB_STAT]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_TXNID_PARAMETER_TO_DB_STAT$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_TXNID_PARAMETER_TO_DB_STAT], [/* Define if DB stat function takes txnid parameter */ +#undef HAVE_TXNID_PARAMETER_TO_DB_STAT]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_TXNID_PARAMETER_TO_DB_OPEN]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_TXNID_PARAMETER_TO_DB_OPEN$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_TXNID_PARAMETER_TO_DB_OPEN], [/* Define if DB open function takes a txnid parameter */ +#undef HAVE_TXNID_PARAMETER_TO_DB_OPEN]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_DB_DIRTY_READ]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_DIRTY_READ$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_DB_DIRTY_READ], [/* Define if db library has DB_DIRTY_READ flag */ +#undef HAVE_DB_DIRTY_READ]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_DB_BUFFER_SMALL]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_BUFFER_SMALL$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_DB_BUFFER_SMALL], [/* Define if db library has DB_BUFFER_SMALL error */ +#undef HAVE_DB_BUFFER_SMALL]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_DB_GET_PAGESIZE]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_GET_PAGESIZE$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_DB_GET_PAGESIZE], [/* Define if DB has get_pagesize function */ +#undef HAVE_DB_GET_PAGESIZE]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2414: AC_TRY_LINK is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2414: AC_TRY_LINK is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -1- AC_SUBST([DB_CFLAGS]) +m4trace:configure.ac:52: -1- AC_SUBST_TRACE([DB_CFLAGS]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^DB_CFLAGS$]) +m4trace:configure.ac:52: -1- AC_SUBST([DB_LIB]) +m4trace:configure.ac:52: -1- AC_SUBST_TRACE([DB_LIB]) +m4trace:configure.ac:52: -1- m4_pattern_allow([^DB_LIB$]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK], [/* Define if DB error callback function takes dbenv parameter */ +#undef HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK], [/* Define if third param (message) to DB error callback function is const */ +#undef HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_UNKNOWN_PARAMETER_TO_DB_STAT]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_UNKNOWN_PARAMETER_TO_DB_STAT$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_UNKNOWN_PARAMETER_TO_DB_STAT], [/* Define if DB stat function takes malloc function ptr */ +#undef HAVE_UNKNOWN_PARAMETER_TO_DB_STAT]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_TXNID_PARAMETER_TO_DB_STAT]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_TXNID_PARAMETER_TO_DB_STAT$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_TXNID_PARAMETER_TO_DB_STAT], [/* Define if DB stat function takes txnid parameter */ +#undef HAVE_TXNID_PARAMETER_TO_DB_STAT]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_TXNID_PARAMETER_TO_DB_OPEN]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_TXNID_PARAMETER_TO_DB_OPEN$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_TXNID_PARAMETER_TO_DB_OPEN], [/* Define if DB open function takes a txnid parameter */ +#undef HAVE_TXNID_PARAMETER_TO_DB_OPEN]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_DB_DIRTY_READ]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_DIRTY_READ$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_DB_DIRTY_READ], [/* Define if db library has DB_DIRTY_READ flag */ +#undef HAVE_DB_DIRTY_READ]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_DB_BUFFER_SMALL]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_BUFFER_SMALL$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_DB_BUFFER_SMALL], [/* Define if db library has DB_BUFFER_SMALL error */ +#undef HAVE_DB_BUFFER_SMALL]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:52: -2- AC_DEFINE_TRACE_LITERAL([HAVE_DB_GET_PAGESIZE]) +m4trace:configure.ac:52: -2- m4_pattern_allow([^HAVE_DB_GET_PAGESIZE$]) +m4trace:configure.ac:52: -2- AH_OUTPUT([HAVE_DB_GET_PAGESIZE], [/* Define if DB has get_pagesize function */ +#undef HAVE_DB_GET_PAGESIZE]) +m4trace:configure.ac:52: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2367: AC_TRY_COMPILE is expanded from... +maint/config/bdb.m4:2: AX_BERKELEY_DB is expanded from... +../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... +../../lib/autoconf/general.m4:1382: AC_ARG_WITH is expanded from... +configure.ac:52: the top level]) +m4trace:configure.ac:70: -1- AC_SUBST([MPICC]) +m4trace:configure.ac:70: -1- AC_SUBST_TRACE([MPICC]) +m4trace:configure.ac:70: -1- m4_pattern_allow([^MPICC$]) +m4trace:configure.ac:71: -1- AC_SUBST([MPICFLAGS]) +m4trace:configure.ac:71: -1- AC_SUBST_TRACE([MPICFLAGS]) +m4trace:configure.ac:71: -1- m4_pattern_allow([^MPICFLAGS$]) +m4trace:configure.ac:72: -1- AC_SUBST([MPILDFLAGS]) +m4trace:configure.ac:72: -1- AC_SUBST_TRACE([MPILDFLAGS]) +m4trace:configure.ac:72: -1- m4_pattern_allow([^MPILDFLAGS$]) +m4trace:configure.ac:73: -1- AC_SUBST([MPILIBS]) +m4trace:configure.ac:73: -1- AC_SUBST_TRACE([MPILIBS]) +m4trace:configure.ac:73: -1- m4_pattern_allow([^MPILIBS$]) +m4trace:configure.ac:74: -1- AC_SUBST([BUILD_MPI]) +m4trace:configure.ac:74: -1- AC_SUBST_TRACE([BUILD_MPI]) +m4trace:configure.ac:74: -1- m4_pattern_allow([^BUILD_MPI$]) +m4trace:configure.ac:80: -1- AC_SUBST([BUILD_ABSOLUTE_TOP]) +m4trace:configure.ac:80: -1- AC_SUBST_TRACE([BUILD_ABSOLUTE_TOP]) +m4trace:configure.ac:80: -1- m4_pattern_allow([^BUILD_ABSOLUTE_TOP$]) +m4trace:configure.ac:81: -1- AC_SUBST([SRC_RELATIVE_TOP]) +m4trace:configure.ac:81: -1- AC_SUBST_TRACE([SRC_RELATIVE_TOP]) +m4trace:configure.ac:81: -1- m4_pattern_allow([^SRC_RELATIVE_TOP$]) +m4trace:configure.ac:82: -1- AC_SUBST([SRC_ABSOLUTE_TOP]) +m4trace:configure.ac:82: -1- AC_SUBST_TRACE([SRC_ABSOLUTE_TOP]) +m4trace:configure.ac:82: -1- m4_pattern_allow([^SRC_ABSOLUTE_TOP$]) +m4trace:configure.ac:84: -1- AC_SUBST([CFLAGS]) +m4trace:configure.ac:84: -1- AC_SUBST_TRACE([CFLAGS]) +m4trace:configure.ac:84: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.ac:85: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.ac:85: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.ac:85: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.ac:86: -1- AC_SUBST([LIBS]) +m4trace:configure.ac:86: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.ac:86: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.ac:87: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.ac:87: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.ac:87: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.ac:93: -1- AC_SUBST([QUIET_COMPILE]) +m4trace:configure.ac:93: -1- AC_SUBST_TRACE([QUIET_COMPILE]) +m4trace:configure.ac:93: -1- m4_pattern_allow([^QUIET_COMPILE$]) +m4trace:configure.ac:99: -1- AC_SUBST([STRICT_CFLAGS]) +m4trace:configure.ac:99: -1- AC_SUBST_TRACE([STRICT_CFLAGS]) +m4trace:configure.ac:99: -1- m4_pattern_allow([^STRICT_CFLAGS$]) +m4trace:configure.ac:105: -1- AC_SUBST([AE_DEBUG]) +m4trace:configure.ac:105: -1- AC_SUBST_TRACE([AE_DEBUG]) +m4trace:configure.ac:105: -1- m4_pattern_allow([^AE_DEBUG$]) +m4trace:configure.ac:112: -1- AC_SUBST([ENABLE_COVERAGE]) +m4trace:configure.ac:112: -1- AC_SUBST_TRACE([ENABLE_COVERAGE]) +m4trace:configure.ac:112: -1- m4_pattern_allow([^ENABLE_COVERAGE$]) +m4trace:configure.ac:127: -1- AC_SUBST([LIBCFLAGS]) +m4trace:configure.ac:127: -1- AC_SUBST_TRACE([LIBCFLAGS]) +m4trace:configure.ac:127: -1- m4_pattern_allow([^LIBCFLAGS$]) +m4trace:configure.ac:128: -1- AC_SUBST([THREAD_LIB]) +m4trace:configure.ac:128: -1- AC_SUBST_TRACE([THREAD_LIB]) +m4trace:configure.ac:128: -1- m4_pattern_allow([^THREAD_LIB$]) +m4trace:configure.ac:130: -1- AC_SUBST([TRITON_SQLITE_INCLUDES]) +m4trace:configure.ac:130: -1- AC_SUBST_TRACE([TRITON_SQLITE_INCLUDES]) +m4trace:configure.ac:130: -1- m4_pattern_allow([^TRITON_SQLITE_INCLUDES$]) +m4trace:configure.ac:130: -1- AC_SUBST([TRITON_SQLITE_LIBS]) +m4trace:configure.ac:130: -1- AC_SUBST_TRACE([TRITON_SQLITE_LIBS]) +m4trace:configure.ac:130: -1- m4_pattern_allow([^TRITON_SQLITE_LIBS$]) +m4trace:configure.ac:130: -1- AC_SUBST([BUILD_OSD]) +m4trace:configure.ac:130: -1- AC_SUBST_TRACE([BUILD_OSD]) +m4trace:configure.ac:130: -1- m4_pattern_allow([^BUILD_OSD$]) +m4trace:configure.ac:138: -1- AC_CONFIG_FILES([Makefile +src/common/module.mk +src/common/tests/module.mk +src/common/resources/timer/test/module.mk +src/common/resources/timer/module.mk +src/common/resources/scheduling/module.mk +src/common/resources/scheduling/test/module.mk +src/net/module.mk +src/net/mpi/module.mk +src/net/mpi/test/module.mk +src/remote/module.mk +src/aesop/module.mk +src/aesop/parser/module.mk +src/aesop/examples/module.mk +src/aesop/parser/tests/remote/module.mk +src/aesop/parser/tests/blocking/module.mk]) +m4trace:configure.ac:138: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments. +You should run autoupdate.], []) +m4trace:configure.ac:138: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) +m4trace:configure.ac:138: -1- m4_pattern_allow([^LIB@&t@OBJS$]) +m4trace:configure.ac:138: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([LTLIBOBJS]) +m4trace:configure.ac:138: -1- m4_pattern_allow([^LTLIBOBJS$]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([top_builddir]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([srcdir]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([abs_srcdir]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([top_srcdir]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([abs_top_srcdir]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([builddir]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([abs_builddir]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([abs_top_builddir]) +m4trace:configure.ac:138: -1- AC_SUBST_TRACE([INSTALL]) diff --git a/code/configure b/code/configure new file mode 100755 index 0000000..d4ac3cd --- /dev/null +++ b/code/configure @@ -0,0 +1,7798 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.61 for grayskull 0.1.1. +# +# Report bugs to <[email protected]>. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell [email protected] about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 </dev/null 6>&1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='grayskull' +PACKAGE_TARNAME='grayskull' +PACKAGE_VERSION='0.1.1' +PACKAGE_STRING='grayskull 0.1.1' +PACKAGE_BUGREPORT='[email protected]' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#ifdef HAVE_STRINTRITON_H +# include <strings.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +TRITON_VERSION +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +CPP +GREP +EGREP +GHC +DB_CFLAGS +DB_LIB +MPICC +MPICFLAGS +MPILDFLAGS +MPILIBS +BUILD_MPI +BUILD_ABSOLUTE_TOP +SRC_RELATIVE_TOP +SRC_ABSOLUTE_TOP +QUIET_COMPILE +STRICT_CFLAGS +AE_DEBUG +ENABLE_COVERAGE +LIBCFLAGS +THREAD_LIB +TRITON_SQLITE_INCLUDES +TRITON_SQLITE_LIBS +BUILD_OSD +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + 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 | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 | -n) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + 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 "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + 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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # 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 <<_ACEOF +\`configure' configures grayskull 0.1.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/grayskull] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of grayskull 0.1.1:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-verbose Enables verbose output during build process + --enable-strict Turn on strict compiler warnings + --enable-aesop-debug Turn on debugging of the gs-parser + --enable-coverage Enable coverage analysis (disables optimizations) + --disable-thread-safety Disables thread safety in the client library + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-ghc=<dir> Location of installed ghc + --with-db=<dir> Location of installed DB package +(default=/usr) + --with-mpi=<dir> Location of the MPI installation + --with-sqlite=PREFIX Use installed SQLite library or amalgamation file. + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to <[email protected]>. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +grayskull configure 0.1.1 +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by grayskull $as_me 0.1.1, which was +generated by GNU Autoconf 2.61. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + +cat >>confdefs.h <<_ACEOF +#define TRITON_VERSION_MAJOR $TRITON_MAJOR +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define TRITON_VERSION_MINOR $TRITON_MINOR +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define TRITON_VERSION_SUB $TRITON_SUB +_ACEOF + + +ac_config_headers="$ac_config_headers gs-config.h" + +ac_aux_dir= +for ac_dir in maint/config "$srcdir"/maint/config; 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 + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in maint/config \"$srcdir\"/maint/config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in maint/config \"$srcdir\"/maint/config" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +# 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 +# AmigaOS /C/install, which installs bootblocks on floppy discs +# 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" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /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 + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_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. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&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}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +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 "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to [email protected]." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&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 +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ctype.h> +#include <stdlib.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_bigendian=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + +{ echo "$as_me:$LINENO: checking for long int" >&5 +echo $ECHO_N "checking for long int... $ECHO_C" >&6; } +if test "${ac_cv_type_long_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long int ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_int=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_int" >&5 +echo "${ECHO_T}$ac_cv_type_long_int" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of long int" >&5 +echo $ECHO_N "checking size of long int... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_long_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long_int=$ac_lo;; +'') if test "$ac_cv_type_long_int" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_long_int=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long int ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +#include <stdio.h> +#include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long_int=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_long_int" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_long_int=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG_INT $ac_cv_sizeof_long_int +_ACEOF + + +{ echo "$as_me:$LINENO: checking for void *" >&5 +echo $ECHO_N "checking for void *... $ECHO_C" >&6; } +if test "${ac_cv_type_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef void * ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_void_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_void_p=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 +echo "${ECHO_T}$ac_cv_type_void_p" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of void *" >&5 +echo $ECHO_N "checking size of void *... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_void_p=$ac_lo;; +'') if test "$ac_cv_type_void_p" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_void_p=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef void * ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +#include <stdio.h> +#include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_void_p=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_void_p" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_void_p=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p +_ACEOF + + + +{ echo "$as_me:$LINENO: checking for required gcc" >&5 +echo $ECHO_N "checking for required gcc... $ECHO_C" >&6; } +if test "x$GCC" = "x"; then + { { echo "$as_me:$LINENO: error: no" >&5 +echo "$as_me: error: no" >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + + +# Check whether --with-ghc was given. +if test "${with_ghc+set}" = set; then + withval=$with_ghc; # Extract the first word of "${withval}/bin/ghc", so it can be a program name with args. +set dummy ${withval}/bin/ghc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GHC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GHC in + [\\/]* | ?:[\\/]*) + ac_cv_path_GHC="$GHC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GHC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +GHC=$ac_cv_path_GHC +if test -n "$GHC"; then + { echo "$as_me:$LINENO: result: $GHC" >&5 +echo "${ECHO_T}$GHC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +else + # Extract the first word of "ghc", so it can be a program name with args. +set dummy ghc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GHC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GHC in + [\\/]* | ?:[\\/]*) + ac_cv_path_GHC="$GHC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GHC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +GHC=$ac_cv_path_GHC +if test -n "$GHC"; then + { echo "$as_me:$LINENO: result: $GHC" >&5 +echo "${ECHO_T}$GHC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi + + + + +# Check whether --with-db was given. +if test "${with_db+set}" = set; then + withval=$with_db; + dbpath=${withval} + + DB_LDFLAGS= + { echo "$as_me:$LINENO: checking for db library" >&5 +echo $ECHO_N "checking for db library... $ECHO_C" >&6; } + oldlibs=$LIBS + lib=notfound + + if test "x$dbpath" != "x" ; then + oldcflags=$CFLAGS + for dbheader in db4 db3 notfound; do + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/$dbheader/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/$dbheader/" + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + + if test "x$dbheader" = "xnotfound"; then + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { echo "$as_me:$LINENO: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&5 +echo "$as_me: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + DB_LDFLAGS="-L${dbpath}/lib" + LDFLAGS="$DB_LDFLAGS ${LDFLAGS}" + + LIBS="${oldlibs} -ldb -lpthread" + DB_LIB="-ldb" + CFLAGS="$DB_CFLAGS $oldcflags" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + lib=db +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$oldcflags + + else + for lib in db4 db3 db notfound; do + LIBS="${oldlibs} -l$lib -lpthread" + DB_LIB="-l$lib" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + done + fi + + LIBS=$oldlibs + if test "x$lib" = "xnotfound" ; then + { { echo "$as_me:$LINENO: error: could not find DB libraries" >&5 +echo "$as_me: error: could not find DB libraries" >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: result: $lib" >&5 +echo "${ECHO_T}$lib" >&6; } + fi + + + + + { echo "$as_me:$LINENO: checking for dbenv parameter to DB error callback function" >&5 +echo $ECHO_N "checking for dbenv parameter to DB error callback function... $ECHO_C" >&6; } + oldcflags=$CFLAGS + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + const char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + + have_dbenv_parameter_to_db_error_callback=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_dbenv_parameter_to_db_error_callback=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_dbenv_parameter_to_db_error_callback" = "xyes" ; then + { echo "$as_me:$LINENO: checking if third parameter to error callback function is const" >&5 +echo $ECHO_N "checking if third parameter to error callback function is const... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + { echo "$as_me:$LINENO: checking for DB stat with malloc function ptr" >&5 +echo $ECHO_N "checking for DB stat with malloc function ptr... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + #include <stdlib.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + int dummy = 0; + u_int32_t flags = 0; + + ret = db->stat(db, &dummy, malloc, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UNKNOWN_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_db_stat_malloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_db_stat_malloc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_db_stat_malloc" = "xno" ; then + + { echo "$as_me:$LINENO: checking for txnid parameter to DB stat function" >&5 +echo $ECHO_N "checking for txnid parameter to DB stat function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + DB_TXN *txnid = txnid; + u_int32_t flags = 0; + + ret = db->stat(db, txnid, NULL, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TXNID_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_txnid_param_to_stat=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_txnid_param_to_stat=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi + + { echo "$as_me:$LINENO: checking for txnid parameter to DB open function" >&5 +echo $ECHO_N "checking for txnid parameter to DB open function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + DB_TXN *txnid = NULL; + char *file = NULL; + char *database = NULL; + DBTYPE type = 0; + u_int32_t flags = 0; + int mode = 0; + + ret = db->open(db, txnid, file, database, type, flags, mode); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TXNID_PARAMETER_TO_DB_OPEN 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_DIRTY_READ flag" >&5 +echo $ECHO_N "checking for DB_DIRTY_READ flag... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + u_int32_t flags = DB_DIRTY_READ; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DB_DIRTY_READ 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_BUFFER_SMALL error" >&5 +echo $ECHO_N "checking for DB_BUFFER_SMALL error... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int res = DB_BUFFER_SMALL; + res++; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DB_BUFFER_SMALL 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for berkeley db get_pagesize function" >&5 +echo $ECHO_N "checking for berkeley db get_pagesize function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + int pagesize; + + ret = db->get_pagesize(db, &pagesize); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DB_GET_PAGESIZE 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + CFLAGS="$oldcflags" + +else + + dbpath="" + + DB_LDFLAGS= + { echo "$as_me:$LINENO: checking for db library" >&5 +echo $ECHO_N "checking for db library... $ECHO_C" >&6; } + oldlibs=$LIBS + lib=notfound + + if test "x$dbpath" != "x" ; then + oldcflags=$CFLAGS + for dbheader in db4 db3 notfound; do + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/$dbheader/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/$dbheader/" + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + + if test "x$dbheader" = "xnotfound"; then + cat >conftest.$ac_ext <<_ACEOF +#include "$dbpath/include/db.h" +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + DB_CFLAGS="-I$dbpath/include/" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { echo "$as_me:$LINENO: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&5 +echo "$as_me: error: Invalid libdb path specified. No db.h found. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + DB_LDFLAGS="-L${dbpath}/lib" + LDFLAGS="$DB_LDFLAGS ${LDFLAGS}" + + LIBS="${oldlibs} -ldb -lpthread" + DB_LIB="-ldb" + CFLAGS="$DB_CFLAGS $oldcflags" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + lib=db +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$oldcflags + + else + for lib in db4 db3 db notfound; do + LIBS="${oldlibs} -l$lib -lpthread" + DB_LIB="-l$lib" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <db.h> +int +main () +{ +DB *dbp; db_create(&dbp, NULL, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + done + fi + + LIBS=$oldlibs + if test "x$lib" = "xnotfound" ; then + { { echo "$as_me:$LINENO: error: could not find DB libraries" >&5 +echo "$as_me: error: could not find DB libraries" >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: result: $lib" >&5 +echo "${ECHO_T}$lib" >&6; } + fi + + + + + { echo "$as_me:$LINENO: checking for dbenv parameter to DB error callback function" >&5 +echo $ECHO_N "checking for dbenv parameter to DB error callback function... $ECHO_C" >&6; } + oldcflags=$CFLAGS + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + const char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + + have_dbenv_parameter_to_db_error_callback=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_dbenv_parameter_to_db_error_callback=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_dbenv_parameter_to_db_error_callback" = "xyes" ; then + { echo "$as_me:$LINENO: checking if third parameter to error callback function is const" >&5 +echo $ECHO_N "checking if third parameter to error callback function is const... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + + void error_callback_fn(const DB_ENV *dbenv, + const char *prefix, + char *message) + { + return; + } + +int +main () +{ + + DB *db; + + db->set_errcall(db, error_callback_fn); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK 1 +_ACEOF + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + CFLAGS="$USR_CFLAGS $DB_CFLAGS -Werror" + { echo "$as_me:$LINENO: checking for DB stat with malloc function ptr" >&5 +echo $ECHO_N "checking for DB stat with malloc function ptr... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + #include <stdlib.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + int dummy = 0; + u_int32_t flags = 0; + + ret = db->stat(db, &dummy, malloc, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UNKNOWN_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_db_stat_malloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_db_stat_malloc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + if test "x$have_db_stat_malloc" = "xno" ; then + + { echo "$as_me:$LINENO: checking for txnid parameter to DB stat function" >&5 +echo $ECHO_N "checking for txnid parameter to DB stat function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = db; + DB_TXN *txnid = txnid; + u_int32_t flags = 0; + + ret = db->stat(db, txnid, NULL, flags); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TXNID_PARAMETER_TO_DB_STAT 1 +_ACEOF + + have_txnid_param_to_stat=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + have_txnid_param_to_stat=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi + + { echo "$as_me:$LINENO: checking for txnid parameter to DB open function" >&5 +echo $ECHO_N "checking for txnid parameter to DB open function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + DB_TXN *txnid = NULL; + char *file = NULL; + char *database = NULL; + DBTYPE type = 0; + u_int32_t flags = 0; + int mode = 0; + + ret = db->open(db, txnid, file, database, type, flags, mode); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TXNID_PARAMETER_TO_DB_OPEN 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_DIRTY_READ flag" >&5 +echo $ECHO_N "checking for DB_DIRTY_READ flag... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + u_int32_t flags = DB_DIRTY_READ; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DB_DIRTY_READ 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for DB_BUFFER_SMALL error" >&5 +echo $ECHO_N "checking for DB_BUFFER_SMALL error... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int res = DB_BUFFER_SMALL; + res++; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DB_BUFFER_SMALL 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { echo "$as_me:$LINENO: checking for berkeley db get_pagesize function" >&5 +echo $ECHO_N "checking for berkeley db get_pagesize function... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <db.h> + +int +main () +{ + + int ret = 0; + DB *db = NULL; + int pagesize; + + ret = db->get_pagesize(db, &pagesize); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DB_GET_PAGESIZE 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + CFLAGS="$oldcflags" + +fi + + + +# Check whether --with-mpi was given. +if test "${with_mpi+set}" = set; then + withval=$with_mpi; if test x$withval = xyes; then + { { echo "$as_me:$LINENO: error: --with-mpi must be given a pathname" >&5 +echo "$as_me: error: --with-mpi must be given a pathname" >&2;} + { (exit 1); exit 1; }; } + else + MPICC="${withval}/bin/mpicc" + MPICFLAGS="-I${withval}/include" + MPILDFLAGS="-L${withval}/lib" + MPILIBS="-lmpich" + BUILD_MPI="1" + fi + +fi + + + + + + + +BUILD_ABSOLUTE_TOP=${PWD} +SRC_RELATIVE_TOP=$srcdir +SRC_ABSOLUTE_TOP=`cd $srcdir; pwd` + + + + + + + + + + +# Check whether --enable-verbose was given. +if test "${enable_verbose+set}" = set; then + enableval=$enable_verbose; QUIET_COMPILE=0 +else + QUIET_COMPILE=1 +fi + + + +STRICT_CFLAGS= +# Check whether --enable-strict was given. +if test "${enable_strict+set}" = set; then + enableval=$enable_strict; STRICT_CFLAGS=1 +fi + + + +AE_DEBUG= +# Check whether --enable-aesop-debug was given. +if test "${enable_aesop_debug+set}" = set; then + enableval=$enable_aesop_debug; AE_DEBUG=1 +fi + + + +# Check whether --enable-coverage was given. +if test "${enable_coverage+set}" = set; then + enableval=$enable_coverage; CFLAGS="$CFLAGS -g -pg -ftest-coverage -O0" + ENABLE_COVERAGE=1 +fi + + + +{ echo "$as_me:$LINENO: checking for client library thread safety support" >&5 +echo $ECHO_N "checking for client library thread safety support... $ECHO_C" >&6; } +# Check whether --enable-thread-safety was given. +if test "${enable_thread_safety+set}" = set; then + enableval=$enable_thread_safety; if test "x$enableval" = "xno" ; then + LIBCFLAGS="$LIBCFLAGS -D__TRITON_NULL_LOCKING__" + THREAD_LIB="" + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +else + LIBCFLAGS="$LIBCFLAGS -D__TRITON_POSIX_LOCKING__" + THREAD_LIB="-lpthread" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +fi + + + + + + + SQLITE_MINIMUM_VER="3.0.0" + SQLITE_PKGNAME="sqlite3" + BUILD_OSD= + + + sqlite_min_major=`expr $SQLITE_MINIMUM_VER : '\([0-9]*\)'` + sqlite_min_minor=`expr $SQLITE_MINIMUM_VER : '[0-9]*\.\([0-9]*\)'` + sqlite_min_micro=`expr $SQLITE_MINIMUM_VER : '[0-9]*\.[0-9]*\.\([0-9]*\)'` + sqlite_min_ver_num=`expr $sqlite_min_major \* 1000000 \ + \+ $sqlite_min_minor \* 1000 \ + \+ $sqlite_min_micro` + + + { echo "$as_me:$LINENO: checking sqlite library" >&5 +echo "$as_me: checking sqlite library" >&6;} + + +# Check whether --with-sqlite was given. +if test "${with_sqlite+set}" = set; then + withval=$with_sqlite; + if test "$withval" = "yes" ; then + { { echo "$as_me:$LINENO: error: --with-sqlite requires an argument." >&5 +echo "$as_me: error: --with-sqlite requires an argument." >&2;} + { (exit 1); exit 1; }; } + else + sqlite_dir="$withval" + fi + + if test -d $sqlite_dir; then + + if test -z "$sqlite_dir"; then + sqlite_dir="" + sqlite_include="sqlite3.h" + else + sqlite_dir="$sqlite_dir" + sqlite_include="$sqlite_dir/include/sqlite3.h" + fi + + save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + + if test ! -z "$sqlite_dir"; then + CPPFLAGS="$CPPFLAGS -I$sqlite_dir/include" + LDFLAGS="$LDFLAGS -L$sqlite_dir/lib" + fi + + if test "${ac_cv_header_sqlite3_h+set}" = set; then + { echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking sqlite3.h usability" >&5 +echo $ECHO_N "checking sqlite3.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <sqlite3.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking sqlite3.h presence" >&5 +echo $ECHO_N "checking sqlite3.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sqlite3.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sqlite3.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sqlite3.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sqlite3.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ---------------------------------- ## +## Report this to [email protected] ## +## ---------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sqlite3_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } + +fi +if test $ac_cv_header_sqlite3_h = yes; then + + { echo "$as_me:$LINENO: checking sqlite library version (via header)" >&5 +echo $ECHO_N "checking sqlite library version (via header)... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "$sqlite_include" +#if SQLITE_VERSION_NUMBER >= $sqlite_min_ver_num +SQLITE_VERSION_OKAY +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "SQLITE_VERSION_OKAY" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: result: okay" >&5 +echo "${ECHO_T}okay" >&6; } + { echo "$as_me:$LINENO: checking for sqlite3_close in -lsqlite3" >&5 +echo $ECHO_N "checking for sqlite3_close in -lsqlite3... $ECHO_C" >&6; } +if test "${ac_cv_lib_sqlite3_sqlite3_close+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsqlite3 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sqlite3_close (); +int +main () +{ +return sqlite3_close (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_sqlite3_sqlite3_close=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_sqlite3_sqlite3_close=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite3_sqlite3_close" >&5 +echo "${ECHO_T}$ac_cv_lib_sqlite3_sqlite3_close" >&6; } +if test $ac_cv_lib_sqlite3_sqlite3_close = yes; then + + triton_lib_sqlite="yes" + if test -z "$sqlite_dir" -o ! -d "$sqlite_dir"; then + TRITON_SQLITE_LIBS="-lsqlite3" + else + TRITON_SQLITE_INCLUDES="-I$sqlite_dir/include" + TRITON_SQLITE_LIBS="-L$sqlite_dir/lib -lsqlite3" + fi + +fi + +else + { echo "$as_me:$LINENO: result: unsupported SQLite version" >&5 +echo "${ECHO_T}unsupported SQLite version" >&6; } +fi +rm -f conftest* + + +fi + + + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + + else + { { echo "$as_me:$LINENO: error: $sqlite_dir is not a directory." >&5 +echo "$as_me: error: $sqlite_dir is not a directory." >&2;} + { (exit 1); exit 1; }; } + fi + + # if a --with-sqlite argument was given, then we should complain if we + # can't find it there + if test -z "$triton_lib_sqlite"; then + { { echo "$as_me:$LINENO: error: no suitable sqlite found in $sqlite_dir" >&5 +echo "$as_me: error: no suitable sqlite found in $sqlite_dir" >&2;} + { (exit 1); exit 1; }; } + else + BUILD_OSD=1 + fi + +else + + if test -z "$triton_lib_sqlite"; then + + if test -z ""; then + sqlite_dir="" + sqlite_include="sqlite3.h" + else + sqlite_dir="" + sqlite_include="/include/sqlite3.h" + fi + + save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + + if test ! -z ""; then + CPPFLAGS="$CPPFLAGS -I$sqlite_dir/include" + LDFLAGS="$LDFLAGS -L$sqlite_dir/lib" + fi + + if test "${ac_cv_header_sqlite3_h+set}" = set; then + { echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking sqlite3.h usability" >&5 +echo $ECHO_N "checking sqlite3.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <sqlite3.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking sqlite3.h presence" >&5 +echo $ECHO_N "checking sqlite3.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sqlite3.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sqlite3.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sqlite3.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sqlite3.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sqlite3.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sqlite3.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ---------------------------------- ## +## Report this to [email protected] ## +## ---------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for sqlite3.h" >&5 +echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sqlite3_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sqlite3_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5 +echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; } + +fi +if test $ac_cv_header_sqlite3_h = yes; then + + { echo "$as_me:$LINENO: checking sqlite library version (via header)" >&5 +echo $ECHO_N "checking sqlite library version (via header)... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "$sqlite_include" +#if SQLITE_VERSION_NUMBER >= $sqlite_min_ver_num +SQLITE_VERSION_OKAY +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "SQLITE_VERSION_OKAY" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: result: okay" >&5 +echo "${ECHO_T}okay" >&6; } + { echo "$as_me:$LINENO: checking for sqlite3_close in -lsqlite3" >&5 +echo $ECHO_N "checking for sqlite3_close in -lsqlite3... $ECHO_C" >&6; } +if test "${ac_cv_lib_sqlite3_sqlite3_close+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsqlite3 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sqlite3_close (); +int +main () +{ +return sqlite3_close (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_sqlite3_sqlite3_close=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_sqlite3_sqlite3_close=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite3_sqlite3_close" >&5 +echo "${ECHO_T}$ac_cv_lib_sqlite3_sqlite3_close" >&6; } +if test $ac_cv_lib_sqlite3_sqlite3_close = yes; then + + triton_lib_sqlite="yes" + if test -z "$sqlite_dir" -o ! -d "$sqlite_dir"; then + TRITON_SQLITE_LIBS="-lsqlite3" + else + TRITON_SQLITE_INCLUDES="-I$sqlite_dir/include" + TRITON_SQLITE_LIBS="-L$sqlite_dir/lib -lsqlite3" + fi + +fi + +else + { echo "$as_me:$LINENO: result: unsupported SQLite version" >&5 +echo "${ECHO_T}unsupported SQLite version" >&6; } +fi +rm -f conftest* + + +fi + + + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + + fi + + if test -z "$triton_lib_sqlite"; then + + if test -n "$PKG_CONFIG"; then + { echo "$as_me:$LINENO: checking sqlite library version (via pkg-config)" >&5 +echo $ECHO_N "checking sqlite library version (via pkg-config)... $ECHO_C" >&6; } + sqlite_version=`$PKG_CONFIG $SQLITE_PKGNAME --modversion --silence-errors` + + if test -n "$sqlite_version"; then + + sqlite_major=`expr $sqlite_version : '\([0-9]*\)'` + sqlite_minor=`expr $sqlite_version : '[0-9]*\.\([0-9]*\)'` + sqlite_micro=`expr $sqlite_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'` + if test -z "$sqlite_micro"; then + sqlite_micro=0 + fi + sqlite_ver_num=`expr $sqlite_major \* 1000000 \ + \+ $sqlite_minor \* 1000 \ + \+ $sqlite_micro` + + + if test "$sqlite_ver_num" -ge "$sqlite_min_ver_num"; then + { echo "$as_me:$LINENO: result: $sqlite_version" >&5 +echo "${ECHO_T}$sqlite_version" >&6; } + triton_lib_sqlite="yes" + TRITON_SQLITE_INCLUDES="`$PKG_CONFIG $SQLITE_PKGNAME --cflags`" + TRITON_SQLITE_LIBS="`$PKG_CONFIG $SQLITE_PKGNAME --libs`" + else + { echo "$as_me:$LINENO: result: none or unsupported $sqlite_version" >&5 +echo "${ECHO_T}none or unsupported $sqlite_version" >&6; } + fi + fi + fi + + if test -z "$triton_lib_sqlite"; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + fi + + fi + +# if test -z "$triton_lib_sqlite"; then +# TRITON_DOWNLOAD_SQLITE +# fi + if test -n "$triton_lib_sqlite"; then + BUILD_OSD=1 + fi + +fi + + + + + + + + +ac_config_files="$ac_config_files Makefile src/common/module.mk src/common/tests/module.mk src/common/resources/timer/test/module.mk src/common/resources/timer/module.mk src/common/resources/scheduling/module.mk src/common/resources/scheduling/test/module.mk src/net/module.mk src/net/mpi/module.mk src/net/mpi/test/module.mk src/remote/module.mk src/aesop/module.mk src/aesop/parser/module.mk src/aesop/examples/module.mk src/aesop/parser/tests/remote/module.mk src/aesop/parser/tests/blocking/module.mk" + +cat >confcache <<\_ACEOF +# 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, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by grayskull $as_me 0.1.1, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to <[email protected]>." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +grayskull config.status 0.1.1 +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "gs-config.h") CONFIG_HEADERS="$CONFIG_HEADERS gs-config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/common/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/module.mk" ;; + "src/common/tests/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/tests/module.mk" ;; + "src/common/resources/timer/test/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/timer/test/module.mk" ;; + "src/common/resources/timer/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/timer/module.mk" ;; + "src/common/resources/scheduling/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/scheduling/module.mk" ;; + "src/common/resources/scheduling/test/module.mk") CONFIG_FILES="$CONFIG_FILES src/common/resources/scheduling/test/module.mk" ;; + "src/net/module.mk") CONFIG_FILES="$CONFIG_FILES src/net/module.mk" ;; + "src/net/mpi/module.mk") CONFIG_FILES="$CONFIG_FILES src/net/mpi/module.mk" ;; + "src/net/mpi/test/module.mk") CONFIG_FILES="$CONFIG_FILES src/net/mpi/test/module.mk" ;; + "src/remote/module.mk") CONFIG_FILES="$CONFIG_FILES src/remote/module.mk" ;; + "src/aesop/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/module.mk" ;; + "src/aesop/parser/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/parser/module.mk" ;; + "src/aesop/examples/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/examples/module.mk" ;; + "src/aesop/parser/tests/remote/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/parser/tests/remote/module.mk" ;; + "src/aesop/parser/tests/blocking/module.mk") CONFIG_FILES="$CONFIG_FILES src/aesop/parser/tests/blocking/module.mk" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +TRITON_VERSION!$TRITON_VERSION$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +GHC!$GHC$ac_delim +DB_CFLAGS!$DB_CFLAGS$ac_delim +DB_LIB!$DB_LIB$ac_delim +MPICC!$MPICC$ac_delim +MPICFLAGS!$MPICFLAGS$ac_delim +MPILDFLAGS!$MPILDFLAGS$ac_delim +MPILIBS!$MPILIBS$ac_delim +BUILD_MPI!$BUILD_MPI$ac_delim +BUILD_ABSOLUTE_TOP!$BUILD_ABSOLUTE_TOP$ac_delim +SRC_RELATIVE_TOP!$SRC_RELATIVE_TOP$ac_delim +SRC_ABSOLUTE_TOP!$SRC_ABSOLUTE_TOP$ac_delim +QUIET_COMPILE!$QUIET_COMPILE$ac_delim +STRICT_CFLAGS!$STRICT_CFLAGS$ac_delim +AE_DEBUG!$AE_DEBUG$ac_delim +ENABLE_COVERAGE!$ENABLE_COVERAGE$ac_delim +LIBCFLAGS!$LIBCFLAGS$ac_delim +THREAD_LIB!$THREAD_LIB$ac_delim +TRITON_SQLITE_INCLUDES!$TRITON_SQLITE_INCLUDES$ac_delim +TRITON_SQLITE_LIBS!$TRITON_SQLITE_LIBS$ac_delim +BUILD_OSD!$BUILD_OSD$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS <conf$$subs.sed +rm -f conf$$subs.sed +cat >>$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # +_ACEOF + +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #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. +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : +do + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines conftest.tail + +echo "ac_result=$ac_in" >>$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" + ;; + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/code/configure.ac b/code/configure.ac new file mode 100644 index 0000000..9907b6b --- /dev/null +++ b/code/configure.ac @@ -0,0 +1,153 @@ +dnl ************************************************************** +dnl GS AUTOCONF SCRIPT +dnl +dnl Process this file with autoconf to produce a configure script. +dnl You may need to use autoheader as well if changing any DEFINEs + +CONFIGURE_TIME=`date -u +"%Y-%m-%d-%H%M%S"` +TRITON_MAJOR=0 +TRITON_MINOR=1 +TRITON_SUB=1 +TRITON_PRE="pre-$CONFIGURE_TIME" + +TRITON_VERSION=$TRITON_MAJOR.$TRITON_MINOR.$TRITON_SUB$TRITON_PRE + +AC_PREREQ(2.50) +AC_INIT(triton, 0.1.1, [email protected]) + +AC_SUBST(TRITON_VERSION) + +AC_DEFINE_UNQUOTED(TRITON_VERSION_MAJOR, $TRITON_MAJOR, major version number) +AC_DEFINE_UNQUOTED(TRITON_VERSION_MINOR, $TRITON_MINOR, minor version number) +AC_DEFINE_UNQUOTED(TRITON_VERSION_SUB, $TRITON_SUB, sub version number) + +AC_CONFIG_HEADER(gs-config.h) +AC_CONFIG_AUX_DIR(maint/config) + +AC_PROG_INSTALL +AC_PROG_CC +AC_PROG_CPP + +AC_C_BIGENDIAN + +AC_CHECK_SIZEOF([long int]) +AC_CHECK_SIZEOF(void *) + +AC_MSG_CHECKING([for required gcc]) +if test "x$GCC" = "x"; then + AC_MSG_ERROR(no) +fi +AC_MSG_RESULT(yes) + +AC_ARG_WITH(ghc, + [ --with-ghc=<dir> Location of installed ghc], + [AC_PATH_PROG(GHC, ${withval}/bin/ghc)], + [AC_PATH_PROG(GHC, ghc)]) +AC_SUBST(GHC) + +dnl +dnl make sure that required db development package is installed +dnl and valid; path can be specified at configure time +dnl +AC_ARG_WITH(db, + [ --with-db=<dir> Location of installed DB package +(default=/usr)], + [AX_BERKELEY_DB(${withval})], + [AX_BERKELEY_DB("")]) + +AC_ARG_WITH(mpi, +[ --with-mpi=<dir> Location of the MPI installation], + if test x$withval = xyes; then + AC_MSG_ERROR(--with-mpi must be given a pathname) + else + MPICC="${withval}/bin/mpicc" + MPICFLAGS="-I${withval}/include" + MPILDFLAGS="-L${withval}/lib" + MPILIBS="-lmpich" + BUILD_MPI="1" + fi +) +AC_SUBST(MPICC) +AC_SUBST(MPICFLAGS) +AC_SUBST(MPILDFLAGS) +AC_SUBST(MPILIBS) +AC_SUBST(BUILD_MPI) + +BUILD_ABSOLUTE_TOP=${PWD} +SRC_RELATIVE_TOP=$srcdir +SRC_ABSOLUTE_TOP=`cd $srcdir; pwd` + +AC_SUBST(BUILD_ABSOLUTE_TOP) +AC_SUBST(SRC_RELATIVE_TOP) +AC_SUBST(SRC_ABSOLUTE_TOP) + +AC_SUBST(CFLAGS) +AC_SUBST(LDFLAGS) +AC_SUBST(LIBS) +AC_SUBST(CPPFLAGS) + +AC_ARG_ENABLE(verbose, +[ --enable-verbose Enables verbose output during build process], +QUIET_COMPILE=0, +QUIET_COMPILE=1) +AC_SUBST(QUIET_COMPILE) + +STRICT_CFLAGS= +AC_ARG_ENABLE(strict, +[ --enable-strict Turn on strict compiler warnings], + STRICT_CFLAGS=1) +AC_SUBST(STRICT_CFLAGS) + +AE_DEBUG= +AC_ARG_ENABLE(aesop-debug, +[ --enable-aesop-debug Turn on debugging of the gs-parser], + AE_DEBUG=1) +AC_SUBST(AE_DEBUG) + +AC_ARG_ENABLE(coverage, +[ --enable-coverage Enable coverage analysis (disables optimizations)], +[ CFLAGS="$CFLAGS -g -pg -ftest-coverage -O0" + ENABLE_COVERAGE=1], +) +AC_SUBST(ENABLE_COVERAGE) + +dnl a mechanism to turn off threads in the client library +AC_MSG_CHECKING([for client library thread safety support]) +AC_ARG_ENABLE(thread-safety, +[ --disable-thread-safety Disables thread safety in the client library], +[if test "x$enableval" = "xno" ; then + LIBCFLAGS="$LIBCFLAGS -D__TRITON_NULL_LOCKING__" + THREAD_LIB="" + AC_MSG_RESULT(no) +fi], +[ LIBCFLAGS="$LIBCFLAGS -D__TRITON_POSIX_LOCKING__" + THREAD_LIB="-lpthread" + AC_MSG_RESULT(yes) ]) + +AC_SUBST(LIBCFLAGS) +AC_SUBST(THREAD_LIB) + +TRITON_LIB_SQLITE(3.0.0) + +dnl src/cosd/prototype/test/module.mk +dnl src/cosd/prototype/module.mk +dnl src/cosd/storage/osd-target/module.mk +dnl src/cosd/storage/test/module.mk +dnl src/cosd/storage/module.mk + +AC_OUTPUT(Makefile +src/common/module.mk +src/common/tests/module.mk +src/common/resources/timer/test/module.mk +src/common/resources/timer/module.mk +src/common/resources/scheduling/module.mk +src/common/resources/scheduling/test/module.mk +src/net/module.mk +src/net/mpi/module.mk +src/net/mpi/test/module.mk +src/remote/module.mk +src/aesop/module.mk +src/aesop/parser/module.mk +src/aesop/examples/module.mk +src/aesop/parser/tests/remote/module.mk +src/aesop/parser/tests/blocking/module.mk) diff --git a/oldcode/maint/config/bdb.m4 b/code/maint/config/bdb.m4 similarity index 100% copy from oldcode/maint/config/bdb.m4 copy to code/maint/config/bdb.m4 diff --git a/oldcode/maint/config/install-sh b/code/maint/config/install-sh similarity index 100% copy from oldcode/maint/config/install-sh copy to code/maint/config/install-sh diff --git a/code/maint/config/sqlite.m4 b/code/maint/config/sqlite.m4 new file mode 100644 index 0000000..677d24c --- /dev/null +++ b/code/maint/config/sqlite.m4 @@ -0,0 +1,185 @@ +dnl TRITON_LIB_SQLITE(minimum_ver) +dnl +dnl Search for a suitable version of sqlite. minimum_ver is a +dnl version string which is the lowest suitable version we can use. +dnl +dnl If a --with-sqlite=PREFIX option is passed, look for a suitable sqlite +dnl installed under the directory PREFIX, otherwise search system +dnl +dnl If the search for sqlite fails, set triton_lib_sqlite to no, otherwise set +dnl it to yes. + +AC_DEFUN([TRITON_LIB_SQLITE], +[ + SQLITE_MINIMUM_VER="$1" + SQLITE_PKGNAME="sqlite3" + BUILD_OSD= + + TRITON_SQLITE_MIN_VERNUM_PARSE + + AC_MSG_NOTICE([checking sqlite library]) + + AC_ARG_WITH(sqlite, + AS_HELP_STRING([--with-sqlite=PREFIX], + [Use installed SQLite library or amalgamation file.]), + [ + if test "$withval" = "yes" ; then + AC_MSG_ERROR([--with-sqlite requires an argument.]) + else + sqlite_dir="$withval" + fi + + if test -d $sqlite_dir; then + dnl pointed at an sqlite installation + TRITON_SQLITE_DIR_CONFIG($sqlite_dir) + else + AC_MSG_ERROR([$sqlite_dir is not a directory.]) + fi + + # if a --with-sqlite argument was given, then we should complain if we + # can't find it there + if test -z "$triton_lib_sqlite"; then + AC_MSG_ERROR([no suitable sqlite found in $sqlite_dir]) + else + BUILD_OSD=1 + fi + ], + [ + if test -z "$triton_lib_sqlite"; then + dnl check the "standard" location of /usr + TRITON_SQLITE_DIR_CONFIG() + fi + + if test -z "$triton_lib_sqlite"; then + dnl no --with-sqlite switch, and no sqlite subdir, look in PATH + TRITON_SQLITE_PKG_CONFIG + fi + +# if test -z "$triton_lib_sqlite"; then +# TRITON_DOWNLOAD_SQLITE +# fi + if test -n "$triton_lib_sqlite"; then + BUILD_OSD=1 + fi + ]) + + AC_SUBST(TRITON_SQLITE_INCLUDES) + AC_SUBST(TRITON_SQLITE_LIBS) + AC_SUBST(BUILD_OSD) +]) + +dnl TRITON_SQLITE_PKG_CONFIG +dnl +dnl Look for sqlite in PATH using pkg-config. +AC_DEFUN([TRITON_SQLITE_PKG_CONFIG], +[ + if test -n "$PKG_CONFIG"; then + AC_MSG_CHECKING([sqlite library version (via pkg-config)]) + sqlite_version=`$PKG_CONFIG $SQLITE_PKGNAME --modversion --silence-errors` + + if test -n "$sqlite_version"; then + TRITON_SQLITE_VERNUM_PARSE + + if test "$sqlite_ver_num" -ge "$sqlite_min_ver_num"; then + AC_MSG_RESULT([$sqlite_version]) + triton_lib_sqlite="yes" + TRITON_SQLITE_INCLUDES="`$PKG_CONFIG $SQLITE_PKGNAME --cflags`" + TRITON_SQLITE_LIBS="`$PKG_CONFIG $SQLITE_PKGNAME --libs`" + else + AC_MSG_RESULT([none or unsupported $sqlite_version]) + fi + fi + fi + + if test -z "$triton_lib_sqlite"; then + AC_MSG_RESULT(no) + fi +]) + +dnl TRITON_SQLITE_DIR_CONFIG(sqlite_dir) +dnl +dnl Check to see if we've got an appropriate sqlite library at sqlite_dir. +dnl If we don't, fail. +AC_DEFUN([TRITON_SQLITE_DIR_CONFIG], +[ + if test -z "$1"; then + sqlite_dir="" + sqlite_include="sqlite3.h" + else + sqlite_dir="$1" + sqlite_include="$1/include/sqlite3.h" + fi + + save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + + if test ! -z "$1"; then + CPPFLAGS="$CPPFLAGS -I$sqlite_dir/include" + LDFLAGS="$LDFLAGS -L$sqlite_dir/lib" + fi + + AC_CHECK_HEADER(sqlite3.h, + [ + AC_MSG_CHECKING([sqlite library version (via header)]) + AC_EGREP_CPP(SQLITE_VERSION_OKAY,[ +#include "$sqlite_include" +#if SQLITE_VERSION_NUMBER >= $sqlite_min_ver_num +SQLITE_VERSION_OKAY +#endif], + [AC_MSG_RESULT([okay]) + AC_CHECK_LIB(sqlite3, sqlite3_close, [ + triton_lib_sqlite="yes" + if test -z "$sqlite_dir" -o ! -d "$sqlite_dir"; then + TRITON_SQLITE_LIBS="-lsqlite3" + else + TRITON_SQLITE_INCLUDES="-I$sqlite_dir/include" + TRITON_SQLITE_LIBS="-L$sqlite_dir/lib -lsqlite3" + fi + ])], [AC_MSG_RESULT([unsupported SQLite version])]) + ]) + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" +]) + +dnl TRITON_SQLITE_VERNUM_PARSE() +dnl +dnl Parse a x.y[.z] version string sqlite_version into a number sqlite_ver_num. +AC_DEFUN([TRITON_SQLITE_VERNUM_PARSE], +[ + sqlite_major=`expr $sqlite_version : '\([[0-9]]*\)'` + sqlite_minor=`expr $sqlite_version : '[[0-9]]*\.\([[0-9]]*\)'` + sqlite_micro=`expr $sqlite_version : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` + if test -z "$sqlite_micro"; then + sqlite_micro=0 + fi + sqlite_ver_num=`expr $sqlite_major \* 1000000 \ + \+ $sqlite_minor \* 1000 \ + \+ $sqlite_micro` +]) + +dnl TRITON_SQLITE_MIN_VERNUM_PARSE() +dnl +dnl Parse a x.y.z version string SQLITE_MINIMUM_VER into a number +dnl sqlite_min_ver_num. +AC_DEFUN([TRITON_SQLITE_MIN_VERNUM_PARSE], +[ + sqlite_min_major=`expr $SQLITE_MINIMUM_VER : '\([[0-9]]*\)'` + sqlite_min_minor=`expr $SQLITE_MINIMUM_VER : '[[0-9]]*\.\([[0-9]]*\)'` + sqlite_min_micro=`expr $SQLITE_MINIMUM_VER : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` + sqlite_min_ver_num=`expr $sqlite_min_major \* 1000000 \ + \+ $sqlite_min_minor \* 1000 \ + \+ $sqlite_min_micro` +]) + +dnl TRITON_DOWNLOAD_SQLITE() +dnl no sqlite found, print out a message telling the user what to do +AC_DEFUN([TRITON_DOWNLOAD_SQLITE], +[ + echo "" + echo "An appropriate version of sqlite could not be found. We require" + echo "at least ${SQLITE_MINIMUM_VER}. Please install a newer sqlite " + echo "on this system." + echo "" + AC_MSG_ERROR([Grayskull requires SQLite]) +]) diff --git a/oldcode/src/gsl/maint/hs/alex-2.3.1.tar.gz b/code/maint/hs/alex-2.3.1.tar.gz similarity index 100% copy from oldcode/src/gsl/maint/hs/alex-2.3.1.tar.gz copy to code/maint/hs/alex-2.3.1.tar.gz diff --git a/oldcode/src/gsl/maint/hs/happy-1.18.4.tar.gz b/code/maint/hs/happy-1.18.4.tar.gz similarity index 100% copy from oldcode/src/gsl/maint/hs/happy-1.18.4.tar.gz copy to code/maint/hs/happy-1.18.4.tar.gz diff --git a/oldcode/src/gsl/maint/hs/language-c-0.3.3.tar.gz b/code/maint/hs/language-c-0.3.3.tar.gz similarity index 100% copy from oldcode/src/gsl/maint/hs/language-c-0.3.3.tar.gz copy to code/maint/hs/language-c-0.3.3.tar.gz diff --git a/oldcode/src/gsl/maint/hs/language-c.patch b/code/maint/hs/language-c.patch similarity index 100% copy from oldcode/src/gsl/maint/hs/language-c.patch copy to code/maint/hs/language-c.patch diff --git a/oldcode/src/gsl/maint/hs/mtl-1.1.0.2.tar.gz b/code/maint/hs/mtl-1.1.0.2.tar.gz similarity index 100% copy from oldcode/src/gsl/maint/hs/mtl-1.1.0.2.tar.gz copy to code/maint/hs/mtl-1.1.0.2.tar.gz diff --git a/code/maint/hs/regex-base-0.93.1.tar.gz b/code/maint/hs/regex-base-0.93.1.tar.gz new file mode 100644 index 0000000..56da286 Binary files /dev/null and b/code/maint/hs/regex-base-0.93.1.tar.gz differ diff --git a/code/maint/hs/regex-pcre-builtin-0.94.2.1.7.7.tar.gz b/code/maint/hs/regex-pcre-builtin-0.94.2.1.7.7.tar.gz new file mode 100644 index 0000000..c64fe0a Binary files /dev/null and b/code/maint/hs/regex-pcre-builtin-0.94.2.1.7.7.tar.gz differ diff --git a/code/maint/hs/regex-posix-0.94.1.tar.gz b/code/maint/hs/regex-posix-0.94.1.tar.gz new file mode 100644 index 0000000..84d5617 Binary files /dev/null and b/code/maint/hs/regex-posix-0.94.1.tar.gz differ diff --git a/oldcode/src/gsl/maint/hs/setup-hs-debian b/code/maint/hs/setup-hs-debian similarity index 100% copy from oldcode/src/gsl/maint/hs/setup-hs-debian copy to code/maint/hs/setup-hs-debian diff --git a/code/maint/hs/setup-hs-local b/code/maint/hs/setup-hs-local new file mode 100755 index 0000000..20762dd --- /dev/null +++ b/code/maint/hs/setup-hs-local @@ -0,0 +1,66 @@ +#!/bin/sh + +OLDPWD=$PWD + +cmdpath=$(echo $0|sed -e "s|^\(.*\)/[^/]*$|\1|") + +verbose= + +while [ x"$1" != x ]; do + case $1 in + -v) verbose=1 + shift + continue;; + *) arg=shift + echo "unknown argument $arg" + exit 1 + esac +done + +install_pkg() +{ + pname=$1 + version=$2 + cd ${OLDPWD} +# wget http://hackage.haskell.org/packages/archive/$pname/$version/$pname-$version.... + tar xvfz ${cmdpath}/$pname-$version.tar.gz 2>&1 >/dev/null + if [ $? != 0 ]; then + echo "Untar of $pname-$version.tar.gz failed!" >&2 + exit 1 + fi + cd $pname-$version + runhaskell Setup configure --prefix=${OLDPWD}/GHC --user 2>&1 >/dev/null + if [ $? != 0 ]; then + echo "configure of $pname-$version failed!" >&2 + exit 1 + fi + runhaskell Setup build 2>&1 >/dev/null + if [ $? != 0 ]; then + echo "build of $pname-$version failed!" >&2 + exit 1 + fi + runhaskell Setup install --user 2>&1 >/dev/null + if [ $? != 0 ]; then + echo "install of $pname-$version failed!" >&2 + exit 1 + fi +} + +vpkg() +{ + if [ "x$verbose" != "x" ]; then + install_pkg $1 $2 + else + echo -n "Installing package $1, version $2..." + install_pkg $1 $2 > /dev/null + echo "done." + fi +} + +vpkg mtl 1.1.0.2 +vpkg happy 1.18.4 +vpkg alex 2.3.1 +vpkg regex-base 0.93.1 +vpkg regex-posix 0.94.1 +vpkg regex-pcre-builtin 0.94.2.1.7.7 + diff --git a/code/maint/hs/setup-langc b/code/maint/hs/setup-langc new file mode 100755 index 0000000..a4dffb5 --- /dev/null +++ b/code/maint/hs/setup-langc @@ -0,0 +1,46 @@ +#!/bin/sh + +#wget --connect-timeout=2 --read-timeout=2 --tries=1 http://hackage.haskell.org/packages/archive/language-c/0.3.1/language-c-0.3.... + +OLDPWD=$PWD + +cmdpath=$(echo $0|sed -e "s|^\(.*\)/[^/]*$|\1|") + +# put happy and alex in the path +PATH=${OLDPWD}/GHC/bin:$PATH + +# use local copy for now +tar xvfz ${cmdpath}/language-c-0.3.3.tar.gz 2>&1 >/dev/null +if [ $? != 0 ]; then + echo "Untar of language-c-0.3.3.tar.gz failed!" + exit 1 +fi + +cd language-c-0.3.3 +patch -p 1 < ${OLDPWD}/${cmdpath}/language-c.patch 2>&1 >/dev/null +if [ $? != 0 ]; then + echo "Patch of language-c failed!" + exit 1 +fi + +runhaskell Setup configure --prefix=${OLDPWD}/GHC 2>&1 >/dev/null +if [ $? != 0]; then + echo "Configure of language-c failed!" + exit 1 +fi + +runhaskell Setup build 2>&1 >/dev/null +if [ $? != 0]; then + echo "Build of language-c failed!" + exit 1 +fi + +runhaskell Setup install --user 2>&1 >/dev/null +if [ $? != 0]; then + echo "Install of language-c failed!" + exit 1 +fi + + +cd - +rm -r language-c-0.3.3 diff --git a/oldcode/src/gsl/prepare b/code/prepare similarity index 100% copy from oldcode/src/gsl/prepare copy to code/prepare diff --git a/code/src/aesop/ae-blocking-parser.h b/code/src/aesop/ae-blocking-parser.h new file mode 100644 index 0000000..2cdffc4 --- /dev/null +++ b/code/src/aesop/ae-blocking-parser.h @@ -0,0 +1,221 @@ +#ifndef __AE_BLOCKING_H__ +#define __AE_BLOCKING_H__ + +/** + * Defines macros that get used by the parser to generate C code for blocking and remote parsers. + * Each macro translates a set of parameters into either a C statement or a C declaration. + * C statements can "one line" statements of the form: + * + * baz = foo(bar); + * + * or can be compound statements: + * + * { + * int foo1, foo2; + * baz1 = bar(foo1); + * baz2 = bar(foo2); + * } + * + * or can be more complex statements: + * + * if(foo == 1) { baz = bar(foo); return baz; } + * + * Note that in the one line case, the statement _must_ end with a semi-colon, whereas in the compound statement + * and if conditional, the curly braces end the statement. + * + * Declarations are of the form: + * + * int bar; + * struct foo foo1, foo2; + * char *baz = "foobar"; + * + * Note that declarations must always end with a semi-colon. + */ + +#include "src/aesop/aesop.h" +#include "src/common/triton-error.h" +#include "src/common/triton-log.h" +#include "src/common/triton-debug.h" + +#define AE_MK_START_OF_BLOCKING(__fname__) \ + triton_debug(ae_debug_blocking_funs, "[START]: %s (%p)\n", #__fname__, ctl); + +#define AE_MK_END_OF_BLOCKING(__fname__) \ + triton_debug(ae_debug_blocking_funs, "[END]: %s (%p)\n", #__fname__, ctl); + +#define AE_MK_RET_DECL() \ + triton_ret_t __ae_postret; + +#define AE_MK_POSTCB_STMT(__fname, __ret_type, __ctl_name, __location) \ + if(__ae_postret != TRITON_SUCCESS) \ + { \ + triton_err(triton_log_default, "INVALID STATE: %s:%d: post call did not return AE_POSTED or AE_COMPLETE, trace exiting\n", #__fname, __location); \ + return; \ + } + +#define AE_MK_POST_STMT(__fname, __ret_type, __ctl_name, __location) \ + if(__ae_postret != TRITON_SUCCESS) \ + { \ + triton_err(triton_log_default, "INVALID STATE: %s:%d: post call did not return AE_POSTED or AE_COMPLETE, trace exiting\n", #__fname, __location); \ + return __ae_postret; \ + } + +#define AE_MK_PBREAK_DECLS() \ + int __ae_cancel_ret; + +#define AE_MK_PBREAK_STMTS(__prefix, __fname, __location) \ +{ \ + done_ctl->parent->hit_pbreak = 1; \ + triton_list_del(&done_ctl->link); \ + __ae_cancel_ret = ae_cancel_children(done_ctl->context, done_ctl->parent); \ + if(__ae_cancel_ret != 0) \ + { \ + triton_err(triton_log_default, "INVALID STATE: %s:%d: ae_cancel_cancel did not return success\n", #__fname, __location); \ + } \ +} + +#define AE_MK_PBRANCH_CB_START_DECLS(__prefix, __ctl_name) \ + int __ae_pwait_done; \ + struct __ctl_name *done_ctl; + +#define AE_MK_PBRANCH_CB_START_STMTS(__prefix) \ +{ \ + done_ctl = __prefix; \ + triton_mutex_lock(&done_ctl->parent->mutex); \ +} + +#define AE_MK_PBRANCH_DELETE_STMTS() \ + triton_list_del(&done_ctl->link); + +#define AE_MK_PBRANCH_DONE_STMTS() \ +{ \ + done_ctl->parent->completed++; \ + __ae_pwait_done = done_ctl->parent->allposted == 1 && done_ctl->parent->posted == done_ctl->parent->completed; \ + triton_mutex_unlock(&done_ctl->parent->mutex); \ + free(done_ctl); \ +} + +#define AE_MK_PBRANCH_CB_DONE_STMTS(__id) \ + if(!__ae_pwait_done) goto __ae_callback_end; + +#define AE_MK_PBRANCH_POST_DONE_STMTS(__pbranch_id) \ + if(!__ae_pwait_done) goto __ae_##__pbranch_id##_end; + +#define AE_MK_CB_DONE_STMTS() \ + goto __ae_callback_end; + +#define AE_MK_CB_DONE_CTL_SET_STMTS(__prefix) \ + __prefix = done_ctl->parent; + +#define AE_MK_PWAIT_INIT_STMTS(__pwait_params, __ctl) \ +{ \ + __ctl->posted = 0; \ + __ctl->completed = 0; \ + __ctl->allposted = 0; \ + __ctl->hit_pbreak = 0; \ + triton_mutex_init(&__ctl->mutex, NULL); \ + __ctl->parent = NULL; \ + triton_list_init(&__ctl->children); \ + __ctl->in_pwait = 1; \ + __ctl->__pwait_params.shared_params = &__ctl->__pwait_params.shared; \ +} + +#define AE_MK_PWAIT_FINISH_STMTS(__ctl, __pwait_id) \ +{ \ + int __ae_pwait_done; \ + triton_mutex_lock(&__ctl->mutex); \ + __ae_pwait_done = __ctl->posted == __ctl->completed; \ + __ctl->allposted = 1; \ + triton_mutex_unlock(&__ctl->mutex); \ + if(!__ae_pwait_done) goto __ae_pwait_##__pwait_id##_not_done; \ +} + +#define AE_MK_PWAIT_NOT_DONE_STMTS(__ctl, __pwait_id) \ + __ae_pwait_##__pwait_id##_not_done: {} + +#define AE_MK_POST_FUN_INIT_STMTS(__ctl) \ +{ \ + __ctl = malloc(sizeof(*__ctl)); \ + if(__ctl == NULL) \ + { \ + return TRITON_ERR_NOMEM; \ + } \ + __ctl->params = &__ctl->fields; \ + __ctl->user_ptr = user_ptr; \ + __ctl->callback = callback; \ + __ctl->hints = hints; \ + __ctl->context = context; \ + triton_mutex_init(&__ctl->mutex, NULL); \ +} + +#define AE_MK_PBRANCH_POST_DECLS(__ctl_type, __ctl) \ + struct __ctl_type * __ctl; + +#define AE_MK_PBRANCH_POST_STMTS(__pwait_ctl, __ctl, __parent_ctl, __ctl_type, __fname, __location, __pbranch_id) \ +{ \ + __ctl = malloc(sizeof(*__ctl)); \ + if(__ctl == NULL) \ + { \ + triton_err(triton_log_default, "INVALID STATE: %s:%d: memory allocation for control structure failed!\n", #__fname, __location); \ + goto __ae_##__pbranch_id##_end; \ + } \ + __ctl->parent = __parent_ctl; \ + __ctl->context = __parent_ctl->context; \ + __ctl->hints = __parent_ctl->hints; \ + __ctl->params = __parent_ctl->params; \ + memcpy(&__ctl->__pwait_ctl.private, &__parent_ctl->__pwait_ctl.private, sizeof(__ctl->__pwait_ctl.private)); \ + __ctl->__pwait_ctl.shared_params = &__parent_ctl->__pwait_ctl.shared; \ + triton_mutex_lock(&__ctl->parent->mutex); \ + __ctl->parent->posted++; \ + triton_list_link_clear(&__ctl->link); \ + triton_queue_enqueue(&__ctl->link, &__ctl->parent->children); \ + triton_mutex_unlock(&__ctl->parent->mutex); \ +} + +#define AE_MK_PARENT_POINTER_DECL(__parent) \ + struct __parent##_ctl *parent; + +#define AE_MK_BLOCKING_PARAMS_FOR_STRUCT_DECLS() \ + ae_op_id_t current_op_id; \ + int cancelled; \ + triton_mutex_t mutex; \ + triton_list_t children; \ + struct triton_list_link link; \ + int posted; \ + int completed; \ + int allposted; \ + int hit_pbreak; \ + int in_pwait; \ + void *user_ptr; \ + ae_hints_t hints; \ + ae_context_t context; + /* void (*callback) (void *user_ptr [, __ret_type __ae_ret]); */ + /* __ret_type __ae_ret */ + +#define AE_MK_BLOCKING_PARAMS_FOR_POST_DECLS() \ + void *user_ptr; \ + ae_hints_t hints; \ + ae_context_t context; \ + ae_op_id_t *op_id; + /* void (*callback) (void *user_ptr [, __ret_type __ae_ret]); */ + +#define AE_MK_BLOCKING_PARAMS_FUN_PTR_DECLS() \ + void *user_ptr; \ + ae_hints_t hints; \ + ae_context_t context; \ + ae_op_id_t *op_id; + /* void (*callback) (void *user_ptr [, __ret_type __ae_ret]); */ + + +#define AE_MK_POST_FUN_DECLS(__ctl_type) \ + struct __ctl_type##_ctl *ctl; \ + triton_ret_t __ae_postret; + +#define AE_MK_POST_FUN_FINISHED_STMTS() \ +__ae_post_end: \ +{ \ + if(op_id) *op_id = ae_id_gen(0, (uint64_t)ctl); \ + return __ae_postret; \ +} \ + +#endif diff --git a/code/src/aesop/ae-remote-parser.h b/code/src/aesop/ae-remote-parser.h new file mode 100644 index 0000000..dca83e9 --- /dev/null +++ b/code/src/aesop/ae-remote-parser.h @@ -0,0 +1,384 @@ +#ifndef __AE_REMOTE_PARSER_H__ +#define __AE_REMOTE_PARSER_H__ + +#include "src/common/triton-types.h" +#include "src/common/triton-list.h" +#include "src/common/triton-error.h" +#include "src/common/triton-log.h" +#include "src/remote/remote.hae" + +/** + * The remote parser generates encoding/decoding functions for every type (struct, typedef, etc.) with + * the __remote specifier. This header allows callouts to be defined, so that compile time configuration + * changes (made through CPP #defines) can be made to the internals of the encoding/decoding functions. + * The header defines a set of macros that get invoked by the parser to generate declarations or statements that + * are placed in the encoding/decoding functions. To get an idea of how this works, the parser + * generates an encoding function that looks like this: + * + * static inline triton_ret_t aer_encode_<type>(ae_buffer_t buf, const char *field_name, void *vx) + * { + * AE_MK_ENCODE_DECLS(<type>); + * AE_MK_ENCODE_STMTS_START(<type>); + * + * AE_MK_ENCODE_TYPE(<subtype1>, <subfield1>); + * AE_MK_ENCODE_TYPE(<subtype2>, <subfield2>); + * ... + * + * AE_MK_ENCODE_STMTS_END(<type>); + * } + * + * For fields that are pointers, the AE_MK_ENCODE_TYPE_PTR macro is called instead. + * + * The macros below are defined generate the appropriate code for the above function. + */ + +#define AER_MK_ENCODE_TYPE_PTR(__type__, __field__) \ +{ \ + ret = aer_encode_##__type__(buf, #__field__, x->__field__); \ + if(ret != 0) \ + { \ + return ret; \ + } \ +} + +#define AER_MK_ENCODE_TYPE(__type__, __field__) \ +{ \ + ret = aer_encode_##__type__(buf, #__field__, &x->__field__); \ + if(ret != 0) \ + { \ + return ret; \ + } \ +} + +#define AER_MK_ENCODE_DECLS(__type__) \ + triton_ret_t ret; \ + __type__ x; + +#define AER_MK_ENCODE_STMTS_START(__type__) \ +{ \ + x = (__type__)vx; \ +} + +#define AER_MK_ENCODE_STMTS_END() \ +{ \ + return ret; \ +} + +/** + * Simlarly, the decode function looks like this: + * + * triton_ret_t aer_decode_<type>(ae_buffer_t buf, const char *field_name, void *vx) + * { + * AER_MK_DECODE_DECLS(<type>); + * AER_MK_DECODE_STMTS_START(<type>); + * + * AER_MK_DECODE_TYPE(<subtype1>, <subfield1>); + * AER_MK_DECODE_TYPE(<subtype2>, <subfield2>); + * ... + * + * AER_MK_DECODE_STMTS_END(<type>); + * } + * + * As before, for fields that are pointers, the AER_MK_DECODE_TYPE_PTR macro is called instead. + */ + +#define AER_MK_DECODE_TYPE_PTR(__type__, __field__) \ +{ \ + ret = aer_decode_##__type__(buf, NULL, x->__field__); \ +} + +#define AER_MK_DECODE_TYPE(__type__, __field__) \ +{ \ + ret = aer_decode_##__type__(buf, NULL, &x->__field__); \ +} + +#define AER_MK_DECODE_DECLS(__type__) \ + triton_ret_t ret; \ + __type__ x; + +#define AER_MK_DECODE_STMTS_START(__type__) \ +{ \ + x = (__type__)vx; \ +} + +#define AER_MK_DECODE_STMTS_END() \ +{ \ + return ret; \ +} + +/** + * Simlarly, the size encode_size function looks like this: + * + * uint64_t aer_encode_size_<type>(const char *field_name, void *vx) + * { + * AER_MK_SIZE_DECLS(<type>); + * AER_MK_SIZE_STMTS_START(<type>); + * + * AER_MK_SIZE_TYPE(<subtype1>, <subfield1>); + * AER_MK_SIZE_TYPE(<subtype2>, <subfield2>); + * ... + * + * AER_MK_SIZE_STMTS_END(<type>); + * } + * + * As before, for fields that are pointers, the AER_MK_SIZE_TYPE_PTR macro is called instead. + */ + +#define AER_MK_SIZE_TYPE_PTR(__type__, __field__) \ +{ \ + size += aer_encode_size_##__type__ (#__field__, x->__field__); \ +} + +#define AER_MK_SIZE_TYPE(__type__, __field__) \ +{ \ + size += aer_encode_size_##__type__ (#__field__, &x->__field__); \ +} + +#define AER_MK_SIZE_DECLS(__type__) \ + uint64_t size; \ + __type__ x; + +#define AER_MK_SIZE_STMTS_START(__type__) \ +{ \ + size = 0; \ + x = (__type__)vx; \ +} + +#define AER_MK_SIZE_STMTS_END() \ +{ \ + return size; \ +} + +/** + * Only called on pointer fields to pre-initialize + */ +#define AER_MK_INIT_PTR_NULL(__type__, __field__) \ +{ \ + x->__field__ = NULL; \ +} + +#define AER_MK_INIT_PTR_TYPE(__basetype__, __type__, __field__) \ +{ \ + x->__field__ = malloc(sizeof(*(x->__field__))); \ + if(!x->__field__) \ + { \ + aer_destroy_##__basetype__(x); \ + return TRITON_ERR_ENOMEM; \ + } \ + ret = aer_init_##__type__(x->__field__); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_destroy_##__basetype__(x); \ + return ret; \ + } \ +} + +#define AER_MK_INIT_TYPE(__basetype__, __type__, __field__) \ +{ \ + ret = aer_init_##__type__(&x->__field__); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_destroy_##__basetype__(x); \ + return ret; \ + } \ +} + +#define AER_MK_INIT_DECLS(__type__) \ + triton_ret_t ret; \ + __type__ x; + +#define AER_MK_INIT_STMTS_START(__type__) \ +{ \ + x = (__type__)vx; \ +} + +#define AER_MK_INIT_STMTS_END() \ +{ \ + return ret; \ +} + +#define AER_MK_DESTROY_PTR_TYPE(__basetype__, __type__, __field__) \ +{ \ + if(x->__field__ != NULL) \ + { \ + aer_destroy_##__type__(x->__field__); \ + free(x->__field__); \ + x->__field__ = NULL; \ + } \ +} + +#define AER_MK_DESTROY_TYPE(__basetype__, __type__, __field__) \ +{ \ + aer_destroy_##__type__(&x->__field__); \ +} + +#define AER_MK_DESTROY_DECLS(__type__) \ + __type__ x; + +#define AER_MK_DESTROY_STMTS_START(__type__) \ +{ \ + x = (__type__)vx; \ +} + +#define AER_MK_DESTROY_STMTS_END() + +#define AER_MK_STUB_DECL(__ret__, __fname__, params...) \ + __blocking __ret__ remote_##__fname__(triton_node_t id, ##params); + +#define AER_MK_STUB_DECLS(__fname__) \ + aer_message_t send_message; \ + aer_message_t recv_message; \ + triton_ret_t ret; \ + uint64_t insize; + +#define AER_MK_STUB_BLOCK(__fname__, __intype__, __inname__, __outtype__, __outname__) \ +{ \ + ret = aer_message_init(&send_message, AE_REMOTE_MAX_REQUEST_SIZE, __get_op_id_##__fname__()); \ + if(ret != TRITON_SUCCESS) \ + { \ + return ret; \ + } \ + ret = aer_encode_##__intype__(&(send_message.buffer), #__inname__, &__inname__); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_message_destroy(&send_message); \ + return ret; \ + } \ + ret = aer_message_init(&recv_message, AE_REMOTE_MAX_RESPONSE_SIZE, __get_op_id_##__fname__()); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_message_destroy(&send_message); \ + return ret; \ + } \ + ret = aer_message_sendrecv(id, &send_message, &recv_message); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_message_destroy(&send_message); \ + aer_message_destroy(&recv_message); \ + return ret; \ + } \ + ret = aer_decode_##__outtype__(&(recv_message.buffer), NULL, __outname__); \ + aer_message_destroy(&send_message); \ + aer_message_destroy(&recv_message); \ + return ret; \ +} + +#define AER_MK_STUB_PTR_BLOCK(__fname__, __intype__, __inname__, __outtype__, __outname__) \ +{ \ + ret = aer_message_init(&send_message); \ + if(ret != TRITON_SUCCESS) \ + { \ + return ret; \ + } \ + ret = aer_message_set_op(&send_message, __get_op_id_##__fname__()); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_message_destroy(&send_message); \ + return ret; \ + } \ + ret = aer_encode_##__intype__(&(send_message.buffer), #__inname__, __inname__); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_message_destroy(&send_message); \ + return ret; \ + } \ + ret = aer_message_init(&recv_message); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_message_destroy(&send_message); \ + return ret; \ + } \ + ret = aer_message_sendrecv(id, &send_message, &recv_message); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_message_destroy(&send_message); \ + aer_message_destroy(&recv_message); \ + return ret; \ + } \ + ret = aer_decode_##__outtype__(&(recv_message.buffer), NULL, __outname__); \ + aer_message_destroy(&send_message); \ + aer_message_destroy(&recv_message); \ + return ret; \ +} + +#define AER_MK_SERVICE_DECL(__fname__) \ + __blocking triton_ret_t __service_##__fname__(aer_message_t *send_message, aer_message_t *recv_message); + +#define AER_MK_SERVICE_FNDEF(__fname__, __intype__, __inname__, __outtype__, __outname__) \ +__blocking triton_ret_t __service_##__fname__(aer_message_t *send_message, aer_message_t *recv_message) \ +{ \ + triton_ret_t ret; \ + __intype__ __inname__; \ + __outtype__ __outname__; \ + ret = aer_decode_##__intype__(&(recv_message->buffer), NULL, &__inname__); \ + if(ret != TRITON_SUCCESS) \ + { \ + return ret; \ + } \ + ret = __fname__(__inname__, &__outname__); \ + if(ret != TRITON_SUCCESS) \ + { \ + return ret; \ + } \ + ret = aer_encode_##__outtype__(&(send_message->buffer), #__outname__, &__outname__); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_message_destroy(send_message); \ + return ret; \ + } \ + return ret; \ +} + +#define AER_MK_SERVICE_FNDEF_INPTR(__fname__, __intype__, __inname__, __outtype__, __outname__) \ +__blocking triton_ret_t __service_##__fname__(aer_message_t *send_message, aer_message_t *recv_message) \ +{ \ + triton_ret_t ret; \ + __intype__ __inname__; \ + __outtype__ __outname__; \ + ret = aer_decode_##__intype__(&(recv_message->buffer), NULL, &__inname__); \ + if(ret != TRITON_SUCCESS) \ + { \ + return ret; \ + } \ + ret = __fname__(&__inname__, &__outname__); \ + if(ret != TRITON_SUCCESS) \ + { \ + return ret; \ + } \ + ret = aer_encode_##__outtype__(&(send_message->buffer), #__outname__, &__outname__); \ + if(ret != TRITON_SUCCESS) \ + { \ + aer_message_destroy(send_message); \ + return ret; \ + } \ + return ret; \ +} + +#define AER_MK_OP_STMTS(__fname__) \ +{ \ + if(__op_id_##__fname__) \ + { \ + return __op_id_##__fname__; \ + } \ + __op_id_##__fname__ = aer_service_unique_id(#__fname__); \ + return __op_id_##__fname__; \ +} + +#define AER_MK_REG_DECLS(__service_name__) \ + triton_ret_t ret; + +#define AER_MK_REG_BLOCK(__fname__) \ +{ \ + ret = aer_service_register(__get_op_id_##__fname__(), #__fname__, __service_##__fname__); \ + if(ret != TRITON_SUCCESS) return ret; \ +} + +#define AER_MK_REG_START(__service_name__) + +#define AER_MK_REG_END(__service_name__) \ + return ret; + +#define AER_MK_STATIC_OP_DECL(__fname__) \ + static uint64_t __op_id_##__fname__ = 0; + +#endif diff --git a/code/src/aesop/aesop.c b/code/src/aesop/aesop.c new file mode 100644 index 0000000..114450b --- /dev/null +++ b/code/src/aesop/aesop.c @@ -0,0 +1,24 @@ + +#include "src/aesop/aesop.h" + +triton_debug_mask_t ae_debug_blocking_funs; + +static int initialized = 0; + +triton_ret_t aesop_init(void) +{ + triton_ret_t ret; + if(initialized == 0) + { + ret = triton_debug_add_mask("aesop.blocking.funs", &ae_debug_blocking_funs); + initialized++; + return ret; + } + return TRITON_SUCCESS; +} + +void aesop_finalize(void) +{ + initialized--; +} + diff --git a/code/src/aesop/aesop.h b/code/src/aesop/aesop.h new file mode 100644 index 0000000..ef99e4b --- /dev/null +++ b/code/src/aesop/aesop.h @@ -0,0 +1,20 @@ +#ifndef __AESOP_H__ +#define __AESOP_H__ + +#include "src/common/triton-base.h" +#include "src/common/triton-error.h" +#include "src/common/triton-thread.h" +#include "src/common/triton-list.h" +#include "src/common/triton-log.h" +#include "src/common/triton-debug.h" + +#include "src/aesop/resource.h" +#include "src/aesop/op.h" +#include "src/aesop/opcache.h" + +extern triton_debug_mask_t ae_debug_blocking_funs; + +triton_ret_t aesop_init(void); +void aesop_finalize(void); + +#endif diff --git a/oldcode/src/gsl/examples/TODO b/code/src/aesop/examples/TODO similarity index 100% copy from oldcode/src/gsl/examples/TODO copy to code/src/aesop/examples/TODO diff --git a/code/src/aesop/examples/module.mk.in b/code/src/aesop/examples/module.mk.in new file mode 100644 index 0000000..a9e15fa --- /dev/null +++ b/code/src/aesop/examples/module.mk.in @@ -0,0 +1,5 @@ +DIR := src/aesop/examples + +AETESTSRC += $(DIR)/rpc-invoke.ae + +MODLIBS_$(DIR) = -lpthread diff --git a/code/src/aesop/examples/rpc-invoke.ae b/code/src/aesop/examples/rpc-invoke.ae new file mode 100644 index 0000000..4b3adc6 --- /dev/null +++ b/code/src/aesop/examples/rpc-invoke.ae @@ -0,0 +1,133 @@ + +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include "src/common/resources/timer/timer.hae" + +__blocking static int rpc_invoke() +{ + int a = 0; + int randval, val, ret; + + randval = btest_random(); + val = randval % 3; + printf("RANDOM VALUE: %d\n", val); + if(0 == val) + { + ret = btest1(&a); + } + else if(1 == val) + { + ret = btest2(&a); + } + else if(2 == val) + { + ret = btest3(&a); + } + + assert(ret == 0); + assert((a-1) == val); + return randval; +} + +__blocking static void invoke_many(int count) +{ + pwait + { + int i; + for(i = 0; i < count; ++i) + { + pbranch { rpc_invoke(); } + } + } +} + +static int running = 1; + +__blocking static void many_looping() +{ + pwait + { + int i; + + /* startup 100 looping invocations */ + i = 0; + while(i < 100) + { + pbranch + { + int j = 0; + + while(running) + { + rpc_invoke(); + printf("invoke: %d, %d\n", i, j++); + } + } + ++i; + } + + /* let those loop for a bit */ + pbranch + { + triton_timer(10000); + running = 0; + } + } +} + +static int many_looping_done = 0; +static void many_looping_cb(void *up) +{ + many_looping_done = 1; +} + +static int done = 0; +static int manydone = 0; + +static void cb(void *up, int ret) +{ + done++; +} + +static void many_cb(void *up) +{ + manydone=1; +} + +int main(int argc, char *argv[]) +{ + ae_context_t ctx; + int i; + + triton_timer_init(); + btest_init(); + + ae_context_create(&ctx, 2, "btest", "timer"); + + for(i = 0; i < 100; ++i) + { + rpc_invoke_post(cb, NULL, NULL, NULL, NULL); + } + + while(done < 100) + { + ae_poll(ctx, 100); + } + + invoke_many_post(200, many_cb, NULL, NULL, NULL, NULL); + while(manydone == 0) + { + ae_poll(ctx, 100); + } + + many_looping_post(many_looping_cb, NULL, NULL, NULL, NULL); + while(many_looping_done == 0) + { + ae_poll(ctx, 100); + } + + ae_context_destroy(ctx); + btest_finalize(); + triton_timer_finalize(); + return 0; +} diff --git a/code/src/aesop/module.mk.in b/code/src/aesop/module.mk.in new file mode 100644 index 0000000..81c2515 --- /dev/null +++ b/code/src/aesop/module.mk.in @@ -0,0 +1,6 @@ +DIR := src/aesop + +LIBSRC += $(DIR)/opcache.c \ + $(DIR)/aesop.c \ + $(DIR)/resource.c + diff --git a/code/src/aesop/op.h b/code/src/aesop/op.h new file mode 100644 index 0000000..b8d6493 --- /dev/null +++ b/code/src/aesop/op.h @@ -0,0 +1,88 @@ + +#ifndef __OP_H__ +#define __OP_H__ + +#include "src/common/triton-list.h" + +typedef struct ae_op +{ + void (*callback)(void *ptr, int ret); + int (*op_worker)(struct ae_op* op); + void *user_ptr; + ae_hints_t hints; + ae_context_t ctx; + int cache_id; + triton_list_link_t link; +} ae_op_t; + +#define ae_op_from_link(_link) triton_list_get_entry((_link), struct ae_op, link) + +#define ae_op_entry(_op, _type, _member) \ + ((_op != NULL) ? \ + ((_type *)((char *)(_op) - (unsigned long)((&((_type *)0)->_member)))) : NULL) + +#define ae_invoke_callback(_op, _result) (_op)->callback((_op)->user_ptr, _result) + +#define ae_op_fill(_op, _cb, _up, _hints, _ctx) \ + do { \ + (_op)->callback = (_cb); \ + (_op)->user_ptr = (_up); \ + (_op)->hints = (_hints); \ + (_op)->ctx = (_ctx); \ + } while(0) + +#define ae_ops_link_clear(_op) triton_list_link_clear(&(_op)->link) + +#define ae_op_clear(_op) \ + do { \ + (_op)->callback = NULL; \ + (_op)->user_ptr = NULL; \ + (_op)->hints = NULL; \ + (_op)->ctx = NULL; \ + ae_ops_link_clear(_op); \ + } while(0) + +typedef triton_list_t ae_ops_t; + +#define ae_ops_init(ops) triton_list_init(ops) + +#define ae_ops_enqueue(_op, _queue) triton_queue_enqueue(&(_op)->link, _queue) + +static inline ae_op_t *ae_ops_dequeue(ae_ops_t *queue) +{ + triton_list_link_t *llink; + llink = triton_queue_dequeue(queue); + if(!llink) return NULL; + return ae_op_from_link(llink); +} + +#define ae_ops_del(_op) triton_list_del(&(_op)->link) +#define ae_ops_empty(_ops) triton_list_empty(_ops) + +static inline ae_op_t *ae_ops_peek(ae_ops_t *queue) +{ + triton_list_link_t *llink; + llink = triton_queue_peek(queue); + if(!llink) return NULL; + return ae_op_from_link(llink); +} + +#define ae_ops_for_each(_pos, _safe, _ops) triton_list_for_each_entry(_pos, _safe, _ops, link) +#define ae_ops_exists(_ops, _op) triton_list_exists(_ops, _op) +#define ae_ops_count(_ops) triton_list_count(_ops) +#define ae_ops_find(_ops, _compare, _ptr) triton_list_find(_ops, _compare, _ptr) + +#define ae_ops_insert_after(_new, _after, _ops) triton_list_insert_after(&(_new)->link, &(_after)->link, _ops) +#define ae_ops_insert_before(_new, _before, _ops) triton_list_insert_before(&(_new)->link, &(_before)->link, _ops) + +#endif + + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/aesop/opcache.c b/code/src/aesop/opcache.c new file mode 100644 index 0000000..c748f72 --- /dev/null +++ b/code/src/aesop/opcache.c @@ -0,0 +1,151 @@ + +#include <errno.h> +#include "src/aesop/aesop.h" +#include "src/aesop/opcache.h" + +#define TRITON_OPCACHE_ARRAY_COUNT 32 +#define TRITON_OPCACHE_MAX_INDEX (0xFFFFFF) + +struct ae_opcache +{ + void *array[TRITON_OPCACHE_ARRAY_COUNT]; + int array_count; + int size; + int count; + triton_mutex_t mutex; + ae_ops_t free_list; + int typesize; + int member_offset; +}; + +int ae_opcache_init(int typesize, int member_offset, int init_size, ae_opcache_t *cache) +{ + struct ae_opcache *c; + c = malloc(sizeof(*c)); + if(!c) + { + return -ENOMEM; + } + c->size = init_size; + c->array_count = 1; + c->array[0] = malloc(typesize * init_size); + if(!c->array[0]) + { + free(c); + return -ENOMEM; + } + c->typesize = typesize; + c->member_offset = member_offset; + c->count = 0; + triton_mutex_init(&c->mutex, NULL); + ae_ops_init(&(c->free_list)); + *cache = c; + return 0; +} + +int ae_opcache_double_size(ae_opcache_t cache) +{ + int i; + triton_mutex_lock(&cache->mutex); + cache->array[cache->array_count] = malloc(cache->typesize * cache->size); + if(!cache->array[cache->array_count]) + { + for(i = 0; i < cache->array_count; ++i) + { + free(cache->array[i]); + } + free(cache); + triton_mutex_unlock(&cache->mutex); + return -ENOMEM; + } + cache->array_count++; + cache->size *= 2; + triton_mutex_unlock(&cache->mutex); + return 0; +} + +int ae_opcache_destroy(ae_opcache_t cache) +{ + int i; + triton_mutex_lock(&cache->mutex); + for(i = 0; i < cache->array_count; ++i) + { + free(cache->array[i]); + } + free(cache); + triton_mutex_unlock(&cache->mutex); + return 0; +} + +inline int ae_opcache_size(ae_opcache_t cache) +{ + return cache->size; +} + +inline int ae_opcache_count(ae_opcache_t cache) +{ + return cache->count; +} + +struct ae_op *ae_opcache_get(ae_opcache_t cache) +{ + int aind, count; + struct ae_op *op; + + triton_mutex_lock(&cache->mutex); + if(ae_ops_empty(&cache->free_list)) + { + if(cache->count == cache->size) + { + ae_opcache_double_size(cache); + } + + aind = cache->array_count - 1; + count = (cache->array_count > 1) ? + cache->count - (cache->size / 2) : cache->count; + + op = (struct ae_op *)(((char *)cache->array[aind]) + + (count * cache->typesize) + + cache->member_offset); + op->cache_id = (aind << 25) | count; + ae_op_clear(op); + ++cache->count; + } + else + { + op = ae_ops_dequeue(&cache->free_list); + } + triton_mutex_unlock(&cache->mutex); + return op; +} + +int ae_opcache_put(ae_opcache_t cache, struct ae_op *op) +{ + triton_mutex_lock(&cache->mutex); + ae_ops_enqueue(op, &cache->free_list); + triton_mutex_unlock(&cache->mutex); + + return 0; +} + +struct ae_op *ae_opcache_lookup(ae_opcache_t cache, int id) +{ + int aind, count; + + /* we get the array index from the top 6 bits */ + aind = (id >> 25); + count = id & 0xFFFFFF; + + return (struct ae_op *)(((char *)cache->array[aind]) + + (count * cache->typesize) + + cache->member_offset); +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/aesop/opcache.h b/code/src/aesop/opcache.h new file mode 100644 index 0000000..79e17fd --- /dev/null +++ b/code/src/aesop/opcache.h @@ -0,0 +1,49 @@ + +#ifndef __OPCACHE_H__ +#define __OPCACHE_H__ + +#include "src/aesop/op.h" + +typedef struct ae_opcache *ae_opcache_t; + +#define TRITON_OPCACHE_INIT(_optype, _member, _size, _name) \ + ae_opcache_init(sizeof(_optype), (unsigned long)(&((_optype *)0)->_member), _size, (_name)) + +/* complete an operation by returning it to opcache and invoking callback */ +/* note that __error_code is copied on purpose for safety in case it is a + * member of the __op structure. + */ +#define ae_opcache_complete_op(__opcache, __op, __error_code) do { \ + void (*__callback)(void *, int) = (__op)->callback; \ + void* __user_ptr = (__op)->user_ptr; \ + int __saved_error_code = __error_code; \ + ae_opcache_put(__opcache, __op); \ + __callback(__user_ptr, __saved_error_code); \ + } while(0) + +int ae_opcache_init(int typesize, int member_offset, int init_size, ae_opcache_t *cache); + +int ae_opcache_double_size(ae_opcache_t cache); + +int ae_opcache_destroy(ae_opcache_t cache); + +struct ae_op *ae_opcache_get(ae_opcache_t cache); + +int ae_opcache_put(ae_opcache_t cache, struct ae_op *op); + +inline int ae_opcache_size(ae_opcache_t cache); + +inline int ae_opcache_count(ae_opcache_t cache); + +struct ae_op *ae_opcache_lookup(ae_opcache_t cache, int id); + +#endif + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/aesop/parser/BlockingContext.lhs b/code/src/aesop/parser/BlockingContext.lhs new file mode 100644 index 0000000..47e6cf8 --- /dev/null +++ b/code/src/aesop/parser/BlockingContext.lhs @@ -0,0 +1,364 @@ +> module BlockingContext where +> import Language.C +> import Language.C.System.GCC -- preprocessor used +> import System.Environment +> import Data.Typeable +> import Data.Maybe +> import Data.Either +> import Data.HashTable +> import Control.Exception +> import Control.Monad.State +> import Data.List +> import Debug.Trace +> import CParse +> import CUtils +> import Data.Generics +> import Data.Generics.Schemes +> import Data.Tree + +> data BlockingContext = FunContext { funDef :: CFunDef , +> stmts :: [BlockingContext] , +> parent :: Maybe BlockingContext , +> next :: Maybe BlockingContext , +> prev :: Maybe BlockingContext } + +> | IfContext { ifDef :: CStat , +> ifStmts :: [BlockingContext] , +> elseStmts :: Maybe [BlockingContext] , +> nbStmtsBefore :: [CStat] , +> nbStmtsAfter :: [CStat] , +> parent :: Maybe BlockingContext , +> next :: Maybe BlockingContext , +> prev :: Maybe BlockingContext } + +> | ForContext { forDef :: CStat , +> forStmts :: [BlockingContext] , +> nbStmtsBefore :: [CStat] , +> nbStmtsAfter :: [CStat] , +> parent :: Maybe BlockingContext , +> next :: Maybe BlockingContext , +> prev :: Maybe BlockingContext } + +> | WhileContext { whileDef :: CStat , +> whileStmts :: [BlockingContext] , +> nbStmtsBefore :: [CStat] , +> nbStmtsAfter :: [CStat] , +> parent :: Maybe BlockingContext , +> next :: Maybe BlockingContext , +> prev :: Maybe BlockingContext } + +> | BlockingStmt { stmt :: CStat , +> nbStmtsBefore :: [CStat] , +> nbStmtsAfter :: [CStat] , +> parent :: Maybe BlockingContext , +> next :: Maybe BlockingContext , +> prev :: Maybe BlockingContext } + +> | CompoundContext { +> compoundDef :: CStat , +> compoundStmts :: [BlockingContext] , +> nbStmtsBefore :: [CStat] , +> nbStmtsAfter :: [CStat] , +> parent :: Maybe BlockingContext , +> next :: Maybe BlockingContext , +> prev :: Maybe BlockingContext } + +> | PWaitContext { id :: String, +> pwaitDef :: CStat , +> stmts :: [BlockingContext] , +> nbStmtsBefore :: [CStat] , +> nbStmtsAfter :: [CStat] , +> parent :: Maybe BlockingContext , +> next :: Maybe BlockingContext , +> prev :: Maybe BlockingContext } + +> | PBranchContext { id :: String, +> pbranchDef :: CStat , +> stmts :: [BlockingContext] , +> nbStmtsBefore :: [CStat] , +> nbStmtsAfter :: [CStat] , +> parent :: Maybe BlockingContext , +> next :: Maybe BlockingContext , +> prev :: Maybe BlockingContext } + +> getNI :: BlockingContext -> NodeInfo +> getNI (PBranchContext _ d _ _ _ _ _ _) = nodeInfo d +> getNI (PWaitContext _ d _ _ _ _ _ _) = nodeInfo d +> getNI (BlockingStmt s _ _ _ _ _) = nodeInfo s +> getNI (WhileContext d _ _ _ _ _ _) = nodeInfo d +> getNI (CompoundContext c _ _ _ _ _ _) = nodeInfo c +> getNI (ForContext d _ _ _ _ _ _) = nodeInfo d +> getNI (IfContext d _ _ _ _ _ _ _) = nodeInfo d +> getNI (FunContext d _ _ _ _) = nodeInfo d + +> instance Eq BlockingContext where +> (==) (FunContext fDef1 _ _ _ _) (FunContext fDef2 _ _ _ _) = (nodeInfo fDef1) == (nodeInfo fDef2) +> (==) (IfContext ifDef1 _ _ _ _ _ _ _) (IfContext ifDef2 _ _ _ _ _ _ _) = (nodeInfo ifDef1) == (nodeInfo ifDef2) +> (==) (ForContext fDef1 _ _ _ _ _ _) (ForContext fDef2 _ _ _ _ _ _) = (nodeInfo fDef1) == (nodeInfo fDef2) +> (==) (WhileContext wDef1 _ _ _ _ _ _) (WhileContext wDef2 _ _ _ _ _ _) = (nodeInfo wDef1) == (nodeInfo wDef2) +> (==) (CompoundContext cDef1 _ _ _ _ _ _) (CompoundContext cDef2 _ _ _ _ _ _) = (nodeInfo cDef1) == (nodeInfo cDef2) +> (==) (BlockingStmt s1 _ _ _ _ _) (BlockingStmt s2 _ _ _ _ _) = (nodeInfo s1) == (nodeInfo s2) +> (==) (PWaitContext _ pw1 _ _ _ _ _ _) (PWaitContext _ pw2 _ _ _ _ _ _) = (nodeInfo pw1) == (nodeInfo pw2) +> (==) (PBranchContext _ pb1 _ _ _ _ _ _) (PBranchContext _ pb2 _ _ _ _ _ _) = (nodeInfo pb1) == (nodeInfo pb2) +> (==) _ _ = False + +> isLastContext :: BlockingContext -> Bool +> isLastContext b = isNothing $ next b + +> isLastContextInFun :: BlockingContext -> Bool +> isLastContextInFun b +> | isLastContext b && parentIsFun b = True +> | isLastContext b && (isJust $ parent b) = isLastContextInFun $ fromJust $ parent b +> | otherwise = False + +> parentIsFun :: BlockingContext -> Bool +> parentIsFun b = case (parent b) of { (Just (FunContext _ _ _ _ _)) -> True ; _ -> False } + +> parentIsFor :: BlockingContext -> Bool +> parentIsFor b = (isJust $ parent b) && (isForContext $ fromJust $ parent b) + +> parentIsWhile :: BlockingContext -> Bool +> parentIsWhile b = (isJust $ parent b) && (isWhileContext $ fromJust $ parent b) + +> parentIsIf :: BlockingContext -> Bool +> parentIsIf b = (isJust $ parent b) && (isIfContext $ fromJust $ parent b) + +> parentIsCompound :: BlockingContext -> Bool +> parentIsCompound b = (isJust $ parent b) && (isCompoundContext $ fromJust $ parent b) + +> parentIsPBranch :: BlockingContext -> Bool +> parentIsPBranch b = (isJust $ parent b) && (isPBranchContext $ fromJust $ parent b) + +> getPBranchAncestor :: BlockingContext -> BlockingContext +> getPBranchAncestor b | isPBranchContext b = b +> | otherwise = getPBranchAncestor $ fromJust $ parent b + +> hasPBranchAncestor :: BlockingContext -> Bool +> hasPBranchAncestor b +> | (isJust $ parent b) && (isPBranchContext $ fromJust $ parent b) = True +> | (isJust $ parent b) = hasPBranchAncestor $ fromJust $ parent b +> | otherwise = False + +> getPWaitAncestor :: BlockingContext -> BlockingContext +> getPWaitAncestor b | isPWaitContext b = b +> | otherwise = getPWaitAncestor $ fromJust $ parent b + +> hasPWaitAncestor :: BlockingContext -> Bool +> hasPWaitAncestor b | isPWaitContext b = True +> | isJust $ parent b = hasPWaitAncestor $ fromJust $ parent b +> | otherwise = False + +> isIfContext :: BlockingContext -> Bool +> isIfContext (IfContext _ _ _ _ _ _ _ _) = True +> isIfContext _ = False + +> isForContext :: BlockingContext -> Bool +> isForContext (ForContext _ _ _ _ _ _ _) = True +> isForContext _ = False + +> isWhileContext :: BlockingContext -> Bool +> isWhileContext (WhileContext _ _ _ _ _ _ _) = True +> isWhileContext _ = False + +> isCompoundContext :: BlockingContext -> Bool +> isCompoundContext (CompoundContext _ _ _ _ _ _ _) = True +> isCompoundContext _ = False + +> isPBranchContext :: BlockingContext -> Bool +> isPBranchContext (PBranchContext _ _ _ _ _ _ _ _) = True +> isPBranchContext _ = False + +> isPWaitContext :: BlockingContext -> Bool +> isPWaitContext (PWaitContext _ _ _ _ _ _ _ _) = True +> isPWaitContext _ = False + +> isBlockingStmt :: BlockingContext -> Bool +> isBlockingStmt (BlockingStmt _ _ _ _ _ _) = True +> isBlockingStmt _ = False + +> getCtxName :: BlockingContext -> String +> getCtxName (BlockingStmt _ _ _ _ _ _) = "BlockingStmt" +> getCtxName (FunContext _ _ _ _ _) = "FunContext" +> getCtxName (ForContext _ _ _ _ _ _ _) = "ForContext" +> getCtxName (WhileContext _ _ _ _ _ _ _) = "WhileContext" +> getCtxName (CompoundContext _ _ _ _ _ _ _) = "CompoundContext" +> getCtxName (PWaitContext _ _ _ _ _ _ _ _) = "PWaitContext" +> getCtxName (PBranchContext _ _ _ _ _ _ _ _) = "PBranchContext" +> getCtxName (IfContext _ _ _ _ _ _ _ _) = "IfContext" + +> instance Show BlockingContext where +> show (BlockingStmt stmt _ _ parent prev next) = "BlockingStmt: " ++ (show . pretty $ stmt) ++ "\n" +> show (FunContext funDef _ _ _ _) = "FunContext: " ++ (getFunDefName $ funDef) ++ "\n" +> show (ForContext forDef forStmts _ _ _ _ _) = "ForContext" +> show (WhileContext whileDef whileStmts _ _ _ _ _) = "WhileContext" +> show (CompoundContext cDef cStmts _ _ _ _ _) = "CompoundContext" +> show (PWaitContext _ _ stmts _ _ _ _ _) = "PWaitContext" +> show (PBranchContext _ _ stmts _ _ _ _ _) = "PBranchContext" +> show (IfContext ifDef ifCtx elseCtx nbBefore nbAfter parent next prev) = +> "IfContext: IF: " ++ (concat (map (("IFNODE: " ++) . (drawTree . contextToTree)) ifCtx)) ++ +> (if isJust elseCtx then ("\n\n\tELSE: " ++ +> (concat (map (("ELSENODE: " ++) . (drawTree . contextToTree)) $ fromJust elseCtx))) +> else "") + +> mkTreeNode :: BlockingContext -> (String, [BlockingContext]) +> mkTreeNode b@(BlockingStmt stmt _ _ _ _ _) = +> let nodeName = show b +> in (nodeName, []) + +> mkTreeNode b@(FunContext funDef stmts _ _ _) = +> let nodeName = show b +> in (nodeName, stmts) + +> mkTreeNode b@(ForContext forDef forStmts _ _ _ _ _) = +> let nodeName = show b +> in (nodeName, forStmts) + +> mkTreeNode b@(WhileContext whileDef whileStmts nbStmtsBefore nbStmtsAfter parent next prev) = +> let nodeName = show b +> in (nodeName, whileStmts) + +> mkTreeNode b@(CompoundContext cDef cStmts nbStmtBefore nbStmtsAfter parent next prev) = +> let nodeName = show b +> in (nodeName, cStmts) + +> mkTreeNode b@(IfContext ifDef ifCtx elseCtx nbBefore nbAfter parent next prev) = +> let nodeName = show b +> in (nodeName, []) + +> mkTreeNode b@(PWaitContext _ _ stmts _ _ _ _ _) = +> let nodeName = show b +> in (nodeName, stmts) + +> mkTreeNode b@(PBranchContext _ _ stmts _ _ _ _ _) = +> let nodeName = show b +> in (nodeName, stmts) + +> contextToTree :: BlockingContext -> Tree String +> contextToTree b = unfoldTree mkTreeNode b + +> getFunContext :: BlockingContext -> BlockingContext +> getFunContext b@(FunContext _ _ _ _ _) = b +> getFunContext b = getFunContext $ fromJust $ parent b + +> getParent :: BlockingContext -> BlockingContext +> getParent b@(FunContext _ _ _ _ _) = b +> getParent b = getParent $ fromJust $ parent b + +> findLoopParent :: BlockingContext -> BlockingContext +> findLoopParent b +> | parentIsWhile b = fromJust $ parent b +> | parentIsFor b = fromJust $ parent b +> | otherwise = findLoopParent $ fromJust $ parent b + +> getParentName :: BlockingContext -> String +> getParentName (FunContext funDef _ _ _ _) = getFunDefName funDef +> getParentName b = getParentName $ assert (isJust $ parent b) fromJust $ parent b + +> mkContextTree :: Maybe BlockingContext -> Maybe BlockingContext -> Maybe BlockingContext -> BlockingContext -> BlockingContext + +> mkContextTree parent next prev (FunContext funDef stmts _ _ _) = this +> where this = FunContext funDef (fixupContextList (Just this) Nothing stmts) Nothing Nothing Nothing + +> mkContextTree parent next prev (IfContext ifDef ifStmts elseStmts nbBefore nbAfter _ _ _) = this +> where newElseStmts = if isJust elseStmts then +> Just (fixupContextList (Just this) Nothing (fromJust elseStmts)) else Nothing +> this = IfContext ifDef +> (fixupContextList (Just this) Nothing ifStmts) +> newElseStmts +> nbBefore +> nbAfter +> parent +> next +> prev + +> mkContextTree parent next prev (ForContext forDef forStmts nbBefore nbAfter _ _ _) = this +> where this = ForContext forDef (fixupContextList (Just this) Nothing forStmts) nbBefore nbAfter parent next prev + +> mkContextTree parent next prev (WhileContext whileDef whileStmts nbBefore nbAfter _ _ _) = this +> where this = WhileContext whileDef (fixupContextList (Just this) Nothing whileStmts) nbBefore nbAfter parent next prev + +> mkContextTree parent next prev (CompoundContext cDef cStmts nbBefore nbAfter _ _ _) = this +> where this = CompoundContext cDef (fixupContextList (Just this) Nothing cStmts) nbBefore nbAfter parent next prev + +> mkContextTree parent next prev (BlockingStmt stmt nbBefore nbAfter _ _ _) = this +> where this = BlockingStmt stmt nbBefore nbAfter parent next prev + +> mkContextTree parent next prev (PWaitContext id waitDef stmts nbBefore nbAfter _ _ _) = this +> where this = PWaitContext id waitDef (fixupContextList (Just this) Nothing stmts) nbBefore nbAfter parent next prev + +> mkContextTree parent next prev (PBranchContext id branchDef stmts nbBefore nbAfter _ _ _) = this +> where this = PBranchContext id branchDef (fixupContextList (Just this) Nothing stmts) nbBefore nbAfter parent next prev + +> fixupContextList :: Maybe BlockingContext -> Maybe BlockingContext -> [BlockingContext] -> [BlockingContext] + +> fixupContextList parent prev [] = [] +> fixupContextList parent prev (b:[]) = (mkContextTree parent Nothing prev b):[] + +> fixupContextList parent prev (b:bs) = newb:next:rest +> where newb = mkContextTree parent (Just next) prev b +> next:rest = fixupContextList parent (Just newb) bs + +> getPWaitSharedDecls :: BlockingContext -> [CDecl] +> getPWaitSharedDecls (PWaitContext id (CPWait (CCompound _ bitems _) _) _ _ _ _ _ _) = +> filterDecls (\_ -> True) (not . isPrivateSpec) removeSharedSpecFromDecl $ findFuncDecls bitems +> getPWaitSharedDecls _ = [] + +> getPWaitPrivateDecls :: BlockingContext -> [CDecl] +> getPWaitPrivateDecls (PWaitContext id (CPWait (CCompound _ bitems _) _) _ _ _ _ _ _) = +> filterDecls isPrivateSpec (not . isSharedSpec) removePrivateSpecFromDecl $ findFuncDecls bitems + +> getPWaitId :: BlockingContext -> String +> getPWaitId (PWaitContext id _ _ _ _ _ _ _) = id +> getPWaitId _ = error "Not a pwait context" + +> containsPWait :: BlockingContext -> Bool +> containsPWait (PWaitContext _ _ _ _ _ _ _ _) = True +> containsPWait (PBranchContext _ _ stmts _ _ _ _ _) = any containsPWait stmts +> containsPWait (BlockingStmt _ _ _ _ _ _) = False +> containsPWait (WhileContext _ stmts _ _ _ _ _) = any containsPWait stmts +> containsPWait (ForContext _ stmts _ _ _ _ _) = any containsPWait stmts +> containsPWait (CompoundContext _ stmts _ _ _ _ _) = any containsPWait stmts +> containsPWait (IfContext _ ifStmts elseStmts _ _ _ _ _) = +> (any containsPWait ifStmts) || +> (if isJust elseStmts then any containsPWait $ fromJust elseStmts else False) +> containsPWait (FunContext _ stmts _ _ _) = any containsPWait stmts + +> foldPWaits :: [BlockingContext] -> [BlockingContext] +> foldPWaits [] = [] +> foldPWaits bs = foldl1 (++) $ map getPWaits bs + +> getPWaits :: BlockingContext -> [BlockingContext] +> getPWaits b@(PWaitContext _ _ _ _ _ _ _ _) = [b] +> getPWaits (PBranchContext _ _ stmts _ _ _ _ _) = foldPWaits stmts +> getPWaits (BlockingStmt _ _ _ _ _ _) = [] +> getPWaits (WhileContext _ stmts _ _ _ _ _) = foldPWaits stmts +> getPWaits (ForContext _ stmts _ _ _ _ _) = foldPWaits stmts +> getPWaits (CompoundContext _ stmts _ _ _ _ _) = foldPWaits stmts +> getPWaits (IfContext _ ifStmts elseStmts _ _ _ _ _) = +> (foldPWaits ifStmts) ++ +> (if isJust elseStmts then foldPWaits $ fromJust elseStmts else []) +> getPWaits (FunContext _ stmts _ _ _) = foldPWaits stmts + +> getPBranchDecls :: BlockingContext -> [CDecl] +> getPBranchDecls (PBranchContext id (CPBranch (CCompound _ bitems _) _) _ _ _ _ _ _) = +> findFuncDecls bitems +> getPBranchDecls _ = [] + +> getPBranchId :: BlockingContext -> String +> getPBranchId (PBranchContext id _ _ _ _ _ _ _) = id +> getPBranchId _ = error "Not a pbranch context" + +> foldPBranches :: [BlockingContext] -> [BlockingContext] +> foldPBranches [] = [] +> foldPBranches bs = foldl1 (++) $ map getPBranches bs + +> getPBranches :: BlockingContext -> [BlockingContext] +> getPBranches (PWaitContext _ _ stmts _ _ _ _ _) = foldPBranches stmts +> getPBranches b@(PBranchContext _ _ _ _ _ _ _ _) = [b] +> getPBranches (BlockingStmt _ _ _ _ _ _) = [] +> getPBranches (WhileContext _ stmts _ _ _ _ _) = foldPBranches stmts +> getPBranches (ForContext _ stmts _ _ _ _ _) = foldPBranches stmts +> getPBranches (CompoundContext _ stmts _ _ _ _ _) = foldPBranches stmts +> getPBranches (IfContext _ ifStmts elseStmts _ _ _ _ _) = +> (foldPBranches ifStmts) ++ +> (if isJust elseStmts then foldPBranches $ fromJust elseStmts else []) diff --git a/code/src/aesop/parser/CGen.lhs b/code/src/aesop/parser/CGen.lhs new file mode 100644 index 0000000..c78aa85 --- /dev/null +++ b/code/src/aesop/parser/CGen.lhs @@ -0,0 +1,588 @@ +> module CGen where +> import Language.C +> import Language.C.System.GCC -- preprocessor used +> import Language.C.System.Preprocess +> import Language.C.Data.Position +> import System.Environment +> import Data.Typeable +> import Data.Maybe +> import Data.Either +> import Data.HashTable +> import Data.Generics +> import Data.Generics.Schemes +> import Control.Monad.State +> import qualified Data.ByteString +> import qualified Data.ByteString.Char8 +> import Control.Exception +> import Data.List +> import Debug.Trace +> import CParse +> import System.IO +> import System.IO.Unsafe +> import System.Directory + +> type ReturnType = (CTypeSpec, [CDerivedDeclr]) + +> returnToString :: ReturnType -> String +> returnToString (t, ds) = (show $ pretty t) ++ (join (map derivedToString ds)) + +> derivedToString :: CDerivedDeclr -> String +> derivedToString (CPtrDeclr _ _) = " * " +> derivedToString (CFunDeclr (Right ([], _)) _ _) = "" +> derivedToString (CFunDeclr (Right (params, _)) _ _) = foldl1 (++) $ map (show . pretty) params + +Construct a new node info: + +> newIdent :: String -> NodeInfo -> Ident +> newIdent name ni = mkIdent (posOfNode ni) name (Name 0) + +Functions to generate AST objects from C template code + +> mkInputStream :: String -> InputStream +> mkInputStream s = inputStreamFromString s + +> constructDeclFromC :: NodeInfo -> String -> CDecl +> constructDeclFromC ni s = +> let result = (execParser_ extDeclP (mkInputStream s) $ posOfNode ni) in +> case result of +> -- parse succeeded, so we return the declaration +> (Right (CDeclExt decl)) -> decl +> -- parse failed, so we assert fail for now. The CDecl empty constructor is needed to match types +> (Left pe) -> assert False (CDecl [] [] ni) + +> mkStmtFromC :: NodeInfo -> String -> CStat +> mkStmtFromC ni s = +> let result = (execParser_ statementP (mkInputStream s) $ posOfNode ni) in +> case result of +> -- parse succeeded, so we return the statement +> (Right stmt) -> stmt +> (Left pe) -> trace ("Parse Error in:\n\n" ++ +> ("mkStmtFromC failed: " ++ s) ++ +> (show pe)) $ assert False (CBreak ni) + +> mkStmtsFromCLines :: NodeInfo -> String -> [CStat] +> mkStmtsFromCLines ni lines = [mkStmtFromC ni lines] + +> doStmtPP :: [FilePath] -> [(String, String)] -> FilePath -> NodeInfo -> String -> [String] -> IO Data.ByteString.ByteString +> doStmtPP idirs defines ifile ni macro params = do +> let paramsStr [] = "" +> paramsStr pp = foldl1 ((++) . (++ ",")) pp +> (fp, h) <- openTempFile "/tmp" "__tmp-gs-macro-code.c" +> hPutStrLn h "void tmp_triton_macro_fun(void) {" +> hPutStrLn h (macro ++ "(" ++ (paramsStr params) ++ ")") +> hPutStrLn h "}" +> hClose h +> -- putStrLn $ join $ map (\(a,b) -> "-D" ++ a ++ "=" ++ b) defines +> let cppa = CppArgs ((map IncludeDir idirs) ++ [IncludeFile ifile] ++ (map (uncurry Define) defines)) [] Nothing fp Nothing +> result <- runPreprocessor (newGCC "gcc") cppa +> case result of +> (Right ios) -> do { removeFile fp; return ios } +> (Left error) -> trace ("Preprocessor failed:" ++ (show error)) $ assert False $ return Data.ByteString.empty + +> mkStmtFromCPPMacro :: [FilePath] -> [(String, String)] -> FilePath -> NodeInfo -> String -> [String] -> [CStat] +> mkStmtFromCPPMacro idirs defines ifile ni macro params = stmts +> where preproc = unsafePerformIO $ doStmtPP idirs defines ifile ni macro params +> strproc = Data.ByteString.Char8.unpack preproc +> parsedResult = (execParser_ translUnitP preproc $ posOfNode ni) +> stmts = case parsedResult of +> -- parse succeeded, so we return the statement +> (Right (CTranslUnit [] _)) -> [] +> (Right (CTranslUnit edecls _)) -> case (last edecls) of +> (CFDefExt (CFunDef _ _ _ stmt _)) -> [stmt] +> _ -> [] +> (Left pe) -> trace ("Error generating function definitions from macro '" ++ macro ++ "': " ++ strproc ++ (show pe)) +> (assert False []) + +> declDummyName :: String +> declDummyName = "__dummy_decl" + +> doDeclPP :: [FilePath] -> [(String, String)] -> FilePath -> NodeInfo -> String -> [String] -> IO Data.ByteString.ByteString +> doDeclPP idirs defines ifile ni macro params = do +> let paramsStr [] = "" +> paramsStr pp = foldl1 ((++) . (++ ",")) pp +> (fp, h) <- openTempFile "/tmp" "__tmp-gs-macro-code.c" +> hPutStrLn h $ "int " ++ declDummyName ++ ";" +> hPutStrLn h $ macro ++ "(" ++ (paramsStr params) ++ ")" +> hClose h +> let cppa = CppArgs ((map IncludeDir idirs) ++ [IncludeFile ifile] ++ (map (uncurry Define) defines)) [] Nothing fp Nothing +> result <- runPreprocessor (newGCC "gcc") cppa +> case result of +> (Right ios) -> do { removeFile fp; return ios } +> (Left error) -> trace ("Preprocessor failed:" ++ (show error)) $ assert False $ return Data.ByteString.empty + +> getDeclsAfterDummy :: [CExtDecl] -> [CDecl] +> getDeclsAfterDummy edecls = map getd $ reverse $ takeWhile dname (reverse edecls) +> where getd (CDeclExt d) = d +> dname (CDeclExt d) = (/=) declDummyName $ identToString (getCDeclName d) +> dname _ = False + +> mkDeclsFromCPPMacro :: [FilePath] -> [(String, String)] -> FilePath -> NodeInfo -> String -> [String] -> [CDecl] +> mkDeclsFromCPPMacro idirs defines ifile ni macro params = decls +> where preproc = unsafePerformIO $ doDeclPP idirs defines ifile ni macro params +> strproc = Data.ByteString.Char8.unpack preproc +> parsedResult = (execParser_ translUnitP preproc $ posOfNode ni) +> decls = case parsedResult of +> -- parse succeeded, so we return the statement +> (Right (CTranslUnit [] _)) -> [] +> (Right (CTranslUnit edecls _)) -> getDeclsAfterDummy edecls +> (Left pe) -> trace ("Error generating function definitions from macro '" ++ macro ++ "': " ++ strproc ++ (show pe)) +> (assert False []) + +> doFunDefPP :: [FilePath] -> [(String, String)] -> FilePath -> NodeInfo -> String -> [String] -> IO Data.ByteString.ByteString +> doFunDefPP idirs defines ifile ni macro params = do +> let paramsStr [] = "" +> paramsStr pp = foldl1 ((++) . (++ ",")) pp +> (fp, h) <- openTempFile "/tmp" "__tmp-gs-macro-code.c" +> hPutStrLn h $ "int " ++ declDummyName ++ ";" +> hPutStrLn h $ macro ++ "(" ++ (paramsStr params) ++ ")" +> hClose h +> let cppa = CppArgs ((map IncludeDir idirs) ++ [IncludeFile ifile] ++ (map (uncurry Define) defines)) [] Nothing fp Nothing +> result <- runPreprocessor (newGCC "gcc") cppa +> case result of +> (Right ios) -> do { removeFile fp; return ios } +> (Left error) -> trace ("Preprocessor failed:" ++ (show error)) $ assert False $ return Data.ByteString.empty + +> getFunDefDeclsAfterDummy :: [CExtDecl] -> [CExtDecl] +> getFunDefDeclsAfterDummy edecls = reverse $ takeWhile dname (reverse edecls) +> where dname (CDeclExt d) = (/=) declDummyName $ identToString (getCDeclName d) +> dname _ = True + +> swapStmts :: String -> [CStat] -> CStat -> CStat +> swapStmts stmtName insert a@(CLabel name _ _ ni) +> | (identToString name) == "__AESOP_BLOCK_INSERT_HERE__" = mkCompoundStmt (Just stmtName) insert ni +> | otherwise = a +> swapStmts _ _ a = a + +> insertStmtBlock :: (Data a) => String -> [CStat] -> a -> a +> insertStmtBlock name insert a = everywhere (mkT $ swapStmts name insert) a + +> mkFunDefFromCPPMacro :: [FilePath] -> [(String, String)] -> FilePath -> NodeInfo -> String -> [String] -> String -> [CStat] -> [CExtDecl] +> mkFunDefFromCPPMacro idirs defines ifile ni macro params insertName insertStmts = [completedFunDef] +> where preproc = unsafePerformIO $ doFunDefPP idirs defines ifile ni macro params +> strproc = Data.ByteString.Char8.unpack preproc +> parsedResult = (execParser_ translUnitP preproc $ posOfNode ni) +> decls = case parsedResult of +> -- parse succeeded, so we return the statement +> (Right (CTranslUnit [] _)) -> [] +> (Right (CTranslUnit edecls _)) -> getFunDefDeclsAfterDummy edecls +> (Left pe) -> trace ("Error generating function definitions from macro '" ++ macro ++ "': " ++ strproc ++ (show pe)) +> (assert False []) + +> [fdef] = assert ((length decls) == 1) $ decls +> completedFunDef = insertStmtBlock insertName insertStmts fdef + +> mkCompoundStmt :: Maybe String -> [CStat] -> NodeInfo -> CStat +> mkCompoundStmt (Just label) stmts ni = CLabel (newIdent label ni) (CCompound [] (map CBlockStmt stmts) ni) [] ni +> mkCompoundStmt Nothing stmts ni = CCompound [] (map CBlockStmt stmts) ni + +> mkCompoundWithDecls :: Maybe String -> [CDecl] -> [CStat] -> NodeInfo -> CStat +> mkCompoundWithDecls (Just label) decls stmts ni = +> CLabel (newIdent label ni) (CCompound [] ((map CBlockDecl decls) ++ (map CBlockStmt stmts)) ni) [] ni +> mkCompoundWithDecls Nothing decls stmts ni = +> CCompound [] ((map CBlockDecl decls) ++ (map CBlockStmt stmts)) ni + +> constructExprFromC :: NodeInfo -> String -> CExpr +> constructExprFromC ni s = +> let result = (execParser_ expressionP (mkInputStream s) $ posOfNode ni) in +> case result of +> -- parse succeeded, so we return the expression +> (Right expr) -> expr +> (Left pe) -> assert False (CVar (newIdent "blah" ni) ni) + +funDefDecl creates the return type declaration for a given function. The parameters to funDefDecl are +the function definition and the name of the return type. For example, a function defined as: + +int ** myFunc(int a); + +would generate a CDecl like this: + +int ** ret; + +> mkRetDecl :: (CTypeSpec, [CDerivedDeclr]) -> String -> NodeInfo -> [CDecl] +> mkRetDecl ((CVoidType _), []) name ni = [] +> mkRetDecl rtype name ni = [CDecl [(CTypeSpec (fst rtype))] +> [(Just (CDeclr (Just $ newIdent name ni) (snd rtype) Nothing [] ni), +> Nothing, +> Nothing)] +> ni] + +> mkRetDeclFromFunDef :: CFunDef -> String -> [CDecl] +> mkRetDeclFromFunDef f name = +> mkRetDecl rtype name (nodeInfo f) +> where rtype = getFunDefReturn f + +Functions for building struct members from scratch + +Make a declarator: <derived> name; +Examples: + +**foo; + +mkCDeclr "foo" [CPtrDeclr, CPtrDeclr] ... + +(*myFunPtr)(int bar, char *baz); + +mkCDeclr "myFunPtr" [CPtrDeclr, (CFunDeclr (Right [(CDecl [CTypeSpec CIntType] [("bar" ...)]), ...]) ...)] + +> mkCDeclr :: String -> [CDerivedDeclr] -> CDeclr +> mkCDeclr name derived = +> let ni = nodeInfo $ head derived +> in CDeclr (Just (newIdent name ni)) derived Nothing [] ni + +> mkAnonCDeclr :: [CDerivedDeclr] -> CDeclr +> mkAnonCDeclr derived = +> let ni = nodeInfo $ head derived +> in CDeclr Nothing derived Nothing [] ni + +Make a declaration: type <derived> name; +Examples: + +int **foo; + +mkCDecl CIntType [CPtrDeclr, CPtrDeclr] "foo" + +struct myStruct bar; + +mkCDecl (CSUType (CStruct CStructTag "myStruct" Nothing [] ...) ...) [] "bar" + +myType *baz; + +mkCDecl (CTypeDef "myType") [CPtrDeclr] "baz" + +> mkCDecl :: CTypeSpec -> [CDerivedDeclr] -> String -> NodeInfo -> CDecl +> mkCDecl mtype derives name ni = CDecl [CTypeSpec mtype] [(Just $ mkCDeclr name derives, Nothing, Nothing)] ni + +> mkAnonCDecl :: CTypeSpec -> [CDerivedDeclr] -> NodeInfo -> CDecl +> mkAnonCDecl mtype derives ni = CDecl [CTypeSpec mtype] [(Just $ mkAnonCDeclr derives, Nothing, Nothing)] ni + +> mkAnonFromDecl :: CDecl -> CDecl +> mkAnonFromDecl (CDecl specs inits ni) = (CDecl specs (map stripName inits) ni) +> where stripName ((Just (CDeclr (Just n) deriveds strlit attrs sni)), init, ex) = +> ((Just (CDeclr Nothing deriveds strlit attrs sni)), init, ex) + +> mkConstCDecl :: CTypeSpec -> [CDerivedDeclr] -> String -> NodeInfo -> CDecl +> mkConstCDecl mtype derives name ni = CDecl [CTypeQual (CConstQual ni), CTypeSpec mtype] [(Just $ mkCDeclr name derives, Nothing, Nothing)] ni + +> genCDecl :: String -> String -> NodeInfo -> CDecl +> genCDecl typedef name ni = mkCDecl (CTypeDef (newIdent typedef ni) ni) [] name ni + +> addBlockingTQ :: CDecl -> CDecl +> addBlockingTQ (CDecl specs inits ni) = CDecl (CTypeQual ((CBlocking ni)):specs) inits ni + +> mkFunPtrsStruct :: String -> String -> [(String, String)] -> NodeInfo -> CExtDecl +> mkFunPtrsStruct stype sname fields ni = CDeclExt decl +> where decl = CDecl [tspec] declrs ni +> tspec = CTypeSpec (CSUType (CStruct CStructTag (Just $ newIdent stype ni) Nothing [] ni) ni) +> declrs = [(Just vname, Just inits, Nothing)] +> vname = CDeclr (Just (newIdent sname ni)) [] Nothing [] ni +> inits = CInitList [ ( [CMemberDesig (newIdent field ni) ni], CInitExpr (CVar (newIdent fun ni) ni) ni ) | (field, fun) <- fields ] ni + +Functions for building a struct from the name and array of members + +param1Decl can be created with mkCDecl. + +> mkStructDef :: Ident -> [CDecl] -> NodeInfo -> CTypeSpec +> mkStructDef name members ni = CSUType (CStruct CStructTag (Just name) (Just members) [] ni) ni + +> mkStructDefDecl :: String -> [CDecl] -> NodeInfo -> CDecl +> mkStructDefDecl name members ni = +> CDecl [CTypeSpec $ mkStructDef (newIdent name ni) members ni] [(Nothing, Nothing, Nothing)] ni + +> mkStructDecl :: String -> String -> NodeInfo -> CDecl +> mkStructDecl tname name ni = mkCDecl (CSUType (CStruct CStructTag (Just $ newIdent tname ni) +> Nothing +> [] +> ni) ni) [] name ni + +> mkStructPtrDecl :: String -> String -> NodeInfo -> CDecl +> mkStructPtrDecl tname name ni = mkCDecl (CSUType (CStruct CStructTag (Just $ newIdent tname ni) +> Nothing +> [] +> ni) ni) [(CPtrDeclr [] ni)] name ni + +> mkAnonStructPtrDecl :: String -> NodeInfo -> CDecl +> mkAnonStructPtrDecl tname ni = mkAnonCDecl (CSUType (CStruct CStructTag (Just $ newIdent tname ni) Nothing [] ni) ni) +> [(CPtrDeclr [] ni)] ni +> mkIntDecl :: String -> NodeInfo -> CDecl +> mkIntDecl name ni = mkCDecl (CIntType ni) [] name ni + +From a name list of parameters, and return type, construct an external declaration struct + +Example: + +struct myStruct +{ + param1type param1; + param2type param2; +}; + +genStructExtDecl "myStruct" [param1Decl, param2Decl] + +> genStructExtDecl :: String -> [CDecl] -> NodeInfo -> CExtDecl +> genStructExtDecl name members ni = CDeclExt $ mkStructDefDecl name members ni + +Make a function pointer declarator: (*) (params); + +> mkFunPtrDeclr :: [CDecl] -> [CDerivedDeclr] +> mkFunPtrDeclr params = +> let ni = nodeInfo $ head params +> in [CPtrDeclr [] ni, CFunDeclr (Right (params, False)) [] ni] + +Make the function pointer: void (* name) (params); + +> mkFunPtrDecl :: String -> CTypeSpec -> [CDecl] -> CDecl +> mkFunPtrDecl name retType params = +> let ni = nodeInfo retType +> in mkCDecl retType (mkFunPtrDeclr params) name ni + +> mkFunPtrDerivedDecl :: String -> CTypeSpec -> [CDerivedDeclr] -> [CDecl] -> CDecl +> mkFunPtrDerivedDecl name retType retDerived params = +> let ni = nodeInfo retType +> in mkCDecl retType ((mkFunPtrDeclr params) ++ retDerived) name ni + +> mkVoidFunPtr :: String -> [CDecl] -> CDecl +> mkVoidFunPtr name params = +> let ni = nodeInfo $ head params +> in mkFunPtrDecl name (CVoidType ni) params + +> mkFunDeclr :: [CDecl] -> NodeInfo -> CDerivedDeclr +> mkFunDeclr params ni = +> CFunDeclr (Right (params, False)) [] ni + +> mkFunDecl :: String -> CTypeSpec -> [CDerivedDeclr] -> [CDecl] -> CDecl +> mkFunDecl fname returnType returnDerived params = +> let ni = nodeInfo returnType +> in mkCDecl returnType ([mkFunDeclr params ni] ++ returnDerived) fname ni + +> mkFunDeclWithDeclSpecs :: String -> CTypeSpec -> [CDerivedDeclr] -> [CDeclSpec] -> [CDecl] -> CDecl +> mkFunDeclWithDeclSpecs fname rType rDerived declSpecs params = +> let ni = nodeInfo rType +> in CDecl (declSpecs ++ [CTypeSpec rType]) +> [(Just $ mkCDeclr fname ([mkFunDeclr params ni] ++ rDerived), +> Nothing, Nothing)] ni + +> mkFunPtrDeclWithDeclSpecs :: String -> CTypeSpec -> [CDerivedDeclr] -> [CDeclSpec] -> [CDecl] -> Maybe String -> CDecl +> mkFunPtrDeclWithDeclSpecs fname rType rDerived declSpecs params initName = +> let ni = nodeInfo rType +> in CDecl (declSpecs ++ [CTypeSpec rType]) +> [(Just $ mkCDeclr fname ([CPtrDeclr [] ni, mkFunDeclr params ni] ++ rDerived), +> (if isJust initName +> then Just (CInitExpr (CVar (newIdent (fromJust initName) ni) ni) ni) +> else Nothing), Nothing)] ni + +Remove the initializer from the declarator. For example: + +int a = 10; + +becomes: + +int a; + +We don't remove the initialization list, so: + +int a[2] = {1, 2}; + +remains. + +> removeInitFromDeclr :: (Maybe CDeclr, Maybe CInit, Maybe CExpr) -> (Maybe CDeclr, Maybe CInit, Maybe CExpr) +> removeInitFromDeclr ((,,) declr (Just (CInitExpr expr _)) cexpr) = (declr, Nothing, cexpr) +> removeInitFromDeclr t = t + +> removeInitFromDecl :: CDecl -> CDecl +> removeInitFromDecl (CDecl declspecs declrs ni) = (CDecl declspecs (map removeInitFromDeclr declrs) ni) + +> getInitFromDeclr :: (Maybe CDeclr, Maybe CInit, Maybe CExpr) -> Maybe CExpr +> getInitFromDeclr ((,,) _ (Just (CInitExpr initexpr _)) _) = Just initexpr +> getInitFromDeclr _ = Nothing + +> getNameFromDeclr :: (Maybe CDeclr, Maybe CInit, Maybe CExpr) -> Maybe Ident +> getNameFromDeclr ((,,) (Just (CDeclr name _ _ _ _)) _ _) = name +> getNameFromDeclr _ = Nothing + +Get the init statements from a declaration. As an example, the declaration: + +int a, b = 3, c = 4; + +results in the statements: + +b = 3; +c = 4; + +> getInitStmtsFromDecl :: CDecl -> [CStat] +> getInitStmtsFromDecl d@(CDecl declspecs declrs ni) = do +> declr <- declrs +> let name = getNameFromDeclr declr +> init = getInitFromDeclr declr +> ni = nodeInfo d +> if isJust init && isJust name then (return $ mkAssignStmt (CVar (fromJust name) ni) (fromJust init)) else [] + +> getInitsFromDecls :: [CDecl] -> [CStat] +> getInitsFromDecls ds = join $ map getInitStmtsFromDecl ds + +> removeVarNameFromDeclr :: CDeclr -> CDeclr +> removeVarNameFromDeclr (CDeclr name indirections asm attrs ni) = +> (CDeclr Nothing indirections asm attrs ni) + +> removeVarFromDecl :: CDecl -> CDecl +> removeVarFromDecl (CDecl specs indirs ni) = (CDecl specs (map stripVar indirs) ni) where +> stripVar i@(cd, ci, ce) = +> if isJust cd +> then (Just (removeVarNameFromDeclr $ fromJust $ cd), Nothing, Nothing) +> else i + +Given a lhs expression and rhs expression, construct the statement: lhs = rhs; + +> mkAssignStmt :: CExpr -> CExpr -> CStat +> mkAssignStmt lexpr rexpr = +> let ni = nodeInfo lexpr +> in (CExpr (Just (CAssign CAssignOp lexpr rexpr ni)) ni) + +> mkFunCall :: CExpr -> CExpr -> [CExpr] -> CStat +> mkFunCall ret call params = +> let ni = nodeInfo ret +> in (CExpr (Just (CAssign CAssignOp ret (CCall call params ni) ni)) ni) + +> mkVar :: String -> NodeInfo -> CExpr +> mkVar s ni = (CVar (newIdent s ni) ni) + +Tack on a struct pointer variable to an expression (assuming its a CVar). For example, with an expression of "blah" + +addStructPtr "params" expr + +will make: + +params->blah + +> addStructPtr :: String -> CExpr -> CExpr +> addStructPtr sname (CVar name ni) = CMember (CVar (newIdent sname ni) ni) name True ni +> addStructPtr _ expr = expr + +> addAddrOp :: CExpr -> CExpr +> addAddrOp c = (CUnary CAdrOp c (nodeInfo c)) + +addStructPtrPrefix "ctl" "params" (CVar "blah") + +will make: + +ctl->params->blah + +> addStructPtrPrefix :: String -> String -> CExpr -> CExpr +> addStructPtrPrefix sname pname (CVar name ni) = CMember (CMember (CVar (newIdent sname ni) ni) (newIdent pname ni) True ni) name True ni +> addStructPtrPrefix _ _ e = e + +Same as above, but without the second pointer deref: + +ctl->params.blah + +> addStructPrefix :: String -> String -> CExpr -> CExpr +> addStructPrefix sname pname (CVar name ni) = +> CMember (CMember (CVar (newIdent sname ni) ni) +> (newIdent pname ni) True ni) name False ni + +> addStructPrefixPrefix :: String -> String -> String -> CExpr -> CExpr +> addStructPrefixPrefix sname p1name p2name (CVar name ni) = +> CMember (CMember (CMember (CVar (newIdent sname ni) ni) +> (newIdent p1name ni) True ni) +> (newIdent p2name ni) False ni) name False ni + +> addStructPtrPrefixPrefix :: String -> String -> String -> CExpr -> CExpr +> addStructPtrPrefixPrefix sname p1name p2name (CVar name ni) = +> CMember (CMember (CMember (CVar (newIdent sname ni) ni) (newIdent p1name ni) True ni) (newIdent p2name ni) True ni) name False ni + +Take an assign statement, and insert a struct pointer prefix to the lhs. For example: + +addStructToAssign "params" "mymem" "funcall(a, 123)" + +results in the statement: params.mymem = funcall(a, 123); + +> addStructToAssign :: String -> String -> Ident -> CExpr -> CStat +> addStructToAssign sname pname lvar rexpr = +> let ni = nodeInfo rexpr +> in (CExpr (Just (CAssign CAssignOp (addStructPrefix sname pname (CVar lvar ni)) rexpr ni)) ni) + +Take an assign statement, and insert a struct pointer prefix to the lhs. For example: + +addStructPtrToAssign "params" "mymem" "funcall(a, 123)" + +results in the statement: params->mymem = funcall(a, 123); + +> addStructPtrToAssign :: String -> String -> Ident -> CExpr -> CStat +> addStructPtrToAssign sname pname lvar rexpr = +> let ni = nodeInfo rexpr +> in (CExpr (Just (CAssign CAssignOp (addStructPtrPrefix sname pname (CVar lvar ni)) rexpr ni)) ni) + +> mkFunDef :: (CTypeSpec, [CDerivedDeclr]) -> [CDeclSpec] -> String -> [CDecl] -> CStat -> CExtDecl +> mkFunDef (rtype, derivedPtrs) dspecs fname params stmts = +> let ni = if null params then nodeInfo stmts else nodeInfo $ head params +> in CFDefExt (CFunDef (dspecs ++ [(CTypeSpec rtype)]) +> (CDeclr (Just $ newIdent fname ni) +> (derivedPtrs ++ +> [(CFunDeclr (Right (params, False)) [] ni)]) +> Nothing [] ni) +> [] stmts ni) + +> addDeclSpecs :: CExtDecl -> [CDeclSpec] -> CExtDecl +> addDeclSpecs (CFDefExt (CFunDef s d dls stmt ni)) newspecs = CFDefExt $ CFunDef (newspecs ++ s) d dls stmt ni + +> mkStaticFunDecl :: CTypeSpec -> String -> [CDecl] -> CExtDecl +> mkStaticFunDecl return fname params = +> let ni = nodeInfo return +> in CDeclExt (CDecl [(CStorageSpec (CStatic ni)), +> (CTypeSpec return)] +> [((Just $ mkCDeclr fname [mkFunDeclr params ni]), Nothing, Nothing)] ni) + +> mkStaticFunDef :: CTypeSpec -> String -> [CDecl] -> CStat -> CExtDecl +> mkStaticFunDef return fname params stmts = +> let ni = if null params then nodeInfo stmts else nodeInfo $ head params +> in CFDefExt (CFunDef [(CStorageSpec (CStatic ni)), (CTypeSpec return)] +> (CDeclr (Just $ newIdent fname ni) +> [(CFunDeclr (Right (params, False)) [] ni)] +> Nothing [] ni) +> [] stmts ni) + +> mkIfCondition :: Maybe CExpr -> CExpr +> mkIfCondition mexpr = if isJust mexpr then fromJust mexpr else CConst (CIntConst (cInteger 1) $ nodeInfo $ fromJust mexpr) + +> mkIfStmt :: Maybe CExpr -> [CStat] -> CStat +> mkIfStmt cond stmts = CIf (mkIfCondition cond) (CCompound [] (map CBlockStmt stmts) $ nodeInfo $ fromJust cond) Nothing $ nodeInfo $ fromJust cond + +> mkIfElseStmt :: Maybe CExpr -> [CStat] -> [CStat] -> CStat +> mkIfElseStmt cond ifstmts elsestmts = +> CIf (mkIfCondition cond) +> (CCompound [] (map CBlockStmt ifstmts) $ nodeInfo $ fromJust cond) +> (Just (CCompound [] (map CBlockStmt elsestmts) $ nodeInfo $ fromJust cond)) $ nodeInfo $ fromJust cond + +> mkIntConst :: Integer -> NodeInfo -> CExpr +> mkIntConst v ni = CConst (CIntConst (cInteger v) ni) + +> mkGoto :: String -> NodeInfo -> CStat +> mkGoto s ni = (CGoto (newIdent s ni) ni) + +> mkLabel :: String -> [CStat] -> NodeInfo -> CStat +> mkLabel s stmts ni = (CLabel (newIdent s ni) (CCompound [] (map CBlockStmt stmts) ni) [] ni) + +> canonCDecl :: CDecl -> String +> canonCDecl (CDecl declspecs derived _) = +> let t = getTypeSpec declspecs +> tstr = case t of +> (CSUType (CStruct CStructTag (Just n) _ _ _) _) -> "struct_" ++ (identToString n) +> (CTypeDef n _) -> identToString n +> (CSUType (CStruct CUnionTag (Just n) _ _ _) _) -> "union_" ++ (identToString n) +> (CEnumType (CEnum (Just n) _ _ _) _) -> "enum_" ++ (identToString n) +> _ -> show $ pretty t +> ptrs = filter isDerivedPtr (join $ map getDerivedDeclrs derived) +> ptrStr = concat [ "_ptr" | p <- ptrs ] +> in tstr ++ ptrStr + +> removeAPtr :: CDecl -> CDecl +> removeAPtr (CDecl sp derived n) = (CDecl sp nd n) +> where nd = map remP derived +> remP (declr, init, expr) = (rem declr, init, expr) +> rem Nothing = Nothing +> rem (Just (CDeclr name deriveds lit attrs ni)) = (Just (CDeclr name (remd deriveds) lit attrs ni)) +> remd (d:ds) = if isDerivedPtr d then ds else (d:(remd ds)) +> remd [] = [] + +> mkCastStmt :: String -> CDecl -> String -> NodeInfo -> CStat +> mkCastStmt l t r ni = CExpr (Just (CAssign CAssignOp (CVar (newIdent l ni) ni) (CCast t (CVar (newIdent r ni) ni) ni) ni)) ni + diff --git a/code/src/aesop/parser/CParse.lhs b/code/src/aesop/parser/CParse.lhs new file mode 100644 index 0000000..4721961 --- /dev/null +++ b/code/src/aesop/parser/CParse.lhs @@ -0,0 +1,412 @@ +> module CParse where +> import Language.C +> import Language.C.Data.Node +> import Language.C.Data.Position +> import Language.C.Data.Ident +> import Language.C.System.GCC -- preprocessor used +> import System.Environment +> import Data.Typeable +> import Data.Maybe +> import Data.Either +> import Data.HashTable +> import Data.Generics +> import Data.Generics.Schemes +> import Control.Monad.State +> import qualified Data.ByteString +> import qualified Data.ByteString.Char8 +> import Control.Exception +> import Data.List +> import System.IO.Unsafe +> import Debug.Trace + +Add a first function for triples + +> tfst :: (a,b,c) -> a +> tfst ((,,) a _ _) = a + +Get the line number and column string from a node info. For example, a variable at line 123, column 34 will result +in the string: + +_123_34_ + +> getPosVarStr :: NodeInfo -> String +> getPosVarStr (NodeInfo p _ _) = "_" ++ (show $ posRow p) ++ "_" ++ (show $ posColumn p) ++ "_" + +Get the declarators from a list of triples + +> getCDeclrsFromList :: [(Maybe CDeclr, Maybe CInit, Maybe CExpr)] -> [CDeclr] +> getCDeclrsFromList cdeclrs = +> concatMap (\cd -> if isJust $ tfst cd then [fromJust $ tfst cd] else []) cdeclrs + + Get the name from a declarator + +> getCDeclrName :: CDeclr -> Ident +> getCDeclrName (CDeclr name _ _ _ _) = fromJust $ name + +Get the names from a declaration. For example: + +int a, b, c = 3; + +Will result in ["a", "b", "c"] + +> getCDeclNames :: CDecl -> [Ident] +> getCDeclNames (CDecl _ declrs _) = map getCDeclrName $ getCDeclrsFromList declrs + +> getCDeclName :: CDecl -> Ident +> getCDeclName (CDecl _ declrs _) = getCDeclrName $ d +> where (d:dls) = getCDeclrsFromList declrs + +> hasDeclrName :: CDecl -> Bool +> hasDeclrName (CDecl _ declrs _) = any (\(CDeclr name _ _ _ _) -> isJust name) $ getCDeclrsFromList declrs + +> splitDecls :: CDecl -> [CDecl] +> splitDecls (CDecl specifiers initdecls ni) = map (\dlr -> (CDecl specifiers [dlr] ni)) initdecls + +> isStructTypeSpec :: CDeclSpec -> Bool +> isStructTypeSpec (CTypeSpec (CSUType (CStruct _ _ _ _ _) _)) = True +> isStructTypeSpec _ = False + +> isTypeDefSpec :: CDeclSpec -> Bool +> isTypeDefSpec (CStorageSpec (CTypedef _)) = True +> isTypeDefSpec _ = False + +> isTypeDefTypeSpec :: CDeclSpec -> Bool +> isTypeDefTypeSpec (CTypeSpec (CTypeDef _ _)) = True +> isTypeDefTypeSpec _ = False + +> isVoidTypeSpec :: CDeclSpec -> Bool +> isVoidTypeSpec (CTypeSpec (CVoidType _)) = True +> isVoidTypeSpec _ = False + +> isStructDecl :: CDecl -> Bool +> isStructDecl (CDecl specs initdecls ni) = any isStructTypeSpec specs + +> isTypeDefDecl :: CDecl -> Bool +> isTypeDefDecl (CDecl (s:specs) initdecls ni) = isTypeDefSpec s +> isTypeDefDecl _ = False + +> structSpecHasName :: CDeclSpec -> Bool +> structSpecHasName (CTypeSpec (CSUType (CStruct _ (Just _) _ _ _) _)) = True +> structSpecHasName _ = False + +> structSpecHasFields :: CDeclSpec -> Bool +> structSpecHasFields (CTypeSpec (CSUType (CStruct _ _ (Just fields) _ _) _)) = True +> structSpecHasFields _ = False + +> isTypeDefOfPredefStruct :: CDecl -> Bool +> isTypeDefOfPredefStruct (CDecl (s1:s2:[]) initdecls ni) = +> isTypeDefSpec s1 && isStructTypeSpec s2 && (not $ structSpecHasFields s2) +> isTypeDefOfPredefStruct _ = False + +> isTypeDefOfInlineStruct :: CDecl -> Bool +> isTypeDefOfInlineStruct (CDecl (s1:s2:[]) initdecls ni) = +> isTypeDefSpec s1 && isStructTypeSpec s2 && structSpecHasFields s2 +> isTypeDefOfInlineStruct _ = False + +> isTypeDefOfTypeDef :: CDecl -> Bool +> isTypeDefOfTypeDef (CDecl (s1:s2:[]) _ _) = +> isTypeDefSpec s1 && isTypeDefTypeSpec s2 +> isTypeDefOfTypeDef _ = False + +> getStructName :: CDeclSpec -> Maybe String +> getStructName (CTypeSpec (CSUType (CStruct _ n _ _ _) _)) = if isJust n then Just $ identToString $ fromJust n else Nothing +> getStructName _ = Nothing + +> getStructTypeDefInfo :: CDecl -> Maybe (Maybe String, String) +> getStructTypeDefInfo d@(CDecl (s1:s2:[]) initdecls ni) +> | isTypeDefSpec s1 && isStructTypeSpec s2 = +> let (i:ids) = initdecls +> ((Just (CDeclr (Just (Ident tname _ _)) _ _ _ _)), _, _) = i +> in Just (getStructName s2, tname) +> | otherwise = Nothing + +> getTypeDefTypeDefInfo :: CDecl -> Maybe (String, String) +> getTypeDefTypeDefInfo d@(CDecl (s1:s2:[]) initdecls ni) +> | isTypeDefSpec s1 && isTypeDefTypeSpec s2 = +> let (CTypeSpec (CTypeDef (Ident pname _ _) _)) = s2 +> (i:ids) = initdecls +> ((Just (CDeclr (Just (Ident tname _ _)) _ _ _ _)), _, _) = i +> in Just (pname, tname) +> | otherwise = Nothing + +> getStructInfo :: CDecl -> Maybe (Maybe String, [CDecl]) +> getStructInfo (CDecl s i n) = +> let (t:ts) = filter isStructTypeSpec s +> in case t of +> (CTypeSpec (CSUType (CStruct _ (Just n) (Just f) _ _) _)) -> Just (Just $ identToString n, f) +> (CTypeSpec (CSUType (CStruct _ Nothing (Just f) _ _) _)) -> Just (Nothing, f) +> _ -> Nothing + +> getTypeName :: CDecl -> Maybe String +> getTypeName d@(CDecl s _ _) = +> let (sp:sps) = s +> in case sp of +> (CTypeSpec (CSUType (CStruct _ (Just n) _ _ _) _)) -> Just $ identToString n +> _ -> Nothing + +> isVarDecl :: CDecl -> Bool +> isVarDecl d@(CDecl specs initdecls ni) = +> (not $ isFunDecl d) && (not $ any isTypeDefSpec specs) && hasDeclrName d + +> getVarName :: CDecl -> String +> getVarName d@(CDecl _ initdecls _) = vname +> where (i:ids) = initdecls +> ((Just (CDeclr (Just (Ident vname _ _)) _ _ _ _)), _, _) = i + +For a compound block item (part of a compound block of statements), is the item a declaration? + +> isFuncDecl :: CBlockItem -> Bool +> isFuncDecl (CBlockDecl decl) = True +> isFuncDecl _ = False + +For a compound block item (part of a compound block of statements), is the item a declaration? + +> getFuncDecl :: CBlockItem -> CDecl +> getFuncDecl (CBlockDecl decl) = decl + +For the array of compound block items, get the elements that are declarations + +> findFuncDecls :: [CBlockItem] -> [CDecl] +> findFuncDecls decls = [ getFuncDecl d | d <- decls, isFuncDecl d ] + +For the function derived declarator, get the function parameters + +> getCFunDeclrParams :: CDerivedDeclr -> [CDecl] +> getCFunDeclrParams (CFunDeclr (Right (declarations, isVariadic)) _ ni) = declarations + +> isTypeSpec :: CDeclSpec -> Bool +> isTypeSpec (CTypeSpec c) = True +> isTypeSpec _ = False + +> getTypeSpecFromDeclSpec :: CDeclSpec -> CTypeSpec +> getTypeSpecFromDeclSpec (CTypeSpec c) = c + +> getTypeSpec :: [CDeclSpec] -> CTypeSpec +> getTypeSpec declspecs = getTypeSpecFromDeclSpec $ fromJust $ find isTypeSpec declspecs + +> getTypeSpecFromDecl :: CDecl -> CTypeSpec +> getTypeSpecFromDecl (CDecl dspecs _ _) = getTypeSpec dspecs + +> isDerivedPtr :: CDerivedDeclr -> Bool +> isDerivedPtr (CPtrDeclr _ _) = True +> isDerivedPtr _ = False + +> getDerivedDeclrs :: (Maybe CDeclr, Maybe CInit, Maybe CExpr) -> [CDerivedDeclr] +> getDerivedDeclrs (Just (CDeclr _ derived _ _ _), _, _) = derived +> getDerivedDeclrs _ = [] + +> getDerivedPtrs :: CDeclr -> [CDerivedDeclr] +> getDerivedPtrs (CDeclr _ derivedDeclrs _ _ _) = +> if any isDerivedFun derivedDeclrs then +> tail $ snd $ break isDerivedFun derivedDeclrs +> else filter (not . isDerivedPtr) derivedDeclrs + +> getReturn :: CDecl -> (CTypeSpec, [CDerivedDeclr]) +> getReturn d@(CDecl specs declarators ni) = +> let declrs = getCDeclrsFromList declarators +> (d:ds) = declrs +> derivedPtrs = if null declrs then [] else getDerivedPtrs $ d +> in (getTypeSpec specs, derivedPtrs) + +> isDerivedFun :: CDerivedDeclr -> Bool +> isDerivedFun (CFunDeclr (Right ((,) params variadic)) _ _) +> | otherwise = True +> isDerivedFun _ = False + +> getDerivedFun :: CDeclr -> CDerivedDeclr +> getDerivedFun (CDeclr _ derivedDeclrs _ _ _) = fromJust $ find isDerivedFun derivedDeclrs + +> getDerivedFunParams :: CDerivedDeclr -> [CDecl] +> getDerivedFunParams (CFunDeclr (Right ((,) params variadic)) _ _) = params + +> getParams :: CDecl -> [CDecl] +> getParams (CDecl specs declarators ni) = +> let declrs = getCDeclrsFromList declarators +> (d:ds) = declrs +> in if null declrs then [] else getDerivedFunParams $ getDerivedFun $ d + +split a function declaration into tuple: (function-name, (return-type, return-derived-list), function-parameters) + +> splitFunDecl :: CDecl -> (String, (CTypeSpec, [CDerivedDeclr]), [CDecl]) +> splitFunDecl decl = (identToString $ dn, getReturn decl, getParams decl) +> where (dn:dns) = getCDeclNames decl + +> getFunInfo :: CFunDef -> (String, (CTypeSpec, [CDerivedDeclr]), [CDecl]) +> getFunInfo f = (getFunDefName f, getFunDefReturn f, getFunDefParams f) + +Get the name of a function definition + +> getFunDefName :: CFunDef -> String +> getFunDefName (CFunDef _ (CDeclr name _ _ _ _) _ _ _) = identToString $ fromJust name + +Get the parameter declarations of a function definition + +> getFunDefParams :: CFunDef -> [CDecl] +> getFunDefParams (CFunDef _ (CDeclr _ derivedDeclrs _ _ _) _ _ _) = +> let fundeclr = find isFunDeclr derivedDeclrs +> in getCFunDeclrParams (fromJust fundeclr) + +Get the return type and derived declarators for a function definition + +> getFunDefReturn :: CFunDef -> (CTypeSpec, [CDerivedDeclr]) +> getFunDefReturn (CFunDef specs (CDeclr _ derivedDeclrs _ _ _) _ _ _) = +> let (CTypeSpec tspec) = fromJust $ find isTypeSpec specs +> derivedPtrs = filter isDerivedPtr derivedDeclrs +> in (tspec, derivedPtrs) + +> isBlockingSpec :: CDeclSpec -> Bool +> isBlockingSpec (CTypeQual (CBlocking _)) = True +> isBlockingSpec _ = False + +> isPrivateSpec :: CDeclSpec -> Bool +> isPrivateSpec (CTypeQual (CPPrivate _)) = True +> isPrivateSpec _ = False + +> isSharedSpec :: CDeclSpec -> Bool +> isSharedSpec (CTypeQual (CPShared _)) = True +> isSharedSpec _ = False + +> isStdSpec :: CDeclSpec -> Bool +> isStdSpec c = (not $ isBlockingSpec c) && (not $ isPrivateSpec c) && (not $ isSharedSpec c) + +> isRemoteSpec :: CDeclSpec -> Bool +> isRemoteSpec (CTypeQual (CRemote _)) = True +> isRemoteSpec _ = False + +> getDeclSpecs :: CFunDef -> [CDeclSpec] +> getDeclSpecs (CFunDef declspecs _ _ _ _) = declspecs + +> getAllStorageSpecs :: [CDeclSpec] -> [CStorageSpec] +> getAllStorageSpecs declspecs = map getSto $ filter isSto declspecs +> where isSto (CStorageSpec s) = True +> isSto _ = False +> getSto (CStorageSpec s) = s + +> getStorageSpecs :: CFunDef -> [CStorageSpec] +> getStorageSpecs (CFunDef declspecs _ _ _ _) = getStorageSpecsFromDeclSpecs declspecs + +> getStorageSpecsFromDeclSpecs :: [CDeclSpec] -> [CStorageSpec] +> getStorageSpecsFromDeclSpecs ((CStorageSpec s):specs) +> | isStdSpec (CStorageSpec s) = s:(getStorageSpecsFromDeclSpecs specs) +> | otherwise = getStorageSpecsFromDeclSpecs specs +> getStorageSpecsFromDeclSpecs (s:specs) = getStorageSpecsFromDeclSpecs specs +> getStorageSpecsFromDeclSpecs [] = [] + +> filterDecls :: (CDeclSpec -> Bool) -> (CDeclSpec -> Bool) -> (CDecl -> CDecl) -> [CDecl] -> [CDecl] +> filterDecls anyFunc allFunc transFunc decls = map transFunc $ filter isFilterDecl decls +> where isFilterDecl (CDecl specs l ni) = any anyFunc specs && all allFunc specs + +> isStorageSpec :: CDeclSpec -> Bool +> isStorageSpec (CStorageSpec _) = True +> isStorageSpec _ = False + +> isTypeQual :: CDeclSpec -> Bool +> isTypeQual (CTypeQual _) = True +> isTypeQual _ = False + +> isStdTypeQual :: CDeclSpec -> Bool +> isStdTypeQual (CTypeQual (CRemote _)) = False +> isStdTypeQual (CTypeQual (CBlocking _)) = False +> isStdTypeQual (CTypeQual (CPPrivate _)) = False +> isStdTypeQual (CTypeQual (CPShared _)) = False +> isStdTypeQual (CTypeQual _) = True +> isStdTypeQual _ = False + +> filterStdDeclSpecs :: [CDeclSpec] -> [CDeclSpec] +> filterStdDeclSpecs declspecs = filter (\s -> isStorageSpec s || isStdTypeQual s) declspecs + +> getStdDeclSpecs :: CFunDef -> [CDeclSpec] +> getStdDeclSpecs (CFunDef declspecs _ _ _ _) = filterStdDeclSpecs declspecs + +> removeSharedSpecFromDecl :: CDecl -> CDecl +> removeSharedSpecFromDecl (CDecl specs l ni) = (CDecl rspecs l ni) +> where rspecs = filter (not . isSharedSpec) specs + +> removePrivateSpecFromDecl :: CDecl -> CDecl +> removePrivateSpecFromDecl (CDecl specs l ni) = (CDecl rspecs l ni) +> where rspecs = filter (not . isPrivateSpec) specs + +> removeRemoteSpecFromFunDef :: CExtDecl -> CExtDecl +> removeRemoteSpecFromFunDef (CFDefExt (CFunDef specs declr decls stmt ni)) = +> let newspecs = filter (not . isRemoteSpec) specs +> in (CFDefExt (CFunDef newspecs declr decls stmt ni)) + +Get the local declarations for a function definition + +> getFunLocalDeclarations :: CFunDef -> [CDecl] +> getFunLocalDeclarations (CFunDef _ _ _ (CCompound _ bitems _) _) = findFuncDecls bitems + +> getLocalDeclarations :: CStat -> [CDecl] +> getLocalDeclarations (CPBranch (CCompound _ bitems _) _) = findFuncDecls bitems +> getLocalDeclarations (CPWait (CCompound _ bitems _) _) = findFuncDecls bitems +> getLocalDeclarations _ = error "Not handled!" + +> getCallName :: CExpr -> String +> getCallName (CCall (CVar n _) _ _) = identToString n +> getCallName (CCall _ _ ni) = "fptr" + +> getCallParams :: CExpr -> [CExpr] +> getCallParams (CCall _ p _) = p + +> getCallNodeInfo :: CExpr -> NodeInfo +> getCallNodeInfo (CCall _ _ ni) = ni + +> getBlockStmt :: CBlockItem -> Maybe CStat +> getBlockStmt (CBlockStmt stmt) = Just stmt +> getBlockStmt _ = Nothing + +> getStmtsFromBlockItems :: [CBlockItem] -> [CStat] +> getStmtsFromBlockItems bitems = [ fromJust b | b <- map getBlockStmt bitems, isJust b ] + +> getFunStmts :: CFunDef -> [CStat] +> getFunStmts (CFunDef _ _ _ (CCompound _ bitems _) _) = getStmtsFromBlockItems bitems + +> getStmtList :: CStat -> [CStat] +> getStmtList (CCompound _ bitems _) = getStmtsFromBlockItems bitems +> getStmtList c = [c] + +> getForExprs :: CStat -> (Maybe CExpr, Maybe CExpr, Maybe CExpr) +> getForExprs (CFor (Left init) expr1 expr2 _ _) = (init, expr1, expr2) + +> isFunDeclr :: CDerivedDeclr -> Bool +> isFunDeclr (CFunDeclr _ _ _) = True +> isFunDeclr _ = False + +> isFunDecl :: CDecl -> Bool +> isFunDecl (CDecl specs drs _) = or $ map (any isFunDeclr) $ map getDerivedDeclrs drs + +> blockItemIsDecl :: CBlockItem -> Bool +> blockItemIsDecl (CBlockDecl _) = True +> blockItemIsDecl _ = False + +> isCompound :: CStat -> Bool +> isCompound (CCompound _ _ _) = True +> isCompound _ = False + +> stmtsHaveDecl :: CStat -> (Bool, NodeInfo) +> stmtsHaveDecl (CCompound i bitems ni) = (any blockItemIsDecl bitems, ni) +> stmtsHaveDecl c = (False, nodeInfo c) + +> isVoidType :: CDecl -> Bool +> isVoidType (CDecl specs declarators ni) = +> let derivedDeclrs = concatMap getDerivedDeclrs declarators +> in (not $ any isDerivedPtr derivedDeclrs) && (any isVoidTypeSpec specs) + +> isVoidReturn :: (CTypeSpec, [CDerivedDeclr]) -> Bool +> isVoidReturn (CVoidType _, []) = True +> isVoidReturn _ = False + +> isReturnStmt :: CStat -> Bool +> isReturnStmt (CReturn _ _) = True +> isReturnStmt _ = False + +> justVoid :: [CDecl] -> Bool +> justVoid decls = ((length decls) < 2) && (any isVoidType decls) + +> isBreak :: CStat -> Maybe CStat +> isBreak b@(CBreak _) = Just b +> isBreak _ = Nothing + +> isPBreak :: CStat -> Maybe CStat +> isPBreak b@(CPBreak _) = Just b +> isPBreak _ = Nothing diff --git a/oldcode/src/gsl/parser/CUtils.lhs b/code/src/aesop/parser/CUtils.lhs similarity index 100% copy from oldcode/src/gsl/parser/CUtils.lhs copy to code/src/aesop/parser/CUtils.lhs diff --git a/code/src/aesop/parser/ContextGen.lhs b/code/src/aesop/parser/ContextGen.lhs new file mode 100644 index 0000000..bbff120 --- /dev/null +++ b/code/src/aesop/parser/ContextGen.lhs @@ -0,0 +1,126 @@ +> module ContextGen where +> import Language.C +> import Language.C.System.GCC -- preprocessor used +> import System.Environment +> import Data.Typeable +> import Data.Maybe +> import Data.Either +> import Data.HashTable +> import Control.Exception +> import Control.Monad.State +> import Data.List +> import Debug.Trace +> import CParse +> import CUtils +> import Walker +> import Data.Generics +> import Data.Generics.Schemes +> import Data.Tree +> import BlockingContext + +> mkBlockingContext :: CStat -> [CStat] -> [CStat] -> Maybe BlockingContext -> +> Maybe BlockingContext -> Maybe BlockingContext -> WalkerT BlockingContext + +> mkBlockingContext b@(CIf expr ifStmts elseStmts _) nbBefore nbAfter parent next prev = do +> ifCtxStmts <- mkBlockingList <=< splitAtBlocking $ getStmtList ifStmts +> elseCtxStmts <- if (isJust elseStmts) +> then +> liftM Just $ mkBlockingList <=< splitAtBlocking $ +> getStmtList $ fromJust elseStmts +> else return Nothing +> return $ IfContext b ifCtxStmts elseCtxStmts nbBefore nbAfter parent next prev + +> mkBlockingContext b@(CFor init expr2 expr3 stmts _) nbBefore nbAfter parent next prev = do +> forCtxStmts <- mkBlockingList <=< splitAtBlocking $ getStmtList stmts +> return $ ForContext b forCtxStmts nbBefore nbAfter parent next prev + +> mkBlockingContext b@(CWhile expr stmts isDoWhile _) nbBefore nbAfter parent next prev = do +> whileStmtsCtx <- mkBlockingList <=< splitAtBlocking $ getStmtList stmts +> return $ WhileContext b whileStmtsCtx nbBefore nbAfter parent next prev + +> mkBlockingContext b@(CCompound _ bitems _) nbBefore nbAfter parent next prev = do +> cCtx <- mkBlockingList <=< splitAtBlocking $ getStmtList b +> return $ CompoundContext b cCtx nbBefore nbAfter parent next prev + +> mkBlockingContext b@(CPWait stmts _) nbBefore nbAfter parent next prev = do +> waitCtx <- mkBlockingList <=< splitAtBlocking $ getStmtList stmts +> let (NodeInfo p _ _) = nodeInfo b +> pwaitId = "pwait_" ++ (show $ posRow p) ++ "_" ++ (show $ posColumn p) +> return $ PWaitContext pwaitId b waitCtx nbBefore nbAfter parent next prev + +> mkBlockingContext b@(CPBranch stmts _) nbBefore nbAfter parent next prev = do +> branchCtx <- mkBlockingList <=< splitAtBlocking $ getStmtList stmts +> let (NodeInfo p _ _) = nodeInfo b +> pbranchId = "pbranch_" ++ (show $ posRow p) ++ "_" ++ (show $ posColumn p) +> return $ PBranchContext pbranchId b branchCtx nbBefore nbAfter parent next prev + +> mkBlockingContext b nbBefore nbAfter parent next prev = +> return $ BlockingStmt b nbBefore nbAfter parent next prev + + +> mkBlockingList :: [Either CStat [CStat]] -> WalkerT [BlockingContext] + +> mkBlockingList ((Right nbl):(Left b):(Right nbr):es) = do +> ctx <- mkBlockingContext b nbl nbr Nothing Nothing Nothing +> rest <- mkBlockingList $ (Right nbr):es +> return $ ctx:rest + +> mkBlockingList ((Left b):(Right nbr):es) = do +> ctx <- mkBlockingContext b [] nbr Nothing Nothing Nothing +> rest <- mkBlockingList $ (Right nbr):es +> return $ ctx:rest + +> mkBlockingList ((Right nbl):(Left b):es) = do +> ctx <- mkBlockingContext b nbl [] Nothing Nothing Nothing +> rest <- mkBlockingList es +> return $ ctx:rest + +> mkBlockingList ((Left b):es) = do +> ctx <- mkBlockingContext b [] [] Nothing Nothing Nothing +> rest <- mkBlockingList es +> return $ ctx:rest + +> mkBlockingList ((Right _):[]) = return [] +> mkBlockingList [] = return [] + +> generateContext :: CFunDef -> WalkerT BlockingContext +> generateContext funDef = do +> ctxStmts <- mkBlockingList <=< splitAtBlocking $ getFunStmts funDef +> let fctx = FunContext funDef ctxStmts Nothing Nothing Nothing +> return $ mkContextTree Nothing Nothing Nothing fctx + +> isBlockingCall :: CExpr -> WalkerT Bool +> isBlockingCall c@(CCall v args _) = do +> res <- lookupBlocking v +> if (isJust res) then (return True) else (return False) +> isBlockingCall _ = return False + +> containsBlockingCall :: CStat -> WalkerT Bool +> containsBlockingCall stmt = do +> anyBlocking <- everything orElseMBool (mkQ (return False) isBlockingCall) $ stmt +> if not anyBlocking then +> case stmt of +> (CPBranch stmts ni) -> do +> fstr <- getFilePosStr ni +> error $ fstr ++ ": The pbranch block does not contain a blocking call" +> (CPWait stmts ni) -> do +> fstr <- getFilePosStr ni +> error $ fstr ++ ": The pwait block does not contain a blocking call" +> _ -> return anyBlocking +> +> else return $ anyBlocking + +> splitAtBlocking :: [CStat] -> WalkerT [Either CStat [CStat]] +> splitAtBlocking ls = do +> split <- splitM ((liftM not) . containsBlockingCall) ls +> return split + +> countBlocking :: CExpr -> WalkerT Int +> countBlocking (CCall e _ _) = do +> res <- lookupBlocking e +> if (isJust res) then (return 1) else (return 0) +> countBlocking _ = return 0 + +> countBlockingCalls :: CStat -> WalkerT Int +> countBlockingCalls stmt = do +> everything orElseMAdd (mkQ (return 0) countBlocking) $ stmt diff --git a/code/src/aesop/parser/Header.lhs b/code/src/aesop/parser/Header.lhs new file mode 100644 index 0000000..2db0710 --- /dev/null +++ b/code/src/aesop/parser/Header.lhs @@ -0,0 +1,99 @@ +> module Header where +> import Language.C +> import Language.C.Data.Position +> import Language.C.Data.Node +> import Language.C.System.GCC -- preprocessor used +> import Language.C.Data.Ident +> import System.Environment +> import System.Console.GetOpt +> import System.Exit +> import Data.Typeable +> import Data.Maybe +> import Data.Either +> import Data.HashTable +> import Data.Generics +> import Data.Generics.Schemes +> import qualified Data.ByteString +> import qualified Data.ByteString.Char8 +> import Control.Monad.State +> import Control.Exception +> import Data.List +> import CGen +> import CParse +> import CUtils +> import System.IO.Unsafe +> import Debug.Trace +> import Data.Tree +> import BlockingContext +> import Walker +> import ContextGen +> import Serialize + +> data HeaderS = HeaderS { header :: [String], trans :: Bool, pos :: Position } + +> newHeaderState :: FilePath -> IO HeaderS +> newHeaderState f = do +> s <- readFile f +> return $ HeaderS (lines s) False (position 0 f 0 0) + +> type HeaderT = StateT HeaderS IO + +> getTrans :: HeaderT Bool +> getTrans = do { h <- get ; return $ trans h } + +> setTrans :: Bool -> HeaderT () +> setTrans b = do { (HeaderS h l p) <- get ; put (HeaderS h b p) } + +> getLastPos :: HeaderT Position +> getLastPos = do { h <- get ; return $ pos h } + +> setLastPos :: Position -> HeaderT () +> setLastPos np = do { (HeaderS h l p) <- get ; put (HeaderS h l np) } + +> getHeaderLines :: Int -> HeaderT [String] +> getHeaderLines i = do +> (HeaderS h l p) <- get +> let (n, rest) = splitAt i $ h +> put (HeaderS rest l p) +> return n + +> getRemainingLines :: HeaderT [String] +> getRemainingLines = do +> (HeaderS h l p) <- get +> return h + +> skipBytes :: Int -> HeaderT () +> skipBytes i = do +> (HeaderS h l p) <- get +> let (n, rest) = splitAt i $ unlines h +> put (HeaderS (lines rest) l p) + +> outputHeader :: FilePath -> FilePath -> [([CExtDecl], CExtDecl)] -> IO () +> outputHeader hf outf pairs = do +> hs <- newHeaderState hf +> runStateT (outputPairs hf outf pairs) $ hs +> return () + +> outputPairs :: FilePath -> FilePath -> [([CExtDecl], CExtDecl)] -> HeaderT () +> outputPairs hf outf pairs = do +> mapM_ (outputPair hf outf) pairs +> l <- getRemainingLines +> liftIO $ appendFile outf $ unlines l + +> outputPair :: FilePath -> FilePath -> ([CExtDecl], CExtDecl) -> HeaderT () +> outputPair hf outf ([], c) | isInFile c hf = return () +> outputPair hf outf (ds, c) | isInFile c hf = do +> lastPos <- getLastPos +> let currentPos = posOfNode $ nodeInfo c +> n = (posRow currentPos) - (posRow lastPos) - 1 +> ltp = fst $ getLastTokenPos $ nodeInfo c +> hl <- getHeaderLines n +> getHeaderLines $ (posRow $ ltp) - (posRow currentPos) + 1 +> liftIO $ appendFile outf $ unlines hl +> liftIO $ appendFile outf $ unlines $ map (show . pretty) ds +> setLastPos $ ltp +> outputPair hf outf (ds, c) = do +> return () + +> isInFile :: CExtDecl -> String -> Bool +> isInFile c f = (posFile $ posOfNode $ nodeInfo c) == f diff --git a/code/src/aesop/parser/README b/code/src/aesop/parser/README new file mode 100644 index 0000000..5b96205 --- /dev/null +++ b/code/src/aesop/parser/README @@ -0,0 +1,25 @@ + +If you want to build/install haskell and +the necessary haskell libraries for aesop, you should follow these steps: + +On debian/ubuntu, run (requires sudo privs): + +./maint/hs/setup-hs-debian +./maint/hs/setup-langc + +If you don't have root, but haskell (ghc) has already been installed, you can do: + +./maint/hs/setup-hs-local +./maint/hs/setup-langc + +On systems without haskell binary packages (ghc), you'll need to do: + +* Download/Build/Install ghc from http://www.haskell.org/ghc/ +* Download/Build/Install MTL from http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mtl +* Download/Build/Install happy from http://www.haskell.org/happy/ +* Download/Build/Install alex from http://www.haskell.org/alex/ + +* Then run: setup-langc + +NOTE: Building by hand turns out to be a big PITA, its highly recommended +that you find a system where you can install the debian packages. diff --git a/oldcode/src/gsl/parser/Serialize.hs b/code/src/aesop/parser/Serialize.hs similarity index 100% copy from oldcode/src/gsl/parser/Serialize.hs copy to code/src/aesop/parser/Serialize.hs diff --git a/code/src/aesop/parser/Walker.lhs b/code/src/aesop/parser/Walker.lhs new file mode 100644 index 0000000..923289a --- /dev/null +++ b/code/src/aesop/parser/Walker.lhs @@ -0,0 +1,371 @@ +> module Walker where +> import Language.C +> import Language.C.System.GCC -- preprocessor used +> import Language.C.Pretty +> import System.Environment +> import Data.Typeable +> import Data.Maybe +> import Data.Either +> import Data.HashTable +> import Control.Exception +> import Data.Generics +> import Data.Generics.Schemes +> import Data.List +> import Debug.Trace +> import Control.Monad.State +> import BlockingContext +> import CParse +> import CGen +> import Control.Monad.Error + +Registry for blocking operations. Once we see a function declaration +with the __blocking specifier, we add it to the registry. + +> type FunDecl = (String, ReturnType, [CDecl]) + + +The FPType is either a function or a struct. The FPFun is the +function pointer, declarated within a struct or simply declarated locally. + +The struct (FPStruct) is a struct with a function pointer as one of its fields. + +> data FPType = FPFun { name :: String , ftype :: FunDecl } +> | FPStruct { name :: String , field :: String, inner :: FPType } + +> instance Show FPType where +> show (FPFun n _) = "Fun: " ++ n +> show (FPStruct n f t) = "Struct: " ++ n ++ ":" ++ f ++ "[" ++ (show t) ++ "]" + +> isFPStruct :: FPType -> Bool +> isFPStruct (FPStruct _ _ _) = True +> isFPStruct _ = False + +> getInner :: FPType -> Maybe FPType +> getInner (FPStruct _ _ t) = Just t +> getInner _ = Nothing + +> isFPFun :: FPType -> Bool +> isFPFun (FPFun _ _) = True +> isFPFun _ = False + +> getFunDecl :: FPType -> Maybe FunDecl +> getFunDecl (FPFun _ f) = Just f +> getFunDecl _ = Nothing + +> type FPTypeRegistry = [FPType] + +> type VarMap = HashTable String CDecl + +> data VarRegistry = VarRegistry { locals :: VarMap , globals :: VarMap } + +> newVarRegistry :: IO VarRegistry +> newVarRegistry = do +> l <- Data.HashTable.new (==) Data.HashTable.hashString +> g <- Data.HashTable.new (==) Data.HashTable.hashString +> return $ VarRegistry l g + +> resetLocalVarsInRegistry :: VarRegistry -> IO VarRegistry +> resetLocalVarsInRegistry v = do +> l <- Data.HashTable.new (==) Data.HashTable.hashString +> return $ VarRegistry l (globals v) + +> insertGlobalDeclsToVarRegistry :: [CDecl] -> VarRegistry -> IO () +> insertGlobalDeclsToVarRegistry decls v = do +> let alldecls = concatMap splitDecls decls +> mapM_ (\d -> Data.HashTable.insert (globals v) (identToString . getCDeclName $ d) d) alldecls + +> insertLocalDeclsToVarRegistry :: [CDecl] -> VarRegistry -> IO () +> insertLocalDeclsToVarRegistry decls v = do +> let alldecls = concatMap splitDecls decls +> getDName d = identToString $ getCDeclName $ d +> insertD d = Data.HashTable.insert (locals v) (getDName d) d +> mapM_ insertD alldecls + +> lookupInVarRegistry :: String -> VarRegistry -> IO (Maybe CDecl) +> lookupInVarRegistry s v = do +> res <- Data.HashTable.lookup (locals v) s +> if isJust res +> then return res +> else Data.HashTable.lookup (globals v) s + +The monad transformer that we thread through our functions + +The Walker is the state that we pass around our functions as we walk the AST. It primarily holds +the blocking call information, but is actually a tuple of: +filename, prefix stack, blocking call registry, and blocking function pointer registry + +> data Walker = Walker { +> filename :: String, +> includes :: [String], +> defines :: [(String, String)], +> prefixes :: [String], +> errorWriter :: (Walker -> String -> ReturnType -> String -> NodeInfo -> [CStat]), +> pbranchDone :: (Walker -> BlockingContext -> NodeInfo -> [CStat]), +> transExit :: (CStat -> CStat -> CStat), +> fpTypeReg :: FPTypeRegistry, +> fpTypeLocalReg :: FPTypeRegistry, +> varReg :: VarRegistry +> } + +> newWalkerState :: String -> [String] -> [(String, String)] -> (Walker -> String -> ReturnType -> String -> NodeInfo -> [CStat]) -> (Walker -> BlockingContext -> NodeInfo -> [CStat]) -> (CStat -> CStat -> CStat) -> IO Walker +> newWalkerState fname includes defines errorWriter pbranchDone transExit = do +> varReg <- newVarRegistry +> return $ Walker fname includes defines ["ctl"] errorWriter pbranchDone transExit [] [] varReg + +> setErrorWriter :: (Walker -> String -> ReturnType -> String -> NodeInfo -> [CStat]) -> WalkerT () +> setErrorWriter ew = do +> w@(Walker f is d ps _ pb t fr frl vr) <- get +> put (Walker f is d ps ew pb t fr frl vr) + +> getErrorWriter :: WalkerT (String -> ReturnType -> String -> NodeInfo -> [CStat]) +> getErrorWriter = do +> w <- get +> return $ (errorWriter w) w + +> setPBDone :: (Walker -> BlockingContext -> NodeInfo -> [CStat]) -> WalkerT () +> setPBDone pb = do +> (Walker f is d ps ew _ t fr frl vr) <- get +> put (Walker f is d ps ew pb t fr frl vr) + +> getPBDone :: WalkerT (BlockingContext -> NodeInfo -> [CStat]) +> getPBDone = do +> w <- get +> return $ (pbranchDone w) w + +> setTransExit :: (CStat -> CStat -> CStat) -> WalkerT () +> setTransExit tr = do +> (Walker f is d ps e pb _ fr frl v) <- get +> put (Walker f is d ps e pb tr fr frl v) + +> getTransExit :: WalkerT (CStat -> CStat -> CStat) +> getTransExit = do +> w <- get +> return $ transExit w + +> pushPrefix :: String -> WalkerT () +> pushPrefix s = do +> (Walker f is d ps e pb t fr frl v) <- get +> put (Walker f is d (s:ps) e pb t fr frl v) + +> popPrefix :: WalkerT () +> popPrefix = do +> (Walker f is d (s:ps) e pb t fr frl v) <- get +> put (Walker f is d ps e pb t fr frl v) + +> getPrefix :: WalkerT String +> getPrefix = do +> w <- get +> let (h:hs) = prefixes w +> return h + +> getIncludeDirs :: WalkerT [String] +> getIncludeDirs = do +> w <- get +> return $ includes w + +> setIncludeDirs :: [String] -> WalkerT () +> setIncludeDirs is = do +> (Walker f _ d ps e pb t fr frl v) <- get +> put (Walker f is d ps e pb t fr frl v) + +> getDefines :: WalkerT [(String, String)] +> getDefines = do +> w <- get +> return $ defines w + +> type WalkerT = StateT Walker IO + +> getFileName :: WalkerT String +> getFileName = do +> w <- get +> return $ filename w + +> getFilePosStr :: NodeInfo -> WalkerT (String) +> getFilePosStr (NodeInfo p _ _) = do +> fname <- getFileName +> return (fname ++ ":" ++ (show $ posRow p) ++ ":" ++ (show $ posColumn p)) + +> clearLocalFunPtrRegistry :: WalkerT () +> clearLocalFunPtrRegistry = do +> (Walker s is d pn e pb t fr frl v) <- get +> put (Walker s is d pn e pb t fr [] v) + +> resetLocals :: WalkerT () +> resetLocals = do +> (Walker f is d ps ew pb t fpr fr vr) <- get +> newvr <- liftIO $ resetLocalVarsInRegistry vr +> put (Walker f is d ps ew pb t fpr fr newvr) + +> addLocals :: [CDecl] -> WalkerT () +> addLocals ds = do +> w <- get +> liftIO $ insertLocalDeclsToVarRegistry ds $ varReg w + +> addGlobals :: [CDecl] -> WalkerT () +> addGlobals ds = do +> w <- get +> liftIO $ insertGlobalDeclsToVarRegistry ds $ varReg w + +Get the chain of variable references starting +at the outermost. i.e. + +struct a a1; +struct b b1; +typedef struct c ct; +ct c1; +struct d d1; + +a1->b1->c1->d1 + +Turns into: + +(a, [b1, c1, d1]) + +> lookupVar :: CExpr -> WalkerT (Maybe [String]) +> lookupVar e@(CVar name _) = do +> w <- get +> d <- liftIO $ lookupInVarRegistry (identToString name) $ varReg w +> if isNothing d +> then return Nothing +> else do +> let t = getTypeSpecFromDecl $ fromJust d +> r = case t of +> (CTypeDef tname _) -> Just [identToString tname] +> (CSUType (CStruct _ (Just tname) _ _ _) _) -> Just [identToString tname] +> _ -> Nothing +> if isFunDecl $ fromJust d +> then return $ Just [identToString $ getCDeclName $ fromJust d] +> else if isJust r +> then return r +> else return Nothing + +> lookupVar (CMember expr name _ _) = do +> w <- get +> inner <- lookupVar expr +> if isNothing inner +> then return Nothing +> else return $ Just $ (fromJust inner) ++ [identToString name] + +> lookupVar e = do +> return Nothing + +> insertFP :: FPType -> WalkerT () +> insertFP fptype = do +> (Walker f is d ps ew pb t fr frl vr) <- get +> put (Walker f is d ps ew pb t (fptype:fr) frl vr) + +Registery a blocking function pointer. + +> registerBlocking :: FunDecl -> WalkerT () +> registerBlocking f = do +> let (n, (rt, rd), p) = f +> insertFP $ FPFun n f +> let d = mkFunDecl n rt rd p + +> addGlobals [d] + +Register a blocking struct based on the struct type (structName), the field +with the function pointer, and type of the function pointer (function signature). + +> registerBlockingStruct :: String -> String -> FunDecl -> WalkerT () +> registerBlockingStruct structName fieldName funDecl = do +> let (n, (rt, rd), p) = funDecl +> insertFP $ FPStruct structName fieldName (FPFun n funDecl) + +We have to deal with structs that have members that are structs that have blocking +function pointers. I.e: + +struct inner +{ + __blocking void (*blockingfun)(void); +}; + +struct outer +{ + struct inner i; +}; + +So we need a way to lookup if a field within a struct is a blocking struct, and +if so, register the outer struct too. + +> lookupAndRegisterBlockingStruct :: String -> String -> String -> WalkerT () +> lookupAndRegisterBlockingStruct structName fieldName fieldType = do +> w <- get +> let reg = fpTypeReg w +> matching = filter (\f -> (isFPStruct f && ((name f) == fieldType))) reg +> if not $ null matching +> then do +> mapM_ (\m -> insertFP $ FPStruct structName fieldName m) matching +> else return () + +> lookupAndRegisterBlockingTypedef :: String -> String -> WalkerT () +> lookupAndRegisterBlockingTypedef structName typeName = do +> w <- get +> let reg = fpTypeReg w +> matching = filter (\f -> (isFPStruct f && ((name f) == structName))) reg +> if not $ null matching +> then do +> assert ((length matching) == 1) return () +> let mkFP (FPStruct s f fpt) = FPStruct typeName f fpt +> mapM_ (insertFP . mkFP) matching +> else return () + +> registerLocalBlocking :: FunDecl -> WalkerT () +> registerLocalBlocking fd = do +> (Walker f is d ps ew pb t fr frl vr) <- get +> let (n, _, _) = fd +> put (Walker f is d ps ew pb t fr ((FPFun n fd):frl) vr) + +> getAllBlocking :: WalkerT [FPType] +> getAllBlocking = do +> w <- get +> let bs = fpTypeReg w +> bls = fpTypeLocalReg w +> return $ bs ++ bls + +> showAllBlocking :: WalkerT () +> showAllBlocking = do +> all <- getAllBlocking +> putStrLnW $ unlines $ map show all + +> tr :: [String] -> FPType -> String -> a -> a +> tr ss st a = trace $ a ++ "::" ++ (show ss) ++ "::" ++ (show st) + +> matchFP :: [String] -> FPType -> Maybe FunDecl +> matchFP ss@(s:p:seqs) st@(FPStruct n f t) +> | s == n && p == f && null seqs && isFPFun t = getFunDecl t +> | s == n && p == f = matchiFP seqs (fromJust (getInner t)) +> | otherwise = Nothing + +> matchFP s f = matchiFP s f + +> matchiFP :: [String] -> FPType -> Maybe FunDecl +> matchiFP [] _ = Nothing + +> matchiFP ss@(s:[]) st@(FPFun n t) = if s == n then Just t else Nothing +> matchiFP ss@(s:seqs) st@(FPFun n t) = Nothing +> matchiFP ss@(s:seqs) st@(FPStruct n f t) = +> if s == f then matchFP seqs t else Nothing + +> lookupBlocking :: CExpr -> WalkerT (Maybe FunDecl) +> lookupBlocking (CCall e _ _) = do +> lookupBlocking e + +> lookupBlocking c = do +> w <- get +> v <- lookupVar c +> if isNothing v +> then return Nothing +> else do +> all <- getAllBlocking +> let fs = mapMaybe (matchFP $ fromJust v) $ all +> if null fs then return Nothing +> else return $ Just $ head fs + +Utility lift the print function into the WalkerT monad transformer + +> putStrLnW :: String -> WalkerT () +> putStrLnW = liftIO . putStrLn + +> putStrW :: String -> WalkerT () +> putStrW = liftIO . putStr diff --git a/code/src/aesop/parser/ae-blocking-parser.lhs b/code/src/aesop/parser/ae-blocking-parser.lhs new file mode 100644 index 0000000..8ac4aa1 --- /dev/null +++ b/code/src/aesop/parser/ae-blocking-parser.lhs @@ -0,0 +1,1738 @@ +> module BlockingParser where +> import Language.C +> import Language.C.Data.Position +> import Language.C.System.GCC -- preprocessor used +> import Language.C.Data.Ident +> import System.Environment +> import System.Console.GetOpt +> import System.Exit +> import Data.Typeable +> import Data.Maybe +> import Data.Either +> import Data.HashTable +> import Data.Generics +> import Data.Generics.Schemes +> import qualified Data.ByteString +> import qualified Data.ByteString.Char8 +> import Control.Monad.State +> import Control.Exception +> import Data.List +> import CGen +> import CParse +> import CUtils +> import System.IO.Unsafe +> import Debug.Trace +> import Data.Tree +> import BlockingContext +> import Walker +> import ContextGen +> import Serialize +> import Header + +> mkStmtFromBlockingMacro :: Walker -> String -> [String] -> NodeInfo -> [CStat] +> mkStmtFromBlockingMacro w macro params ni = mkStmtFromCPPMacro includePaths defs "ae-blocking-parser.h" ni macro params +> where includePaths = includes w +> defs = defines w + +> mkStmtFromBlocking :: String -> [String] -> NodeInfo -> WalkerT [CStat] +> mkStmtFromBlocking m p n = do +> w <- get +> return $ mkStmtFromBlockingMacro w m p n + +> mkDeclsFromBlockingMacro :: Walker -> String -> [String] -> NodeInfo -> [CDecl] +> mkDeclsFromBlockingMacro w macro params ni = mkDeclsFromCPPMacro includePaths defs "ae-blocking-parser.h" ni macro params +> where includePaths = includes w +> defs = defines w + +> mkDeclsFromBlocking :: String -> [String] -> NodeInfo -> WalkerT [CDecl] +> mkDeclsFromBlocking m p n = do +> w <- get +> return $ mkDeclsFromBlockingMacro w m p n + +> mkErrorCBPostHandler :: Walker -> String -> ReturnType -> String -> NodeInfo -> [CStat] +> mkErrorCBPostHandler w fname retType ctlName ni = +> let location = show $ posRow $ posOfNode ni +> in mkStmtFromBlockingMacro w "AE_MK_POSTCB_STMT" [fname, (returnToString retType), ctlName, location] ni + +> mkErrorPostHandler :: Walker -> String -> ReturnType -> String -> NodeInfo -> [CStat] +> mkErrorPostHandler w fname retType ctlName ni = +> let location = show $ posRow $ posOfNode ni +> in mkStmtFromBlockingMacro w "AE_MK_POST_STMT" [fname, (returnToString retType), ctlName, location] ni + +> mkPBreakStmts :: String -> NodeInfo -> WalkerT ([CDecl], [CStat]) +> mkPBreakStmts prefix ni = do +> let location = show $ posRow $ posOfNode ni +> fname <- getFileName +> ds <- mkDeclsFromBlocking "AE_MK_PBREAK_DECLS" [] ni +> ss <- mkStmtFromBlocking "AE_MK_PBREAK_STMTS" [prefix, fname, location] ni +> return (ds, ss) + +After a blocking operation within a pbranch, we need to check if the pbranch has been cancelled, +either from a pbreak, or from an external cancel call of the entire blocking function. + +> mkPBranchCallbackStartStmts :: String -> String -> NodeInfo -> WalkerT ([CDecl], [CStat]) +> mkPBranchCallbackStartStmts prefix funName ni = do +> ds <- mkDeclsFromBlocking "AE_MK_PBRANCH_CB_START_DECLS" [prefix, (mkStructCtlName funName)] ni +> ss <- mkStmtFromBlocking "AE_MK_PBRANCH_CB_START_STMTS" [prefix] ni +> return (ds, ss) + +> mkPBranchDeleteStmts :: NodeInfo -> WalkerT [CStat] +> mkPBranchDeleteStmts ni = mkStmtFromBlocking "AE_MK_PBRANCH_DELETE_STMTS" [] ni + +> mkPBranchDoneStmts :: String -> String -> NodeInfo -> WalkerT [CStat] +> mkPBranchDoneStmts prefix funName ni = +> mkStmtFromBlocking "AE_MK_PBRANCH_DONE_STMTS" [] ni + +> mkPBranchCBDoneStmts :: Walker -> BlockingContext -> NodeInfo -> [CStat] +> mkPBranchCBDoneStmts w b ni = +> mkStmtFromBlockingMacro w "AE_MK_PBRANCH_CB_DONE_STMTS" [] ni + +> mkPBranchPostDoneStmts :: Walker -> BlockingContext -> NodeInfo -> [CStat] +> mkPBranchPostDoneStmts w pb ni = +> mkStmtFromBlockingMacro w "AE_MK_PBRANCH_POST_DONE_STMTS" [getPBranchId pb] ni + +> mkDoneStmts :: NodeInfo -> WalkerT [CStat] +> mkDoneStmts ni = mkStmtFromBlocking "AE_MK_CB_DONE_STMTS" [] ni + +> mkDoneCtlSetStmt :: String -> NodeInfo -> WalkerT [CStat] +> mkDoneCtlSetStmt p ni = mkStmtFromBlocking "AE_MK_CB_DONE_CTL_SET_STMTS" [p] ni + +> mkPWaitInitStmts :: String -> String -> NodeInfo -> WalkerT [CStat] +> mkPWaitInitStmts pwaitParams prefix ni = +> mkStmtFromBlocking "AE_MK_PWAIT_INIT_STMTS" [pwaitParams, prefix] ni + +> mkPWaitFinishStmts :: BlockingContext -> String -> WalkerT [CStat] +> mkPWaitFinishStmts pw prefix = do +> let ni = getNI pw +> mkStmtFromBlocking "AE_MK_PWAIT_FINISH_STMTS" [prefix, getPWaitId pw] ni + +> mkPWaitNotDoneStmts :: BlockingContext -> String -> WalkerT [CStat] +> mkPWaitNotDoneStmts pw prefix = do +> let ni = getNI pw +> mkStmtFromBlocking "AE_MK_PWAIT_NOT_DONE_STMTS" [prefix, getPWaitId pw] ni + +> mkPostFunInitStmts :: String -> NodeInfo -> WalkerT [CStat] +> mkPostFunInitStmts name ni = +> mkStmtFromBlocking "AE_MK_POST_FUN_INIT_STMTS" [name] ni + +> mkPBranchPostStmts :: BlockingContext -> String -> String -> String -> String -> [CStat] -> NodeInfo -> WalkerT [CStat] +> mkPBranchPostStmts pb pwaitName prefix parentPrefix fname stmts ni = do +> let location = show $ posRow $ posOfNode ni +> fileName <- getFileName +> ds <- mkDeclsFromBlocking "AE_MK_PBRANCH_POST_DECLS" [mkStructCtlName fname, prefix] ni +> ss <- mkStmtFromBlocking "AE_MK_PBRANCH_POST_STMTS" +> [pwaitName, prefix, parentPrefix, mkStructCtlName fname, fileName, location, getPBranchId pb] ni +> return [mkCompoundWithDecls Nothing ds (ss ++ stmts) ni] + +> mkBlockingParamsParallelFields :: String -> Bool -> NodeInfo -> WalkerT [CDecl] +> mkBlockingParamsParallelFields _ False _ = return [] +> mkBlockingParamsParallelFields name True ni = mkDeclsFromBlocking "AE_MK_PARENT_POINTER_DECL" [name] ni + +> mkBlockingParams :: ReturnType -> [CDecl] -> NodeInfo -> WalkerT [CDecl] +> mkBlockingParams ret params ni = mkDeclsFromBlocking "AE_MK_BLOCKING_PARAMS_DECLS" [returnToString $ ret] ni + +> mkBlockingParamsForStruct :: CFunDef -> WalkerT [CDecl] +> mkBlockingParamsForStruct fdef = do +> let ni = nodeInfo fdef +> ret = getFunDefReturn fdef +> ds <- mkDeclsFromBlocking "AE_MK_BLOCKING_PARAMS_FOR_STRUCT_DECLS" [] ni +> return $ ds +> ++ (mkRetParam ret ni) -- optional return parameter: [__ret_type __ae_ret] +> ++ (mkCBParam ret ni) -- callback parameter: void (*callback)(void *up [, __ret_type __ae_ret]) + +> mkBlockingParamsForPost :: (CTypeSpec, [CDerivedDeclr]) -> NodeInfo -> WalkerT [CDecl] +> mkBlockingParamsForPost retType ni = do +> ds <- mkDeclsFromBlocking "AE_MK_BLOCKING_PARAMS_FOR_POST_DECLS" [] ni +> return $ (mkCBParam retType ni) -- callback parameter: void (*callback) (void *user_ptr, [, __ret_type __ae_ret]) +> ++ ds +> +> mkPostFunDecls :: String -> NodeInfo -> WalkerT [CDecl] +> mkPostFunDecls name ni = mkDeclsFromBlocking "AE_MK_POST_FUN_DECLS" [name] ni + +> mkPostFunFinished :: NodeInfo -> WalkerT [CStat] +> mkPostFunFinished ni = mkStmtFromBlocking "AE_MK_POST_FUN_FINISHED_STMTS" [] ni + +> mkBlockingParamsFromFunPtrDecl :: CDecl -> WalkerT [CDecl] +> mkBlockingParamsFromFunPtrDecl c@(CDecl _ declrs ni) = do +> let retType = getReturn c +> ds <- mkDeclsFromBlocking "AE_MK_BLOCKING_PARAMS_FUN_PTR_DECLS" [] ni +> return $ (mkCBParam retType ni) ++ ds + +> mkPostRetType :: NodeInfo -> WalkerT CTypeSpec +> mkPostRetType ni = do +> prd <- mkPostRetDecl ni +> return $ fst $ getReturn prd + +> mkPostRetDecl :: NodeInfo -> WalkerT CDecl +> mkPostRetDecl ni = liftM head $ mkDeclsFromBlocking "AE_MK_RET_DECL" [] ni + +> getLastStmtInCompounds :: CStat -> CStat +> getLastStmtInCompounds (CCompound _ bitems _) = assert (isJust lastStmt) r +> where lastStmt = getBlockStmt $ last bitems +> r = getLastStmtInCompounds $ fromJust lastStmt +> getLastStmtInCompounds s = s + +> checkForReturn :: CFunDef -> WalkerT CFunDef +> checkForReturn f@(CFunDef specs declarator decls c@(CCompound idents stmts cni) ni) +> | (isVoidReturn $ getFunDefReturn f) && (isJust $ getBlockStmt $ last stmts) && (not $ isReturnStmt $ fromJust $ getBlockStmt $ last stmts) = +> return $ (CFunDef specs declarator decls (CCompound idents (stmts ++ [CBlockStmt (CReturn Nothing ni)]) cni) ni) +> | (not $ isVoidReturn $ getFunDefReturn f) && (not $ isReturnStmt $ getLastStmtInCompounds c) = do +> invalid ("The blocking function: " ++ (getFunDefName f) ++ " does not have a final return statement\n") ni +> return f +> | otherwise = return f + +> getLocals :: BlockingContext -> [CDecl] +> getLocals (FunContext funDef _ _ _ _) = getFuncLocalDecls funDef +> getLocals b = getLocals $ getParent b + +> addLoopBreakLabel :: BlockingContext -> [CStat] -> [CStat] +> addLoopBreakLabel b stmts = [mkLabel (mkLoopBreakLabelStr b) stmts $ getNI b] + +> isBlockingField :: CDecl -> Bool +> isBlockingField (CDecl s i n) = any isBlockingSpec s + +> mkAnonStructName :: NodeInfo -> String +> mkAnonStructName ni = +> "anonstruct_" ++ (show $ posRow $ posOfNode $ ni) ++ "_" ++ +> (show $ posColumn $ posOfNode $ ni) + +> lookupAndRegBlocking :: Maybe String -> CDecl -> WalkerT () +> lookupAndRegBlocking sname d@(CDecl s i n) = do +> let typeName = getTypeName d +> t = if isJust typeName then fromJust typeName else mkAnonStructName $ nodeInfo d +> assert (isJust sname) return () +> lookupAndRegisterBlockingStruct (fromJust sname) +> (identToString $ getCDeclName d) +> t + +> regBlockingStruct :: Maybe String -> CDecl -> WalkerT () +> regBlockingStruct sname d = do +> assert (isJust sname) return () +> registerBlockingStruct (fromJust sname) +> (identToString $ getCDeclName d) +> (splitFunDecl d) + +> registerStruct :: CDecl -> Maybe String -> WalkerT () +> registerStruct d@(CDecl s i n) altSname = do +> when (structSpecHasFields (head $ filter isStructTypeSpec s)) $ do +> let si = getStructInfo d +> (Just (sn, fields)) = si +> sname = if isJust sn then sn else altSname +> assert (isJust si) return () +> let blockingFields = filter isBlockingField fields +> notBlockingFields = filter (\j -> isStructDecl j && (not $ isBlockingField j)) fields + +> mapM_ (regBlockingStruct sname) blockingFields + +> mapM_ (lookupAndRegBlocking sname) (filter isStructDecl notBlockingFields) + +> registerTypedefStruct :: CDecl -> Maybe String -> WalkerT () +> registerTypedefStruct d altSname = do +> let t = getStructTypeDefInfo d +> (Just (sn, tname)) = t +> sname = if isJust sn then sn else altSname +> assert (isJust t && isJust sname) return () +> lookupAndRegisterBlockingTypedef (fromJust sname) tname + +> registerTypedefTypedef :: CDecl -> WalkerT () +> registerTypedefTypedef d = do +> let t = getTypeDefTypeDefInfo d +> (Just (pn, tname)) = t +> assert (isJust t) return () +> lookupAndRegisterBlockingTypedef pn tname + +> registerBlockingDecl :: Bool -> CExtDecl -> WalkerT [CExtDecl] +> registerBlockingDecl ph e@(CDeclExt d@(CDecl specifiers initdecls ni)) + +> | isTypeDefOfInlineStruct d = do +> let name = mkAnonStructName (nodeInfo d) +> registerStruct d (Just name) +> registerTypedefStruct d (Just name) +> if ph then +> return [e] +> else return [] + +> | isTypeDefOfPredefStruct d = do +> registerTypedefStruct d Nothing +> if ph then +> return [e] +> else return [] + +> | isTypeDefOfTypeDef d = do +> registerTypedefTypedef d +> if ph then +> return [e] +> else return [] + +Register structs containing blocking function pointers as fields: struct a { __blocking int (*myfun) (); } +Or fields that are structs with blocking function pointers: struct b { struct a mya; } +etc. etc. + +> | isStructDecl d = do +> registerStruct d Nothing +> if ph then +> liftM ((:[]) . CDeclExt) $ everywhereM (mkM translateBlockingFunParam) d +> else return [] + +Register global variable declarations. This is necessary to map variable names to types (structs, typedefs, etc.) +allowing us to determine if a function pointer is being called within a particular variable. + +> | isVarDecl d = do +> addGlobals [d] +> let name = mkAnonStructName $ nodeInfo d +> when (isStructDecl d) (registerStruct (removeVarFromDecl d) (Just name)) +> if ph then return [e] else return [] + +Register blocking function declarations: __blocking int myfun(); + +> | isFunDecl d && (any isBlockingSpec specifiers) = do +> let function = splitFunDecl (CDecl specifiers initdecls ni) +> registerBlocking function +> pDecl <- mkPostDecl function specifiers +> pPtrDecl <- mkPostPtrDecl True function specifiers +> return $ [CDeclExt pDecl, CDeclExt pPtrDecl] + +Transform function declarations that take blocking function pointers as parameters: int myfun(__blocking int (*fnp)(void)); +We only need to do the transformation here to get the type signature right, we don't generate anything else. + +> | isFunDecl d = do +> if ph then +> liftM ((:[]) . CDeclExt) $ everywhereM (mkM translateBlockingFunParam) d +> else return [] + + let (fname, (rtype, derived), ps) = splitFunDecl d + newps <- mapM translateBlockingFunParam ps + let newd = mkFunDeclWithDeclSpecs fname rtype derived specifiers newps + if ph then return [CDeclExt newd] + else return [] + +> registerBlockingDecl True c = return [c] +> registerBlockingDecl False c = return [] + +Registers all the blocking declarations present in the CTranslUnit + +> registerBlockingFunDecls :: CTranslUnit -> WalkerT CTranslUnit +> registerBlockingFunDecls (CTranslUnit decls ni) = do +> newdecls <- liftM concat $ sequence $ map (registerBlockingDecl True) decls +> return $ CTranslUnit newdecls ni + +> getBlockingHeaderDecls :: CTranslUnit -> WalkerT [([CExtDecl], CExtDecl)] +> getBlockingHeaderDecls (CTranslUnit decls ni) = do +> newdecls <- sequence $ map (registerBlockingDecl False) decls +> return $ zip newdecls decls + +Registers blocking function pointers passed to a blocking function. + +While translating a blocking function, we need to keep a registry of all the +variable names for blocking function pointers passed to the blocking function, so +that if one of them gets called, we can do translation at that point. For example: + +__blocking int myblockingfun(int a, __blocking int (*myblockingfunptr)(int b)); + +In this example, the myblockingfunptr variable refers to a blocking function somewhere, which +gets called in the blocking function myblockingfun. + +> registerBlockingFunParam :: CDecl -> WalkerT () +> registerBlockingFunParam (CDecl specifiers initdecls ni) +> | (any isBlockingSpec specifiers) = do +> let retType = getTypeSpec specifiers +> (Just declr, _, _) = head initdecls +> (CDeclr (Just f) derivedDeclrs _ _ _) = declr +> fname = identToString f +> (Just funDeclr) = find isFunDeclr derivedDeclrs +> params = getCFunDeclrParams funDeclr +> registerLocalBlocking (fname, (retType, derivedDeclrs), params) +> | otherwise = return () + +> declHasBlockingFunPtrParam :: CDecl -> Bool +> declHasBlockingFunPtrParam d = +> let ps = getParams d +> specs (CDecl specs _ _) = specs +> isBlockingParam p = any isBlockingSpec (specs p) +> in any isBlockingParam ps + +> defHasBlockingFunPtrParam :: CFunDef -> Bool +> defHasBlockingFunPtrParam f = +> let ps = getFunDefParams f +> specs (CDecl specs _ _) = specs +> isBlockingParam p = any isBlockingSpec (specs p) +> in any isBlockingParam ps + +> translateBlockingFunParam :: CDecl -> WalkerT CDecl +> translateBlockingFunParam fptr@(CDecl specifiers initdecls ni) +> | isBlockingFunDecl fptr = do +> bParams <- mkBlockingParamsFromFunPtrDecl fptr +> ret <- mkPostRetType ni +> let specs = filter (not . isBlockingSpec) specifiers +> (Just declr, _, _) = head initdecls +> (CDeclr (Just (Ident fname _ _)) _ _ _ _) = declr +> funDeclr = getDerivedFun declr +> params = getCFunDeclrParams funDeclr +> postParams = params ++ bParams +> return $ mkFunPtrDecl fname ret postParams + +> | otherwise = return fptr + +> removeVoid :: [CDecl] -> [CDecl] +> removeVoid decls = if justVoid decls then [] else decls + +> isBlockingFunDef :: CFunDef -> Bool +> isBlockingFunDef (CFunDef specifiers declarator decls stmt ni) = any isBlockingSpec specifiers + +> isBlockingFunDecl :: CDecl -> Bool +> isBlockingFunDecl (CDecl specs _ _) = any isBlockingSpec specs + +> replaceBreak :: CStat -> CStat -> CStat +> replaceBreak replaceStmt bstmt +> | isJust $ isBreak bstmt = replaceStmt +> | otherwise = bstmt + +> swapBreak :: CStat -> [CStat] -> [CStat] +> swapBreak swapStmt stmts = map (everywhere (mkT $ replaceBreak swapStmt)) stmts + +> replacePBreak :: CStat -> CStat -> CStat +> replacePBreak replaceStmt bstmt +> | isJust $ isPBreak bstmt = replaceStmt +> | otherwise = bstmt + +> swapPBreak :: CStat -> [CStat] -> [CStat] +> swapPBreak swapStmt stmts = map (everywhere (mkT $ replacePBreak swapStmt)) stmts + +> containsBreak :: [CStat] -> Bool +> containsBreak stmts = +> let hasBreak = everything orElse (mkQ Nothing isBreak) +> in (any (isJust . hasBreak) stmts) + +> containsPBreak :: [CStat] -> Bool +> containsPBreak stmts = +> let hasPBreak = everything orElse (mkQ Nothing isPBreak) +> in (any (isJust . hasPBreak) stmts) + +> containsReturn :: [CStat] -> Bool +> containsReturn stmts = +> let hasReturn = everything (||) (mkQ False isReturnStmt) +> in (any hasReturn stmts) + +> getBINodeInfo :: CBlockItem -> NodeInfo +> getBINodeInfo (CBlockDecl (CDecl _ _ ni)) = ni + +> invalid :: String -> NodeInfo -> WalkerT () +> invalid msg ni = do +> fstr <- getFilePosStr ni +> error (fstr ++ ": Invalid aesop usage: " ++ msg) + +> gspWarn :: String -> NodeInfo -> WalkerT () +> gspWarn msg ni = do +> fstr <- getFilePosStr ni +> putStrLnW $ fstr ++ ": warning: " ++ msg + +> isValidBlockingFunDef :: CFunDef -> WalkerT () +> isValidBlockingFunDef f@(CFunDef specs (CDeclr _ derivedDeclrs _ _ _) _ _ _) = do +> let isVariadic (CFunDeclr (Right ((,) params variadic)) _ _) = variadic +> isVariadic _ = False +> ni = nodeInfo f +> when (any isVariadic derivedDeclrs) $ invalid "Variadic functions are unsupported with the __blocking specifier" ni +> return () + +> isValidBlockingFor :: CStat -> WalkerT () +> isValidBlockingFor (CFor (Right _) _ _ _ ni) = invalid "declaration in blocking for loop" ni +> isValidBlockingFor (CFor (Left init) expr1 expr2 stmts ni) = do +> binit <- containsBlockingCall (CExpr init ni) +> when binit $ invalid "init expression in for loop cannot contain a blocking call" ni +> bexpr1 <- containsBlockingCall (CExpr expr1 ni) +> when bexpr1 $ invalid "conditional expression in for loop cannot contain a blocking call" ni +> bexpr2 <- containsBlockingCall (CExpr expr2 ni) +> when bexpr2 $ invalid "update expression in for loop cannot contain a blocking call" ni +> when (not $ isCompound stmts) +> $ invalid "blocking for loop requires curly brackets" ni +> when (fst $ stmtsHaveDecl stmts) +> $ invalid "blocking for loop cannot contain local declarations" (snd $ stmtsHaveDecl stmts) +> return () + +> isValidBlockingWhile :: CStat -> WalkerT () +> isValidBlockingWhile (CWhile expr stmts isDoWhile ni) = do +> bexpr <- containsBlockingCall (CExpr (Just expr) ni) +> when bexpr $ invalid "conditional expression in while loop cannot contain a blocking call" ni +> when (not $ isCompound stmts) +> $ invalid "blocking while loop requires curly brackets" ni +> when (fst $ stmtsHaveDecl stmts) +> $ invalid "blocking while loop cannot contain local declarations" (snd $ stmtsHaveDecl stmts) +> return () + + +> isValidBlockingIf :: CStat -> WalkerT () +> isValidBlockingIf (CIf expr ifStmts elseStmts ni) = do +> bexpr <- containsBlockingCall (CExpr (Just expr) ni) +> when bexpr $ invalid "if expression cannot contain a blocking call" ni +> when (not $ isCompound ifStmts) +> $ invalid "blocking if requires curly brackets" ni +> when (fst $ stmtsHaveDecl $ ifStmts) +> $ invalid "if block with blocking calls cannot contain local declarations" (snd $ stmtsHaveDecl $ ifStmts) +> when ((isJust elseStmts) && (isCompound $ fromJust elseStmts) && (fst $ stmtsHaveDecl $ fromJust elseStmts)) +> $ invalid "else block with blocking calls cannot contain local declarations" (snd $ stmtsHaveDecl $ fromJust elseStmts) +> return () + +> isValidPWait :: CStat -> WalkerT () +> isValidPWait (CPWait stmts ni) = do +> when (containsReturn [stmts]) +> $ invalid "return not allowed within pwait/pbranch context" ni +> return () + +> getBlockingCallName :: CExpr -> WalkerT (Maybe String) +> getBlockingCallName (CCall e args _) = do +> res <- lookupBlocking e +> case res of { (Just (bname, _, _)) -> return $ Just bname ; Nothing -> return Nothing } +> getBlockingCallName _ = return Nothing + +> findBlockingCall :: CStat -> WalkerT (Maybe String) +> findBlockingCall stmt = +> everything orElseMMaybe (mkQ (return Nothing) getBlockingCallName) $ stmt + +> getBlockingCallExpr :: CExpr -> WalkerT (Maybe CExpr) +> getBlockingCallExpr call@(CCall e _ _) = do +> res <- lookupBlocking e +> if isJust res then return $ Just call else return Nothing +> getBlockingCallExpr _ = return Nothing + +> findBlockingCallExpr :: CStat -> WalkerT (Maybe CExpr) +> findBlockingCallExpr stmt = +> everything orElseMMaybe (mkQ (return Nothing) getBlockingCallExpr) $ stmt + +Split a statement with a blocking function call into a triple of (return expression, function name, parameter expressions). This +function replaces the blocking call with a variable "ret", and returns that as the return expression. + +> replaceCallWithVar :: String -> CExpr -> WalkerT CExpr +> replaceCallWithVar varname call@(CCall e _ ni) = do +> res <- lookupBlocking e +> if isJust res then return (mkVar varname ni) else return call +> replaceCallWithVar _ c = return c + +> findAndReplaceBlockingCall :: String -> CStat -> WalkerT CStat + +> -- if the statement is just the blocking call (the return value is ignored), we don't replace +> findAndReplaceBlockingCall s (CExpr (Just call@(CCall e _ _)) ni) = do +> res <- lookupBlocking e +> if isJust res then return (mkCompoundStmt (Just "__ae_result_expr") [] ni) else do +> expr <- replaceCallWithVar s call +> return (CExpr (Just expr) ni) + +> findAndReplaceBlockingCall varname stmt = everywhereM (mkM $ replaceCallWithVar varname) stmt + +From a blocking function definition, Construct an external declaration parameters struct + +> mkStructCtlName :: String -> String +> mkStructCtlName name = name ++ "_ctl" + +> mkStructParamsName :: String -> String +> mkStructParamsName name = name ++ "_params" + +> mkStructPWaitName :: String -> String -> String +> mkStructPWaitName name id = name ++ "_" ++ id ++ "_params" + +> mkStructPBranchName :: String -> String -> String -> String +> mkStructPBranchName name pwaitName id = pwaitName ++ "_" ++ name ++ "_" ++ id ++ "_params" + +> mkPrivateParamPWaitName :: String -> String -> String +> mkPrivateParamPWaitName name id = name ++ "_" ++ id ++ "_private_params" + +> mkSharedParamPWaitName :: String -> String -> String +> mkSharedParamPWaitName name id = name ++ "_" ++ id ++ "_shared_params" + +> mkPWaitName :: String -> String +> mkPWaitName id = id ++ "_params" + +> mkPrivateName :: String +> mkPrivateName = "private" + +> mkPrivatePWaitName :: String -> String +> mkPrivatePWaitName id = (mkPWaitName id) ++ "." ++ mkPrivateName + +> mkSharedName :: String +> mkSharedName = "shared" + +> mkSharedPtrName :: String +> mkSharedPtrName = "shared_params" + +> mkSharedPWaitName :: String -> String +> mkSharedPWaitName id = (mkPWaitName id) ++ "." ++ mkSharedPtrName + +> mkParamPBranchName :: String -> String +> mkParamPBranchName id = id ++ "_params" + +> mkBlockingParamsStruct :: CFunDef -> WalkerT CExtDecl +> mkBlockingParamsStruct funDef = do +> let decls = getFunDefParams funDef +> ni = nodeInfo funDef +> bParams <- sequence $ map translateBlockingFunParam $ removeVoid decls +> let params = bParams ++ (map removeInitFromDecl $ getFunLocalDeclarations funDef) +> return $ genStructExtDecl (mkStructParamsName $ getFunDefName funDef) params ni + +> removeInits :: (String, [CDecl]) -> (String, [CDecl]) +> removeInits (pwaitName, pwaitDecls) = (pwaitName, (map removeInitFromDecl pwaitDecls)) + +> mkPWaitExtDecl :: (String -> String) -> (String, [CDecl]) -> NodeInfo -> CExtDecl +> mkPWaitExtDecl snamef (pwaitName, pwaitDecls) ni = +> genStructExtDecl (snamef pwaitName) pwaitDecls ni + +> mkBlockingPBranchStructs :: CFunDef -> (String, BlockingContext) -> WalkerT [CExtDecl] +> mkBlockingPBranchStructs funDef (pwaitName, pwaitCtx) = do +> let fname = getFunDefName funDef +> ni = nodeInfo funDef +> pbranches = getPBranches pwaitCtx +> pbranchDecls = zip (map getPBranchId pbranches) (map getPBranchDecls pbranches) +> params = map removeInits pbranchDecls +> return $ map (\p -> mkPBranchExtDecl fname pwaitName p ni) params + +> addPBranchParams :: CFunDef -> BlockingContext -> (String, [CDecl]) -> (String, [CDecl]) +> addPBranchParams funDef pwaitCtx (pwaitId, pWaitDecls) = +> let fname = getFunDefName funDef +> ni = nodeInfo funDef +> pbranchDecls = +> map (\p -> mkStructDecl +> (mkStructPBranchName fname pwaitId (getPBranchId p)) +> (mkParamPBranchName (getPBranchId p)) ni) $ getPBranches pwaitCtx +> in (pwaitId, (pWaitDecls ++ pbranchDecls)) + +> mkBlockingPWaitStructs :: CFunDef -> BlockingContext -> WalkerT [CExtDecl] +> mkBlockingPWaitStructs funDef bctx +> | containsPWait bctx = do +> let fname = getFunDefName funDef +> ni = nodeInfo funDef +> pwaits = getPWaits bctx +> ids = map getPWaitId pwaits +> privatePWaitDecls = zip ids (map getPWaitPrivateDecls pwaits) -- :: [(pwait_id, [private_decl])] +> sharedPWaitDecls = zip ids (map getPWaitSharedDecls pwaits) -- :: [(pwait_id, [shared_decl])] +> private = map removeInits privatePWaitDecls -- :: [(pwait_id, [private_decl_no_inits])] +> shared = map removeInits sharedPWaitDecls -- :: [(pwait_id, [shared_decl_no_inits])] +> sharedWithPBranch = zipWith (addPBranchParams funDef) pwaits shared -- :: [(pwait_id, [shared_decl_no_inits] ++ [pbranch_struct_decl])] +> privatePWaitStructs = map (\p -> mkPWaitExtDecl (mkPrivateParamPWaitName fname) p ni) private +> sharedPWaitStructs = map (\p -> mkPWaitExtDecl (mkSharedParamPWaitName fname) p ni) sharedWithPBranch +> pwaitParams = map (\id -> (id, [mkStructDecl (mkPrivateParamPWaitName fname id) mkPrivateName ni, +> mkStructDecl (mkSharedParamPWaitName fname id) mkSharedName ni, +> mkStructPtrDecl (mkSharedParamPWaitName fname id) mkSharedPtrName ni])) ids -- [(pwait_id, [private_struct, shared_struct])] +> pwaitStructs = map (\p -> mkPWaitExtDecl (mkStructPWaitName fname) p ni) pwaitParams +> pwaitNamePairs = zip (map getPWaitId pwaits) pwaits +> pbranchStructs <- liftM concat $ mapM (mkBlockingPBranchStructs funDef) pwaitNamePairs +> return $ pbranchStructs ++ privatePWaitStructs ++ sharedPWaitStructs ++ pwaitStructs +> | otherwise = return [] + +> mkPBranchExtDecl :: String -> String -> (String, [CDecl]) -> NodeInfo -> CExtDecl +> mkPBranchExtDecl fname pwaitName (pbranchName, pbranchDecls) ni = +> genStructExtDecl (mkStructPBranchName fname pwaitName pbranchName) pbranchDecls ni + +> mkBlockingCtlStruct :: CFunDef -> BlockingContext -> Bool -> WalkerT CExtDecl +> mkBlockingCtlStruct funDef bctx pblock = do +> let ni = nodeInfo funDef +> fname = getFunDefName funDef +> ctlName = mkStructCtlName fname +> spName = mkStructParamsName fname +> fieldsDecl = mkStructDecl spName "fields" ni +> paramsDecl = mkStructPtrDecl spName "params" ni +> pwaitDecls = map (\p -> mkStructDecl (mkStructPWaitName fname (getPWaitId p)) +> (mkPWaitName (getPWaitId p)) ni) +> $ getPWaits bctx + +> bparams <- mkBlockingParamsForStruct funDef +> pparams <- mkBlockingParamsParallelFields (getFunDefName funDef) pblock ni + +> return $ genStructExtDecl ctlName +> (bparams ++ pparams ++ +> [fieldsDecl, paramsDecl] ++ pwaitDecls) ni + +> mkPostFunName :: String -> String -> String +> mkPostFunName ctlName name = name ++ "_post" + +Each callback function defined for a given blocking function must have a unique name. We use: + +<bfun>_<bcall>_<bcallrow>_<bcallcol>_callback + +<bfun> is the name of the blocking function being translated +<bcall> is the name of the blocking call being made within the function +<bcallrow> is the row (line number in the file) where the blocking call is being made +<bcallcol> is the column in the file where the blocking call is being made + +> mkCallbackFunName :: String -> String -> NodeInfo -> String +> mkCallbackFunName funName callName (NodeInfo p _ _) = funName ++ "_" ++ callName ++ "_" ++ (show $ posRow p) ++ "_" ++ (show $ posColumn p) ++ "_callback" + +> mkCallbackRetParam :: String -> NodeInfo -> String +> mkCallbackRetParam callName (NodeInfo p _ _) = callName ++ "_" ++ (show $ posRow p) ++ "_" ++ (show $ posColumn p) ++ "_ret" + +> isVarIn :: [Ident] -> CExpr -> Bool +> isVarIn locals (CVar name _) = name `elem` locals +> isVarIn _ _ = False + +> addParamsPtrPrefixToExpr :: String -> String -> [Ident] -> CExpr -> CExpr +> addParamsPtrPrefixToExpr ctlPrefix paramsPrefix locals expr +> | isVarIn locals expr = addStructPtrPrefix ctlPrefix paramsPrefix expr +> | otherwise = expr + +> addParamsPtrPrefixes :: String -> String -> [Ident] -> CStat -> CStat +> addParamsPtrPrefixes ctlPrefix paramsPrefix idents stmt = everywhere (mkT $ addParamsPtrPrefixToExpr ctlPrefix paramsPrefix idents) stmt + +> addParamsPrefixToExpr :: String -> String -> [Ident] -> CExpr -> CExpr +> addParamsPrefixToExpr ctlPrefix paramsPrefix locals expr +> | isVarIn locals expr = addStructPrefix ctlPrefix paramsPrefix expr +> | otherwise = expr + +> addParamsPrefixes :: String -> String -> [Ident] -> CStat -> CStat +> addParamsPrefixes ctlPrefix paramsPrefix idents stmt = everywhere (mkT $ addParamsPrefixToExpr ctlPrefix paramsPrefix idents) stmt + +> addParams2PrefixToExpr :: String -> String -> String -> [Ident] -> CExpr -> CExpr +> addParams2PrefixToExpr ctlPrefix p1Prefix p2Prefix locals expr +> | isVarIn locals expr = addStructPrefixPrefix ctlPrefix p1Prefix p2Prefix expr +> | otherwise = expr + +> addParams2Prefixes :: String -> String -> String -> [Ident] -> CStat -> CStat +> addParams2Prefixes ctlPrefix p1Prefix p2Prefix idents stmt = +> everywhere (mkT $ addParams2PrefixToExpr ctlPrefix p1Prefix p2Prefix idents) stmt + +> addParams2PtrPrefixToExpr :: String -> String -> String -> [Ident] -> CExpr -> CExpr +> addParams2PtrPrefixToExpr ctlPrefix p1Prefix p2Prefix locals expr +> | isVarIn locals expr = addStructPtrPrefixPrefix ctlPrefix p1Prefix p2Prefix expr +> | otherwise = expr + +> addParams2PtrPrefixes :: String -> String -> String -> [Ident] -> CStat -> CStat +> addParams2PtrPrefixes ctlPrefix p1Prefix p2Prefix idents stmts = +> everywhere (mkT $ addParams2PtrPrefixToExpr ctlPrefix p1Prefix p2Prefix idents) stmts + +trLocals finds the local declarations for a blocking function context, and translates +the variables used in the statement, into variables prefixed with the ctl and parameter structures. +So for example, if a, b, c and d are local parameters, the statement: + +runfun(a, b, c, d); + +gets translated to: + +runfun(ctl->fields.a, ctl->fields.b, ctl->fields.c, ctl->fields.d); + +> trPBranchLocals :: String -> BlockingContext -> CStat -> CStat +> trPBranchLocals ctlPrefix bctx stmt +> | hasPBranchAncestor bctx = +> let pbranchCtx = getPBranchAncestor bctx +> pwaitCtx = getPWaitAncestor bctx +> locals = join $ map getCDeclNames $ getPBranchDecls pbranchCtx +> in (addParams2PtrPrefixes ctlPrefix +> ((mkPWaitName (getPWaitId pwaitCtx)) ++ "." ++ mkSharedPtrName) +> (mkParamPBranchName (getPBranchId pbranchCtx)) +> locals) stmt +> | otherwise = stmt + +> trPWaitLocals :: String -> BlockingContext -> CStat -> CStat +> trPWaitLocals ctlPrefix bctx stmt +> | hasPWaitAncestor bctx = +> let pwaitCtx = getPWaitAncestor bctx +> privateLocals = join $ map getCDeclNames $ getPWaitPrivateDecls pwaitCtx +> sharedLocals = join $ map getCDeclNames $ getPWaitSharedDecls pwaitCtx +> privatePrefixedStmt = addParamsPrefixes ctlPrefix (mkPrivatePWaitName (getPWaitId pwaitCtx)) privateLocals stmt +> allPrefixedStmt = addParamsPtrPrefixes ctlPrefix (mkSharedPWaitName (getPWaitId pwaitCtx)) sharedLocals privatePrefixedStmt +> in allPrefixedStmt +> | otherwise = stmt + +> trFunLocals :: String -> BlockingContext -> CStat -> CStat +> trFunLocals ctlPrefix bctx stmt = +> let locals = join $ map getCDeclNames $ getLocals bctx +> in (addParamsPtrPrefixes ctlPrefix "params" locals) stmt + +> trLocals :: String -> BlockingContext -> CStat -> CStat +> trLocals s b = (trFunLocals s b) . (trPWaitLocals s b) . (trPBranchLocals s b) + +> trExpr :: String -> BlockingContext -> Maybe CExpr -> Maybe CExpr +> trExpr ctlPrefix bctx expr = +> let (CExpr resExpr _) = trLocals ctlPrefix bctx (CExpr expr $ getNI bctx) +> in resExpr + +translateForCB turns statements that use local variables to statements that use +fields within the appropriate parameter structure, and converts return statements +to calling the appropriate callback + +> translateForCB :: BlockingContext -> [CStat] -> WalkerT [CStat] +> translateForCB b stmts = do +> p <- getPrefix +> endStmts <- mkStmtFromBlocking "AE_MK_END_OF_BLOCKING" [getParentName $ getFunContext b] (getNI b) +> transformExits <- getTransExit +> return $ map ((trLocals p b) . (transformExits (mkCompoundStmt Nothing endStmts (getNI b)))) stmts + +> swapReturnWithCallback :: CStat -> CStat -> CStat +> swapReturnWithCallback endStmt (CReturn retexpr ni) = assert (isJust retexpr) compoundStmt +> where retparam = if isNothing retexpr then [] else [fromJust retexpr] +> compoundStmt = mkCompoundStmt Nothing (endStmt : +> [CExpr (Just (CCall (CMember (mkVar "ctl" ni) +> (newIdent "callback" ni) True ni) +> ([constructExprFromC ni "ctl->user_ptr"] ++ retparam) ni)) ni, +> mkStmtFromC ni "free(ctl);", +> mkStmtFromC ni "return;"]) ni + +> swapReturnWithCallback e c = c + +> transformFuncReturnStmts :: CStat -> CStat -> CStat +> transformFuncReturnStmts endStmt stmt = +> everywhere (mkT $ swapReturnWithCallback endStmt) stmt + +> swapPostReturnWithCallback :: CStat -> CStat -> CStat +> swapPostReturnWithCallback endStmt (CReturn retexpr ni) = assert (isJust retexpr) compoundStmt +> where retparam = if isNothing retexpr then [] else [fromJust retexpr] +> compoundStmt = mkCompoundStmt Nothing (endStmt : +> [(CExpr (Just (CCall (CMember (mkVar "ctl" ni) +> (newIdent "callback" ni) True ni) +> ([constructExprFromC ni "ctl->user_ptr"] ++ retparam) ni)) ni), +> mkStmtFromC ni "free(ctl);", +> mkStmtFromC ni "return 0;"]) ni +> swapPostReturnWithCallback e c = c + +> transformPostFuncReturnStmts :: CStat -> CStat -> CStat +> transformPostFuncReturnStmts endStmt stmt = +> everywhere (mkT $ swapPostReturnWithCallback endStmt) stmt + +> getFuncLocalDecls :: CFunDef -> [CDecl] +> getFuncLocalDecls funDef = (getFunDefParams funDef) ++ (getFunLocalDeclarations funDef) + +Make the initialization statements for the post function: + +params = malloc(sizeof(*params)); +if(params == NULL) +{ + return -ENOMEM; +} +params->j = 0; +params->val = val; +... + +> mkPostFunInit :: String -> BlockingContext -> [CDecl] -> [CDecl] -> WalkerT [CStat] +> mkPostFunInit pname bctx fdecls pdecls = do +> -- default initialize statements for params +> inits <- mkPostFunInitStmts pname (getNI bctx) +> startStmts <- mkStmtFromBlocking "AE_MK_START_OF_BLOCKING" [getParentName $ getFunContext bctx] (getNI bctx) + +> -- get the function parameters, and set the parameters in the params struct to the values passed in +> let funParams = (map ((\name -> addStructPtrToAssign "ctl" "params" name (CVar name $ getNI bctx)) . getCDeclName) $ +> concat (map splitDecls fdecls)) + +> -- get the init statements from local declarations, and add the params-> prefix +> localDecls = (map (trLocals pname bctx) (getInitsFromDecls pdecls)) + +> return $ inits ++ funParams ++ localDecls ++ startStmts + +> generateNextPostStmts :: Maybe BlockingContext -> WalkerT ([CStat]) +> generateNextPostStmts b = do +> generatePostStmts b [] + +> generateFirstPostStmts :: BlockingContext -> WalkerT ([CStat]) +> generateFirstPostStmts b@(FunContext _ (first:_) _ _ _) = do +> let initStmts = nbStmtsBefore first +> ctxInitStmts = getCtxInitStmts first +> tlInitStmts <- translateForCB b (initStmts ++ ctxInitStmts) +> setErrorWriter mkErrorPostHandler +> setPBDone mkPBranchPostDoneStmts +> setTransExit transformPostFuncReturnStmts +> postStmts <- generatePostStmts (Just first) [] +> return $ tlInitStmts ++ postStmts + +> generateFirstPostStmts b@(FunContext f _ _ _ _) = do +> let fname = getFunDefName f +> stmts = getFunStmts f +> tlInitStmts <- translateForCB b stmts +> setErrorWriter mkErrorPostHandler +> setPBDone mkPBranchPostDoneStmts +> setTransExit transformPostFuncReturnStmts +> gspWarn +> ("The blocking function '" ++ fname ++ "' does not contain any blocking statements\n") +> (getNI b) +> return tlInitStmts + +> generateFirstPostStmts _ = error "Not a FunContext. Invalid code path." + +generatePostStmts makes the post call statements for a callback (or post function). +This is called on a blocking statement that will translate to a post call within a callback function (or post function). + +> generatePostStmts :: Maybe BlockingContext -> [BlockingContext] -> WalkerT ([CStat]) + +> generatePostStmts (Just b@(BlockingStmt stmt nbBefore _ _ _ _)) _ = do + +> -- pull out just the blocking call from a complex expression +> (Just blockingCall) <- findBlockingCallExpr $ stmt + +> -- generate the function name for the callback to pass to the post call +> let callbackFunName = (mkCallbackFunName (getParentName b) +> (getCallName blockingCall) +> (getCallNodeInfo blockingCall)) + +> -- get the return type of the blocking call +> let parentRetType = getFunDefReturn $ funDef (getParent b) + +> -- get the current params prefix +> pname <- getPrefix +> fname <- getFileName +> errorWriter <- getErrorWriter +> return (mkPostCall b callbackFunName pname blockingCall (\s -> errorWriter fname parentRetType s (getNI b))) + +> generatePostStmts (Just (FunContext _ (first:stmts) _ _ _)) tracer = error "generatePostStmts(FunContext): Invalid" + +> generatePostStmts (Just ifCtx@(IfContext ifDef (bif:ifStmts) (Just (belse:elseStmts)) nbBefore _ _ _ _)) tr = do +> isValidBlockingIf ifDef +> if (any (ifCtx ==) tr) then return [] +> else do +> let tracer = ifCtx : tr +> (CIf expr _ _ ni) = ifDef +> ifPostStmts <- generatePostStmts (Just bif) tracer +> ifInitStmts <- translateForCB ifCtx (getCtxInitStmts bif) + +> elsePostStmts <- generatePostStmts (Just belse) tracer +> elseInitStmts <- translateForCB ifCtx (getCtxInitStmts belse) + +> ((CExpr tlExpr _):_) <- translateForCB ifCtx [(CExpr (Just expr) ni)] + +> tlNBBeforeIf <- translateForCB ifCtx $ nbStmtsBefore bif +> tlNBBeforeElse <- translateForCB ifCtx $ nbStmtsBefore belse + +> let ifStmts = tlNBBeforeIf ++ ifInitStmts ++ ifPostStmts +> elseStmts = tlNBBeforeElse ++ elseInitStmts ++ elsePostStmts +> return [mkIfElseStmt tlExpr ifStmts elseStmts] + +Special case where the else has blocking call(s) but the if doesn't. We know that the else +has blocking calls, because otherwise the IfContext wouldn't have been created. + +> generatePostStmts (Just ifCtx@(IfContext ifDef [] (Just (belse:elseStmts)) nbBefore nbAfter _ next _)) tr = do +> isValidBlockingIf ifDef +> if (any (ifCtx ==) tr) then return [] +> else do +> let tracer = ifCtx : tr +> transCtx = findTransition ifCtx +> (CIf expr nbIfBlock _ ni) = ifDef + +> elsePostStmts <- generatePostStmts (Just belse) tracer +> firstInitStmts <- translateForCB ifCtx (getCtxInitStmts belse) + +> afterIfStmts <- generateAfterStmts ifCtx tracer + +> ((CExpr tlIfExpr _):_) <- translateForCB ifCtx [(CExpr (Just expr) ni)] + +> tlNBIfStmts <- translateForCB ifCtx [nbIfBlock] + +> tlNBBeforeElse <- translateForCB ifCtx $ nbStmtsBefore belse + +> let ifStmts = tlNBIfStmts ++ afterIfStmts +> elseStmts = tlNBBeforeElse ++ firstInitStmts ++ elsePostStmts + +> return [mkIfElseStmt tlIfExpr ifStmts elseStmts] + +Special case where the if has blocking call(s), but the else doesn't (an else may not even be present). + +> generatePostStmts (Just ifCtx@(IfContext ifDef (bif:ifStmts) (Just []) nbBefore nbAfter _ next _)) tr = do +> isValidBlockingIf ifDef +> if (any (ifCtx ==) tr) then return [] +> else do +> let tracer = ifCtx : tr +> transCtx = findTransition ifCtx +> (CIf expr _ nbElse ni) = ifDef + +> ifPostStmts <- generatePostStmts (Just bif) tracer +> firstInitStmts <- translateForCB ifCtx (getCtxInitStmts bif) + +> afterIfStmts <- generateAfterStmts ifCtx tracer + +> ((CExpr tlIfExpr _):_) <- translateForCB ifCtx [(CExpr (Just expr) ni)] + +> tlNBIfStmts <- translateForCB ifCtx $ nbStmtsBefore bif + +> tlNBBeforeElse <- if isJust nbElse then translateForCB ifCtx [fromJust nbElse] else return [] + +> let ifStmts = tlNBIfStmts ++ firstInitStmts ++ ifPostStmts +> elseStmts = tlNBBeforeElse ++ afterIfStmts + +> return [mkIfElseStmt tlIfExpr ifStmts elseStmts] + +> generatePostStmts (Just ifCtx@(IfContext ifDef (bif:ifStmts) Nothing before after parent next prev)) tr = +> generatePostStmts (Just (IfContext ifDef (bif:ifStmts) (Just []) before after parent next prev)) tr + +> generatePostStmts (Just forCtx@(ForContext forDef (firstB:forStmts) nbBefore nbAfter _ forNext _)) tr = do +> isValidBlockingFor forDef + +> if (any (forCtx ==) tr) then return [mkGoto (mkLoopStartLabelStr forCtx) (getNI forCtx)] +> else do + +> let (CFor init expr1 expr2 _ ni) = forDef +> loopStartLabel = \s -> mkLabel (mkLoopStartLabelStr forCtx) s $ getNI forCtx + +> let tracer = forCtx : tr +> forPostStmts <- generatePostStmts (Just firstB) tracer +> forPostInitStmts <- translateForCB forCtx $ ((nbStmtsBefore firstB) ++ (getCtxInitStmts firstB)) +> firstInitStmts <- translateForCB forCtx (getCtxInitStmts firstB) +> let forStmts = forPostInitStmts ++ forPostStmts + +> afterForStmts <- generateAfterStmts forCtx tracer + +> ((CExpr tlForExpr _):_) <- translateForCB forCtx [(CExpr expr1 ni)] + +> return $ [loopStartLabel [mkIfElseStmt tlForExpr forStmts (addLoopBreakLabel forCtx afterForStmts)]] + +> generatePostStmts (Just whileCtx@(WhileContext whileDef (bwhile:whileStmts) nbBefore nbAfter _ _ _)) tr = do +> isValidBlockingWhile whileDef + +> if (any (whileCtx ==) tr) then return [mkGoto (mkLoopStartLabelStr whileCtx) (getNI whileCtx)] +> else do + +> let (CWhile expr stmts isDoWhile ni) = whileDef +> loopStartLabel = \s -> mkLabel (mkLoopStartLabelStr whileCtx) s $ getNI whileCtx + +> let tracer = whileCtx : tr +> whilePostStmts <- generatePostStmts (Just bwhile) tracer +> whilePostInitStmts <- translateForCB whileCtx $ ((nbStmtsBefore bwhile) ++ (getCtxInitStmts bwhile)) +> firstInitStmts <- translateForCB whileCtx (getCtxInitStmts bwhile) +> let whileStmts = whilePostInitStmts ++ firstInitStmts ++ whilePostStmts + +> afterWhileStmts <- generateAfterStmts whileCtx tracer + +> ((CExpr tlWhileExpr _):_) <- translateForCB whileCtx [(CExpr (Just expr) ni)] + +> return $ [loopStartLabel [mkIfElseStmt tlWhileExpr whileStmts (addLoopBreakLabel whileCtx afterWhileStmts)]] + +> generatePostStmts (Just compoundCtx@(CompoundContext cDef (b:bs) nbBefore nbAfter _ _ _)) tr = do + +> if (any (compoundCtx ==) tr) then return [mkGoto (mkLoopStartLabelStr compoundCtx) (getNI compoundCtx)] +> else do + +> let tracer = compoundCtx : tr +> compoundPostStmts <- generatePostStmts (Just b) tracer +> compoundPostInitStmts <- translateForCB compoundCtx $ ((nbStmtsBefore b) ++ (getCtxInitStmts b)) +> firstInitStmts <- translateForCB compoundCtx (getCtxInitStmts b) +> return $ compoundPostInitStmts ++ firstInitStmts ++ compoundPostStmts + +> generatePostStmts Nothing tr = return [] + +> generatePostStmts (Just next@(PWaitContext _ pwaitDef stmts before after _ _ _)) tr = do +> isValidPWait pwaitDef +> getParallelStmts next tr + +> generatePostStmts (Just next@(PBranchContext _ _ _ _ _ _ _ _)) tr = return [] + +> generatePostStmts (Just c) _ = error $ "generatePostStmts: " ++ (getCtxName c) ++ " not handled yet" + +> generateAfterStmts :: BlockingContext -> [BlockingContext] -> WalkerT [CStat] +> generateAfterStmts b tracer = do +> let transCtx = findTransition b +> afterLoopPostStmts <- generatePostStmts transCtx tracer +> stmtsAfter <- getStmtsAfter b [] +> if isJust transCtx +> then do +> initStmts <- translateForCB b ((getNextInitStmts b) ++ stmtsAfter) +> return $ initStmts ++ afterLoopPostStmts +> else return stmtsAfter + +> getParallelStmts :: BlockingContext -> [BlockingContext] -> WalkerT [CStat] + +> getParallelStmts pb@(PBranchContext _ branchDef (b:branchStmts) _ _ _ _ _) tr = do +> pp <- getPrefix +> let ni = getNI pb +> nbStmtsBeforePB = nbStmtsBefore pb +> nbStmts = nbStmtsBefore b +> pbDeclInits = getInitsFromDecls $ getLocalDeclarations branchDef +> ctxInitStmts = getCtxInitStmts b +> pwaitName = mkPWaitName (getPWaitId $ getPWaitAncestor pb) +> pbend = [mkLabel ("__ae_" ++ (getPBranchId pb) ++ "_end") [] ni] +> afterPBranchNBStmts <- translateForCB pb (nbStmtsAfter pb) +> pushPrefix "child_ctl" +> initStmts <- translateForCB b $ (pbDeclInits ++ nbStmts ++ ctxInitStmts) +> setPBDone mkPBranchPostDoneStmts +> branchPostStmts <- generatePostStmts (Just b) [] +> cp <- getPrefix +> branchStmts <- mkPBranchPostStmts pb pwaitName cp pp (getParentName pb) (initStmts ++ branchPostStmts) (nodeInfo branchDef) +> popPrefix +> return $ branchStmts ++ pbend ++ afterPBranchNBStmts + +> getParallelStmts pw@(PWaitContext _ waitDef waitStmts@(w:ws) before after parent next prev) tr = do +> let nbStmts = nbStmtsBefore w +> pwaitDeclInits = getInitsFromDecls $ getLocalDeclarations waitDef +> pwParamsName = mkPWaitName (getPWaitId pw) +> firstStmts <- translateForCB w (pwaitDeclInits ++ nbStmts) +> pStmts <- liftM concat $ mapM (\b -> (getParallelStmts b tr)) waitStmts +> p <- getPrefix +> afterPWaitStmts <- generateAfterStmts pw tr +> pwaitInitStmts <- mkPWaitInitStmts pwParamsName p $ getNI pw +> pwaitFiniStmts <- mkPWaitFinishStmts pw p +> pwaitNotDoneStmts <- mkPWaitNotDoneStmts pw p +> return $ pwaitInitStmts ++ firstStmts ++ pStmts ++ pwaitFiniStmts ++ afterPWaitStmts ++ pwaitNotDoneStmts + +> getParallelStmts b@(ForContext forDef forStmts@(f:fs) nbBefore nbAfter parent next prev) tr = do +> p <- getPrefix +> pStmts <- liftM concat $ mapM (\f1 -> (getParallelStmts f1 tr)) forStmts +> let (CFor (Left init) expr2 expr3 _ ni) = forDef +> trInit = trExpr p b init +> trExpr2 = trExpr p b expr2 +> trExpr3 = trExpr p b expr3 +> trb <- translateForCB b (nbStmtsBefore f) +> afterForNBStmts <- translateForCB b (nbStmtsAfter b) + +> return $ [(CFor (Left trInit) trExpr2 trExpr3 +> (mkCompoundStmt Nothing (trb ++ pStmts) ni) ni)] ++ afterForNBStmts + +> getParallelStmts b@(WhileContext whileDef whileStmts@(w:ws) nbBefore nbAfter parent next prev) tr = do +> p <- getPrefix +> pStmts <- liftM concat $ mapM (\w1 -> (getParallelStmts w1 tr)) whileStmts +> let (CWhile expr stmts isDoWhile ni) = whileDef +> (Just transExpr) = trExpr p b (Just expr) +> trb <- translateForCB w (nbStmtsBefore w) +> afterWhileNBStmts <- translateForCB b (nbStmtsAfter b) +> return $ [(CWhile transExpr +> (mkCompoundStmt Nothing (trb ++ pStmts) ni) isDoWhile ni)] +> ++ afterWhileNBStmts + +> getParallelStmts b@(IfContext ifDef ifStmts@(if1:ifs) (Just (e1:elseStmts)) nbBefore nbAfter parent next prev) tr = do +> p <- getPrefix +> ifPStmts <- liftM concat $ mapM (\i -> (getParallelStmts i tr)) ifStmts +> elsePStmts <- liftM concat $ mapM (\e -> (getParallelStmts e tr)) elseStmts +> let (CIf expr _ _ ni) = ifDef +> (Just transExpr) = trExpr p b (Just expr) +> iftrb <- translateForCB if1 (nbStmtsBefore if1) +> elsetrb <- translateForCB e1 (nbStmtsBefore e1) + +> afterIfNBStmts <- translateForCB b (nbStmtsAfter b) +> return $ [(CIf transExpr (mkCompoundStmt Nothing (iftrb ++ ifPStmts) ni) (Just (mkCompoundStmt Nothing (elsetrb ++ elsePStmts) ni)) ni)] ++ afterIfNBStmts + +> getParallelStmts b@(IfContext ifDef ifStmts@(if1:ifs) Nothing nbBefore nbAfter parent next prev) tr = do +> p <- getPrefix +> ifPStmts <- liftM concat $ mapM (\i -> (getParallelStmts i tr)) ifStmts +> let (CIf expr _ _ ni) = ifDef +> (Just transExpr) = trExpr p b (Just expr) +> iftrb <- translateForCB if1 (nbStmtsBefore if1) + +> afterIfNBStmts <- translateForCB b (nbStmtsAfter b) +> return $ [(CIf transExpr (mkCompoundStmt Nothing (iftrb ++ ifPStmts) ni) Nothing ni)] ++ afterIfNBStmts + +> getParallelStmts b@(CompoundContext (CCompound _ _ ni) _ _ _ _ _ _) tr = do +> invalid ("Compound statements are not allowed within pwait blocks\n") ni +> return [] + +> getLoopParent :: BlockingContext -> Maybe BlockingContext +> getLoopParent b@(WhileContext _ _ _ _ _ _ _) = Just b +> getLoopParent b@(ForContext _ _ _ _ _ _ _) = Just b +> getLoopParent b = if isNothing $ parent b then Nothing else getLoopParent $ fromJust $ parent b + +> getLoopNI :: BlockingContext -> NodeInfo +> getLoopNI (WhileContext wDef _ _ _ _ _ _) = nodeInfo wDef +> getLoopNI (ForContext fDef _ _ _ _ _ _) = nodeInfo fDef +> getLoopNI _ = assert False $ error "Not a loop context!" + +> mkLoopBreakLabelStr :: BlockingContext -> String +> mkLoopBreakLabelStr b = assert (isJust $ getLoopParent b) s +> where s = (getParentName b) ++ +> (getPosVarStr $ getLoopNI $ fromJust $ getLoopParent b) ++ "break_after_loop" + +> mkLoopStartLabelStr :: BlockingContext -> String +> mkLoopStartLabelStr b = (getParentName b) ++ (getPosVarStr $ getLoopNI b) ++ "start_of_loop" + +> getStmtsAfter :: BlockingContext -> [CStat] -> WalkerT [CStat] +> getStmtsAfter b bcallReturn +> | containsBreak $ nbStmtsAfter b = do +> let loopCtx = findLoopParent b +> ni = getNI b +> breakStmts <- generateAfterStmts loopCtx [] +> tlAfter <- translateForCB b $ bcallReturn ++ (nbStmtsAfter b) +> return $ swapBreak (mkCompoundStmt Nothing (breakStmts ++ [CReturn Nothing ni]) $ getNI b) tlAfter + +> | (containsPBreak $ nbStmtsAfter b) && isLastContext b && parentIsPBranch b = do +> prefix <- getPrefix + +> let pwaitCtx = getPWaitAncestor b +> pbranchCtx = getPBranchAncestor b +> afterPWaitStmts <- generateAfterStmts pwaitCtx [] +> pbDone <- getPBDone + +> let fname = getParentName b +> ni = getNI b +> pbCheckDone = pbDone pbranchCtx ni +> fileName <- getFileName +> (pbreakDecls, pbreakStmts) <- mkPBreakStmts prefix ni +> (pbranchDecls, pbranchStart) <- mkPBranchCallbackStartStmts prefix fname ni +> pbranchDelete <- mkPBranchDeleteStmts ni +> pbranchDone <- mkPBranchDoneStmts prefix fname ni +> doneStmts <- mkDoneStmts ni + +> setDoneCtlStmt <- mkDoneCtlSetStmt prefix ni +> tlAfter <- translateForCB b $ bcallReturn ++ (nbStmtsAfter b) +> let afterStmts = swapPBreak (mkCompoundWithDecls Nothing +> pbreakDecls +> (pbreakStmts ++ setDoneCtlStmt ++ pbranchDone ++ pbCheckDone ++ +> afterPWaitStmts ++ doneStmts) +> $ getNI b) tlAfter + +> return $ [mkCompoundWithDecls Nothing pbranchDecls +> (pbranchStart ++ afterStmts ++ setDoneCtlStmt ++ +> pbranchDelete ++ pbranchDone ++ pbCheckDone ++ afterPWaitStmts) $ getNI b] + + + +> | containsPBreak $ nbStmtsAfter b = do +> prefix <- getPrefix + +> let pwaitCtx = getPWaitAncestor b +> pbranchCtx = getPBranchAncestor b +> afterPWaitStmts <- generateAfterStmts pwaitCtx [] +> pbDone <- getPBDone + +> let fname = getParentName b +> ni = getNI b +> pbCheckDone = pbDone pbranchCtx ni +> setDoneCtlStmt <- mkDoneCtlSetStmt prefix ni +> (pbreakDecls, pbreakStmts) <- mkPBreakStmts prefix ni +> (pbranchDecls, pbranchStart) <- mkPBranchCallbackStartStmts prefix fname ni +> pbranchDone <- mkPBranchDoneStmts prefix fname ni +> doneStmts <- mkDoneStmts ni + +> tlAfter <- translateForCB b $ bcallReturn ++ (nbStmtsAfter b) +> let afterStmts = swapPBreak (mkCompoundWithDecls Nothing +> pbreakDecls +> (pbranchStart ++ pbreakStmts ++ setDoneCtlStmt ++ pbranchDone ++ pbCheckDone ++ +> afterPWaitStmts ++ doneStmts) +> $ getNI b) tlAfter + +> return $ [mkCompoundWithDecls Nothing pbranchDecls afterStmts $ getNI b] + + +> | isLastContext b && (parentIsIf b || parentIsCompound b) = do +> prefix <- getPrefix +> assert (isJust $ parent b) return () +> parentStmts <- getStmtsAfter (fromJust $ parent b) [] +> tlAfter <- translateForCB b $ bcallReturn ++ (nbStmtsAfter b) +> return $ tlAfter ++ parentStmts + +> | isLastContext b && parentIsPBranch b = do + +> prefix <- getPrefix + +> let pn = getParentName b +> ni = getNI b + +> -- get statements after last blocking call in pbranch +> tlAfterLastBlocking <- translateForCB b $ bcallReturn ++ (nbStmtsAfter b) + +> -- get statements after pwait context +> let pwaitCtx = getPWaitAncestor b +> pbranchCtx = getPBranchAncestor b +> afterPWaitStmts <- getStmtsAfter pwaitCtx [] +> pbDone <- getPBDone + +> pbDoneStmts <- liftM concat $ sequence [mkPBranchDeleteStmts ni, +> mkPBranchDoneStmts prefix pn ni] +> let doneStmts = pbDone pbranchCtx ni +> setDoneCtlStmt <- mkDoneCtlSetStmt prefix ni +> (cbDecls, cbStmts) <- mkPBranchCallbackStartStmts prefix pn ni +> return $ [mkCompoundWithDecls Nothing +> cbDecls +> (cbStmts ++ tlAfterLastBlocking ++ setDoneCtlStmt ++ +> pbDoneStmts ++ doneStmts ++ afterPWaitStmts) $ getNI b] + +> | otherwise = translateForCB b $ bcallReturn ++ (nbStmtsAfter b) + +> getNextInitStmts :: BlockingContext -> [CStat] +> getNextInitStmts b +> | isLastContext b && parentIsFor b = +> let (Just (ForContext (CFor (Left init) expr1 expr2 _ ni) _ _ _ _ _ _)) = parent b +> in [(CExpr expr2 ni)] + +> | isLastContext b && parentIsIf b = +> let nis = getNextInitStmts $ fromJust $ parent b +> in assert (isJust $ parent b) nis + +> | (isJust $ next b) && (isForContext $ fromJust $ next b) = +> let (Just (ForContext (CFor (Left init) expr1 expr2 _ ni) _ _ _ _ _ _)) = next b +> in [CExpr init ni] +> | otherwise = [] + +> getCtxInitStmts :: BlockingContext -> [CStat] +> getCtxInitStmts b +> | isForContext b = +> let (ForContext (CFor (Left init) expr1 expr2 _ ni) _ _ _ _ _ _) = b +> in [(CExpr init ni)] +> | otherwise = [] + +> findTransition :: BlockingContext -> Maybe BlockingContext + +> findTransition b + +> -- When the blocking context is the last context in a chain and the parent is a loop, +> -- we transition back to the loop + +> | isLastContext b && parentIsFun b = Nothing +> | isLastContext b && parentIsFor b = parent b +> | isLastContext b && parentIsWhile b = parent b +> | isLastContext b && parentIsIf b = +> let res = findTransition $ fromJust $ parent b +> in assert (isJust $ parent b) res +> | isLastContext b && parentIsPBranch b = findTransition $ getPWaitAncestor b +> | isLastContext b && parentIsCompound b = +> let res = findTransition $ fromJust $ parent b +> in assert (isJust $ parent b) res +> | otherwise = next b + +> mkPostCall :: BlockingContext -> String -> String -> CExpr -> (String -> [CStat]) -> [CStat] +> mkPostCall b fname ctlName bcall@(CCall fexpr _ _) errorHandler = +> let ni = nodeInfo bcall +> in [mkFunCall (mkVar "__ae_postret" ni) +> fexpr +> ((map (fromJust . (trExpr ctlName b) . Just) $ getCallParams bcall) +> ++ [mkVar fname ni, mkVar ctlName ni, +> addStructPtr ctlName $ mkVar "hints" ni, +> addStructPtr ctlName $ mkVar "context" ni, +> addAddrOp $ addStructPtr ctlName $ mkVar "current_op_id" ni])] ++ +> (errorHandler ctlName) + +Construct the statements for the post function. First the declarations, next the initialization parts, +and finally the code up-to the first blocking call. + +> mkPostStmts :: String -> BlockingContext -> CFunDef -> [CStat] -> WalkerT CStat +> mkPostStmts prefix bctx funDef blockingStmts = do + +> -- declarations +> decls <- mkPostFunDecls (getParentName bctx) $ getNI bctx + +> -- initializer statements +> inits <- mkPostFunInit prefix bctx (getFunDefParams funDef) (getFunLocalDeclarations funDef) +> finis <- mkPostFunFinished (getNI bctx) + +> return $ mkCompoundWithDecls Nothing decls (inits ++ (map (trLocals prefix bctx) blockingStmts) ++ finis) $ getNI bctx + +> mkRetParam :: (CTypeSpec, [CDerivedDeclr]) -> NodeInfo -> [CDecl] +> mkRetParam (CVoidType _, []) ni = [] +> mkRetParam (ret, derived) ni = [mkCDecl ret derived "__ae_ret" ni] + +> mkCBParam :: (CTypeSpec, [CDerivedDeclr]) -> NodeInfo -> [CDecl] +> mkCBParam (CVoidType _, []) ni = +> [mkVoidFunPtr "callback" [constructDeclFromC ni "void *user_ptr;"]] +> mkCBParam return ni = +> [mkVoidFunPtr "callback" +> [constructDeclFromC ni "void *user_ptr;", mkCDecl (fst return) (snd return) "__ae_ret" ni]] + +> mkPostParams :: (String, (CTypeSpec, [CDerivedDeclr]), [CDecl]) -> WalkerT [CDecl] +> mkPostParams ((,,) fname ret params) = do +> let ni = nodeInfo $ fst ret + +> txParams <- sequence $ map translateBlockingFunParam $ removeVoid params +> bParams <- mkBlockingParamsForPost ret ni + +> return $ txParams ++ bParams + +> mkPostDecl :: (String, (CTypeSpec, [CDerivedDeclr]), [CDecl]) -> [CDeclSpec] -> WalkerT CDecl +> mkPostDecl f@((,,) fname ret params) declspecs = do +> let ni = nodeInfo $ fst ret +> fparams <- mkPostParams f +> ret <- mkPostRetType ni +> return $ mkFunDeclWithDeclSpecs +> (fname ++ "_post") +> ret [] +> (filterStdDeclSpecs declspecs) +> fparams + +> mkPostPtrDecl :: Bool -> (String, (CTypeSpec, [CDerivedDeclr]), [CDecl]) -> [CDeclSpec] -> WalkerT CDecl +> mkPostPtrDecl extern f@((,,) fname ret params) declspecs = do +> let ni = nodeInfo $ fst ret +> fparams <- mkPostParams f +> ret <- mkPostRetType ni +> return $ mkFunPtrDeclWithDeclSpecs +> fname +> ret [] +> ((filterStdDeclSpecs declspecs) ++ +> (if extern then [CStorageSpec $ CExtern ni] else [])) +> fparams +> (if not extern then Just (fname ++ "_post") else Nothing) + +> mkPostFunction :: String -> BlockingContext -> CFunDef -> [CStat] -> WalkerT CExtDecl +> mkPostFunction prefix bctx funDef postStmts = do +> let decls = getFunDefParams funDef +> ni = getNI bctx +> params <- sequence $ map translateBlockingFunParam $ removeVoid decls +> blockingParams <- mkBlockingParamsForPost (getFunDefReturn funDef) (nodeInfo funDef) +> stmts <- mkPostStmts prefix bctx funDef postStmts +> ret <- mkPostRetType ni +> return $ mkFunDef (ret, []) -- return type +> (getStdDeclSpecs funDef) -- get the storage specifiers for the function +> (mkPostFunName "params" $ getFunDefName funDef) -- function name +> (params ++ blockingParams) +> stmts -- statements + +> mkCallbackInitStmts :: String -> BlockingContext -> [CStat] +> mkCallbackInitStmts prefix bctx = +> let ni = getNI bctx +> in [CExpr (Just (CAssign +> CAssignOp +> (mkVar prefix ni) +> (CCast (mkAnonStructPtrDecl (mkStructCtlName $ getParentName bctx) ni) +> (mkVar "__ae_ptr" ni) ni) ni)) ni] + +> mkCallbackStmts :: String -> BlockingContext -> [CStat] -> [CStat] -> WalkerT CStat +> mkCallbackStmts prefix bctx stmtsAfter nextBlockingPostStmts = do +> let ni = getNI bctx +> ret <- mkPostRetDecl ni +> return $ mkCompoundWithDecls Nothing + +> -- declarations +> [(mkStructPtrDecl (mkStructCtlName $ getParentName bctx) "ctl" ni), +> ret] + +> -- initializer stmts +> ((mkCallbackInitStmts prefix bctx) + +> -- callback statements +> ++ stmtsAfter + +> -- the next blocking call +> ++ nextBlockingPostStmts +> ++ [mkLabel "__ae_callback_end" [] $ getNI bctx]) $ getNI bctx + +> mkCallbackReturnParamDecl :: (CTypeSpec, [CDerivedDeclr]) -> String -> NodeInfo -> [CDecl] +> -- no parameter if the return type is void +> mkCallbackReturnParamDecl (CVoidType _, []) _ _ = [] +> mkCallbackReturnParamDecl (retType, derives) name ni = +> [mkCDecl retType (filter (not . isDerivedFun) derives) (mkCallbackRetParam name ni) ni] + +function definition, blocking call, return expression, statements after blocking call up to next blocking, optional next blocking call + +> mkCallbackDecl :: BlockingContext -> CExpr -> (CTypeSpec, [CDerivedDeclr]) -> CExtDecl +> mkCallbackDecl bctx blockingCall returnType = +> let fname = getCallName blockingCall +> params = getCallParams blockingCall +> ni = getCallNodeInfo blockingCall +> in mkStaticFunDecl (CVoidType ni) -- return type +> (mkCallbackFunName (getParentName bctx) fname ni) -- function name +> ([constructDeclFromC ni "void *__ae_ptr;"] ++ -- parameter for control state +> (mkCallbackReturnParamDecl returnType fname ni)) -- parameter for return type of blocking function + +> mkCallback :: String -> BlockingContext -> CExpr -> (CTypeSpec, [CDerivedDeclr]) -> [CStat] -> [CStat] -> WalkerT CExtDecl +> mkCallback prefix bctx blockingCall returnType stmts nextBlockingPostStmts = do +> let fname = getCallName blockingCall +> params = getCallParams blockingCall +> ni = getCallNodeInfo blockingCall +> cbStmts <- mkCallbackStmts prefix bctx stmts nextBlockingPostStmts +> return $ mkStaticFunDef (CVoidType ni) -- return type +> (mkCallbackFunName (getParentName bctx) fname ni) -- function name +> ([constructDeclFromC ni "void *__ae_ptr;"] ++ -- parameter for control state +> (mkCallbackReturnParamDecl returnType fname ni)) -- parameter for return type of blocking function +> cbStmts -- statements + +Take a blocking statement and a list of statements that follow +(possibly containing other blocking statements), and return a list +of external declarations that are linked sequence of callback function +definitions for the blocking statements in the list. + +Parameters: + +BlockingContext: The blocking context +CStat: The blocking statement +[[CStat]]: A list of statement lists. Each internal list contains nonblocking statements, + with an optional blocking statement as the last element. + +> generateCallbackForBlocking :: BlockingContext -> WalkerT CExtDecl +> generateCallbackForBlocking b@(BlockingStmt _ _ _ _ _ _) = do + +> -- get the actual blocking function call from the statement containing the call +> blockingCall <- findBlockingCallExpr $ stmt b + +> -- verify that the blocking call exists +> assert (isJust blockingCall) return () + +> -- create a callback parameter that matches the return type of the blocking call +> let callbackRetParam = mkCallbackRetParam (getCallName $ fromJust blockingCall) (getCallNodeInfo $ fromJust blockingCall) + +> -- make a statement that matches the one with the blocking call, but with the blocking call replaced +> -- with a return variable +> blockingCallReturnStmt <- findAndReplaceBlockingCall callbackRetParam $ stmt b + +> -- lookup the declaration of the blocking function call to get the return type and parameter types +> blockingFun <- lookupBlocking $ fromJust blockingCall +> assert (isJust blockingFun) return () +> let (Just ((,,) bname retType params)) = blockingFun + +> setErrorWriter mkErrorCBPostHandler +> setTransExit transformFuncReturnStmts +> setPBDone mkPBranchCBDoneStmts + +> -- get the nonblocking statements +> prefix <- getPrefix +> nonBlockingStmts <- getStmtsAfter b [blockingCallReturnStmt] +> nextInitStmts <- translateForCB b $ getNextInitStmts b + +> -- figure out if there's another blocking call following this one, and get the call statements if so +> nextBlockingPostStmts <- generateNextPostStmts (findTransition b) + +> prefix <- getPrefix + +> -- finally, generate the actual callback function definition +> mkCallback prefix +> b +> (fromJust blockingCall) +> retType +> (nonBlockingStmts ++ nextInitStmts) +> nextBlockingPostStmts + +> generateCallbackDeclForBlocking :: BlockingContext -> WalkerT CExtDecl +> generateCallbackDeclForBlocking b = do +> blockingCall <- findBlockingCallExpr $ stmt b +> -- verify that the blocking call exists +> assert (isJust blockingCall) return () +> +> blockingFun <- lookupBlocking $ fromJust blockingCall +> assert (isJust blockingFun) return () +> +> let (Just ((,,) bname retType params)) = blockingFun +> return $ mkCallbackDecl b (fromJust blockingCall) retType + +> generateCallbackDefs :: BlockingContext -> WalkerT [CExtDecl] +> generateCallbackDefs = generateCallbacks generateCallbackForBlocking + +> generateCallbackDecls :: BlockingContext -> WalkerT [CExtDecl] +> generateCallbackDecls = generateCallbacks generateCallbackDeclForBlocking + +> generateCallbacks :: (BlockingContext -> WalkerT CExtDecl) -> BlockingContext -> WalkerT [CExtDecl] + +> generateCallbacks transFun (FunContext funDef stmts _ _ _) = liftM concat $ mapM (generateCallbacks transFun) stmts + +> generateCallbacks transFun b@(BlockingStmt stmt before after _ _ _) = do +> liftM (:[]) $ transFun b + +> generateCallbacks transFun b@(IfContext ifDef ifStmts elseStmts before after _ _ _) = do +> isValidBlockingIf ifDef +> ifCallbacks <- mapM (generateCallbacks transFun) ifStmts +> elseCallbacks <- if isJust elseStmts then mapM (generateCallbacks transFun) $ fromJust elseStmts else return [] +> return $ concat ifCallbacks ++ concat elseCallbacks + +> generateCallbacks transFun b@(ForContext forDef forStmts before after _ _ _) = +> liftM concat $ mapM (generateCallbacks transFun) forStmts + +> generateCallbacks transFun b@(WhileContext whileDef whileStmts before after _ _ _) = +> liftM concat $ mapM (generateCallbacks transFun) whileStmts + +> generateCallbacks transFun b@(CompoundContext cDef cStmts before after _ _ _) = +> liftM concat $ mapM (generateCallbacks transFun) cStmts + +> generateCallbacks transFun b@(PWaitContext _ pwaitDef stmts before after _ _ _) = +> liftM concat $ mapM (generateCallbacks transFun) stmts + +> generateCallbacks transFun b@(PBranchContext _ pwaitDef stmts before after _ _ _) = +> liftM concat $ mapM (generateCallbacks transFun) stmts + +> transformBlocking :: CExtDecl -> WalkerT [CExtDecl] +> transformBlocking fdefext@(CFDefExt funDef) + +> -- A blocking function definition, so we transform it +> | isBlockingFunDef funDef = do + +> isValidBlockingFunDef funDef + +> -- register a blocking function with its parameters and return type +> registerBlocking ((getFunDefName funDef), (getFunDefReturn funDef), (getFunDefParams funDef)) + +> -- Find any blocking function pointers as parameters to the blocking function, +> -- and register them +> mapM_ registerBlockingFunParam $ getFunDefParams funDef + +> -- Register function parameters as local variables +> addLocals $ getFunDefParams funDef + +> -- Register function local variables +> addLocals $ getFunLocalDeclarations funDef + +> -- before generating the context, we add a return; statement at the end if its +> -- a void function and doesn't have a return +> fDefWReturn <- checkForReturn funDef + +> -- Generate the blocking tree of BlockingContext nodes +> ctx <- generateContext fDefWReturn + +> -- Debugging: display the blocking tree +> -- putStrLnW $ drawTree $ contextToTree ctx + +> -- Walk the tree, and generate the callback function declarations +> callbackDecls <- generateCallbackDecls ctx + +> -- Walk the tree, and generate the callback function definitions +> callbackDefs <- generateCallbackDefs ctx + +> setErrorWriter mkErrorPostHandler +> setPBDone mkPBranchPostDoneStmts +> setTransExit transformPostFuncReturnStmts + +> -- Generate the post statements for the post function from the first blocking context +> postStmts <- generateFirstPostStmts ctx + +> -- Make the blocking params structure declaration +> paramsStruct <- mkBlockingParamsStruct funDef +> pwaitStructs <- mkBlockingPWaitStructs funDef ctx +> ctlStruct <- mkBlockingCtlStruct funDef ctx True + +> prefix <- getPrefix + +> let ni = getNI ctx +> fi = getFunInfo funDef +> specs = map CStorageSpec (getStorageSpecs funDef) + +> postFun <- mkPostFunction prefix ctx funDef postStmts +> pDecl <- mkPostDecl fi specs +> pPtrDecl <- mkPostPtrDecl False fi specs + +> let postDecls = [] + +> -- Construct the external declarations of parameters, callback functions, and post function +> transformedDecls = pwaitStructs ++ [paramsStruct, ctlStruct] ++ callbackDecls ++ callbackDefs ++ +> [CDeclExt pDecl, CDeclExt pPtrDecl] ++ +> [postFun] + +> -- Clear the blocking function parameters registry +> resetLocals +> clearLocalFunPtrRegistry +> return transformedDecls + + | defHasBlockingFunPtrParam funDef = do + let (fname, (rtype, derived), ps) = getFunInfo funDef + (CFunDef _ _ _ stmt _) = funDef + specs = getDeclSpecs funDef + newps <- mapM translateBlockingFunParam ps + let newDef = mkFunDef (rtype, derived) specs fname newps stmt + return [newDef] + +> | otherwise = +> liftM ((:[]) . CFDefExt) $ everywhereM (mkM translateBlockingFunParam) funDef + +> transformBlocking c = return [c] + +> transform :: CTranslUnit -> WalkerT CTranslUnit +> transform (CTranslUnit decls ni) = do +> -- map transformBlockingDef decls returns: [WalkerT [CExtDecl]] +> -- sequence of that returns: WalkerT [[CExtDecl]] +> -- so we lift concat into a monad so that we end up with WalkerT [CExtDecl] +> newdecls <- liftM concat $ sequence $ map transformBlocking decls +> return $ CTranslUnit newdecls ni + +> printBlocking :: Int -> FPType -> WalkerT () +> printBlocking l (FPFun n f) = do +> let (bname, (rettype, derives), params) = f +> pstr = if null params then "" else (foldl1 ((++) . (++ ", ")) $ map (show . pretty) params) +> liftIO $ print $ (take l $ repeat ' ') ++ bname ++ "( " ++ pstr ++ " ) = " ++ (show . pretty $ rettype) +> printBlocking l (FPStruct n f i) = do +> liftIO $ print $ (take l $ repeat ' ') ++ "( " ++ n ++ " )->" ++ f +> printBlocking (l + 4) i + +> printRegisteredBlockingCalls :: WalkerT () +> printRegisteredBlockingCalls = do +> blocking <- getAllBlocking +> liftIO $ print "BLOCKING FUNCTIONS:" +> mapM_ (printBlocking 0) blocking + +> generateAST :: FilePath -> IO CTranslUnit +> generateAST input_file = do +> input_stream <- readInputStream input_file +> let parse_result = parseC input_stream (position 0 input_file 1 1) +> case parse_result of +> Left parse_err -> error (show parse_err) +> Right ast -> return ast + +> generateASTWithCPP :: FilePath -> [String] -> IO CTranslUnit +> generateASTWithCPP input_file includes = do +> parseResult <- parseCFile (newGCC "gcc") Nothing (("-x c"):includes) input_file +> case parseResult of +> Left p -> error (show p) +> Right ast -> return ast + +> parseHeader :: FilePath -> [String] -> [(String, String)] -> Maybe FilePath -> FilePath -> IO () +> parseHeader headerfile includes defs report outfile = do +> let r = if isJust report then fromJust report else headerfile +> w <- newWalkerState r includes defs mkErrorPostHandler mkPBranchPostDoneStmts transformFuncReturnStmts +> ctu <- generateAST headerfile +> (pairs, w) <- runStateT (getBlockingHeaderDecls ctu) w +> writeFile outfile "\n\n/* This is an auto-generated file created by the ae-blocking-parser tool. DO NOT MODIFY! */\n\n" +> outputHeader r outfile pairs +> appendFile outfile "\n\n" +> return () + +> parseFile :: Bool -> [String] -> [(String, String)] -> FilePath -> Maybe FilePath -> FilePath -> IO () +> parseFile p includes defs outfile report f = do +> let r = if isJust report then fromJust report else f +> w <- newWalkerState r includes defs mkErrorPostHandler mkPBranchPostDoneStmts transformFuncReturnStmts +> ctu <- generateAST f +> (ctuWithPostDecls, w) <- runStateT (registerBlockingFunDecls ctu) w +> -- runStateT (printRegisteredBlockingCalls) w +> (transCTU, w) <- runStateT (transform ctuWithPostDecls) w +> writeFile outfile $ "\n\n\ +> \/* This is an auto-generated source file create by the ae-blocking-parser tool. DO NOT MODIFY! */\n\n" +> if p then ((appendFile outfile) . show . pretty) transCTU +> else ((appendFile outfile) . show . serialize) transCTU +> appendFile outfile "\n\n" +> return () + +> data ParserOpts = Pretty | Help | Include String | Report String | Outfile String | Header | Define (String, String) + +> getIncludes :: [ParserOpts] -> [String] +> getIncludes ((Include s):ps) = s:(getIncludes ps) +> getIncludes (_:ps) = getIncludes ps +> getIncludes [] = [] + +> getReportFilename :: [ParserOpts] -> Maybe String +> getReportFilename ((Report s):ps) = Just s +> getReportFilename (_:ps) = getReportFilename ps +> getReportFilename [] = Nothing + +> getOutfile :: [ParserOpts] -> Maybe String +> getOutfile ((Outfile s):ps) = Just s +> getOutfile (_:ps) = getOutfile ps +> getOutfile [] = Nothing + +> newDefine :: String -> ParserOpts +> newDefine s = Define $ parseDef ([], []) s + +> parseDef :: (String, String) -> String -> (String, String) +> parseDef (k,v) [] = (k,[]) +> parseDef (k,v) ('=':ds) = (k,ds) +> parseDef (k,v) (s:ds) = parseDef (k++[s], []) ds + +> getDefs :: [ParserOpts] -> [(String, String)] +> getDefs ((Define s):ps) = s:(getDefs ps) +> getDefs (_:ps) = getDefs ps +> getDefs [] = [] + +> parserOpts :: [OptDescr ParserOpts] +> parserOpts = +> [ Option ['p'] ["pretty"] (NoArg Pretty) +> "output in pretty form without source line macros" +> , Option ['I'] ["include"] (ReqArg (\s -> Include s) "<include path>") +> "include path for preprocessor" +> , Option ['h','?'] ["help"] (NoArg Help) +> "help text" +> , Option ['r'] ["report"] (ReqArg (\s -> Report s) "<report filename>") +> "filename to use when reporting errors" +> , Option ['o'] ["outfile"] (ReqArg (\s -> Outfile s) "<output file>") +> "filename to write translated C code" +> , Option ['j'] ["header"] (NoArg Header) +> "parse header file instead of source" +> , Option ['D'] ["define"] (ReqArg (\s -> newDefine s) "<cpp def>") +> "define a CPP macro or variable" +> ] + +> optPretty :: ParserOpts -> Bool +> optPretty (Pretty) = True +> optPretty _ = False + +> optHelp :: ParserOpts -> Bool +> optHelp (Help) = True +> optHelp _ = False + +> optHeader :: ParserOpts -> Bool +> optHeader (Header) = True +> optHeader _ = False + +> main :: IO () +> main = do +> args <- getArgs +> let (opts, files, errs) = getOpt RequireOrder parserOpts args +> pretty = any optPretty opts +> help = any optHelp opts +> includes = getIncludes opts +> report = getReportFilename opts +> outfile = getOutfile opts +> pheader = any optHeader opts +> defines = getDefs opts +> header = "Usage: ae-blocking-parser [OPTIONS...] files..." +> when (not $ null errs) $ ioError $ userError ((concat errs) ++ +> (usageInfo header parserOpts)) +> when help $ do { putStrLn $ usageInfo header parserOpts ; exitWith (ExitFailure 1) } +> when (isNothing outfile) $ ioError $ userError "No output file specified." +> when pheader $ do { mapM_ (\f -> parseHeader f includes defines report (fromJust outfile)) files ; exitWith (ExitSuccess) } +> mapM_ (parseFile pretty includes defines (fromJust outfile) report) files + diff --git a/code/src/aesop/parser/ae-remote-parser.lhs b/code/src/aesop/parser/ae-remote-parser.lhs new file mode 100644 index 0000000..4ef60c7 --- /dev/null +++ b/code/src/aesop/parser/ae-remote-parser.lhs @@ -0,0 +1,853 @@ +> module RemoteParser where +> import Language.C +> import Language.C.Data.Position +> import Language.C.System.GCC -- preprocessor used +> import Language.C.Data.Ident +> import System.Environment +> import System.Console.GetOpt +> import System.Exit +> import Data.Typeable +> import Data.Maybe +> import Data.Either +> import Data.HashTable +> import Data.Generics +> import Data.Generics.Schemes +> import qualified Data.ByteString +> import qualified Data.ByteString.Char8 +> import Control.Monad.State +> import Control.Exception +> import Data.List +> import CGen +> import CParse +> import CUtils +> import System.IO.Unsafe +> import Debug.Trace +> import Data.Tree +> import Serialize +> import CParse +> import CGen +> import Header +> import Text.Regex.PCRE +> import Array + +Each type in the registry is the name and a set of truth values each function +required: (encode, decode, encode_size, init, destroy) +Once one of those function declarations is found, the appropriate boolean value +is set to true. + +> type RemoteTypeRegistry = HashTable String (Bool, Bool, Bool, Bool, Bool) + +> newRemoteTypeRegistry :: IO RemoteTypeRegistry +> newRemoteTypeRegistry = Data.HashTable.new (==) Data.HashTable.hashString + +> data Remote = Remote { +> filename :: FilePath, +> typeReg :: RemoteTypeRegistry, +> funs :: [String], +> includes :: [FilePath], +> defines :: [(String, String)] +> } + +> type RemoteT = StateT Remote IO + +> invalid :: String -> NodeInfo -> RemoteT () +> invalid msg ni = do +> fstr <- getFilePosStr ni +> error (fstr ++ ": Invalid aesop usage: " ++ msg) + +> registerRemoteFun :: String -> RemoteT () +> registerRemoteFun name = do +> (Remote fname treg funs is d) <- get +> put (Remote fname treg (name:funs) is d) + +> registerEncodeFun :: String -> RemoteT () +> registerEncodeFun e = do +> r <- get +> res <- liftIO $ Data.HashTable.lookup (typeReg r) e +> if isJust res +> then do +> let (en, de, es, ini, des) = fromJust res +> liftIO $ Data.HashTable.insert (typeReg r) e (True, de, es, ini, des) +> else +> liftIO $ Data.HashTable.insert (typeReg r) e (True, False, False, False, False) +> return () + +> registerDecodeFun :: String -> RemoteT () +> registerDecodeFun d = do +> r <- get +> res <- liftIO $ Data.HashTable.lookup (typeReg r) d +> if isJust res +> then do +> let (en, de, es, ini, des) = fromJust res +> liftIO $ Data.HashTable.insert (typeReg r) d (en, True, es, ini, des) +> else +> liftIO $ Data.HashTable.insert (typeReg r) d (False, True, False, False, False) +> return () + +> registerEncodeSizeFun :: String -> RemoteT () +> registerEncodeSizeFun d = do +> r <- get +> res <- liftIO $ Data.HashTable.lookup (typeReg r) d +> if isJust res +> then do +> let (en, de, es, ini, des) = fromJust res +> liftIO $ Data.HashTable.insert (typeReg r) d (en, de, True, ini, des) +> else +> liftIO $ Data.HashTable.insert (typeReg r) d (False, False, True, False, False) +> return () + +> registerInitFun :: String -> RemoteT () +> registerInitFun d = do +> r <- get +> res <- liftIO $ Data.HashTable.lookup (typeReg r) d +> if isJust res +> then do +> let (en, de, es, ini, des) = fromJust res +> liftIO $ Data.HashTable.insert (typeReg r) d (en, de, es, True, des) +> else +> liftIO $ Data.HashTable.insert (typeReg r) d (False, False, False, True, False) +> return () + +> registerDestroyFun :: String -> RemoteT () +> registerDestroyFun d = do +> r <- get +> res <- liftIO $ Data.HashTable.lookup (typeReg r) d +> if isJust res +> then do +> let (en, de, es, ini, des) = fromJust res +> liftIO $ Data.HashTable.insert (typeReg r) d (en, de, es, ini, True) +> else +> liftIO $ Data.HashTable.insert (typeReg r) d (False, True, False, False, False) +> return () + +> isFullEncoding :: String -> RemoteT Bool +> isFullEncoding d = do +> r <- get +> res <- liftIO $ Data.HashTable.lookup (typeReg r) d +> let (Just (enc, dec, siz, ini, des)) = res +> if isJust res && enc && dec && siz && ini && des +> then return True +> else return False + +> registerFullEncoding :: String -> NodeInfo -> RemoteT () +> registerFullEncoding s ni = do +> r <- get +> res <- liftIO $ Data.HashTable.lookup (typeReg r) s +> when (isJust res) $ invalid (s ++ " already has encoding functions defined.\n") ni +> liftIO $ Data.HashTable.insert (typeReg r) s (True, True, True, True, True) + +> newRemoteState :: String -> [FilePath] -> [(String, String)] -> IO Remote +> newRemoteState fname includes defs = do +> r <- Data.HashTable.new (==) Data.HashTable.hashString +> return $ Remote fname r [] includes defs + +> getRemoteTypeName :: CTypeSpec -> Maybe String +> getRemoteTypeName (CSUType (CStruct CStructTag (Just n) _ _ _) _) = Just $ "struct_" ++ (identToString n) +> getRemoteTypeName (CSUType (CStruct CUnionTag (Just n) _ _ _) _) = Just $ "union_" ++ (identToString n) +> getRemoteTypeName (CEnumType (CEnum (Just n) _ _ _) _) = Just $ "enum_" ++ (identToString n) +> getRemoteTypeName (CTypeDef n _) = Just $ identToString n +> getRemoteTypeName _ = Nothing + +> getIncludes :: RemoteT [FilePath] +> getIncludes = liftM includes $ get + +> getDefines :: RemoteT [(String, String)] +> getDefines = liftM defines $ get + +> mkRemoteDecl :: CDecl -> [CDerivedDeclr] -> String -> Maybe CDecl +> mkRemoteDecl d@(CDecl specs inits ni) ders v = +> let s = getTypeSpec specs +> in case s of +> (CSUType (CStruct CStructTag name _ _ ni2) ni3) -> Just $ mkCDecl (CSUType (CStruct CStructTag name Nothing [] ni2) ni3) ders v ni +> (CSUType (CStruct CUnionTag name _ _ ni2) ni3) -> Just $ mkCDecl (CSUType (CStruct CUnionTag name Nothing [] ni2) ni3) ders v ni +> (CEnumType (CEnum name _ _ ni2) ni3) -> Just $ mkCDecl (CEnumType (CEnum name Nothing [] ni2) ni3) ders v ni +> (CTypeDef name ni2) -> Just $ mkCDecl (CTypeDef name ni2) ders v ni +> _ -> Nothing + +> uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d) +> uncurry3 f (a, b, c) = f a b c + +> getFieldInfo :: CDecl -> RemoteT (String, String, Bool) +> getFieldInfo d@(CDecl specs declrs ni) = do +> let t = getTypeSpec specs +> ds = getCDeclrsFromList declrs +> ptrs = if null ds then [] else getDerivedPtrs $ head ds +> tname = getRemoteTypeName t +> isPtr = not $ null ptrs +> varName = getVarName d +> when (length ptrs > 1) $ invalid ("parameter '" ++ (show $ pretty d) ++ "' has too many pointers, only one pointer supported") ni +> when (isNothing tname) $ invalid ("parameter '" ++ (show $ pretty d) ++ "' does not have a known encoding type") ni +> return (fromJust tname, varName, isPtr) + +typeof(expr) + +CTypeOfType CDecl NodeInfo + +> mkDeclsFromRemote :: String -> [String] -> NodeInfo -> RemoteT [CDecl] +> mkDeclsFromRemote macro params ni = do +> includes <- getIncludes +> defs <- getDefines +> return $ mkDeclsFromCPPMacro includes defs "ae-remote-parser.h" ni macro params + +> mkStmtFromRemote :: String -> [String] -> NodeInfo -> RemoteT [CStat] +> mkStmtFromRemote macro params ni = do +> includes <- getIncludes +> defs <- getDefines +> return $ mkStmtFromCPPMacro includes defs "ae-remote-parser.h" ni macro params + +> mkFunDefFromRemote :: String -> [CStat] -> String -> [String] -> NodeInfo -> RemoteT [CExtDecl] +> mkFunDefFromRemote name block macro params ni = do +> includes <- getIncludes +> defs <- getDefines +> return $ mkFunDefFromCPPMacro includes defs "ae-remote-parser.h" ni macro params name block + +> mkEncodeBlock :: NodeInfo -> String -> String -> Bool -> RemoteT [CStat] +> mkEncodeBlock ni typeName fieldName isPtr = do +> let encodeMacro = if isPtr then "AER_MK_ENCODE_TYPE_PTR" else "AER_MK_ENCODE_TYPE" +> mkStmtFromRemote encodeMacro [typeName, fieldName] ni + +> mkEncodeStmts :: CDecl -> [CDecl] -> NodeInfo -> RemoteT CStat +> mkEncodeStmts stype fields ni = do +> fieldsInfo <- mapM getFieldInfo fields +> let anonSType = mkAnonFromDecl stype +> encodeBlocks <- liftM concat $ sequence $ map (uncurry3 $ mkEncodeBlock ni) fieldsInfo +> encodeDecls <- mkDeclsFromRemote "AER_MK_ENCODE_DECLS" [show $ pretty anonSType] ni +> startStmts <- mkStmtFromRemote "AER_MK_ENCODE_STMTS_START" [show $ pretty anonSType] ni +> endStmts <- mkStmtFromRemote "AER_MK_ENCODE_STMTS_END" [] ni +> return $ mkCompoundWithDecls Nothing encodeDecls (startStmts ++ encodeBlocks ++ endStmts) ni + +> mkEncodeFun :: CDecl -> String -> [CDecl] -> NodeInfo -> RemoteT CExtDecl +> mkEncodeFun decl sname fields ni = do +> let tparam = mkRemoteDecl decl [(CPtrDeclr [] ni)] "x" +> when (isNothing tparam) $ invalid "not a known encoding type" ni +> stmts <- mkEncodeStmts (fromJust tparam) fields ni +> return $ mkFunDef ((CTypeDef (newIdent "triton_ret_t" ni) ni), []) +> [(CStorageSpec (CStatic ni)), (CTypeQual (CInlineQual ni))] +> ("aer_encode_" ++ sname) +> [mkCDecl (CTypeDef (newIdent "triton_buffer_t" ni) ni) [CPtrDeclr [] ni] "buf" ni, +> mkConstCDecl (CCharType ni) [CPtrDeclr [] ni] "varname" ni, +> mkCDecl (CVoidType ni) [CPtrDeclr [] ni] "vx" ni] +> stmts + +> mkDecodeBlock :: NodeInfo -> String -> String -> Bool -> RemoteT [CStat] +> mkDecodeBlock ni typeName fieldName isPtr = do +> let decodeMacro = if isPtr then "AER_MK_DECODE_TYPE_PTR" else "AER_MK_DECODE_TYPE" +> mkStmtFromRemote decodeMacro [typeName, fieldName] ni + +> mkDecodeStmts :: CDecl -> [CDecl] -> NodeInfo -> RemoteT CStat +> mkDecodeStmts stype fields ni = do +> fieldsInfo <- mapM getFieldInfo fields +> let anonSType = mkAnonFromDecl stype +> decodeBlocks <- liftM concat $ sequence $ map (uncurry3 $ mkDecodeBlock ni) fieldsInfo +> decodeDecls <- mkDeclsFromRemote "AER_MK_DECODE_DECLS" [show $ pretty anonSType] ni +> startStmts <- mkStmtFromRemote "AER_MK_DECODE_STMTS_START" [show $ pretty anonSType] ni +> endStmts <- mkStmtFromRemote "AER_MK_DECODE_STMTS_END" [] ni +> return $ mkCompoundWithDecls Nothing decodeDecls (startStmts ++ decodeBlocks ++ endStmts) ni + +> mkDecodeFun :: CDecl -> String -> [CDecl] -> NodeInfo -> RemoteT CExtDecl +> mkDecodeFun decl sname fields ni = do +> let tparam = mkRemoteDecl decl [(CPtrDeclr [] ni)] "x" +> when (isNothing tparam) $ invalid "not a known encoding type" ni +> stmts <- mkDecodeStmts (fromJust tparam) fields ni +> return $ mkFunDef ((CTypeDef (newIdent "triton_ret_t" ni) ni), []) +> [(CStorageSpec (CStatic ni)), (CTypeQual (CInlineQual ni))] +> ("aer_decode_" ++ sname) +> [mkCDecl (CTypeDef (newIdent "triton_buffer_t" ni) ni) [CPtrDeclr [] ni] "buf" ni, +> mkCDecl (CCharType ni) [CPtrDeclr [] ni, CPtrDeclr [] ni] "varname" ni, +> mkCDecl (CVoidType ni) [CPtrDeclr [] ni] "vx" ni] +> stmts + +> mkSizeBlock :: NodeInfo -> String -> String -> Bool -> RemoteT [CStat] +> mkSizeBlock ni typeName fieldName isPtr = do +> let sizeMacro = if isPtr then "AER_MK_SIZE_TYPE_PTR" else "AER_MK_SIZE_TYPE" +> mkStmtFromRemote sizeMacro [typeName, fieldName] ni + +> mkSizeStmts :: CDecl -> [CDecl] -> NodeInfo -> RemoteT CStat +> mkSizeStmts stype fields ni = do +> fieldsInfo <- mapM getFieldInfo fields +> let anonSType = mkAnonFromDecl stype +> sizeBlocks <- liftM concat $ sequence $ map (uncurry3 $ mkSizeBlock ni) fieldsInfo +> sizeDecls <- mkDeclsFromRemote "AER_MK_SIZE_DECLS" [show $ pretty anonSType] ni +> startStmts <- mkStmtFromRemote "AER_MK_SIZE_STMTS_START" [show $ pretty anonSType] ni +> endStmts <- mkStmtFromRemote "AER_MK_SIZE_STMTS_END" [] ni +> return $ mkCompoundWithDecls Nothing sizeDecls (startStmts ++ sizeBlocks ++ endStmts) ni + +> mkSizeFun :: CDecl -> String -> [CDecl] -> NodeInfo -> RemoteT CExtDecl +> mkSizeFun decl sname fields ni = do +> let tparam = mkRemoteDecl decl [(CPtrDeclr [] ni)] "x" +> when (isNothing tparam) $ invalid "not a known encoding type" ni +> stmts <- mkSizeStmts (fromJust tparam) fields ni +> return $ mkFunDef ((CTypeDef (newIdent "uint64_t" ni) ni), []) +> [(CStorageSpec (CStatic ni)), (CTypeQual (CInlineQual ni))] +> ("aer_encode_size_" ++ sname) +> [mkConstCDecl (CCharType ni) [CPtrDeclr [] ni] "varname" ni, +> mkCDecl (CVoidType ni) [CPtrDeclr [] ni] "vx" ni] +> stmts + +> mkInitBlock :: NodeInfo -> String -> String -> String -> Bool -> RemoteT [CStat] +> mkInitBlock ni baseTypeName typeName fieldName isPtr = do +> let initMacro = if isPtr then "AER_MK_INIT_PTR_TYPE" else "AER_MK_INIT_TYPE" +> mkStmtFromRemote initMacro [baseTypeName, typeName, fieldName] ni + +> mkInitNullBlock :: NodeInfo -> String -> String -> Bool -> RemoteT [CStat] +> mkInitNullBlock ni tName fName isPtr = do +> if isPtr then mkStmtFromRemote "AER_MK_INIT_PTR_NULL" [tName, fName] ni +> else return [] + +> mkInitStmts :: CDecl -> [CDecl] -> NodeInfo -> RemoteT CStat +> mkInitStmts stype fields ni = do +> fieldsInfo <- mapM getFieldInfo fields +> let getDeriveds (CDecl _ declrs _) = concatMap getDerivedDeclrs declrs +> ptrVars = map getVarName $ filter (\d -> any isDerivedPtr (getDeriveds d)) fields +> initPtr s = "x->" ++ s ++ " = 0;" +> initPtrs = mkStmtsFromCLines ni ("{ " ++ (join $ map initPtr ptrVars) ++ "}") +> anonSType = mkAnonFromDecl stype +> baseTypeName = getRemoteTypeName $ getTypeSpecFromDecl anonSType +> when (isNothing baseTypeName) $ invalid ("type '" ++ (show $ pretty stype) ++ "does not have a known encoding type") ni +> nullBlocks <- liftM concat $ sequence $ map (uncurry3 $ mkInitNullBlock ni) fieldsInfo +> initBlocks <- liftM concat $ sequence $ map (uncurry3 $ mkInitBlock ni $ fromJust baseTypeName) fieldsInfo +> initDecls <- mkDeclsFromRemote "AER_MK_INIT_DECLS" [show $ pretty anonSType] ni +> startStmts <- mkStmtFromRemote "AER_MK_INIT_STMTS_START" [show $ pretty anonSType] ni +> endStmts <- mkStmtFromRemote "AER_MK_INIT_STMTS_END" [] ni + +> return $ mkCompoundWithDecls Nothing initDecls (startStmts ++ nullBlocks ++ initBlocks ++ endStmts) ni + +> mkInitFun :: CDecl -> String -> [CDecl] -> NodeInfo -> RemoteT CExtDecl +> mkInitFun decl sname fields ni = do +> let tparam = mkRemoteDecl decl [(CPtrDeclr [] ni)] "x" +> when (isNothing tparam) $ invalid "not a known encoding type" ni +> stmts <- mkInitStmts (fromJust tparam) fields ni +> return $ mkFunDef ((CTypeDef (newIdent "triton_ret_t" ni) ni), []) +> [(CStorageSpec (CStatic ni)), (CTypeQual (CInlineQual ni))] +> ("aer_init_" ++ sname) +> [mkCDecl (CVoidType ni) [CPtrDeclr [] ni] "vx" ni] +> stmts + +> mkDestroyBlock :: NodeInfo -> String -> String -> String -> Bool -> RemoteT [CStat] +> mkDestroyBlock ni baseTypeName typeName fieldName isPtr = do +> let destroyMacro = if isPtr then "AER_MK_DESTROY_PTR_TYPE" else "AER_MK_DESTROY_TYPE" +> mkStmtFromRemote destroyMacro [baseTypeName, typeName, fieldName] ni + +> mkDestroyStmts :: CDecl -> [CDecl] -> NodeInfo -> RemoteT CStat +> mkDestroyStmts stype fields ni = do +> fieldsInfo <- mapM getFieldInfo fields +> let anonSType = mkAnonFromDecl stype +> destroyBlocks <- liftM concat $ sequence $ map (uncurry3 $ mkDestroyBlock ni (show $ pretty anonSType)) fieldsInfo +> destroyDecls <- mkDeclsFromRemote "AER_MK_DESTROY_DECLS" [show $ pretty anonSType] ni +> startStmts <- mkStmtFromRemote "AER_MK_DESTROY_STMTS_START" [show $ pretty anonSType] ni +> endStmts <- mkStmtFromRemote "AER_MK_DESTROY_STMTS_END" [] ni + +> return $ mkCompoundWithDecls Nothing destroyDecls (startStmts ++ destroyBlocks ++ endStmts) ni + +> mkDestroyFun :: CDecl -> String -> [CDecl] -> NodeInfo -> RemoteT CExtDecl +> mkDestroyFun decl sname fields ni = do +> let tparam = mkRemoteDecl decl [(CPtrDeclr [] ni)] "x" +> when (isNothing tparam) $ invalid "not a known encoding type" ni +> stmts <- mkDestroyStmts (fromJust tparam) fields ni +> return $ mkFunDef ((CVoidType ni), []) +> [(CStorageSpec (CStatic ni)), (CTypeQual (CInlineQual ni))] +> ("aer_destroy_" ++ sname) +> [mkCDecl (CVoidType ni) [CPtrDeclr [] ni] "vx" ni] +> stmts + +> mkEncodingStruct :: CDecl -> String -> NodeInfo -> RemoteT CExtDecl +> mkEncodingStruct decl sname ni = do +> let ffs = zip fields funs +> fields = ["encode", "decode", "encode_size", "init", "destroy"] +> funs = ["aer_encode_"++sname, "aer_decode_"++sname, "aer_encode_size_"++sname, "aer_init_"++sname, "aer_destroy_"++sname] +> return $ mkFunPtrsStruct "aer_encoder" ("aer_encoder_"++sname) ffs ni + +> tripleFST :: (a,b,c) -> a +> tripleFST (a,b,c) = a + +> registerTypedefTypedef :: CDecl -> RemoteT [CExtDecl] +> registerTypedefTypedef t@(CDecl specs inits ni) = do +> let ti@(Just (t1, t2)) = getTypeDefTypeDefInfo t +> when (isNothing ti) $ invalid ("cannot register a remote type without a name\n") ni +> return [] + + +> registerStruct :: CDecl -> RemoteT [CExtDecl] +> registerStruct d@(CDecl specs inits ni) = do +> let si = getStructInfo d +> (Just (structName, fields)) = si +> s = getRemoteTypeName (getTypeSpec specs) +> sname = fromJust s +> allFields = join $ map splitDecls fields + +> -- check that struct has a name +> when (isNothing s) $ invalid ("cannot define a remote struct without a name\n") ni + +> -- check that fields all have encoding functions +> finfos <- mapM getFieldInfo fields +> let types = map tripleFST finfos +> bools <- mapM isFullEncoding types +> let nInfos = map nodeInfo fields +> tbns = zip4 types bools nInfos fields +> let checkRemoteFields (t, b, n, f) = when (not b) $ +> invalid ("struct '" ++ (fromJust structName) ++ "' with parameter '" ++ +> (identToString $ getCDeclName $ f) ++ "' is not a valid remote type\n") n +> mapM_ checkRemoteFields tbns +> +> let (s:_) = filter isStructTypeSpec specs +> if (structSpecHasFields s) +> then do +> let newS = CDeclExt $ CDecl (filterOutRemoteSpec specs) inits ni +> enc <- mkEncodeFun d sname allFields ni +> size <- mkSizeFun d sname allFields ni +> dec <- mkDecodeFun d sname allFields ni +> init <- mkInitFun d sname allFields ni +> dest <- mkDestroyFun d sname allFields ni +> encStruct <- mkEncodingStruct d sname ni +> registerFullEncoding sname ni +> return [newS, dest, init, size, enc, dec, encStruct] +> else return [] + +> transDecl :: CExtDecl -> RemoteT [CExtDecl] +> transDecl e@(CDeclExt d@(CDecl specs inits ni)) +> | any isRemoteSpec specs && isStructDecl d = registerStruct d +> | any isRemoteSpec specs = do +> invalid "__remote specifiers can only be placed on struct declarations.\n" ni +> return [] +> | otherwise = return [] + +> getFileName :: RemoteT String +> getFileName = do +> w <- get +> return $ filename w + +> setFileName :: FilePath -> RemoteT () +> setFileName f = do +> (Remote _ t s is d) <- get +> put (Remote f t s is d) + +> getFilePosStr :: NodeInfo -> RemoteT String +> getFilePosStr (NodeInfo p _ _) = do +> fname <- getFileName +> return (fname ++ ":" ++ (show $ posRow p) ++ ":" ++ (show $ posColumn p)) + +> inRemoteStructs :: CDecl -> Bool +> inRemoteStructs _ = True + +> isRemoteFunDef :: CFunDef -> Bool +> isRemoteFunDef (CFunDef specs declr decls stmt ni) = any isRemoteSpec specs + +> filterOutRemoteSpec :: [CDeclSpec] -> [CDeclSpec] +> filterOutRemoteSpec = filter (not . isRemoteSpec) + +> filterOutTypeSpec :: [CDeclSpec] -> [CDeclSpec] +> filterOutTypeSpec = filter (not . isTypeSpec) + +> mkStubDecl :: String -> ReturnType -> [CDecl] -> NodeInfo -> RemoteT CExtDecl +> mkStubDecl fname r@(retType, retDerived) params ni = do +> [decl] <- liftM (map CDeclExt) $ mkDeclsFromRemote "AER_MK_STUB_DECL" ([(returnToString r), fname] ++ (map (show . pretty) params)) ni +> return decl + +> mkGSRetType :: NodeInfo -> CTypeSpec +> mkGSRetType ni = (CTypeDef (newIdent "triton_ret_t" ni) ni) + +> mkGSBufferType :: NodeInfo -> CTypeSpec +> mkGSBufferType ni = (CTypeDef (newIdent "triton_buffer_t" ni) ni) + +> checkRemoteParams :: NodeInfo -> [CDecl] -> RemoteT () +> checkRemoteParams ni [inputdecl, outputdecl] = do +> let inNI = nodeInfo inputdecl +> inName = identToString $ getCDeclName inputdecl +> outNI = nodeInfo outputdecl +> outName = identToString $ getCDeclName outputdecl +> when (not $ inRemoteStructs inputdecl) $ invalid ("input parameter '"++inName++"' cannot be encoded, must use a __remote type") inNI +> when (not $ inRemoteStructs outputdecl) $ invalid ("output parameter '"++outName++"' cannot be encoded, must use a __remote type") outNI +> let (CDecl specs initdeclrs ni) = outputdecl +> ptrs = filter isDerivedPtr $ join $ map getDerivedDeclrs initdeclrs +> when ((length ptrs) /= 1) $ invalid ("output parameter '"++outName++"' must be a pointer to type") outNI +> return () + +> checkRemoteParams ni _ = do +> invalid "only two parameters allowed for a __remote declaration" ni +> return () + +> isAEReturnType :: CTypeSpec -> Bool +> isAEReturnType (CTypeDef (Ident name _ _) _) = name == "triton_ret_t" + +> checkRemoteReturn :: (CTypeSpec, [CDerivedDeclr]) -> RemoteT () +> checkRemoteReturn (retType, retDerived) = do +> when (not $ isAEReturnType retType) $ invalid "__remote function must have a return type of triton_ret_t" (nodeInfo retType) +> return () + +> registerEFun :: String -> RemoteT () +> registerEFun fname = do +> let encRE = "aer_encode_(.*)$" +> decRE = "aer_decode_(.*)$" +> sizeRE = "aer_encode_size_(.*)$" +> initRE = "aer_init_(.*)$" +> destRE = "aer_destroy_(.*)$" +> getT r = fst ((head r) ! 1) + +> let encResult = (fname =~ encRE) :: [MatchText String] +> when (not $ null encResult) $ registerEncodeFun $ getT encResult + +> let decResult = (fname =~ decRE) :: [MatchText String] +> when (not $ null decResult) $ registerDecodeFun $ getT decResult + +> let sizeResult = (fname =~ sizeRE) :: [MatchText String] +> when (not $ null sizeResult) $ registerEncodeSizeFun $ getT sizeResult + +> let initResult = (fname =~ initRE) :: [MatchText String] +> when (not $ null initResult) $ registerInitFun $ getT initResult + +> let destResult = (fname =~ destRE) :: [MatchText String] +> when (not $ null destResult) $ registerDestroyFun $ getT destResult + +> registerRemoteDecl :: CExtDecl -> RemoteT [CExtDecl] +> registerRemoteDecl e@(CDeclExt d@(CDecl specs inits ni)) + +> | isStructDecl d && (any isRemoteSpec specs) = transDecl e +> | isFunDecl d && (any isRemoteSpec specs) = do +> let (fname, returnType, params) = splitFunDecl d +> newspecs = filterOutRemoteSpec specs +> ni = nodeInfo e + +> -- only two params allowed right now: input and pointer to output +> checkRemoteParams ni params + +> checkRemoteReturn returnType + +> let [inputdecl, outputdecl] = params +> origDecl = CDeclExt $ (CDecl newspecs inits ni) +> stubDecl <- mkStubDecl fname returnType params ni +> serviceDecl <- mkServiceDecl ni fname + +> return [origDecl, stubDecl, serviceDecl] + +> | isFunDecl d = do +> let (fname, _, _) = splitFunDecl d +> registerEFun fname +> return [e] + +> registerRemoteDecl e@(CFDefExt fd) = do +> registerEFun $ getFunDefName fd +> return [e] + +> registerRemoteDecl e = return [e] + +> registerRemoteDecls :: CTranslUnit -> RemoteT CTranslUnit +> registerRemoteDecls (CTranslUnit decls ni) = do +> newdecls <- liftM concat $ sequence $ map registerRemoteDecl decls +> return $ CTranslUnit newdecls ni + +> data ParserOpts = Pretty | Help | Include String | Report String | Outfile String | Header | ServiceName String | RegistryDir String | Define (String, String) + +> newDefine :: String -> ParserOpts +> newDefine s = Define $ parseDef ([], []) s + +> parseDef :: (String, String) -> String -> (String, String) +> parseDef (k,v) [] = (k,[]) +> parseDef (k,v) ('=':ds) = (k,ds) +> parseDef (k,v) (s:ds) = parseDef (k++[s], []) ds + +> getDefs :: [ParserOpts] -> [(String, String)] +> getDefs ((Define s):ps) = s:(getDefs ps) +> getDefs (_:ps) = getDefs ps +> getDefs [] = [] + +> getReportFilename :: [ParserOpts] -> Maybe String +> getReportFilename ((Report s):ps) = Just s +> getReportFilename (_:ps) = getReportFilename ps +> getReportFilename [] = Nothing + +> getOutfile :: [ParserOpts] -> Maybe String +> getOutfile ((Outfile s):ps) = Just s +> getOutfile (_:ps) = getOutfile ps +> getOutfile [] = Nothing + +> getServiceName :: [ParserOpts] -> Maybe String +> getServiceName ((ServiceName s):ps) = Just s +> getServiceName (_:ps) = getServiceName ps +> getServiceName [] = Nothing + +> getRegistryDir :: [ParserOpts] -> Maybe String +> getRegistryDir ((RegistryDir s):ps) = Just s +> getRegistryDir (_:ps) = getRegistryDir ps +> getRegistryDir [] = Nothing + +> getIncludeOpts :: [ParserOpts] -> [FilePath] +> getIncludeOpts ((Include f):ps) = f:(getIncludeOpts ps) +> getIncludeOpts (_:ps) = getIncludeOpts ps +> getIncludeOpts [] = [] + +> parserOpts :: [OptDescr ParserOpts] +> parserOpts = +> [ Option ['p'] ["pretty"] (NoArg Pretty) +> "output in pretty form without source line macros" +> , Option ['I'] ["include"] (ReqArg (\s -> Include s) "<include path>") +> "include path for preprocessor" +> , Option ['h','?'] ["help"] (NoArg Help) +> "help text" +> , Option ['r'] ["report"] (ReqArg (\s -> Report s) "<report filename>") +> "filename to use when reporting errors" +> , Option ['o'] ["outfile"] (ReqArg (\s -> Outfile s) "<output file>") +> "filename to write translated C code" +> , Option ['j'] ["header"] (NoArg Header) +> "parse header file instead of source" +> , Option ['n'] ["name"] (ReqArg (\s -> ServiceName s) "<service name>") +> "service name to use for remote functions" +> , Option ['d'] ["regdir"] (ReqArg (\s -> RegistryDir s) "<registry dir>") +> "registry directory path to use for generated service files" +> , Option ['D'] ["define"] (ReqArg (\s -> newDefine s) "<cpp define>") +> "define a CPP macro or variable" +> ] + +> optPretty :: ParserOpts -> Bool +> optPretty (Pretty) = True +> optPretty _ = False + +> optHelp :: ParserOpts -> Bool +> optHelp (Help) = True +> optHelp _ = False + +> optHeader :: ParserOpts -> Bool +> optHeader (Header) = True +> optHeader _ = False + +> parseRemoteHeader :: FilePath -> Maybe FilePath -> FilePath -> IO () +> parseRemoteHeader headerfile report outfuile = return () + +> mkStubBlock :: String -> String -> String -> Bool -> String -> String -> NodeInfo -> RemoteT [CStat] +> mkStubBlock fname inTypeName inName isInPtr outTypeName outName ni = do +> let macro = if isInPtr then "AER_MK_STUB_PTR_BLOCK" else "AER_MK_STUB_BLOCK" +> mkStmtFromRemote macro [fname, inTypeName, inName, outTypeName, outName] ni + +> mkStubStmts :: String -> [CDecl] -> NodeInfo -> RemoteT CStat +> mkStubStmts fname params ni = do +> let [inparam, outparam] = params +> (Ident inParamName _ _) = getCDeclName inparam +> (Ident outParamName _ _) = getCDeclName outparam +> inTypeName = canonCDecl (removeAPtr inparam) +> outTypeName = canonCDecl (removeAPtr outparam) +> (CDecl _ inDerived _) = inparam +> isInPtr = any isDerivedPtr (join $ map getDerivedDeclrs inDerived) +> stubBlock <- mkStubBlock fname inTypeName inParamName isInPtr outTypeName outParamName ni +> stubDecls <- mkDeclsFromRemote "AER_MK_STUB_DECLS" [fname] ni +> return $ mkCompoundWithDecls Nothing +> -- declarations +> stubDecls +> stubBlock +> ni + +> mkStubFun :: CFunDef -> RemoteT CExtDecl +> mkStubFun fundef = do +> let fname = getFunDefName fundef +> params = getFunDefParams fundef +> ni = nodeInfo fundef +> noremote = filterOutRemoteSpec $ getDeclSpecs fundef +> newspecs = filterOutTypeSpec $ noremote +> stubStmts <- mkStubStmts fname params ni +> return $ mkFunDef ((CTypeDef (newIdent "triton_ret_t" ni) ni), []) -- return type +> newspecs -- get the storage specs for the function +> ("remote_" ++ fname) -- the function name for the stub +> ((genCDecl "triton_node_t" "id" ni) : params) -- parameters +> stubStmts + +> mkServiceBlock :: String -> String -> String -> Bool -> String -> String -> NodeInfo -> RemoteT [CStat] +> mkServiceBlock fname inTypeName inName isInPtr outTypeName outName ni = do +> let macro = if isInPtr then "AER_MK_SERVICE_PTR_BLOCK" else "AER_MK_SERVICE_BLOCK" +> mkStmtFromRemote macro [fname, inTypeName, inName, outTypeName, outName] ni + +> mkServiceStmts :: String -> [CDecl] -> NodeInfo -> RemoteT CStat +> mkServiceStmts fname params ni = do +> let [inparam, outparam] = params +> (Ident inParamName _ _) = getCDeclName inparam +> (Ident outParamName _ _) = getCDeclName outparam +> inTypeName = canonCDecl (removeAPtr inparam) +> outTypeName = canonCDecl (removeAPtr outparam) +> (CDecl _ inDerived _) = inparam +> isInPtr = any isDerivedPtr (join $ map getDerivedDeclrs inDerived) +> serviceBlock <- mkServiceBlock fname inTypeName inParamName isInPtr outTypeName outParamName ni + +> return $ mkCompoundWithDecls Nothing [inparam, (removeAPtr outparam), genCDecl "triton_ret_t" "ret" ni] +> serviceBlock ni + +> mkServiceFun :: CFunDef -> RemoteT CExtDecl +> mkServiceFun fundef = do +> let fname = getFunDefName fundef +> [inparam, outparam]= getFunDefParams fundef +> ni = nodeInfo fundef +> noremote = filterOutRemoteSpec $ getDeclSpecs fundef +> newspecs = filterOutTypeSpec $ noremote +> (Ident inParamName _ _) = getCDeclName inparam +> (Ident outParamName _ _) = getCDeclName outparam +> inTypeName = canonCDecl (removeAPtr inparam) +> outTypeName = canonCDecl (removeAPtr outparam) +> (CDecl _ inDerived _) = inparam +> isInPtr = any isDerivedPtr (join $ map getDerivedDeclrs inDerived) +> macro = if isInPtr then "AER_MK_SERVICE_FNDEF_INPTR" else "AER_MK_SERVICE_FNDEF" +> [fdef] <- mkFunDefFromRemote (fname ++ "_service_block") [] macro [fname, inTypeName, inParamName, outTypeName, outParamName] ni +> return $ addDeclSpecs fdef newspecs + +> mkOpStmts :: String -> NodeInfo -> RemoteT [CStat] +> mkOpStmts fname ni = mkStmtFromRemote "AER_MK_OP_STMTS" [fname] ni + +> mkOpFun :: CFunDef -> RemoteT CExtDecl +> mkOpFun fundef = do +> let fname = getFunDefName fundef +> ni = nodeInfo fundef +> opfunStmts <- mkOpStmts fname ni +> return $ mkFunDef ((CTypeDef (newIdent "uint64_t" ni) ni), []) +> [] +> ("__get_op_id_" ++ fname) +> [] +> (mkCompoundStmt Nothing (opfunStmts) ni) + +> transformRemote :: CExtDecl -> RemoteT [CExtDecl] +> transformRemote e@(CFDefExt funDef) +> | isRemoteFunDef funDef = do +> let re = removeRemoteSpecFromFunDef e +> ni = nodeInfo funDef +> stub <- mkStubFun funDef +> servF <- mkServiceFun funDef +> let rstub = removeRemoteSpecFromFunDef stub +> rservF = removeRemoteSpecFromFunDef servF +> opfundecl = mkOpIdDecl (nodeInfo funDef) (getFunDefName funDef) +> opfun <- mkOpFun funDef +> sop <- liftM (map CDeclExt) $ mkDeclsFromRemote "AER_MK_STATIC_OP_DECL" [getFunDefName funDef] ni +> registerRemoteFun $ getFunDefName funDef +> return $ sop ++ [opfundecl, opfun, re, rstub, rservF] +> | otherwise = return [e] +> transformRemote e = return [e] + +> transformR :: CTranslUnit -> RemoteT CTranslUnit +> transformR (CTranslUnit decls ni) = do +> newdecls <- liftM concat $ sequence $ map transformRemote decls +> return $ CTranslUnit newdecls ni + +> mkRegBlock :: NodeInfo -> String -> RemoteT [CStat] +> mkRegBlock ni s = do +> mkStmtFromRemote "AER_MK_REG_BLOCK" [s] ni + +> mkRegFun :: String -> NodeInfo -> RemoteT CExtDecl +> mkRegFun sname ni = do +> r <- get +> decls <- mkDeclsFromRemote "AER_MK_REG_DECLS" [sname] ni +> stmts <- liftM concat $ sequence $ map (mkRegBlock ni) (funs r) +> endStmts <- mkStmtFromRemote "AER_MK_REG_END" [sname] ni +> return $ mkFunDef ((CTypeDef (newIdent "triton_ret_t" ni) ni), []) +> [] +> ("aer_remote_register_" ++ sname) +> [mkAnonCDecl (CVoidType ni) [] ni] +> (mkCompoundWithDecls Nothing +> decls +> (stmts ++ endStmts) +> ni) + +> mkOpIdDecl :: NodeInfo -> String -> CExtDecl +> mkOpIdDecl ni s = +> CDeclExt $ mkFunDeclWithDeclSpecs +> ("__get_op_id_" ++ s) +> (CTypeDef (newIdent "uint64_t" ni) ni) +> [] +> [CStorageSpec $ CExtern ni] +> [mkAnonCDecl (CVoidType ni) [] ni] + +> mkOpIdDecls :: NodeInfo -> RemoteT [CExtDecl] +> mkOpIdDecls ni = do +> r <- get +> return $ map (mkOpIdDecl ni) (funs r) + +> mkServiceDecl :: NodeInfo -> String -> RemoteT CExtDecl +> mkServiceDecl ni s = do +> [decl] <- liftM (map CDeclExt) $ mkDeclsFromRemote "AER_MK_SERVICE_DECL" [s] ni +> return $ decl + +> mkServiceDecls :: NodeInfo -> RemoteT [CExtDecl] +> mkServiceDecls ni = do +> r <- get +> sequence $ map (mkServiceDecl ni) (funs r) + +> addRegisterFun :: String -> NodeInfo -> RemoteT CTranslUnit +> addRegisterFun sname ni = do +> opidDecls <- mkOpIdDecls ni +> sDecls <- mkServiceDecls ni +> regf <- mkRegFun sname ni +> return $ CTranslUnit (opidDecls ++ sDecls ++ [regf]) ni + +> generateAST :: FilePath -> IO CTranslUnit +> generateAST input_file = do +> input_stream <- readInputStream input_file +> let parse_result = parseC input_stream (position 0 input_file 1 1) +> case parse_result of +> Left parse_err -> error (show parse_err) +> Right ast -> return ast + +> getRegistryDecl :: String -> NodeInfo -> CTranslUnit +> getRegistryDecl s ni = CTranslUnit [ CDeclExt $ (mkFunDecl ("aer_remote_register_" ++ s) (CTypeDef (newIdent "triton_ret_t" ni) ni) [] +> [mkAnonCDecl (CVoidType ni) [] ni]) ] ni + +> writeRegistryFiles :: String -> Maybe String -> RemoteT () +> writeRegistryFiles s r = do +> let ni = mkNodeInfoOnlyPos $ initPos s +> regCTU <- addRegisterFun s ni +> let sourcefile = (if (isJust r) then ((fromJust r) ++ "/") else "") ++ s ++ "_module.ae" +> headerfile = (if (isJust r) then ((fromJust r) ++ "/") else "") ++ s ++ "_module.h" +> liftIO $ (writeFile sourcefile) $ "\ +> \\n\n\ +> \/* This is an auto-generated source file created by the ae-remote-parser tool. DO NOT MODIFY! */\n\n\ +> \#include \"" ++ headerfile ++ "\"\n\n" +> liftIO $ ((appendFile sourcefile) . show . pretty) regCTU +> liftIO $ appendFile sourcefile "\n\n" + +> liftIO $ (writeFile headerfile) $ "\ +> \\n\n\ +> \/* This is an auto-generated header created by the ae-remote-parser tool. DO NOT MODIFY! */\n\n\ +> \#ifndef ___" ++ s ++ "_h__ \n\ +> \#define ___" ++ s ++ "_h__ \n\ +> \#include \"src/aesop/aesop.h\" \n\ +> \#include \"src/remote/service.h\" \n\ +> \\n\n" +> liftIO $ ((appendFile headerfile) . show . pretty) (getRegistryDecl s ni) +> liftIO $ appendFile headerfile $ " \n\ +> \\n\n\ +> \#endif \ +> \\n\n" + +> parseRemote :: Bool -> [String] -> Maybe FilePath -> Maybe FilePath -> FilePath -> RemoteT () +> parseRemote p includes outfile report f = do +> let r = if isJust report then fromJust report else f +> outf = fromJust outfile +> setFileName r +> ctu <- liftIO $ generateAST f +> ctuWithDecls <- registerRemoteDecls ctu +> transCTU <- transformR ctuWithDecls +> when (isJust outfile) $ do +> if p then liftIO $ ((writeFile outf) . show . pretty) transCTU +> else liftIO $ ((writeFile outf) . show . serialize) transCTU +> liftIO $ appendFile (fromJust outfile) "\n\n" +> return () + +> main :: IO () +> main = do +> args <- getArgs +> let (opts, files, errs) = getOpt RequireOrder parserOpts args +> pretty = any optPretty opts +> help = any optHelp opts +> includes = getIncludeOpts opts +> outfile = getOutfile opts +> pheader = any optHeader opts +> report = getReportFilename opts +> sname = getServiceName opts +> regdir = getRegistryDir opts +> defs = getDefs opts +> header = "Usage: ae-remote-parser [OPTIONS...] files..." +> +> when (not $ null errs) $ ioError $ userError ((concat errs) ++ +> (usageInfo header parserOpts)) +> +> when help $ do { putStrLn $ usageInfo header parserOpts ; exitWith (ExitFailure 1) } +> when (isNothing outfile && isNothing sname) $ ioError $ userError "No output file specified." + +> when pheader $ do { mapM_ (\f -> parseRemoteHeader f report (fromJust outfile)) files ; exitWith (ExitSuccess) } +> w <- newRemoteState "" includes defs -- empty string here because the parseRemote function sets the filename for each file +> let remotes = map (\f -> parseRemote pretty includes outfile report f) files :: [RemoteT ()] +> w <- foldM (flip execStateT) w remotes +> when (isJust sname) $ do { runStateT (writeRegistryFiles (fromJust sname) regdir) w; return () } + +vim: ts=8 sts=4 sw=4 expandtab diff --git a/code/src/aesop/parser/ae-test.lhs b/code/src/aesop/parser/ae-test.lhs new file mode 100644 index 0000000..68482a5 --- /dev/null +++ b/code/src/aesop/parser/ae-test.lhs @@ -0,0 +1,38 @@ +> module Main where +> import Language.C +> import Language.C.Data.Position +> import Language.C.System.GCC -- preprocessor used +> import Language.C.Data.Ident +> import System.Environment +> import System.Console.GetOpt +> import System.Exit +> import Data.Typeable +> import Data.Maybe +> import Data.Either +> import Data.HashTable +> import Data.Generics +> import Data.Generics.Schemes +> import qualified Data.ByteString +> import qualified Data.ByteString.Char8 +> import Control.Monad.State +> import Control.Exception +> import Data.List +> import CGen +> import CParse +> import CUtils +> import System.IO.Unsafe +> import Debug.Trace +> import Data.Tree +> import BlockingContext +> import Walker +> import ContextGen +> import Serialize +> import Header +> import Language.C.Data.Node +> import Language.C.Data.Position + +> main :: IO () +> main = do +> let decls = mkDeclsFromCPPMacro "/radix-homes/slang/dev/grayskull/code/src/gsl/" "common/triton-blocking.h" (mkNodeInfoOnlyPos (initPos "dummy")) "GSTESTDECLMACRO" ["blah"] +> writeFile "/tmp/out1" "" +> mapM_ ((appendFile "/tmp/out1") . show. pretty) (map CDeclExt decls) diff --git a/code/src/aesop/parser/module.mk.in b/code/src/aesop/parser/module.mk.in new file mode 100644 index 0000000..a2aee25 --- /dev/null +++ b/code/src/aesop/parser/module.mk.in @@ -0,0 +1,18 @@ +DIR := src/aesop/parser + +HSSRC += $(DIR)/CGen.lhs \ + $(DIR)/CParse.lhs \ + $(DIR)/CUtils.lhs \ + $(DIR)/BlockingContext.lhs \ + $(DIR)/Walker.lhs \ + $(DIR)/ContextGen.lhs \ + $(DIR)/Serialize.hs \ + $(DIR)/Header.lhs + +HSBINSRC += $(DIR)/ae-blocking-parser.lhs $(DIR)/ae-remote-parser.lhs + +MODNAME_$(DIR)/ae-blocking-parser.lhs = BlockingParser +MODNAME_$(DIR)/ae-remote-parser.lhs = RemoteParser + +clean:: + rm -rf *.o *.hi ae-blocking-parser ae-remote-parser diff --git a/oldcode/src/gsl/tests/correctness/TODO b/code/src/aesop/parser/tests/blocking/TODO similarity index 100% copy from oldcode/src/gsl/tests/correctness/TODO copy to code/src/aesop/parser/tests/blocking/TODO diff --git a/code/src/aesop/parser/tests/blocking/afterwhile.ae b/code/src/aesop/parser/tests/blocking/afterwhile.ae new file mode 100644 index 0000000..2fdc5ac --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/afterwhile.ae @@ -0,0 +1,55 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static int here = 0; + +static __blocking int run_afterwhile(void) +{ + int i, ret; + int a = 0; + + i = 100; + while(i > 0) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == ((100-i)+1)); + --i; + } + return 0; +} + +static __blocking void run_outer(void) +{ + run_afterwhile(); + here = 1; +}; + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_outer_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + assert(here == 1); + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/basic.ae b/code/src/aesop/parser/tests/blocking/basic.ae new file mode 100644 index 0000000..7f3a62e --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/basic.ae @@ -0,0 +1,50 @@ + +#include <assert.h> +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_basic(void) +{ + int ret; + int a = 0; + + ret = btest1(&a); + assert(a == 1); + assert(ret == 0); + + ret = btest2(&a); + assert(a == 3); + assert(ret == 0); + + ret = btest3(&a); + assert(a == 6); + assert(ret == 0); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_basic_post(basic_cb, myptr, NULL, NULL, &id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/btest-impl.c b/code/src/aesop/parser/tests/blocking/btest-impl.c new file mode 100644 index 0000000..50f1df8 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/btest-impl.c @@ -0,0 +1,382 @@ + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <assert.h> +#include <pthread.h> +#include "src/aesop/aesop.h" +#include "src/common/triton-list.h" +#include "src/aesop/parser/tests/blocking/btest.h" + +static int btest_resource_id; + +struct bsleep_op +{ + int sleep; + ae_op_id_t id; + struct ae_op op; +}; + +struct btest_op +{ + int *value; + ae_op_id_t id; + struct ae_op op; +}; + +static ae_ops_t list1; +static ae_ops_t list2; +static ae_ops_t list3; +static ae_ops_t slist; +static ae_ops_t clist; +static ae_ops_t flist; +static ae_ops_t rlist; + +static ae_opcache_t test_opcache; +static ae_opcache_t sleep_opcache; + +triton_ret_t ictest1_post(int *a, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + ++(*a); + callback(up, 0); + return TRITON_SUCCESS; +} +triton_ret_t (* ictest1)(int *a, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = ictest1_post; + +static void *tctest1_threadfun(void *ptr) +{ + struct ae_op *op; + struct btest_op *bop; + op = (struct ae_op *)ptr; + bop = ae_op_entry(op, struct btest_op, op); + *(bop->value) += 1; + ae_opcache_complete_op(test_opcache, &bop->op, 0); + + return NULL; +} + +triton_ret_t tctest1_post(int *a, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + pthread_t tid; + struct ae_op *op; + struct btest_op *bop; + op = ae_opcache_get(test_opcache); + ae_op_fill(op, callback, up, hints, ctx); + bop = ae_op_entry(op, struct btest_op, op); + bop->value = a; + bop->id = ae_id_gen(btest_resource_id, (uint64_t)(op->cache_id)); + *op_id = bop->id; + pthread_create(&tid, NULL, tctest1_threadfun, op); + usleep(1000); + + return TRITON_SUCCESS; +} +triton_ret_t (* tctest1)(int *a, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = tctest1_post; + +triton_ret_t btest1_post(int *a, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct btest_op *bop; + printf("BTEST1: %d\n", *a); + op = ae_opcache_get(test_opcache); + ae_op_fill(op, callback, up, hints, ctx); + bop = ae_op_entry(op, struct btest_op, op); + bop->value = a; + bop->id = ae_id_gen(btest_resource_id, (uint64_t)(op->cache_id)); + *op_id = bop->id; + ae_ops_enqueue(op, &list1); + + return TRITON_SUCCESS; +} +triton_ret_t (* btest1)(int *a, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = btest1_post; + +triton_ret_t btest2_post(int *a, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct btest_op *bop; + printf("BTEST2: %d\n", *a); + op = ae_opcache_get(test_opcache); + ae_op_fill(op, callback, up, hints, ctx); + bop = ae_op_entry(op, struct btest_op, op); + bop->value = a; + bop->id = ae_id_gen(btest_resource_id, (uint64_t)(op->cache_id)); + *op_id = bop->id; + ae_ops_enqueue(op, &list2); + + return TRITON_SUCCESS; +} +triton_ret_t (* btest2)(int *a, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = btest2_post; + +triton_ret_t btest3_post(int *a, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct btest_op *bop; + printf("BTEST3: %d\n", *a); + op = ae_opcache_get(test_opcache); + ae_op_fill(op, callback, up, hints, ctx); + bop = ae_op_entry(op, struct btest_op, op); + bop->value = a; + bop->id = ae_id_gen(btest_resource_id, (uint64_t)(op->cache_id)); + *op_id = bop->id; + ae_ops_enqueue(op, &list3); + + return TRITON_SUCCESS; +} +triton_ret_t (* btest3)(int *a, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = btest3_post; + +triton_ret_t btest_sleep_post(int secs, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct bsleep_op *bop; + printf("BTEST SLEEP\n"); + op = ae_opcache_get(sleep_opcache); + ae_op_fill(op, callback, up, hints, ctx); + bop = ae_op_entry(op, struct bsleep_op, op); + bop->sleep = secs; + bop->id = ae_id_gen(btest_resource_id, (uint64_t)(op->cache_id)); + *op_id = bop->id; + ae_ops_enqueue(op, &slist); + + return TRITON_SUCCESS; +} +triton_ret_t (* btest_sleep)(int secs, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = btest_sleep_post; + +triton_ret_t btest_forever_post(void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct btest_op *bop; + printf("BTEST FOREVER\n"); + op = ae_opcache_get(test_opcache); + ae_op_fill(op, callback, up, hints, ctx); + bop = ae_op_entry(op, struct btest_op, op); + bop->value = NULL; + bop->id = ae_id_gen(btest_resource_id, (uint64_t)(op->cache_id)); + *op_id = bop->id; + ae_ops_enqueue(op, &flist); + + return TRITON_SUCCESS; +} +triton_ret_t (* btest_forever)(void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = btest_forever_post; + +triton_ret_t btest_random_post(void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct btest_op *bop; + printf("BTEST RANDOM\n"); + op = ae_opcache_get(test_opcache); + ae_op_fill(op, callback, up, hints, ctx); + bop = ae_op_entry(op, struct btest_op, op); + bop->value = NULL; + bop->id = ae_id_gen(btest_resource_id, (uint64_t)(op->cache_id)); + *op_id = bop->id; + ae_ops_enqueue(op, &rlist); + + return TRITON_SUCCESS; +} +triton_ret_t (* btest_random)(void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = btest_random_post; + +static struct bsleep_op * poll_sleep_list(void) +{ + struct ae_op *t; + t = ae_ops_dequeue(&slist); + if(t) + { + return ae_op_entry(t, struct bsleep_op, op); + } + return NULL; +} + +static struct btest_op * poll_list(ae_ops_t *list) +{ + struct ae_op *t; + t = ae_ops_dequeue(list); + if(t) + { + return ae_op_entry(t, struct btest_op, op); + } + return NULL; +} + +static int btest_poll(ae_context_t context, int ms) +{ + struct btest_op *b; + struct bsleep_op *s; + + b = poll_list(&list1); + if(b) + { + *(b->value) += 1; + ae_opcache_complete_op(test_opcache, &b->op, 0); + } + + b = poll_list(&list2); + if(b) + { + *(b->value) += 2; + ae_opcache_complete_op(test_opcache, &b->op, 0); + } + + b = poll_list(&list3); + if(b) + { + *(b->value) += 3; + ae_opcache_complete_op(test_opcache, &b->op, 0); + } + + b = poll_list(&clist); + if(b) + { + ae_opcache_complete_op(test_opcache, &b->op, -1); + } + + b = poll_list(&rlist); + if(b) + { + ae_opcache_complete_op(test_opcache, &b->op, random()); + } + + s = poll_sleep_list(); + if(s) + { + sleep(s->sleep); + ae_opcache_complete_op(sleep_opcache, &s->op, 0); + } + return 0; +} + +static int btest_cancel(ae_context_t ctx, ae_op_id_t op_id) +{ + struct ae_op *t, *tmp; + struct btest_op *b; + + ae_ops_for_each(t, tmp, &flist) + { + b = ae_op_entry(t, struct btest_op, op); + if(b->id == op_id) + { + ae_ops_del(t); + printf("forever op cancelled\n"); + ae_ops_enqueue(&b->op, &clist); + } + } + + return 0; +} + +struct ae_resource btest_resource = +{ + .resource_name = "btest", + .poll_context = btest_poll, + .cancel = btest_cancel +}; + +int btest_init(void) +{ + ae_resource_register(&btest_resource, &btest_resource_id); + + TRITON_OPCACHE_INIT(struct bsleep_op, op, 1024, &sleep_opcache); + TRITON_OPCACHE_INIT(struct btest_op, op, 1024, &test_opcache); + + ae_ops_init(&list1); + ae_ops_init(&list2); + ae_ops_init(&list3); + ae_ops_init(&slist); + ae_ops_init(&clist); + ae_ops_init(&flist); + ae_ops_init(&rlist); + + return 0; +} + +int btest_finalize(void) +{ + ae_resource_unregister(btest_resource_id); + + ae_opcache_destroy(sleep_opcache); + ae_opcache_destroy(test_opcache); +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/aesop/parser/tests/blocking/btest.hae b/code/src/aesop/parser/tests/blocking/btest.hae new file mode 100644 index 0000000..b365097 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/btest.hae @@ -0,0 +1,56 @@ +#ifndef __BTEST_AEH__ +#define __BTEST_AEH__ + +#include <stdlib.h> +#include <stdio.h> +#include "src/aesop/aesop.h" +#include "src/aesop/op.h" + +/* These interfaces are used to test the gsl code for correctness. They + * emulate a basic resource with blocking functions, using different completion + * techniques (queue/polling, threads, immediate completion). + */ + +/* These three functions increment the integer pointer by 1, 2, and 3 respectively, + * by first storing the operation on a queue and completing the operation through + * a poll call. + */ + +__blocking int btest1(int *a); +__blocking int btest2(int *b); +__blocking int btest3(int *c); + +/* This function sleeps for the specified seconds. This is implemented by putting + * the operation on queue, and performing the sleep() call at polling time. + */ +__blocking int btest_sleep(int secs); + +/* This function is a blocking function that never returns, but can be cancelled. + * The operation is placed on a queue, and if a call to ae_cancel occurs the operation + * is completed, otherwise the operation remains on the queue indefinitely. + */ +__blocking int btest_forever(); + +/* This function simply returns a random value. The operation is first placed + * on a queue, and during polling the random value is calculated and the operation + * completed. + */ +__blocking int btest_random(); + +/* This function tests immediate completion. It increments the parameter passed in + * directly in the post function and calls the callback from the post function, returning + * the TRITON_COMPLETE value instead of TRITON_POSTED. + */ +__blocking int ictest1(int *a); + +/* This function tests completion in a separate thread, where the completion callback may + * be called before the post call actually completes. The post call starts a thread that + * increments the value and calls the callback. After the post call starts the thread it + * sleeps for 1000 microseconds before returning TRITON_POSTED. + */ +__blocking int tctest1(int *a); + +int btest_init(void); +int btest_finalize(void); + +#endif diff --git a/code/src/aesop/parser/tests/blocking/compound.ae b/code/src/aesop/parser/tests/blocking/compound.ae new file mode 100644 index 0000000..8de2ba8 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/compound.ae @@ -0,0 +1,73 @@ + + +#include <assert.h> +#include <unistd.h> +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +__blocking int blah(void) +{ + btest_sleep(100); + return 0; +} + +static __blocking int run_compound(void) +{ + int ret; + int a; + + { + a = 0; + + ret = btest1(&a); + assert(a == 1); + assert(ret == 0); + + ret = btest2(&a); + assert(a == 3); + assert(ret == 0); + + { + a = 0; + + ret = btest1(&a); + assert(a == 1); + assert(ret == 0); + + ret = btest2(&a); + assert(a == 3); + assert(ret == 0); + + } + } + return 0; +} + +static int done = 0; +static void compound_cb(void *ptr, int ret) +{ + printf("return: %d\n", ret); + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_compound_post(compound_cb, myptr, NULL, NULL, &id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/forloop.ae b/code/src/aesop/parser/tests/blocking/forloop.ae new file mode 100644 index 0000000..2341396 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/forloop.ae @@ -0,0 +1,53 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +static __blocking void run_forloop(void) +{ + int i; + int a = 0; + int ret; + + for(i = 0; i < 100; ++i) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == (i*6+1)); + ret = btest2(&a); + assert(ret == 0); + assert(a == (i*6+3)); + ret = btest3(&a); + assert(ret == 0); + assert(a == (i*6+6)); + if(i == 10) + break; + } + +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_forloop_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/funptrs.ae b/code/src/aesop/parser/tests/blocking/funptrs.ae new file mode 100644 index 0000000..4ae1498 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/funptrs.ae @@ -0,0 +1,116 @@ + +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +struct mystruct +{ + __blocking int (*myfun)(int a); + int a; +}; + +typedef struct +{ + char *str; + struct mystruct *p; + int b; +} mytype; + +typedef mytype ttype; + +static __blocking int blocking1(int a) +{ + int ret; + int b = a; + + ret = btest1(&a); + assert(ret == 0); + assert(a == (b + 1)); + + return 0; +} + +static __blocking int do_blocking(struct mystruct *s) +{ + return s->myfun(s->a); +}; + +static __blocking int do_mtype_blocking(mytype *t) +{ + return t->p->myfun(t->b); +} + +static __blocking int do_ttype_blocking(ttype *t) +{ + return t->p->myfun(t->b); +} + +typedef ttype atype; + +static __blocking int do_atype_blocking(atype *t) +{ + return t->p->myfun(t->b); +} + +static int done = 0; +static void *myptr; + +static void basic_cb(void *ptr, int a) +{ + assert(myptr == ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t id; + struct mystruct s; + mytype t; + myptr = malloc(1); + + btest_init(); + + s.myfun = blocking1; + s.a = 0; + do_blocking_post(&s, basic_cb, myptr, NULL, NULL, &id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + done = 0; + t.p = &s; + t.b = 100; + do_mtype_blocking_post(&t, basic_cb, myptr, NULL, NULL, &id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + done = 0; + t.p = &s; + t.b = 100; + do_ttype_blocking_post(&t, basic_cb, myptr, NULL, NULL, &id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + done = 0; + t.p = &s; + t.b = 100; + do_atype_blocking_post(&t, basic_cb, myptr, NULL, NULL, &id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/icpfor.ae b/code/src/aesop/parser/tests/blocking/icpfor.ae new file mode 100644 index 0000000..751be1d --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/icpfor.ae @@ -0,0 +1,56 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_parfor(void) +{ + int a[100]; + int ret[100]; + + memset(a, 0, sizeof(int)*100); + memset(ret, 0, sizeof(int)*100); + + pwait + { + pprivate int i, j; + for(i = 0; i < 100; ++i) + { + pbranch + { + j = i; + a[i] = i; + ret[i] = ictest1(&a[i]); + assert(ret[i] == 0); + assert(a[i] == (i+1)); + } + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_parfor_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/if.ae b/code/src/aesop/parser/tests/blocking/if.ae new file mode 100644 index 0000000..00f0f78 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/if.ae @@ -0,0 +1,66 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +int val = 0; + +static __blocking void run_if(void) +{ + int a = 0; + int ret; + + if(val == 0) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == 1); + ret = btest2(&a); + assert(ret == 0); + assert(a == 3); + ret = btest3(&a); + assert(ret == 0); + assert(a == 6); + } + else + { + ret = btest3(&a); + assert(ret == 0); + assert(a == 3); + ret = btest2(&a); + assert(ret == 0); + assert(a == 5); + ret = btest1(&a); + assert(ret == 0); + assert(a == 6); + } +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + printf("%p\n", myptr); + + btest_init(); + val = atoi(argv[1]); + run_if_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/ifnbelse.ae b/code/src/aesop/parser/tests/blocking/ifnbelse.ae new file mode 100644 index 0000000..893dcca --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/ifnbelse.ae @@ -0,0 +1,56 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +int val = 0; + +static __blocking void run_ifnbelse(void) +{ + int a = 0; + int ret; + + if(val == 0) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == 1); + } + else + { + printf("ELSE\n"); + } + ret = btest3(&a); + assert(ret == 0); + if(val == 0) assert(a == 4); + else assert(a == 3); +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + printf("%p\n", myptr); + + btest_init(); + val = atoi(argv[1]); + run_ifnbelse_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/ifnoelse.ae b/code/src/aesop/parser/tests/blocking/ifnoelse.ae new file mode 100644 index 0000000..4bffcdc --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/ifnoelse.ae @@ -0,0 +1,52 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +int val = 0; + +static __blocking void run_ifnoelse(void) +{ + int a = 0; + int ret; + + if(val == 0) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == 1); + } + ret = btest3(&a); + assert(ret == 0); + if(val == 0) assert(a == 4); + else assert(a == 3); +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + printf("%p\n", myptr); + + btest_init(); + val = atoi(argv[1]); + run_ifnoelse_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/ifnoelse2.ae b/code/src/aesop/parser/tests/blocking/ifnoelse2.ae new file mode 100644 index 0000000..9366bb0 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/ifnoelse2.ae @@ -0,0 +1,54 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +int val = 0; + +static __blocking void run_ifnoelse2(void) +{ + int a = 0; + int ret; + + if(val == 0) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == 1); + } + + a += 10; + ret = btest3(&a); + assert(ret == 0); + if(val == 0) assert(a == 14); + else assert(a == 13); +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + printf("%p\n", myptr); + + btest_init(); + val = atoi(argv[1]); + run_ifnoelse2_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/mixed.ae b/code/src/aesop/parser/tests/blocking/mixed.ae new file mode 100644 index 0000000..473949b --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/mixed.ae @@ -0,0 +1,101 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +int val = 0; + +static __blocking void run_mixed(void) +{ + int i, j; + int a = 0; + int ret; + + i = 100; + while(i > 0) + { + for(j = 0; j < 100; ++j) + { + if(val == 0) + { + printf("no calls\n"); + } + else if(val == 1) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == (100-i)*300+j*3+1); + ret = btest1(&a); + assert(ret == 0); + assert(a == (100-i)*300+j*3+2); + ret = btest1(&a); + assert(ret == 0); + assert(a == (100-i)*300+j*3+3); + } + else if(val == 2) + { + ret = btest2(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+2); + ret = btest2(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+4); + ret = btest2(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+6); + } + else if(val == 3) + { + ret = btest3(&a); + assert(ret == 0); + assert(a == (100-i)*900+j*9+3); + ret = btest3(&a); + assert(ret == 0); + assert(a == (100-i)*900+j*9+6); + ret = btest3(&a); + assert(ret == 0); + assert(a == (100-i)*900+j*9+9); + } + else + { + ret = btest1(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+1); + ret = btest2(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+3); + ret = btest3(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+6); + } + } + --i; + } +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + + val = atoi(argv[1]); + run_mixed_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/module.mk.in b/code/src/aesop/parser/tests/blocking/module.mk.in new file mode 100644 index 0000000..1ff9d25 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/module.mk.in @@ -0,0 +1,58 @@ +DIR := src/aesop/parser/tests/blocking + +AETESTSRC += $(DIR)/icpfor.ae \ + $(DIR)/tcpfor.ae \ + $(DIR)/afterwhile.ae \ + $(DIR)/basic.ae \ + $(DIR)/compound.ae \ + $(DIR)/params.ae \ + $(DIR)/forloop.ae \ + $(DIR)/whileloop.ae \ + $(DIR)/parallel1.ae \ + $(DIR)/parallel2.ae \ + $(DIR)/parallel3.ae \ + $(DIR)/parallel4.ae \ + $(DIR)/parallelfor.ae \ + $(DIR)/parallelfor2.ae \ + $(DIR)/whilebreak.ae \ + $(DIR)/whilebreak2.ae \ + $(DIR)/whilebreak3.ae \ + $(DIR)/nested.ae \ + $(DIR)/pbreak.ae \ + $(DIR)/pbreak2.ae \ + $(DIR)/pbreak3.ae \ + $(DIR)/pbreak4.ae \ + $(DIR)/pbreak5.ae \ + $(DIR)/pbreak6.ae \ + $(DIR)/pbreak7.ae \ + $(DIR)/pbreak8.ae \ + $(DIR)/if.ae \ + $(DIR)/ifnoelse.ae \ + $(DIR)/ifnoelse2.ae \ + $(DIR)/ifnbelse.ae \ + $(DIR)/multif.ae \ + $(DIR)/mixed.ae \ + $(DIR)/twofors.ae \ + $(DIR)/threefors.ae \ + $(DIR)/funptrs.ae \ + $(DIR)/nbfun.ae \ + $(DIR)/pprivate.ae \ + $(DIR)/pshared.ae + +# This should not compile +# $(DIR)/pbranch-with-return.ae + +AESOP_HDR += $(DIR)/btest.hae + +TESTLIBSRC += $(DIR)/btest-impl.c + +MODLIBS_$(DIR) = -lpthread + +TESTPARAMS_$(DIR)/if = 0 1 2 3 4 +TESTPARAMS_$(DIR)/ifnoelse = 0 1 +TESTPARAMS_$(DIR)/ifnoelse2 = 0 1 +TESTPARAMS_$(DIR)/ifnbelse = 0 1 +TESTPARAMS_$(DIR)/multif = 0 1 2 3 4 +TESTPARAMS_$(DIR)/mixed = 0 1 2 3 4 +TESTPARAMS_$(DIR)/twofors = 0 1 2 3 4 +TESTPARAMS_$(DIR)/threefors = 0 1 2 3 4 diff --git a/code/src/aesop/parser/tests/blocking/multif.ae b/code/src/aesop/parser/tests/blocking/multif.ae new file mode 100644 index 0000000..2906cf0 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/multif.ae @@ -0,0 +1,93 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +int val = 0; + +static __blocking void run_multiif(void) +{ + int ret; + int a = 0; + + if(val == 0) + { + printf("no calls\n"); + } + else if(val == 1) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == 1); + ret = btest1(&a); + assert(ret == 0); + assert(a == 2); + ret = btest1(&a); + assert(ret == 0); + assert(a == 3); + } + else if(val == 2) + { + ret = btest2(&a); + assert(ret == 0); + assert(a == 2); + ret = btest2(&a); + assert(ret == 0); + assert(a == 4); + ret = btest2(&a); + assert(ret == 0); + assert(a == 6); + } + else if(val == 3) + { + ret = btest3(&a); + assert(ret == 0); + assert(a == 3); + ret = btest3(&a); + assert(ret == 0); + assert(a == 6); + ret = btest3(&a); + assert(ret == 0); + assert(a == 9); + } + else + { + ret = btest1(&a); + assert(ret == 0); + assert(a == 1); + ret = btest2(&a); + assert(ret == 0); + assert(a == 3); + ret = btest3(&a); + assert(ret == 0); + assert(a == 6); + } +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + + val = atoi(argv[1]); + run_multiif_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/nbfun.ae b/code/src/aesop/parser/tests/blocking/nbfun.ae new file mode 100644 index 0000000..1d2ef80 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/nbfun.ae @@ -0,0 +1,83 @@ +#include <assert.h> +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking int run_inner_nbfun1(void) +{ + int ret; + int a = 0; + + printf("a is: %d\n", a); + return 1; +} + +static __blocking int run_outer_nbfun1(void) +{ + return run_inner_nbfun1(); +} + +static int done = 0; +static void cb(void *ptr, int i) +{ + printf("%p\n", ptr); + printf("done: %d\n", i); + done = 1; +} + +static __blocking int run_nbfun2(int a) +{ + if(a == 0) + { + printf("reached dynamic no blocking\n"); + return a; + } + else + { + return btest1(&a); + } + + return 0; +} + +static int done2 = 0; +static void cb2(void *ptr, int r) +{ + printf("%p\n", ptr); + printf("done: %d\n", r); + done2 = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_outer_nbfun1_post(cb, myptr, NULL, NULL, &id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + run_nbfun2_post(20, cb2, myptr, NULL, NULL, &id); + + while(done2 == 0) + { + ae_poll(NULL, 0); + } + + done2 = 0; + run_nbfun2_post(0, cb2, myptr, NULL, NULL, &id); + + while(done2 == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/nested.ae b/code/src/aesop/parser/tests/blocking/nested.ae new file mode 100644 index 0000000..ab66361 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/nested.ae @@ -0,0 +1,50 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static int here = 0; + +static __blocking int run_inner(void) +{ + int ret; + int a = 0; + + ret = btest1(&a); + assert(ret == 0); + assert(a == 1); + return 0; +} + +static __blocking void run_outer(void) +{ + run_inner(); + here = 1; +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_outer_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + assert(here == 1); + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/parallel1.ae b/code/src/aesop/parser/tests/blocking/parallel1.ae new file mode 100644 index 0000000..db82f3b --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/parallel1.ae @@ -0,0 +1,65 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +static __blocking void run_par1(void) +{ + int shared = 0; + int a = 0, b = 0, c = 0; + int ret1, ret2, ret3; + + pwait + { + pbranch + { + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 1); + shared = 1; + } + + pbranch + { + ret2 = btest2(&b); + assert(ret2 == 0); + shared = 2; + assert(b == 2); + } + + pbranch + { + ret3 = btest3(&c); + assert(ret3 == 0); + assert(c == 3); + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_par1_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/parallel2.ae b/code/src/aesop/parser/tests/blocking/parallel2.ae new file mode 100644 index 0000000..7b4814f --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/parallel2.ae @@ -0,0 +1,74 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +static __blocking void run_par2(void) +{ + int a = 0, b = 0, c = 0; + int ret1, ret2, ret3; + + pwait + { + pbranch + { + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 1); + } + + pbranch + { + ret2 = btest2(&b); + assert(ret2 == 0); + assert(b == 2); + } + + pbranch + { + ret3 = btest3(&c); + assert(ret3 == 0); + assert(c == 3); + } + } + + printf("pwait done\n"); + + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 2); + + ret1 = btest2(&b); + assert(ret1 == 0); + assert(b == 4); + + ret1 = btest3(&c); + assert(ret1 == 0); + assert(c == 6); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_par2_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/parallel3.ae b/code/src/aesop/parser/tests/blocking/parallel3.ae new file mode 100644 index 0000000..af5a9a5 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/parallel3.ae @@ -0,0 +1,92 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +static __blocking void run_par3(void) +{ + int a = 0, b = 0, c = 0; + int ret1, ret2, ret3; + + pwait + { + pbranch + { + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 1); + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 2); + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 3); + } + + pbranch + { + ret2 = btest2(&b); + assert(ret2 == 0); + assert(b == 2); + ret2 = btest2(&b); + assert(ret2 == 0); + assert(b == 4); + ret2 = btest2(&b); + assert(ret2 == 0); + assert(b == 6); + } + + pbranch + { + ret3 = btest3(&c); + assert(ret3 == 0); + assert(c == 3); + ret3 = btest3(&c); + assert(ret3 == 0); + assert(c == 6); + ret3 = btest3(&c); + assert(ret3 == 0); + assert(c == 9); + } + } + + printf("pwait done\n"); + + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 4); + + ret1 = btest2(&a); + assert(ret1 == 0); + assert(a == 6); + + ret1 = btest3(&a); + assert(ret1 == 0); + assert(a == 9); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_par3_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/parallel4.ae b/code/src/aesop/parser/tests/blocking/parallel4.ae new file mode 100644 index 0000000..7956247 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/parallel4.ae @@ -0,0 +1,90 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +static __blocking void run_par4(void) +{ + int a = 0, b = 0, c = 0; + int ret1, ret2, ret3; + + pwait + { + pbranch + { + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 1); + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 2); + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 3); + } + + pbranch + { + ret2 = btest2(&b); + assert(ret2 == 0); + assert(b == 2); + ret2 = btest2(&b); + assert(ret2 == 0); + assert(b == 4); + ret2 = btest2(&b); + assert(ret2 == 0); + assert(b == 6); + } + + pbranch + { + ret3 = btest3(&c); + assert(ret3 == 0); + assert(c == 3); + ret3 = btest3(&c); + assert(ret3 == 0); + assert(c == 6); + ret3 = btest3(&c); + assert(ret3 == 0); + assert(c == 9); + } + } + + printf("pwait done\n"); + + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 4); + ret1 = btest2(&b); + assert(ret1 == 0); + assert(b == 8); + ret1 = btest3(&c); + assert(ret1 == 0); + assert(c == 12); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_par4_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/parallelfor.ae b/code/src/aesop/parser/tests/blocking/parallelfor.ae new file mode 100644 index 0000000..30e4ec8 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/parallelfor.ae @@ -0,0 +1,65 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_parfor(void) +{ + int a[100]; + int ret[100]; + + memset(a, 0, sizeof(int)*100); + memset(ret, 0, sizeof(int)*100); + + pwait + { + pprivate int i, j; + for(i = 0; i < 100; ++i) + { + pbranch + { + j = i; + a[i] = i; + ret[i] = btest1(&a[i]); + assert(ret[i] == 0); + assert(a[i] == (i+1)); + + j = i; + ret[i] = btest2(&a[i]); + assert(ret[i] == 0); + assert(a[i] == (i+3)); + + ret[i] = btest3(&a[i]); + assert(ret[i] == 0); + assert(a[i] == (i+6)); + } + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_parfor_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/parallelfor2.ae b/code/src/aesop/parser/tests/blocking/parallelfor2.ae new file mode 100644 index 0000000..ab69fec --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/parallelfor2.ae @@ -0,0 +1,72 @@ +/* + * (C) 2009 The University of Chicago + * + * See COPYING in top-level directory. + */ + +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_parfor( + void) +{ + /* note: if you comment this out, then the test case works fine */ + btest_sleep(1); + + pwait + { + int i; + for (i = 0; i < 2; ++i) + { + pbranch + { + /* deliberately skip blocking function in one branch */ + if(i != 1) + { + btest_sleep(1); + } + } + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb( + void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main( + int argc, + char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_parfor_post(basic_cb, myptr, NULL, NULL, &op_id); + + while (done == 0) + { + ae_poll(NULL, 10000); + } + + btest_finalize(); + free(myptr); + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/aesop/parser/tests/blocking/params.ae b/code/src/aesop/parser/tests/blocking/params.ae new file mode 100644 index 0000000..4d1703b --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/params.ae @@ -0,0 +1,46 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_params(int a, const char *b, const char *c) +{ + int ret; + ret = btest1(&a); + printf("%s\n", b); + assert(ret == 0); + assert(a == 11); + ret = btest2(&a); + printf("%s\n", c); + assert(ret == 0); + assert(a == 13); + ret = btest3(&a); + printf("%d\n", a); + assert(ret == 0); + assert(a == 16); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_params_post(10, "FOO", "BAR", basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/pbranch-with-return.ae b/code/src/aesop/parser/tests/blocking/pbranch-with-return.ae new file mode 100644 index 0000000..b1f5456 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pbranch-with-return.ae @@ -0,0 +1,53 @@ +#include <assert.h> +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking int pbranch_with_return(void) +{ + + pwait + { + pprivate int a = 0; + + pbranch + { + btest1(&a); + return a; + } + + pbranch + { + btest2(&a); + } + } + + return 0; +} + +static int done = 0; +static void cb(void *ptr, int i) +{ + printf("%p\n", ptr); + printf("done: %d\n", i); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + pbranch_with_return_post(cb, myptr, NULL, NULL, &id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/pbreak.ae b/code/src/aesop/parser/tests/blocking/pbreak.ae new file mode 100644 index 0000000..7b4d47c --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pbreak.ae @@ -0,0 +1,74 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +static __blocking void run_pbreak(void) +{ + int a = 0, b = 0, c = 0; + int ret1, ret2, ret3, ret4; + + pwait + { + pbranch + { + ret1 = btest1(&a); + assert(ret1 == 0); + assert(a == 1); + } + + pbranch + { + ret2 = btest2(&b); + assert(ret2 == 0); + assert(b == 2); + ret2 = btest_forever(); + assert(ret2 != 0); + } + + pbranch + { + ret3 = btest3(&c); + assert(ret3 == 0); + assert(c == 3); + ret3 = btest1(&c); + assert(ret3 == 0); + assert(c == 4); + } + + pbranch + { + ret4 = btest_sleep(4); + assert(ret4 == 0); + pbreak; + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_pbreak_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/pbreak2.ae b/code/src/aesop/parser/tests/blocking/pbreak2.ae new file mode 100644 index 0000000..c888df5 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pbreak2.ae @@ -0,0 +1,68 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_pbreak2(void) +{ + int a = 0, b = 0, shared = 0; + int ret; + + pwait + { + pbranch + { + ret = btest1(&a); + assert(ret == 0); + assert(a == 1); + shared += a; + printf("before pbreak: a == %d!\n", a); + if(shared > 2) + { + pbreak; + } + ret = btest2(&a); + assert(ret == 0); + assert(a == 3); + } + + pbranch + { + ret = btest3(&b); + assert(ret == 0); + assert(b == 3); + shared += b; + + ret = btest1(&b); + assert(ret == 0); + assert(b == 4); + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_pbreak2_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/pbreak3.ae b/code/src/aesop/parser/tests/blocking/pbreak3.ae new file mode 100644 index 0000000..a474c1a --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pbreak3.ae @@ -0,0 +1,77 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_pbreak3(void) +{ + int a = 0, b = 0; + int ret, ret2; + + pwait + { + pbranch + { + ret = btest1(&a); + assert(ret == 0); + assert(a == 1); + printf("before pbreak: a == %d!\n", a); + if(a > 3) + { + printf("hit pbreak!\n"); + pbreak; + } + ret = btest2(&a); + assert(ret == 0); + assert(a == 3); + if(a > 1) + { + printf("hit pbreak!\n"); + pbreak; + } + ret = btest3(&a); + assert(0); + } + + pbranch + { + ret2 = btest1(&b); + assert(ret2 == 0); + assert(b == 1); + ret2 = btest1(&b); + assert(ret2 == 0); + assert(b == 2); + } + } + + printf("pwait done\n"); + + ret = btest3(&a); + assert(ret == 0); + assert(a == 6); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_pbreak3_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/pbreak4.ae b/code/src/aesop/parser/tests/blocking/pbreak4.ae new file mode 100644 index 0000000..906e89c --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pbreak4.ae @@ -0,0 +1,86 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_pbreak4(void) +{ + int a = 0, b = 0, c = 0; + int ret, ret1, ret2; + + ret = btest1(&a); + assert(ret == 0); + assert(a == 1); + + pwait + { + pbranch + { + ret = btest1(&a); + assert(ret == 0); + assert(a == 2); + if(a > 1) + { + printf("hit pbreak!\n"); + pbreak; + } + ret = btest3(&a); + assert(0); + } + + pbranch + { + ret1 = btest2(&b); + assert(ret1 == 0); + if(b > 1) + { + printf("hit pbreak2!\n"); + pbreak; + } + } + + pbranch + { + printf("other pbranch\n"); + ret2 = btest1(&c); + assert(ret2 == 0); + assert(c == 1); + printf("other pbranch2\n"); + ret2 = btest3(&c); + assert(ret2 == 0); + assert(c == 4); + } + } + + printf("pwait done\n"); + + ret = btest3(&a); + assert(ret == 0); + assert(a == 5); + +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_pbreak4_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/pbreak5.ae b/code/src/aesop/parser/tests/blocking/pbreak5.ae new file mode 100644 index 0000000..573fec8 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pbreak5.ae @@ -0,0 +1,82 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_pbreak5(void) +{ + int a[100]; + int ret[100]; + int ret1; + int b = 0; + + memset(a, 0, sizeof(int)*100); + + ret1 = btest1(&b); + assert(ret1 == 0); + assert(b == 1); + + pwait + { + pprivate int i; + + pbranch + { + ret1 = btest1(&b); + assert(ret1 == 0); + assert(b == 2); + if(b > 1) + { + printf("hit pbreak!\n"); + pbreak; + } + ret1 = btest3(&b); + assert(0); + } + + for(i = 0; i < 100; ++i) + { + pbranch + { + ret[i] = btest2(&a[i]); + assert(ret[i] == 0); + assert(a[i] == 2); + ret[i] = btest3(&a[i]); + assert(ret[i] == 0); + assert(a[i] == 5); + } + } + } + + printf("pwait done\n"); + + ret1 = btest3(&b); + assert(ret1 == 0); + assert(b == 5); + +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_pbreak5_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/pbreak6.ae b/code/src/aesop/parser/tests/blocking/pbreak6.ae new file mode 100644 index 0000000..2b1bb20 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pbreak6.ae @@ -0,0 +1,76 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_pbreak6(void) +{ + int a[100]; + int b; + int ret[100]; + int ret1; + + memset(a, 0, sizeof(int)*100); + + ret1 = btest1(&b); + assert(ret1 == 0); + assert(b == 1); + + pwait + { + pprivate int i = 0; + for(i = 0; i < 100; ++i) + { + pbranch + { + ret[i] = btest2(&a[i]); + assert(ret[i] == 0); + assert(a[i] == 2); + } + } + + pbranch + { + ret1 = btest1(&b); + if(b > 1) + { + printf("hit pbreak!\n"); + pbreak; + } + ret1 = btest3(&b); + assert(0); + } + } + + printf("pwait done\n"); + + ret1 = btest3(&b); + assert(ret1 == 0); + assert(b == 5); + +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_pbreak6_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/pbreak7.ae b/code/src/aesop/parser/tests/blocking/pbreak7.ae new file mode 100644 index 0000000..93fea95 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pbreak7.ae @@ -0,0 +1,102 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +static __blocking void run_par1(void) +{ + int a = 0, b = 0, c = 0; + int ret1, ret2, ret3; + + pwait + { + pbranch + { + ret1 = btest1(&a); + if(ret1 != 0) + { + printf("Error in branch 1.\n"); + pbreak; + } + + ret1 = btest2(&a); + if(ret1 != 0) + { + printf("Error in branch 1.\n"); + pbreak; + } + } + + pbranch + { + ret2 = btest1(&b); + if(ret2 != 0) + { + printf("Error in branch 2.\n"); + pbreak; + } + + ret2 = btest2(&b); + if(ret2 != 0) + { + printf("Error in branch 2.\n"); + pbreak; + } + } + + pbranch + { + ret3 = btest1(&c); + if(ret3 != 0) + { + printf("Error in branch 3.\n"); + pbreak; + } + + ret3 = btest2(&c); + if(ret3 != 0) + { + printf("Error in branch 3.\n"); + pbreak; + } + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_par1_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ + diff --git a/code/src/aesop/parser/tests/blocking/pbreak8.ae b/code/src/aesop/parser/tests/blocking/pbreak8.ae new file mode 100644 index 0000000..78c29a9 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pbreak8.ae @@ -0,0 +1,103 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +static __blocking void run_par1(void) +{ + int a = 0, b = 0, c = 0; + int ret1, ret2, ret3; + + pwait + { + pbranch + { + ret1 = btest1(&a); + if(ret1 != 0) + { + printf("Error in branch 1.\n"); + pbreak; + } + + ret1 = btest2(&a); + if(ret1 != 0) + { + printf("Error in branch 1.\n"); + pbreak; + } + } + + pbranch + { + ret2 = btest1(&b); + if(ret2 != 0) + { + printf("Error in branch 2.\n"); + pbreak; + } + + ret2 = btest2(&b); + if(ret2 != 0) + { + printf("Error in branch 2.\n"); + pbreak; + } + } + + pbranch + { + ret3 = btest1(&c); + if(ret3 != 0) + { + printf("Error in branch 3.\n"); + pbreak; + } + pbreak; + + ret3 = btest2(&c); + if(ret3 != 0) + { + printf("Error in branch 3.\n"); + pbreak; + } + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_par1_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ + diff --git a/code/src/aesop/parser/tests/blocking/pprivate.ae b/code/src/aesop/parser/tests/blocking/pprivate.ae new file mode 100644 index 0000000..26ec7f2 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pprivate.ae @@ -0,0 +1,79 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +static __blocking void run_pprivate(void) +{ + pwait + { + pprivate int a; + + a = 100; + + pbranch + { + /* each pbranch block gets its own copy of pprivate variables */ + assert(a == 100); + + /* setting this pbranch's a to 200. */ + a = 200; + + btest1(&a); + + /* this pbranch's a should be incremented by 1 */ + assert(a == 201); + } + + pbranch + { + /* each pbranch gets its own copy of pprivate variables, so a in this pbranch should + * still be 100, even though in the previous pbranch we set it to 200 + */ + assert(a == 100); + + btest2(&a); + + /* btest2 increments a by 2 */ + assert(a == 102); + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_pprivate_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ + diff --git a/code/src/aesop/parser/tests/blocking/pshared.ae b/code/src/aesop/parser/tests/blocking/pshared.ae new file mode 100644 index 0000000..15496c9 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/pshared.ae @@ -0,0 +1,97 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +static __blocking void run_pshared(void) +{ + pwait + { + pprivate int a; + pshared int b; + int c; + + a = 100; + b = a; + + pbranch + { + /* each pbranch block gets its own copy of pprivate variables */ + assert(a == 100); + assert(a == b); + + /* setting this pbranch's a to 200. */ + a = 200; + assert(b == 100); + b = 300; + + assert(c == 0); + + btest1(&a); + /* this pbranch's a should be incremented by 1 */ + assert(a == 201); + + btest1(&b); + assert(b == 301); + + /* c is shared */ + assert(c == 400); + } + + pbranch + { + /* each pbranch gets its own copy of pprivate variables, so a in this pbranch should + * still be 100, even though in the previous pbranch we set it to 200 + */ + assert(a == 100); + + /* b is shared */ + assert(b == 300); + + c = 400; + + btest2(&a); + + /* btest2 increments a by 2 */ + assert(a == 102); + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_pshared_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ + diff --git a/code/src/aesop/parser/tests/blocking/tcpfor.ae b/code/src/aesop/parser/tests/blocking/tcpfor.ae new file mode 100644 index 0000000..ba675ab --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/tcpfor.ae @@ -0,0 +1,56 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_parfor(void) +{ + int a[100]; + int ret[100]; + + memset(a, 0, sizeof(int)*100); + memset(ret, 0, sizeof(int)*100); + + pwait + { + pprivate int i, j; + for(i = 0; i < 100; ++i) + { + pbranch + { + j = i; + a[i] = i; + ret[i] = tctest1(&a[i]); + assert(ret[i] == 0); + assert(a[i] == (i+1)); + } + } + } + + printf("pwait done\n"); +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_parfor_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/threefors.ae b/code/src/aesop/parser/tests/blocking/threefors.ae new file mode 100644 index 0000000..2c963f2 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/threefors.ae @@ -0,0 +1,115 @@ + +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" +#include <assert.h> + +int val = 0; + +static __blocking void run_threefors(void) +{ + int i, j, k; + int a = 0; + int b = 0; + int ret; + + for(i = 10; i > 0; --i) + { + for(j = 0; j < 10; ++j) + { + for(k = 10; k > 0; k--) + { + if(val == 0) + { + printf("no calls\n"); + } + else if(val == 1) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == (b+1)); + + ret = btest1(&a); + assert(ret == 0); + assert(a == (b+2)); + + ret = btest1(&a); + assert(ret == 0); + assert(a == (b+3)); + } + else if(val == 2) + { + ret = btest2(&a); + assert(ret == 0); + assert(a == (b+2)); + + ret = btest2(&a); + assert(ret == 0); + assert(a == (b+4)); + + ret = btest2(&a); + assert(ret == 0); + assert(a == (b+6)); + } + else if(val == 3) + { + ret = btest3(&a); + assert(ret == 0); + assert(a == (b+3)); + + ret = btest3(&a); + assert(ret == 0); + assert(a == (b+6)); + + ret = btest3(&a); + assert(ret == 0); + assert(a == (b+9)); + } + else + { + ret = btest1(&a); + assert(ret == 0); + assert(a == (b+1)); + + ret = btest2(&a); + assert(ret == 0); + assert(a == (b+3)); + + ret = btest3(&a); + assert(ret == 0); + assert(a == (b+6)); + } + + b = a; + } + } + } +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + + val = atoi(argv[1]); + run_threefors_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/twofors.ae b/code/src/aesop/parser/tests/blocking/twofors.ae new file mode 100644 index 0000000..f6152fa --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/twofors.ae @@ -0,0 +1,99 @@ + +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +int val = 0; + +static __blocking void run_twofors(void) +{ + int i, j, ret; + int a = 0; + + for(i = 100; i > 0; --i) + { + for(j = 0; j < 100; ++j) + { + if(val == 0) + { + printf("no calls\n"); + } + else if(val == 1) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == (100-i)*300+j*3+1); + ret = btest1(&a); + assert(ret == 0); + assert(a == (100-i)*300+j*3+2); + ret = btest1(&a); + assert(ret == 0); + assert(a == (100-i)*300+j*3+3); + + } + else if(val == 2) + { + ret = btest2(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+2); + ret = btest2(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+4); + ret = btest2(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+6); + } + else if(val == 3) + { + ret = btest3(&a); + assert(ret == 0); + assert(a == (100-i)*900+j*9+3); + ret = btest3(&a); + assert(ret == 0); + assert(a == (100-i)*900+j*9+6); + ret = btest3(&a); + assert(ret == 0); + assert(a == (100-i)*900+j*9+9); + } + else + { + ret = btest1(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+1); + ret = btest2(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+3); + ret = btest3(&a); + assert(ret == 0); + assert(a == (100-i)*600+j*6+6); + } + } + } +} + +static int done = 0; +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + + val = atoi(argv[1]); + run_twofors_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/whilebreak.ae b/code/src/aesop/parser/tests/blocking/whilebreak.ae new file mode 100644 index 0000000..c2ab73b --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/whilebreak.ae @@ -0,0 +1,52 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_whilebreak(void) +{ + int i = 0; + int a = 0; + int ret; + + while(1) + { + ret = btest1(&a); + assert(ret == 0); + ret = btest2(&a); + assert(ret == 0); + ret = btest3(&a); + assert(ret == 0); + ++i; + if(i == 1000) + { + break; + } + } +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_whilebreak_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/whilebreak2.ae b/code/src/aesop/parser/tests/blocking/whilebreak2.ae new file mode 100644 index 0000000..4e3e8b1 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/whilebreak2.ae @@ -0,0 +1,50 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_whilebreak(void) +{ + int ret; + int a = 0; + + while(1) + { + ret = btest1(&a); + assert(ret == 0); + ret = btest2(&a); + assert(ret == 0); + if(a > 1000) + { + break; + } + ret = btest3(&a); + assert(ret == 0); + } +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_whilebreak_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/whilebreak3.ae b/code/src/aesop/parser/tests/blocking/whilebreak3.ae new file mode 100644 index 0000000..b4c2771 --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/whilebreak3.ae @@ -0,0 +1,57 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_whilebreak(void) +{ + int a = 0; + int ret; + + while(1) + { + ret = btest1(&a); + assert(ret == 0); + ret = btest2(&a); + assert(ret == 0); + if(a > 1000) + { + break; + } + ret = btest3(&a); + assert(ret == 0); + } + + ret = btest1(&a); + assert(ret == 0); + ret = btest2(&a); + assert(ret == 0); + ret = btest3(&a); + assert(ret == 0); +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_whilebreak_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/blocking/whileloop.ae b/code/src/aesop/parser/tests/blocking/whileloop.ae new file mode 100644 index 0000000..1e7acdf --- /dev/null +++ b/code/src/aesop/parser/tests/blocking/whileloop.ae @@ -0,0 +1,53 @@ +#include "src/aesop/aesop.h" +#include "src/aesop/parser/tests/blocking/btest.hae" + +static __blocking void run_whileloop(void) +{ + int i, ret; + int a = 0; + + i = 100; + while(i > 0) + { + ret = btest1(&a); + assert(ret == 0); + assert(a == ((100-i)*6+1)); + + ret = btest2(&a); + assert(ret == 0); + assert(a == ((100-i)*6+3)); + + ret = btest3(&a); + assert(ret == 0); + assert(a == ((100-i)*6+6)); + --i; + } +} + +static int done = 0; + +static void basic_cb(void *ptr) +{ + printf("%p\n", ptr); + printf("done\n"); + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + void *myptr = malloc(1); + + btest_init(); + printf("%p\n", myptr); + run_whileloop_post(basic_cb, myptr, NULL, NULL, &op_id); + + while(done == 0) + { + ae_poll(NULL, 0); + } + + btest_finalize(); + free(myptr); + return 0; +} diff --git a/code/src/aesop/parser/tests/remote/module.mk.in b/code/src/aesop/parser/tests/remote/module.mk.in new file mode 100644 index 0000000..108537c --- /dev/null +++ b/code/src/aesop/parser/tests/remote/module.mk.in @@ -0,0 +1,13 @@ +DIR := src/aesop/parser/tests/remote + +# define the test_remote module +REMOTE_TESTLIB_MODULES += $(DIR)/test_remote + +MYR = $(DIR)/test-remote.aer + +# specifies which aer files get included in the module +REMOTE_TESTMODSRC_$(DIR)/test_remote := $(MYR) + +# include aer files in test library +REMOTE_TESTLIBSRC += $(MYR) + diff --git a/code/src/aesop/parser/tests/remote/test-remote.aer b/code/src/aesop/parser/tests/remote/test-remote.aer new file mode 100644 index 0000000..93e0e1d --- /dev/null +++ b/code/src/aesop/parser/tests/remote/test-remote.aer @@ -0,0 +1,31 @@ +#include "src/common/triton-types.h" +#include "src/aesop/aesop.h" +#include "src/remote/encoding.h" +#include "src/remote/remote.hae" +#include "src/common/resources/timer/timer.hae" + +__remote struct myremotes +{ + int32_t t1; + uint64_t ut1; +}; + +__remote __blocking triton_ret_t myremote(int32_t in, int32_t *out); + +__remote __blocking triton_ret_t myremote(int32_t in, int32_t *out) +{ + triton_ret_t ret; + *out = triton_timer(in); + *out = in; + return TRITON_SUCCESS; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ + diff --git a/code/src/aesop/resource.c b/code/src/aesop/resource.c new file mode 100644 index 0000000..adb8551 --- /dev/null +++ b/code/src/aesop/resource.c @@ -0,0 +1,335 @@ + +#include "src/common/triton-error.h" +#include "src/aesop/resource.h" + +struct ae_resource_entry +{ + int id; + struct ae_resource *resource; +}; + +static int ae_resource_count = 0; +static struct ae_resource_entry ae_resource_entries[AE_MAX_RESOURCES]; + +#define AE_RESOURCE_IDX2ID(reindex) (reindex+16) +#define AE_RESOURCE_ID2IDX(rid) (rid-16) + +struct ae_context +{ + int id; + int resource_count; + int *resource_ids; +}; + +static int ae_context_count = 0; +static struct ae_context ae_context_entries[AE_MAX_CONTEXTS]; + +triton_ret_t ae_resource_register(struct ae_resource *resource, int *newid) +{ + int reindex = ae_resource_count; + + if(ae_resource_count == AE_MAX_RESOURCES) + { + return TRITON_ERR_INVAL; + } + + ae_resource_entries[reindex].id = AE_RESOURCE_IDX2ID(reindex); + ae_resource_entries[reindex].resource = resource; + ae_resource_count++; + *newid = AE_RESOURCE_IDX2ID(reindex); + return TRITON_SUCCESS; +} + +void ae_resource_unregister(int id) +{ + int idx = AE_RESOURCE_ID2IDX(id); + + if(idx != (ae_resource_count -1)) + { + /* this is not the last resource in the table; shift everything down */ + memmove(&ae_resource_entries[idx], &ae_resource_entries[idx+1], + (sizeof(struct ae_resource_entry) * (ae_resource_count-idx-1))); + } + ae_resource_count--; +} + +int ae_cancel_op(ae_context_t context, ae_op_id_t op_id) +{ + struct ae_ctl *ctl; + int resource_id, ridx; + int ret = -EINVAL; + + ae_id_lookup(op_id, &resource_id); + ridx = AE_RESOURCE_ID2IDX(resource_id); + if(ridx > ae_resource_count) + { + return -EINVAL; + } + + if(ae_resource_entries[ridx].id != resource_id) + { + return -EINVAL; + } + + if(ae_resource_entries[ridx].id == -1) + { + return -EINVAL; + } + + if(resource_id == 0) + { + ctl = (struct ae_ctl *)(intptr_t)ae_id_lookup(op_id, NULL); + triton_mutex_lock(&ctl->mutex); + if(ctl->cancelled) + { + /* already cancelled! */ + triton_mutex_unlock(&ctl->mutex); + return -EINVAL; + } + + ctl->cancelled = 1; + if(ctl->in_pwait) + { + /* cancel children */ + struct triton_list_link *entry, *safe; + struct ae_ctl *child_ctl; + if(triton_list_empty(&ctl->children)) + { + return -EINVAL; + } + + triton_list_for_each(entry, safe, &ctl->children) + { + child_ctl = triton_list_get_entry(entry, typeof(*child_ctl), link); + ret = ae_cancel_op(context, child_ctl->current_op_id); + if(ret != 0) + { + /* cancel failed */ + triton_mutex_unlock(&ctl->mutex); + } + } + } + else + { + ret = ae_cancel_op(context, ctl->current_op_id); + } + triton_mutex_unlock(&ctl->mutex); + return ret; + } + + return ae_resource_entries[ridx].resource->cancel(context, op_id); +} + +ae_op_id_t ae_id_gen(int resource_id, uint64_t ptr) +{ + return (ae_op_id_t)(AE_GET_RESOURCE_MASK(resource_id) | ptr); +} + +uint64_t ae_id_lookup(ae_op_id_t id, int *resource_id) +{ + if(resource_id) *resource_id = AE_GET_RESOURCE_ID(id); + return (~AE_RESOURCE_MASK)&id; +} + +int ae_cancel_children(ae_context_t context, void *ptr) +{ + int ret; + struct ae_ctl *ctl; + struct ae_ctl *child_ctl; + struct triton_list_link *entry, *safe; + + ctl = (struct ae_ctl *)ptr; + if(triton_list_empty(&ctl->children)) + { + /* don't do anything here because there are no children + * to cancel + */ + return 0; + } + + triton_list_for_each(entry, safe, &ctl->children) + { + child_ctl = triton_list_get_entry(entry, struct ae_ctl, link); + ret = ae_cancel_op(context, child_ctl->current_op_id); + if(ret != 0) + { + /* cancel failed */ + return ret; + } + } + + return 0; +} + +#include <execinfo.h> +#include <stdio.h> + +void ae_backtrace(void) +{ + void *trace[16]; + char **messages = (char **)NULL; + int size, i; + + size = backtrace(trace, 16); + messages = backtrace_symbols(trace, size); + for(i = 0; i < size; ++i) + { + fprintf(stderr, "gsl backtrace: %s\n", messages[i]); + } +} + +#include <assert.h> + +int ae_poll(ae_context_t context, int millisecs) +{ + int resource_ms, i, ret; + int rid, ridx; + int resources_polled = 0; + + if(context) + { + resource_ms = millisecs / context->resource_count; + for(i = 0; i < context->resource_count; ++i) + { + rid = context->resource_ids[i]; + ridx = AE_RESOURCE_ID2IDX(rid); + if(ae_resource_entries[ridx].resource->poll_context) + { + ret = ae_resource_entries[ridx].resource->poll_context(context, resource_ms); + if(ret != 0) + { + return ret; + } + resources_polled++; + } + } + } + else + { + resource_ms = millisecs / ae_resource_count; + for(i = 0; i < ae_resource_count; ++i) + { + if(ae_resource_entries[i].resource->poll_context) + { + ret = ae_resource_entries[i].resource->poll_context( + context, resource_ms); + if(ret != 0) + { + return ret; + } + resources_polled++; + } + } + } + + if(resources_polled == 0) + { + struct timespec ts; + + ts.tv_sec = (int)(millisecs / 1e3); + ts.tv_nsec = (millisecs % 1000) * 1e6; + ret = nanosleep(&ts, NULL); + if(ret != 0) + { + return -errno; + } + } + return 0; +} + +#include <stdarg.h> + +int ae_context_create(ae_context_t *context, int resource_count, ...) +{ + va_list ap; + char *rname; + int cindex = ae_context_count; + ae_context_t c; + int i, j, ret, reindex; + + if(ae_context_count == AE_MAX_CONTEXTS) + { + return -EINVAL; + } + + c = &(ae_context_entries[cindex]); + c->id = ae_context_count; + ae_context_count++; + c->resource_count = resource_count; + c->resource_ids = malloc(sizeof(int) * resource_count); + if(!c->resource_ids) + { + return -ENOMEM; + } + reindex = 0; + + + /* step through the resource names passed in and register the context with them */ + va_start(ap, resource_count); + for(i = 0; i < resource_count; ++i) + { + int resource_found = 0; + rname = va_arg(ap, char *); + + /* find the matching resource and register the context with that resource */ + + for(j = 0; j < ae_resource_count; ++j) + { + if(!strcmp(ae_resource_entries[j].resource->resource_name, rname)) + { + if(ae_resource_entries[j].resource->register_context) + { + ret = ae_resource_entries[j].resource->register_context(c); + if(ret != 0) + { + /* what do we do if a context fails to register with a resource? */ + va_end(ap); + return ret; + } + } + c->resource_ids[reindex] = ae_resource_entries[j].id; + reindex++; + resource_found = 1; + break; + } + } + if(!resource_found) + { + va_end(ap); + return -EINVAL; + } + } + va_end(ap); + + *context = c; + return 0; +} + +int ae_context_destroy(ae_context_t context) +{ + int rid, idx, i; + + for(i = 0; i < context->resource_count; ++i) + { + rid = context->resource_ids[i]; + idx = AE_RESOURCE_ID2IDX(rid); + if(ae_resource_entries[idx].resource->unregister_context) + { + ae_resource_entries[idx].resource->unregister_context(context); + } + } + free(context->resource_ids); + context->resource_ids = NULL; + context->id = -1; + context->resource_count = -1; + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/aesop/resource.h b/code/src/aesop/resource.h new file mode 100644 index 0000000..6cf6914 --- /dev/null +++ b/code/src/aesop/resource.h @@ -0,0 +1,81 @@ +#ifndef __RESOURCE_H__ +#define __RESOURCE_H__ + +#include "src/common/triton-thread.h" +#include "src/common/triton-list.h" + +#define AE_MAX_RESOURCES 255 +#define AE_MAX_CONTEXTS 1024 + +#define AE_RESOURCE_MASK (((uint64_t)0xFF)<<56) +#define AE_GET_RESOURCE_MASK(resource_id) (AE_RESOURCE_MASK&(((uint64_t)resource_id)<<56)) +#define AE_GET_RESOURCE_ID(op_id) (((op_id&AE_RESOURCE_MASK)>>56)&0xFF) + +typedef struct ae_context *ae_context_t; + +typedef struct ae_hints *ae_hints_t; + +typedef uint64_t ae_op_id_t; + +ae_op_id_t ae_id_gen(int resource_id, uint64_t ptr); +uint64_t ae_id_lookup(ae_op_id_t id, int *resource_id); + +/* The resource structure is defined by a given resource, and registered + * to the aesop management code during resource initialization. + */ +struct ae_resource +{ + const char *resource_name; + int (*test)(ae_op_id_t id, int ms_timeout); + int (*poll_context)(ae_context_t context, int ms_timeout); + int (*cancel)(ae_context_t ctx, ae_op_id_t id); + int (*register_context)(ae_context_t context); + int (*unregister_context)(ae_context_t context); +}; + +/* Called by resources to register themselves to the resource framework */ +triton_ret_t ae_resource_register(struct ae_resource *resource, int *newid); +void ae_resource_unregister(int resource_id); + +/* Contexts are created to allow separation of polling for different logical + * groups of operations. + */ +int ae_context_create(ae_context_t *context, int resource_count, ...); + +/* Context destruction. Called to cleanup state allocated in ae_context_create. + */ +int ae_context_destroy(ae_context_t context); + +/* Poll for completion of the operations within the given context up to a + * timeout value. + */ +int ae_poll(ae_context_t context, int ms); + +/* Cancel an operation */ +int ae_cancel_op(ae_context_t context, ae_op_id_t op_id); + +/* The ae_ctl structure is used by the aesop generated code to manage parallel and + * nested operations. This structure is not needed by resource writers or aesop + * code. + * TODO: move these to a separate header + */ +struct ae_ctl +{ + ae_op_id_t current_op_id; + int cancelled; + triton_mutex_t mutex; + triton_list_t children; + struct triton_list_link link; + int posted; + int completed; + int allposted; + int hit_pbreak; + int in_pwait; +}; + +/* internal function -- used by generated code */ +int ae_cancel_children(ae_context_t ctx, void *ptr); + +void ae_backtrace(void); + +#endif /* __AE_RESOURCE_H__ */ diff --git a/code/src/common/.triton-hash.h.swp b/code/src/common/.triton-hash.h.swp new file mode 100644 index 0000000..d7ee31b Binary files /dev/null and b/code/src/common/.triton-hash.h.swp differ diff --git a/code/src/common/jenkins-hash.h b/code/src/common/jenkins-hash.h new file mode 100644 index 0000000..31aa370 --- /dev/null +++ b/code/src/common/jenkins-hash.h @@ -0,0 +1,20 @@ +#ifndef __JENKINS_HASH__ +#define __JENKINS_HASH__ + +#include <sys/types.h> +#include <stdint.h> + +/* This header declares and exports Bob Jenkins hash functions define in lookup3.c. + * lookup3.c was downloaded from: http://www.burtleburtle.net/bob/c/lookup3.c + * See: http://www.burtleburtle.net/bob/hash/doobs.html for more information. + * + * Export other functions in that library as necessary. + */ + +void bj_hashlittle2( + const void *key, /* the key to hash */ + size_t length, /* length of the key */ + uint32_t *pc, /* IN: primary initval, OUT: primary hash */ + uint32_t *pb); /* IN: secondary initval, OUT: secondary hash */ + +#endif diff --git a/code/src/common/lookup3.c b/code/src/common/lookup3.c new file mode 100644 index 0000000..432e977 --- /dev/null +++ b/code/src/common/lookup3.c @@ -0,0 +1,1004 @@ + +#include "src/common/jenkins-hash.h" + +/* +------------------------------------------------------------------------------- +lookup3.c, by Bob Jenkins, May 2006, Public Domain. + +These are functions for producing 32-bit hashes for hash table lookup. +hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() +are externally useful functions. Routines to test the hash are included +if SELF_TEST is defined. You can use this free for any purpose. It's in +the public domain. It has no warranty. + +You probably want to use hashlittle(). hashlittle() and hashbig() +hash byte arrays. hashlittle() is faster than hashbig() on +little-endian machines. Intel and AMD are little-endian machines. +On second thought, you probably want hashlittle2(), which is identical to +hashlittle() except it returns two 32-bit hashes for the price of one. +You could implement hashbig2() if you wanted but I haven't bothered here. + +If you want to find a hash of, say, exactly 7 integers, do + a = i1; b = i2; c = i3; + mix(a,b,c); + a += i4; b += i5; c += i6; + mix(a,b,c); + a += i7; + final(a,b,c); +then use c as the hash value. If you have a variable length array of +4-byte integers to hash, use hashword(). If you have a byte array (like +a character string), use hashlittle(). If you have several byte arrays, or +a mix of things, see the comments above hashlittle(). + +Why is this so big? I read 12 bytes at a time into 3 4-byte integers, +then mix those integers. This is fast (you can do a lot more thorough +mixing with 12*3 instructions on 3 integers than you can with 3 instructions +on 1 byte), but shoehorning those bytes into integers efficiently is messy. +------------------------------------------------------------------------------- +#define SELF_TEST 1 +*/ + +#include <stdio.h> /* defines printf for tests */ +#include <time.h> /* defines time_t for timings in the test */ +#include <stdint.h> /* defines uint32_t etc */ +#include <sys/param.h> /* attempt to define endianness */ +#ifdef linux +# include <endian.h> /* attempt to define endianness */ +#endif + +/* + * My best guess at if you are big-endian or little-endian. This may + * need adjustment. + */ +#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ + __BYTE_ORDER == __LITTLE_ENDIAN) || \ + (defined(i386) || defined(__i386__) || defined(__i486__) || \ + defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL)) +# define HASH_LITTLE_ENDIAN 1 +# define HASH_BIG_ENDIAN 0 +#elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ + __BYTE_ORDER == __BIG_ENDIAN) || \ + (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel)) +# define HASH_LITTLE_ENDIAN 0 +# define HASH_BIG_ENDIAN 1 +#else +# define HASH_LITTLE_ENDIAN 0 +# define HASH_BIG_ENDIAN 0 +#endif + +#define hashsize(n) ((uint32_t)1<<(n)) +#define hashmask(n) (hashsize(n)-1) +#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) + +/* +------------------------------------------------------------------------------- +mix -- mix 3 32-bit values reversibly. + +This is reversible, so any information in (a,b,c) before mix() is +still in (a,b,c) after mix(). + +If four pairs of (a,b,c) inputs are run through mix(), or through +mix() in reverse, there are at least 32 bits of the output that +are sometimes the same for one pair and different for another pair. +This was tested for: +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that +satisfy this are + 4 6 8 16 19 4 + 9 15 3 18 27 15 + 14 9 3 7 17 3 +Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing +for "differ" defined as + with a one-bit base and a two-bit delta. I +used http://burtleburtle.net/bob/hash/avalanche.html to choose +the operations, constants, and arrangements of the variables. + +This does not achieve avalanche. There are input bits of (a,b,c) +that fail to affect some output bits of (a,b,c), especially of a. The +most thoroughly mixed value is c, but it doesn't really even achieve +avalanche in c. + +This allows some parallelism. Read-after-writes are good at doubling +the number of bits affected, so the goal of mixing pulls in the opposite +direction as the goal of parallelism. I did what I could. Rotates +seem to cost as much as shifts on every machine I could lay my hands +on, and rotates are much kinder to the top and bottom bits, so I used +rotates. +------------------------------------------------------------------------------- +*/ +#define mix(a,b,c) \ +{ \ + a -= c; a ^= rot(c, 4); c += b; \ + b -= a; b ^= rot(a, 6); a += c; \ + c -= b; c ^= rot(b, 8); b += a; \ + a -= c; a ^= rot(c,16); c += b; \ + b -= a; b ^= rot(a,19); a += c; \ + c -= b; c ^= rot(b, 4); b += a; \ +} + +/* +------------------------------------------------------------------------------- +final -- final mixing of 3 32-bit values (a,b,c) into c + +Pairs of (a,b,c) values differing in only a few bits will usually +produce values of c that look totally different. This was tested for +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +These constants passed: + 14 11 25 16 4 14 24 + 12 14 25 16 4 14 24 +and these came close: + 4 8 15 26 3 22 24 + 10 8 15 26 3 22 24 + 11 8 15 26 3 22 24 +------------------------------------------------------------------------------- +*/ +#define final(a,b,c) \ +{ \ + c ^= b; c -= rot(b,14); \ + a ^= c; a -= rot(c,11); \ + b ^= a; b -= rot(a,25); \ + c ^= b; c -= rot(b,16); \ + a ^= c; a -= rot(c,4); \ + b ^= a; b -= rot(a,14); \ + c ^= b; c -= rot(b,24); \ +} + +/* +-------------------------------------------------------------------- + This works on all machines. To be useful, it requires + -- that the key be an array of uint32_t's, and + -- that the length be the number of uint32_t's in the key + + The function hashword() is identical to hashlittle() on little-endian + machines, and identical to hashbig() on big-endian machines, + except that the length has to be measured in uint32_ts rather than in + bytes. hashlittle() is more complicated than hashword() only because + hashlittle() has to dance around fitting the key bytes into registers. +-------------------------------------------------------------------- +*/ +static uint32_t bj_hashword( +const uint32_t *k, /* the key, an array of uint32_t values */ +size_t length, /* the length of the key, in uint32_ts */ +uint32_t initval) /* the previous hash, or an arbitrary value */ +{ + uint32_t a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval; + + /*------------------------------------------------- handle most of the key */ + while (length > 3) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 3; + k += 3; + } + + /*------------------------------------------- handle the last 3 uint32_t's */ + switch(length) /* all the case statements fall through */ + { + case 3 : c+=k[2]; + case 2 : b+=k[1]; + case 1 : a+=k[0]; + final(a,b,c); + case 0: /* case 0: nothing left to add */ + break; + } + /*------------------------------------------------------ report the result */ + return c; +} + + +/* +-------------------------------------------------------------------- +hashword2() -- same as hashword(), but take two seeds and return two +32-bit values. pc and pb must both be nonnull, and *pc and *pb must +both be initialized with seeds. If you pass in (*pb)==0, the output +(*pc) will be the same as the return value from hashword(). +-------------------------------------------------------------------- +*/ +static void bj_hashword2 ( +const uint32_t *k, /* the key, an array of uint32_t values */ +size_t length, /* the length of the key, in uint32_ts */ +uint32_t *pc, /* IN: seed OUT: primary hash value */ +uint32_t *pb) /* IN: more seed OUT: secondary hash value */ +{ + uint32_t a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((uint32_t)(length<<2)) + *pc; + c += *pb; + + /*------------------------------------------------- handle most of the key */ + while (length > 3) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 3; + k += 3; + } + + /*------------------------------------------- handle the last 3 uint32_t's */ + switch(length) /* all the case statements fall through */ + { + case 3 : c+=k[2]; + case 2 : b+=k[1]; + case 1 : a+=k[0]; + final(a,b,c); + case 0: /* case 0: nothing left to add */ + break; + } + /*------------------------------------------------------ report the result */ + *pc=c; *pb=b; +} + + +/* +------------------------------------------------------------------------------- +hashlittle() -- hash a variable-length key into a 32-bit value + k : the key (the unaligned variable-length array of bytes) + length : the length of the key, counting by bytes + initval : can be any 4-byte value +Returns a 32-bit value. Every bit of the key affects every bit of +the return value. Two keys differing by one or two bits will have +totally different hash values. + +The best hash table sizes are powers of 2. There is no need to do +mod a prime (mod is sooo slow!). If you need less than 32 bits, +use a bitmask. For example, if you need only 10 bits, do + h = (h & hashmask(10)); +In which case, the hash table should have hashsize(10) elements. + +If you are hashing n strings (uint8_t **)k, do it like this: + for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h); + +By Bob Jenkins, 2006. [email protected]. You may use this +code any way you wish, private, educational, or commercial. It's free. + +Use for hash table lookup, or anything where one collision in 2^^32 is +acceptable. Do NOT use for cryptographic purposes. +------------------------------------------------------------------------------- +*/ + +static uint32_t bj_hashlittle( const void *key, size_t length, uint32_t initval) +{ + uint32_t a,b,c; /* internal state */ + union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; + + u.ptr = key; + if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) { + const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ + const uint8_t *k8; + + /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 12; + k += 3; + } + + /*----------------------------- handle the last (probably partial) block */ + /* + * "k[2]&0xffffff" actually reads beyond the end of the string, but + * then masks off the part it's not allowed to read. Because the + * string is aligned, the masked-off tail is in the same word as the + * rest of the string. Every machine with memory protection I've seen + * does it on word boundaries, so is OK with this. But VALGRIND will + * still catch it and complain. The masking trick does make the hash + * noticably faster for short strings (like English words). + */ +#ifndef VALGRIND + + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; + case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; + case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=k[1]&0xffffff; a+=k[0]; break; + case 6 : b+=k[1]&0xffff; a+=k[0]; break; + case 5 : b+=k[1]&0xff; a+=k[0]; break; + case 4 : a+=k[0]; break; + case 3 : a+=k[0]&0xffffff; break; + case 2 : a+=k[0]&0xffff; break; + case 1 : a+=k[0]&0xff; break; + case 0 : return c; /* zero length strings require no mixing */ + } + +#else /* make valgrind happy */ + + k8 = (const uint8_t *)k; + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ + case 10: c+=((uint32_t)k8[9])<<8; /* fall through */ + case 9 : c+=k8[8]; /* fall through */ + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ + case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */ + case 5 : b+=k8[4]; /* fall through */ + case 4 : a+=k[0]; break; + case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ + case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */ + case 1 : a+=k8[0]; break; + case 0 : return c; + } + +#endif /* !valgrind */ + + } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { + const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ + const uint8_t *k8; + + /*--------------- all but last block: aligned reads and different mixing */ + while (length > 12) + { + a += k[0] + (((uint32_t)k[1])<<16); + b += k[2] + (((uint32_t)k[3])<<16); + c += k[4] + (((uint32_t)k[5])<<16); + mix(a,b,c); + length -= 12; + k += 6; + } + + /*----------------------------- handle the last (probably partial) block */ + k8 = (const uint8_t *)k; + switch(length) + { + case 12: c+=k[4]+(((uint32_t)k[5])<<16); + b+=k[2]+(((uint32_t)k[3])<<16); + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ + case 10: c+=k[4]; + b+=k[2]+(((uint32_t)k[3])<<16); + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 9 : c+=k8[8]; /* fall through */ + case 8 : b+=k[2]+(((uint32_t)k[3])<<16); + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ + case 6 : b+=k[2]; + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 5 : b+=k8[4]; /* fall through */ + case 4 : a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ + case 2 : a+=k[0]; + break; + case 1 : a+=k8[0]; + break; + case 0 : return c; /* zero length requires no mixing */ + } + + } else { /* need to read the key one byte at a time */ + const uint8_t *k = (const uint8_t *)key; + + /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + a += ((uint32_t)k[1])<<8; + a += ((uint32_t)k[2])<<16; + a += ((uint32_t)k[3])<<24; + b += k[4]; + b += ((uint32_t)k[5])<<8; + b += ((uint32_t)k[6])<<16; + b += ((uint32_t)k[7])<<24; + c += k[8]; + c += ((uint32_t)k[9])<<8; + c += ((uint32_t)k[10])<<16; + c += ((uint32_t)k[11])<<24; + mix(a,b,c); + length -= 12; + k += 12; + } + + /*-------------------------------- last block: affect all 32 bits of (c) */ + switch(length) /* all the case statements fall through */ + { + case 12: c+=((uint32_t)k[11])<<24; + case 11: c+=((uint32_t)k[10])<<16; + case 10: c+=((uint32_t)k[9])<<8; + case 9 : c+=k[8]; + case 8 : b+=((uint32_t)k[7])<<24; + case 7 : b+=((uint32_t)k[6])<<16; + case 6 : b+=((uint32_t)k[5])<<8; + case 5 : b+=k[4]; + case 4 : a+=((uint32_t)k[3])<<24; + case 3 : a+=((uint32_t)k[2])<<16; + case 2 : a+=((uint32_t)k[1])<<8; + case 1 : a+=k[0]; + break; + case 0 : return c; + } + } + + final(a,b,c); + return c; +} + + +/* + * hashlittle2: return 2 32-bit hash values + * + * This is identical to hashlittle(), except it returns two 32-bit hash + * values instead of just one. This is good enough for hash table + * lookup with 2^^64 buckets, or if you want a second hash if you're not + * happy with the first, or if you want a probably-unique 64-bit ID for + * the key. *pc is better mixed than *pb, so use *pc first. If you want + * a 64-bit value do something like "*pc + (((uint64_t)*pb)<<32)". + */ +void bj_hashlittle2( + const void *key, /* the key to hash */ + size_t length, /* length of the key */ + uint32_t *pc, /* IN: primary initval, OUT: primary hash */ + uint32_t *pb) /* IN: secondary initval, OUT: secondary hash */ +{ + uint32_t a,b,c; /* internal state */ + union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((uint32_t)length) + *pc; + c += *pb; + + u.ptr = key; + if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) { + const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ + const uint8_t *k8; + + /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 12; + k += 3; + } + + /*----------------------------- handle the last (probably partial) block */ + /* + * "k[2]&0xffffff" actually reads beyond the end of the string, but + * then masks off the part it's not allowed to read. Because the + * string is aligned, the masked-off tail is in the same word as the + * rest of the string. Every machine with memory protection I've seen + * does it on word boundaries, so is OK with this. But VALGRIND will + * still catch it and complain. The masking trick does make the hash + * noticably faster for short strings (like English words). + */ +#ifndef VALGRIND + + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; + case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; + case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=k[1]&0xffffff; a+=k[0]; break; + case 6 : b+=k[1]&0xffff; a+=k[0]; break; + case 5 : b+=k[1]&0xff; a+=k[0]; break; + case 4 : a+=k[0]; break; + case 3 : a+=k[0]&0xffffff; break; + case 2 : a+=k[0]&0xffff; break; + case 1 : a+=k[0]&0xff; break; + case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ + } + +#else /* make valgrind happy */ + + k8 = (const uint8_t *)k; + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ + case 10: c+=((uint32_t)k8[9])<<8; /* fall through */ + case 9 : c+=k8[8]; /* fall through */ + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ + case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */ + case 5 : b+=k8[4]; /* fall through */ + case 4 : a+=k[0]; break; + case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ + case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */ + case 1 : a+=k8[0]; break; + case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ + } + +#endif /* !valgrind */ + + } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { + const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ + const uint8_t *k8; + + /*--------------- all but last block: aligned reads and different mixing */ + while (length > 12) + { + a += k[0] + (((uint32_t)k[1])<<16); + b += k[2] + (((uint32_t)k[3])<<16); + c += k[4] + (((uint32_t)k[5])<<16); + mix(a,b,c); + length -= 12; + k += 6; + } + + /*----------------------------- handle the last (probably partial) block */ + k8 = (const uint8_t *)k; + switch(length) + { + case 12: c+=k[4]+(((uint32_t)k[5])<<16); + b+=k[2]+(((uint32_t)k[3])<<16); + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ + case 10: c+=k[4]; + b+=k[2]+(((uint32_t)k[3])<<16); + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 9 : c+=k8[8]; /* fall through */ + case 8 : b+=k[2]+(((uint32_t)k[3])<<16); + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ + case 6 : b+=k[2]; + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 5 : b+=k8[4]; /* fall through */ + case 4 : a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ + case 2 : a+=k[0]; + break; + case 1 : a+=k8[0]; + break; + case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ + } + + } else { /* need to read the key one byte at a time */ + const uint8_t *k = (const uint8_t *)key; + + /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + a += ((uint32_t)k[1])<<8; + a += ((uint32_t)k[2])<<16; + a += ((uint32_t)k[3])<<24; + b += k[4]; + b += ((uint32_t)k[5])<<8; + b += ((uint32_t)k[6])<<16; + b += ((uint32_t)k[7])<<24; + c += k[8]; + c += ((uint32_t)k[9])<<8; + c += ((uint32_t)k[10])<<16; + c += ((uint32_t)k[11])<<24; + mix(a,b,c); + length -= 12; + k += 12; + } + + /*-------------------------------- last block: affect all 32 bits of (c) */ + switch(length) /* all the case statements fall through */ + { + case 12: c+=((uint32_t)k[11])<<24; + case 11: c+=((uint32_t)k[10])<<16; + case 10: c+=((uint32_t)k[9])<<8; + case 9 : c+=k[8]; + case 8 : b+=((uint32_t)k[7])<<24; + case 7 : b+=((uint32_t)k[6])<<16; + case 6 : b+=((uint32_t)k[5])<<8; + case 5 : b+=k[4]; + case 4 : a+=((uint32_t)k[3])<<24; + case 3 : a+=((uint32_t)k[2])<<16; + case 2 : a+=((uint32_t)k[1])<<8; + case 1 : a+=k[0]; + break; + case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ + } + } + + final(a,b,c); + *pc=c; *pb=b; +} + + + +/* + * hashbig(): + * This is the same as hashword() on big-endian machines. It is different + * from hashlittle() on all machines. hashbig() takes advantage of + * big-endian byte ordering. + */ +static uint32_t bj_hashbig( const void *key, size_t length, uint32_t initval) +{ + uint32_t a,b,c; + union { const void *ptr; size_t i; } u; /* to cast key to (size_t) happily */ + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; + + u.ptr = key; + if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) { + const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ + const uint8_t *k8; + + /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 12; + k += 3; + } + + /*----------------------------- handle the last (probably partial) block */ + /* + * "k[2]<<8" actually reads beyond the end of the string, but + * then shifts out the part it's not allowed to read. Because the + * string is aligned, the illegal read is in the same word as the + * rest of the string. Every machine with memory protection I've seen + * does it on word boundaries, so is OK with this. But VALGRIND will + * still catch it and complain. The masking trick does make the hash + * noticably faster for short strings (like English words). + */ +#ifndef VALGRIND + + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=k[2]&0xffffff00; b+=k[1]; a+=k[0]; break; + case 10: c+=k[2]&0xffff0000; b+=k[1]; a+=k[0]; break; + case 9 : c+=k[2]&0xff000000; b+=k[1]; a+=k[0]; break; + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=k[1]&0xffffff00; a+=k[0]; break; + case 6 : b+=k[1]&0xffff0000; a+=k[0]; break; + case 5 : b+=k[1]&0xff000000; a+=k[0]; break; + case 4 : a+=k[0]; break; + case 3 : a+=k[0]&0xffffff00; break; + case 2 : a+=k[0]&0xffff0000; break; + case 1 : a+=k[0]&0xff000000; break; + case 0 : return c; /* zero length strings require no mixing */ + } + +#else /* make valgrind happy */ + + k8 = (const uint8_t *)k; + switch(length) /* all the case statements fall through */ + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=((uint32_t)k8[10])<<8; /* fall through */ + case 10: c+=((uint32_t)k8[9])<<16; /* fall through */ + case 9 : c+=((uint32_t)k8[8])<<24; /* fall through */ + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=((uint32_t)k8[6])<<8; /* fall through */ + case 6 : b+=((uint32_t)k8[5])<<16; /* fall through */ + case 5 : b+=((uint32_t)k8[4])<<24; /* fall through */ + case 4 : a+=k[0]; break; + case 3 : a+=((uint32_t)k8[2])<<8; /* fall through */ + case 2 : a+=((uint32_t)k8[1])<<16; /* fall through */ + case 1 : a+=((uint32_t)k8[0])<<24; break; + case 0 : return c; + } + +#endif /* !VALGRIND */ + + } else { /* need to read the key one byte at a time */ + const uint8_t *k = (const uint8_t *)key; + + /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ + while (length > 12) + { + a += ((uint32_t)k[0])<<24; + a += ((uint32_t)k[1])<<16; + a += ((uint32_t)k[2])<<8; + a += ((uint32_t)k[3]); + b += ((uint32_t)k[4])<<24; + b += ((uint32_t)k[5])<<16; + b += ((uint32_t)k[6])<<8; + b += ((uint32_t)k[7]); + c += ((uint32_t)k[8])<<24; + c += ((uint32_t)k[9])<<16; + c += ((uint32_t)k[10])<<8; + c += ((uint32_t)k[11]); + mix(a,b,c); + length -= 12; + k += 12; + } + + /*-------------------------------- last block: affect all 32 bits of (c) */ + switch(length) /* all the case statements fall through */ + { + case 12: c+=k[11]; + case 11: c+=((uint32_t)k[10])<<8; + case 10: c+=((uint32_t)k[9])<<16; + case 9 : c+=((uint32_t)k[8])<<24; + case 8 : b+=k[7]; + case 7 : b+=((uint32_t)k[6])<<8; + case 6 : b+=((uint32_t)k[5])<<16; + case 5 : b+=((uint32_t)k[4])<<24; + case 4 : a+=k[3]; + case 3 : a+=((uint32_t)k[2])<<8; + case 2 : a+=((uint32_t)k[1])<<16; + case 1 : a+=((uint32_t)k[0])<<24; + break; + case 0 : return c; + } + } + + final(a,b,c); + return c; +} + + +#ifdef SELF_TEST + +/* used for timings */ +void driver1() +{ + uint8_t buf[256]; + uint32_t i; + uint32_t h=0; + time_t a,z; + + time(&a); + for (i=0; i<256; ++i) buf[i] = 'x'; + for (i=0; i<1; ++i) + { + h = hashlittle(&buf[0],1,h); + } + time(&z); + if (z-a > 0) printf("time %d %.8x\n", z-a, h); +} + +/* check that every input bit changes every output bit half the time */ +#define HASHSTATE 1 +#define HASHLEN 1 +#define MAXPAIR 60 +#define MAXLEN 70 +void driver2() +{ + uint8_t qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1]; + uint32_t c[HASHSTATE], d[HASHSTATE], i=0, j=0, k, l, m=0, z; + uint32_t e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE]; + uint32_t x[HASHSTATE],y[HASHSTATE]; + uint32_t hlen; + + printf("No more than %d trials should ever be needed \n",MAXPAIR/2); + for (hlen=0; hlen < MAXLEN; ++hlen) + { + z=0; + for (i=0; i<hlen; ++i) /*----------------------- for each input byte, */ + { + for (j=0; j<8; ++j) /*------------------------ for each input bit, */ + { + for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */ + { + for (l=0; l<HASHSTATE; ++l) + e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32_t)0); + + /*---- check that every output bit is affected by that input bit */ + for (k=0; k<MAXPAIR; k+=2) + { + uint32_t finished=1; + /* keys have one bit different */ + for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (uint8_t)0;} + /* have a and b be two keys differing in only one bit */ + a[i] ^= (k<<j); + a[i] ^= (k>>(8-j)); + c[0] = hashlittle(a, hlen, m); + b[i] ^= ((k+1)<<j); + b[i] ^= ((k+1)>>(8-j)); + d[0] = hashlittle(b, hlen, m); + /* check every bit is 1, 0, set, and not set at least once */ + for (l=0; l<HASHSTATE; ++l) + { + e[l] &= (c[l]^d[l]); + f[l] &= ~(c[l]^d[l]); + g[l] &= c[l]; + h[l] &= ~c[l]; + x[l] &= d[l]; + y[l] &= ~d[l]; + if (e[l]|f[l]|g[l]|h[l]|x[l]|y[l]) finished=0; + } + if (finished) break; + } + if (k>z) z=k; + if (k==MAXPAIR) + { + printf("Some bit didn't change: "); + printf("%.8x %.8x %.8x %.8x %.8x %.8x ", + e[0],f[0],g[0],h[0],x[0],y[0]); + printf("i %d j %d m %d len %d\n", i, j, m, hlen); + } + if (z==MAXPAIR) goto done; + } + } + } + done: + if (z < MAXPAIR) + { + printf("Mix success %2d bytes %2d initvals ",i,m); + printf("required %d trials\n", z/2); + } + } + printf("\n"); +} + +/* Check for reading beyond the end of the buffer and alignment problems */ +void driver3() +{ + uint8_t buf[MAXLEN+20], *b; + uint32_t len; + uint8_t q[] = "This is the time for all good men to come to the aid of their country..."; + uint32_t h; + uint8_t qq[] = "xThis is the time for all good men to come to the aid of their country..."; + uint32_t i; + uint8_t qqq[] = "xxThis is the time for all good men to come to the aid of their country..."; + uint32_t j; + uint8_t qqqq[] = "xxxThis is the time for all good men to come to the aid of their country..."; + uint32_t ref,x,y; + uint8_t *p; + + printf("Endianness. These lines should all be the same (for values filled in):\n"); + printf("%.8x %.8x %.8x\n", + hashword((const uint32_t *)q, (sizeof(q)-1)/4, 13), + hashword((const uint32_t *)q, (sizeof(q)-5)/4, 13), + hashword((const uint32_t *)q, (sizeof(q)-9)/4, 13)); + p = q; + printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", + hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), + hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), + hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), + hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), + hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), + hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); + p = &qq[1]; + printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", + hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), + hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), + hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), + hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), + hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), + hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); + p = &qqq[2]; + printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", + hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), + hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), + hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), + hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), + hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), + hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); + p = &qqqq[3]; + printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", + hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), + hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), + hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), + hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), + hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), + hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); + printf("\n"); + + /* check that hashlittle2 and hashlittle produce the same results */ + i=47; j=0; + hashlittle2(q, sizeof(q), &i, &j); + if (hashlittle(q, sizeof(q), 47) != i) + printf("hashlittle2 and hashlittle mismatch\n"); + + /* check that hashword2 and hashword produce the same results */ + len = 0xdeadbeef; + i=47, j=0; + hashword2(&len, 1, &i, &j); + if (hashword(&len, 1, 47) != i) + printf("hashword2 and hashword mismatch %x %x\n", + i, hashword(&len, 1, 47)); + + /* check hashlittle doesn't read before or after the ends of the string */ + for (h=0, b=buf+1; h<8; ++h, ++b) + { + for (i=0; i<MAXLEN; ++i) + { + len = i; + for (j=0; j<i; ++j) *(b+j)=0; + + /* these should all be equal */ + ref = hashlittle(b, len, (uint32_t)1); + *(b+i)=(uint8_t)~0; + *(b-1)=(uint8_t)~0; + x = hashlittle(b, len, (uint32_t)1); + y = hashlittle(b, len, (uint32_t)1); + if ((ref != x) || (ref != y)) + { + printf("alignment error: %.8x %.8x %.8x %d %d\n",ref,x,y, + h, i); + } + } + } +} + +/* check for problems with nulls */ + void driver4() +{ + uint8_t buf[1]; + uint32_t h,i,state[HASHSTATE]; + + + buf[0] = ~0; + for (i=0; i<HASHSTATE; ++i) state[i] = 1; + printf("These should all be different\n"); + for (i=0, h=0; i<8; ++i) + { + h = hashlittle(buf, 0, h); + printf("%2ld 0-byte strings, hash is %.8x\n", i, h); + } +} + +void driver5() +{ + uint32_t b,c; + b=0, c=0, hashlittle2("", 0, &c, &b); + printf("hash is %.8lx %.8lx\n", c, b); /* deadbeef deadbeef */ + b=0xdeadbeef, c=0, hashlittle2("", 0, &c, &b); + printf("hash is %.8lx %.8lx\n", c, b); /* bd5b7dde deadbeef */ + b=0xdeadbeef, c=0xdeadbeef, hashlittle2("", 0, &c, &b); + printf("hash is %.8lx %.8lx\n", c, b); /* 9c093ccd bd5b7dde */ + b=0, c=0, hashlittle2("Four score and seven years ago", 30, &c, &b); + printf("hash is %.8lx %.8lx\n", c, b); /* 17770551 ce7226e6 */ + b=1, c=0, hashlittle2("Four score and seven years ago", 30, &c, &b); + printf("hash is %.8lx %.8lx\n", c, b); /* e3607cae bd371de4 */ + b=0, c=1, hashlittle2("Four score and seven years ago", 30, &c, &b); + printf("hash is %.8lx %.8lx\n", c, b); /* cd628161 6cbea4b3 */ + c = hashlittle("Four score and seven years ago", 30, 0); + printf("hash is %.8lx\n", c); /* 17770551 */ + c = hashlittle("Four score and seven years ago", 30, 1); + printf("hash is %.8lx\n", c); /* cd628161 */ +} + + +int main() +{ + driver1(); /* test that the key is hashed: used for timings */ + driver2(); /* test that whole key is hashed thoroughly */ + driver3(); /* test that nothing but the key is hashed */ + driver4(); /* test hashing multiple buffers (all buffers are null) */ + driver5(); /* test the hash against known vectors */ + return 1; +} + +#endif /* SELF_TEST */ diff --git a/code/src/common/module.mk.in b/code/src/common/module.mk.in new file mode 100644 index 0000000..f6828df --- /dev/null +++ b/code/src/common/module.mk.in @@ -0,0 +1,8 @@ +DIR := src/common + +LIBSRC += $(DIR)/triton-error.c \ + $(DIR)/triton-debug.c \ + $(DIR)/triton-log.c \ + $(DIR)/triton-string.c \ + $(DIR)/lookup3.c + diff --git a/code/src/common/old b/code/src/common/old new file mode 100644 index 0000000..decd4fc --- /dev/null +++ b/code/src/common/old @@ -0,0 +1,157 @@ +#ifndef __TRITON_SAFE_LIST_H__ +#define __TRITON_SAFE_LIST_H__ + +#include "common/triton-base.h" +#include "include/triton-list.h" + +typedef struct +{ + triton_list_t list; + triton_mutex_t mutex; +} triton_safelist_t; + +typedef triton_list_link_t triton_safelist_link_t; + +#define TRITON_SAFE_LIST_STATIC_INITIALIZER(name) \ + { { { &(name), &(name) }, 0 }, TRITON_MUTEX_INITIALIZER } + +#define TRITON_SAFE_LIST_DEFINE(name) \ + triton_safelist_t name = TRITON_SAFE_LIST_STATIC_INITIALIZER(name) + +#define triton_safelist_link_clear(__link) do { \ + triton_list_link_clear(&((__link)->link)); \ +} while(0) + +static inline void triton_safelist_init(triton_safelist_t *slist) +{ + triton_mutex_lock(&slist->mutex); + triton_countlist_init(&slist->list); + triton_mutex_unlock(&slist->mutex); +} + +static inline void triton_safelist_add( + struct triton_safelist_link_t *new, triton_safelist_t *slist) +{ + triton_mutex_lock(&slist->mutex); + triton_countlist_add(&new->link, slist->list); + triton_mutex_unlock(&slist->mutex); +} + +static inline void triton_safelist_add_tail( + triton_safelist_link_t *new, triton_safelist_t *slist) +{ + triton_mutex_lock(&slist->mutex); + triton_countlist_add_tail(&new->link, slist->list); + triton_mutex_unlock(&slist->mutex); +} + +static inline void triton_safelist_del( + triton_safelist_link_t *entry, triton_safelist_t *clist) +{ + triton_mutex_lock(&slist->mutex); + triton_list_del(&entry->link); + triton_mutex_unlock(&slist->mutex); +} + +static inline int triton_safelist_empty(triton_safelist_t *slist) +{ + int empty; + triton_mutex_lock(&slist->mutex); + empty = triton_countlist_empty(&slist->list);; + triton_mutex_unlock(&slist->mutex); + return empty; +} + +#define triton_safelist_push(_op, _clist) triton_safelist_add_tail(_op, _clist) + +static inline triton_safelist_link_t *triton_safelist_pop(triton_safelist_t *list) +{ + struct triton_safelist_link *entry; + triton_mutex_lock(&slist->mutex); + entry = triton_countlist_pop(&list->list); + triton_mutex_unlock(&slist->mutex); + return entry; +} + +static inline triton_safelist_link_t *triton_safelist_peek(triton_safelist_t *list) +{ + triton_safelist_link_t *entry; + triton_mutex_lock(&list->mutex); + entry = triton_countlist_peek(&list->list); + triton_mutex_unlock(&list->mutex); + return entry; +} + +#define triton_safelist_get_entry(ptr, type, member) \ + triton_countlist_get_entry(ptr, type, member) + +#define triton_safelist_link_from_countlist_link(_ptr) \ + triton_countlist_get_entry(_ptr, triton_safelist_link_t, link) + +/* these are automatically safe */ + +#define triton_safelist_for_each(pos, slist) \ + for(triton_mutex_lock(&slist->mutex), \ + struct triton_list_link *lpos = ((slist)->list).list.next, \ + struct triton_list_link *scratch = lpos, \ + pos = triton_list_get_entry(lpos, triton_countlist_link_t, link), \ + triton_mutex_unlock(&slist->mutex); \ + triton_mutex_lock(&slist->mutex) || lpos != &(slist->list).list || triton_mutex_unlock(&slist->mutex); \ + triton_mutex_lock(&slist->mutex), \ + lpos = scratch, \ + scratch = lpos->next, \ + pos = triton_list_get_entry(lpos, triton_countlist_link_t, link), \ + triton_mutex_unlock(&slist->mutex)) + +#define triton_safelist_for_each_entry(pos, slist, member) \ + for (triton_mutex_lock(struct triton_list_link lpos = ((slist)->list).next, \ + struct triton_list_link *scratch = lpos, \ + pos = triton_countlist_get_entry( \ + triton_list_get_entry(lpos, triton_safelist_link_t, link), \ + typeof(*pos), member); \ + lpos != &(slist)->list; \ + lpos = scratch->next, scratch = lpos->next, \ + pos = triton_countlist_get_entry( \ + triton_list_get_entry(lpos, triton_countlist_link_t, link), \ + typeof(*pos), member)) + +static inline int triton_safelist_exists(triton_safelist_t *slist, triton_safelist_link_t *llink) +{ + triton_mutex_lock(&slist->mutex); + ret = triton_list_exists(&(slist->list.list), llink); + triton_mutex_unlock(&slist->mutex); + return ret; +} + +static inline int +#define triton_countlist_find(clist, compare, ptr) \ + triton_countlist_find(&(clist->list), compare, ptr) + +#define triton_countlist_push(__list, __entry) triton_list_push(&(__list)->list, __entry) + +#define triton_countlist_pop(__list) triton_list_pop(&(__list)->list) + +#define triton_countlist_peek(__list) triton_list_peek(&(__list)->list) + +static inline uint64_t triton_countlist_count(triton_countlist_t *list) +{ + return list->count; +} + +static inline triton_countlist_link_t *triton_countlist_find( + triton_countlist_t *list, + int (*compare)(struct triton_countlist_link_t *, void *), + void *ptr) +{ + struct triton_countlist_link_t *llink; + triton_countlist_for_each(llink, list) + { + if(compare(llink, list)) + { + return llink; + } + } + return NULL; +} + +#endif /* __TRITON_COUNT_LIST_H__ */ diff --git a/code/src/common/resources/scheduling/module.mk.in b/code/src/common/resources/scheduling/module.mk.in new file mode 100644 index 0000000..6c88953 --- /dev/null +++ b/code/src/common/resources/scheduling/module.mk.in @@ -0,0 +1,5 @@ +DIR := src/common/resources/scheduling + +AESOP_HDR += $(DIR)/sched.hae + +LIBSRC += $(DIR)/sched.c diff --git a/code/src/common/resources/scheduling/sched.c b/code/src/common/resources/scheduling/sched.c new file mode 100644 index 0000000..5a8349b --- /dev/null +++ b/code/src/common/resources/scheduling/sched.c @@ -0,0 +1,183 @@ + +#include <errno.h> +#include "src/aesop/aesop.h" +#include "src/common/resources/scheduling/sched.h" + +static int triton_sched_resource_id; +static ae_opcache_t sched_opcache; + +#define triton_sched_inotify(_sched, _action) \ + if(_action != TRITON_SCHED_ACTION_NONE) triton_sched_notify(_sched, _action) + +#define triton_sched_itrigger(_sched, _event) \ + do { \ + if((!((_sched)->innotify)) && (_sched)->trigger) \ + { \ + triton_sched_action_t a = (_sched)->trigger(sched, _event); \ + triton_sched_inotify(sched, a); \ + } \ + } while(0) + +static struct ae_resource triton_sched_resource = +{ + .resource_name = "sched", +}; + +triton_ret_t triton_sched_init(void) +{ + int ret; + + TRITON_OPCACHE_INIT(triton_sched_id, op, 1024, &sched_opcache); + return ae_resource_register(&triton_sched_resource, &triton_sched_resource_id); +} + +void triton_sched_finalize(void) +{ + ae_resource_unregister(triton_sched_resource_id); + ae_opcache_destroy(sched_opcache); +} + +triton_ret_t triton_sched_obj_wait_post(triton_sched_t *sched, + triton_sched_id *result, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + if(result == NULL) + { + op = ae_opcache_get(sched_opcache); + result = ae_op_entry(op, triton_sched_id, op); + result->internal = 1; + } + else + { + result->internal = 0; + } + + ae_op_clear(&result->op); + ae_op_fill(&result->op, callback, user_ptr, hints, ctx); + + triton_mutex_lock(&sched->lock); + result->rank = ae_ops_count(&sched->opqueue); + ae_ops_enqueue(&result->op, &sched->opqueue); + triton_sched_itrigger(sched, TRITON_SCHED_OP_ADDED); + triton_mutex_unlock(&sched->lock); + + return TRITON_SUCCESS; +} +triton_ret_t (* triton_sched_obj_wait)(triton_sched_t *sched, + triton_sched_id *result, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = triton_sched_obj_wait_post; + + +int triton_sched_notify(triton_sched_t *sched, triton_sched_action_t action) +{ + switch(action) + { + case TRITON_SCHED_ACTION_NONE: + break; + case TRITON_SCHED_ACTION_NOTIFY_ALL: + triton_sched_notify_all(sched); + break; + case TRITON_SCHED_ACTION_NOTIFY_NEXT: + triton_sched_notify_next(sched); + break; + default: + return -EINVAL; + } + return 0; +} + +int triton_sched_notify_all(triton_sched_t *sched) +{ + struct ae_op *op; + triton_sched_id *result; + triton_mutex_lock(&sched->lock); + if(ae_ops_empty(&sched->opqueue)) + { + triton_mutex_unlock(&sched->lock); + return 0; + } + sched->innotify = 1; + while(!ae_ops_empty(&sched->opqueue)) + { + op = ae_ops_dequeue(&sched->opqueue); + ae_invoke_callback(op, 0); + result = ae_op_entry(op, triton_sched_id, op); + if(result->internal) + { + ae_opcache_put(sched_opcache, op); + } + else + { + ae_op_clear(op); + } + } + triton_sched_itrigger(sched, TRITON_SCHED_EMPTIED); + sched->innotify = 0; + triton_mutex_unlock(&sched->lock); + return 0; +} + +int triton_sched_notify_next(triton_sched_t *sched) +{ + struct ae_op *op; + triton_sched_id *result; + triton_mutex_lock(&sched->lock); + sched->innotify = 1; + if(!ae_ops_empty(&sched->opqueue)) + { + op = ae_ops_dequeue(&sched->opqueue); + ae_invoke_callback(op, 0); + result = ae_op_entry(op, triton_sched_id, op); + if(result->internal) + { + ae_opcache_put(sched_opcache, op); + } + else + { + ae_op_clear(op); + } + triton_sched_itrigger(sched, TRITON_SCHED_OP_REMOVED); + } + sched->innotify = 0; + triton_mutex_unlock(&sched->lock); + return 0; +} + +int triton_sched_notify_specific(triton_sched_t *sched, triton_sched_id *id) +{ + triton_mutex_lock(&sched->lock); + sched->innotify = 1; + + ae_ops_del(&id->op); + ae_invoke_callback(&id->op, 0); + if(id->internal) + { + ae_opcache_put(sched_opcache, &id->op); + } + else + { + ae_op_clear(&id->op); + } + triton_sched_itrigger(sched, TRITON_SCHED_OP_REMOVED); + sched->innotify = 0; + triton_mutex_unlock(&sched->lock); + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/common/resources/scheduling/sched.hae b/code/src/common/resources/scheduling/sched.hae new file mode 100644 index 0000000..93931c4 --- /dev/null +++ b/code/src/common/resources/scheduling/sched.hae @@ -0,0 +1,76 @@ +#ifndef __SCHED_HAE__ +#define __SCHED_HAE__ + +#include "src/aesop/aesop.h" + +typedef struct triton_sched_entry +{ + int rank; + struct ae_op op; + int internal; +} triton_sched_id; + +typedef enum +{ + TRITON_SCHED_OP_ADDED, + TRITON_SCHED_OP_REMOVED, + TRITON_SCHED_EMPTIED +} triton_sched_trigger_event_t; + +typedef enum +{ + TRITON_SCHED_ACTION_NONE, + TRITON_SCHED_ACTION_NOTIFY_ALL, + TRITON_SCHED_ACTION_NOTIFY_NEXT +} triton_sched_action_t; + +struct triton_sched; +typedef triton_sched_action_t (*triton_sched_trigger_t)(struct triton_sched *sched, triton_sched_trigger_event_t op); + +typedef struct triton_sched +{ + ae_ops_t opqueue; + triton_mutex_t lock; + triton_sched_trigger_t trigger; + int innotify; +} triton_sched_t; + +#define triton_sched_reset(_sched) \ +do { \ + ae_ops_init(&(_sched)->opqueue); \ + triton_mutex_init(&(_sched)->lock, NULL); \ + (_sched)->trigger = NULL; \ +} while(0) + +#define triton_sched_set_trigger(sched, _trigger) (sched)->trigger = (_trigger); + +int triton_sched_notify(triton_sched_t *sched, triton_sched_action_t action); + +int triton_sched_notify_all(triton_sched_t *sched); + +int triton_sched_notify_next(triton_sched_t *sched); + +int triton_sched_notify_specific(triton_sched_t *sched, triton_sched_id *id); + +int triton_sched_get_entries(triton_sched_t *sched, int *count, triton_sched_id **entries); + +#define triton_sched_get_envelope(_id, _type, _member) \ + ((_type *)((char *)(_id) - (unsigned long)((&((_type *)0)->_member)))) + +__blocking int triton_sched_obj_wait(triton_sched_t *sched, triton_sched_id *result); + +#define triton_sched_wait(_sched) triton_sched_obj_wait(_sched, NULL) + +triton_ret_t triton_sched_init(void); +void triton_sched_finalize(void); + +#endif + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/common/resources/scheduling/test/coalesce.ae b/code/src/common/resources/scheduling/test/coalesce.ae new file mode 100644 index 0000000..7c8013b --- /dev/null +++ b/code/src/common/resources/scheduling/test/coalesce.ae @@ -0,0 +1,111 @@ + +#include "src/common/resources/scheduling/sched.hae" +#include "src/common/resources/timer/timer.hae" + +static triton_sched_action_t coalesce_trigger(struct triton_sched *sched, triton_sched_trigger_event_t op) +{ + if(ae_ops_size(&sched->opqueue) >= 8) + { + return TRITON_SCHED_ACTION_NOTIFY_ALL; + } + return TRITON_SCHED_ACTION_NONE; +} + +struct coalesce_obj +{ + int ind; + triton_sched_id sched_id; +}; + +static triton_sched_t coalesce_sched; +static triton_sched_t sync_sched; + +__blocking int coalesce(struct coalesce_obj *obj); + +static __blocking int dostuff(void) +{ + struct coalesce_obj obj[32]; + + pwait + { + int i; /* special pwait variable gets copied at pbranch invocation */ + for(i = 0; i < 32; ++i) + { + pbranch + { + obj[i].ind = i; + coalesce(&obj[i]); + } + } + } + + return 0; +} + +__blocking int coalesce(struct coalesce_obj *obj) +{ + int ret; + ret = triton_sched_obj_wait(&coalesce_sched, &obj->sched_id); + assert(ret == 0); + printf("coalesce wait completed for index: %d\n", obj->ind); + + if(obj->sched_id.rank == 0) + { + printf("index: %d does the sync\n", obj->ind); + ret = triton_timer(1000); + assert(ret == 0); + ret = triton_sched_notify_all(&sync_sched); + assert(ret == 0); + } + else + { + printf("index: %d waiting for sync to complete (rank=%d)\n", obj->ind, obj->sched_id.rank); + ret = triton_sched_wait(&sync_sched); + assert(ret == 0); + } + + return 0; +} + +static int done = 0; + +static void cb(void *up, int ret) +{ + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_context_t ctx; + + triton_sched_init(); + triton_timer_init(); + + ae_context_create(&ctx, 2, "sched", "timer"); + + triton_sched_reset(&coalesce_sched); + triton_sched_reset(&sync_sched); + triton_sched_set_trigger(&coalesce_sched, coalesce_trigger); + + dostuff_post(cb,NULL,NULL,ctx,NULL); + + while(!done) + { + ae_poll(ctx, 100); + } + + ae_context_destroy(ctx); + triton_timer_finalize(); + triton_sched_finalize(); + + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/common/resources/scheduling/test/limitqueue.ae b/code/src/common/resources/scheduling/test/limitqueue.ae new file mode 100644 index 0000000..e7a7a05 --- /dev/null +++ b/code/src/common/resources/scheduling/test/limitqueue.ae @@ -0,0 +1,112 @@ + +#include "src/common/resources/scheduling/sched.hae" +#include "src/common/resources/timer/timer.hae" + +struct limit_obj +{ + int ind; + triton_sched_id sched_id; +}; + +static triton_sched_t limit_sched; + +__blocking int dolimit(struct limit_obj *obj); + +static __blocking int dostuff(void) +{ + struct limit_obj obj[100]; + + pwait + { + int i; /* special pwait variable gets copied at pbranch invocation */ + for(i = 0; i < 100; ++i) + { + pbranch + { + obj[i].ind = i; + dolimit(&obj[i]); + } + } + } + + return 0; +} + +static int inprogress = 0; +static triton_mutex_t progmut = TRITON_MUTEX_INITIALIZER; + +__blocking int dolimit(struct limit_obj *obj) +{ + int ret; + + triton_mutex_lock(&progmut); + if(inprogress > 16) + { + triton_mutex_unlock(&progmut); + + /* wait till an op finishes */ + ret = triton_sched_wait(&limit_sched); + assert(ret == 0); + printf("limit wait completed for index: %d\n", obj->ind); + + triton_mutex_lock(&progmut); + } + + ++inprogress; + triton_mutex_unlock(&progmut); + + /* actually do something here, and then notify the next guy */ + printf("index: %d sleeping\n", obj->ind); + ret = triton_timer(100); + assert(ret == 0); + + triton_mutex_lock(&progmut); + --inprogress; + triton_mutex_lock(&progmut); + + ret = triton_sched_notify_next(&limit_sched); + assert(ret == 0); + + return 0; +} + +static int done = 0; + +static void cb(void *up, int ret) +{ + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_context_t ctx; + + triton_sched_init(); + triton_timer_init(); + + ae_context_create(&ctx, 2, "sched", "timer"); + + triton_sched_reset(&limit_sched); + + dostuff_post(cb,NULL,NULL,ctx,NULL); + + while(!done) + { + ae_poll(ctx, 100); + } + + ae_context_destroy(ctx); + triton_timer_finalize(); + triton_sched_finalize(); + + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/common/resources/scheduling/test/module.mk.in b/code/src/common/resources/scheduling/test/module.mk.in new file mode 100644 index 0000000..643cd10 --- /dev/null +++ b/code/src/common/resources/scheduling/test/module.mk.in @@ -0,0 +1,7 @@ +DIR := src/common/resources/scheduling/test + +AETESTSRC += $(DIR)/coalesce.ae \ + $(DIR)/limitqueue.ae \ + $(DIR)/pthread-compare.ae + +MODLIBS_$(DIR)/pthread-compare.ae = -lpthread diff --git a/code/src/common/resources/scheduling/test/pthread-compare.ae b/code/src/common/resources/scheduling/test/pthread-compare.ae new file mode 100644 index 0000000..2c2f92b --- /dev/null +++ b/code/src/common/resources/scheduling/test/pthread-compare.ae @@ -0,0 +1,125 @@ + +#include <pthread.h> +#include "src/aesop/aesop.h" +#include "src/common/resources/scheduling/sched.hae" + +static pthread_cond_t cond; +static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + +static triton_sched_t sched; + +static __blocking int sched_test(void) +{ + struct timeval t1, t2, diff; + + gettimeofday(&t1, NULL); + pwait + { + int i; + for(i = 0; i < 1000; ++i) + { + pbranch + { + triton_sched_wait(&sched); + } + } + } + gettimeofday(&t2, NULL); + diff.tv_sec = t2.tv_sec - t1.tv_sec; + diff.tv_usec = t2.tv_usec - t1.tv_usec; + if(t2.tv_usec < t1.tv_usec) + { + diff.tv_sec--; + diff.tv_usec += 1e6; + } + printf("sched time: %d.%06d secs\n", (int)diff.tv_sec, (int)diff.tv_usec); + return 0; +} + +static void *thread_cb(void *up) +{ + pthread_mutex_lock(&mutex); + pthread_cond_wait(&cond, &mutex); + pthread_mutex_unlock(&mutex); + + return NULL; +} + +static void thread_test(void) +{ + int i, ret; + pthread_t tid[100]; + void *val; + struct timeval t1, t2, diff; + + gettimeofday(&t1, NULL); + for(i = 0; i < 100; ++i) + { + ret = pthread_create(&tid[i], NULL, thread_cb, NULL); + if(ret != 0) + { + perror("pthread_create failed!\n"); + assert(ret == 0); + } + + } + + pthread_mutex_lock(&mutex); + pthread_cond_broadcast(&cond); + pthread_mutex_unlock(&mutex); + + for(i = 0; i < 100; ++i) + { + pthread_join(tid[i], &val); + } + gettimeofday(&t2, NULL); + diff.tv_sec = t2.tv_sec - t1.tv_sec; + diff.tv_usec = t2.tv_usec - t1.tv_usec; + if(t2.tv_usec < t1.tv_usec) + { + diff.tv_sec--; + diff.tv_usec += 1e6; + } + printf("thread time: %d.%06d secs\n", (int)diff.tv_sec, (int)diff.tv_usec); +} + +static int done = 0; +static void donecb(void *up, int ret) +{ + done=1; +} + +int main(int argc, char *argv[]) +{ + ae_context_t ctx; + + triton_sched_init(); + + ae_context_create(&ctx, 1, "sched"); + + triton_sched_reset(&sched); + + sched_test_post(donecb, NULL, NULL, ctx, NULL); + triton_sched_notify_all(&sched); + while(!done) + { + ae_poll(ctx, 100); + } + + ae_context_destroy(ctx); + triton_sched_finalize(); + + pthread_cond_init(&cond, NULL); + thread_test(); + + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/common/resources/timer/module.mk.in b/code/src/common/resources/timer/module.mk.in new file mode 100644 index 0000000..dae449f --- /dev/null +++ b/code/src/common/resources/timer/module.mk.in @@ -0,0 +1,5 @@ +DIR := src/common/resources/timer + +AESOP_HDR += $(DIR)/timer.hae + +LIBSRC += $(DIR)/timer.c diff --git a/code/src/common/resources/timer/test/module.mk.in b/code/src/common/resources/timer/test/module.mk.in new file mode 100644 index 0000000..73e072f --- /dev/null +++ b/code/src/common/resources/timer/test/module.mk.in @@ -0,0 +1,6 @@ +DIR := src/common/resources/timer/test + +AETESTSRC += $(DIR)/timer1.ae \ + $(DIR)/pthread-compare.ae + +MODLIBS_$(DIR)/pthread-compare.ae = -lpthread diff --git a/code/src/common/resources/timer/test/pthread-compare.ae b/code/src/common/resources/timer/test/pthread-compare.ae new file mode 100644 index 0000000..e6209b6 --- /dev/null +++ b/code/src/common/resources/timer/test/pthread-compare.ae @@ -0,0 +1,112 @@ +#include <unistd.h> +#include "src/aesop/aesop.h" +#include "src/common/resources/timer/timer.hae" + +triton_mutex_t mutex = TRITON_MUTEX_INITIALIZER; + +static __blocking int triton_dosleep(void) +{ + pwait + { + int i; + + for(i = 0; i < 1000; ++i) + { + pbranch + { + triton_timer(1000); + } + } + } + + return 0; +} + +static int done = 0; +static void done_cb(void *up, int ret) +{ + done = 1; +} + +static void *threadfun(void *cb) +{ + sleep(1); + return NULL; +} + +static void thread_dosleep(void) +{ + int i, ret; + void *val; + pthread_t tid[100]; + for(i = 0; i < 100; ++i) + { + ret = pthread_create(&tid[i], NULL, threadfun, NULL); + if(ret != 0) + { + perror("pthread_create failed!\n"); + assert(ret == 0); + } + } + + for(i = 0; i < 100; ++i) + { + pthread_join(tid[i], &val); + } + + return; +} + + + +int main(int argc, char *argv[]) +{ + ae_op_id_t op_id; + ae_context_t ctx; + struct timeval t1, t2, diff; + + triton_timer_init(); + + ae_context_create(&ctx, 1, "timer"); + + gettimeofday(&t1, NULL); + triton_dosleep_post(done_cb, NULL, NULL, ctx, &op_id); + while (done == 0) + { + ae_poll(ctx, 10); + } + gettimeofday(&t2, NULL); + diff.tv_sec = t2.tv_sec - t1.tv_sec; + diff.tv_usec = t2.tv_usec - t1.tv_usec; + if(t2.tv_usec < t1.tv_usec) + { + diff.tv_sec--; + diff.tv_usec += 1e6; + } + printf("aesop time: %d.%06d secs\n", (int)diff.tv_sec, (int)diff.tv_usec); + + gettimeofday(&t1, NULL); + thread_dosleep(); + gettimeofday(&t2, NULL); + diff.tv_sec = t2.tv_sec - t1.tv_sec; + diff.tv_usec = t2.tv_usec - t1.tv_usec; + if(t2.tv_usec < t1.tv_usec) + { + diff.tv_sec--; + diff.tv_usec += 1e6; + } + printf("thread time: %d.%06d secs\n", (int)diff.tv_sec, (int)diff.tv_usec); + + ae_context_destroy(ctx); + triton_timer_finalize(); + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/common/resources/timer/test/timer1.ae b/code/src/common/resources/timer/test/timer1.ae new file mode 100644 index 0000000..cee8d1b --- /dev/null +++ b/code/src/common/resources/timer/test/timer1.ae @@ -0,0 +1,70 @@ + +#include <stdio.h> +#include "src/aesop/aesop.h" +#include "src/common/resources/timer/timer.hae" + +static __blocking int dotimer(void) +{ + pwait + { + pbranch + { + printf("sleeping for 100 ms\n"); + triton_timer(100); + printf("100 ms done.\n"); + } + + pbranch + { + printf("sleeping for 1000 ms\n"); + triton_timer(1000); + printf("1000 ms done.\n"); + } + + pbranch + { + printf("sleeping for 10 ms\n"); + triton_timer(10); + printf("10 ms done.\n"); + } + } + return 0; +} + +int done = 0; + +static void done_callback(void *up, int ret) +{ + done = 1; +} + +int main(int argc, char *argv[]) +{ + ae_context_t ctx; + int pc = 0; + ae_op_id_t op_id; + + triton_timer_init(); + ae_context_create(&ctx, 1, "timer"); + + dotimer_post(done_callback, NULL, NULL, ctx, &op_id); + while(done == 0) + { + ae_poll(ctx, 10); + printf("polled %d times\n", ++pc); + } + + ae_context_destroy(ctx); + triton_timer_finalize(); + + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/common/resources/timer/timer.c b/code/src/common/resources/timer/timer.c new file mode 100644 index 0000000..8cdc743 --- /dev/null +++ b/code/src/common/resources/timer/timer.c @@ -0,0 +1,223 @@ + +#define _GNU_SOURCE + +#include <time.h> +#include <sys/time.h> +#include <errno.h> +#include "src/aesop/aesop.h" +#include "src/aesop/op.h" +#include "src/aesop/opcache.h" +#include "src/common/resources/timer/timer.h" + +#define TIMER_DEFAULT_SIZE 1024 + +static ae_opcache_t timer_opcache; +static ae_ops_t timer_oplist; +static triton_mutex_t timer_mutex = TRITON_MUTEX_INITIALIZER; + +static int triton_timer_resource_id; + +struct timer_op +{ + struct timeval timer; + ae_op_id_t op_id; + struct ae_op op; +}; + +triton_ret_t triton_timer_post( + int millisecs, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct timeval adjust, now; + struct ae_op *op; + struct timer_op *top; + struct ae_op *iter, *safe, *holder; + struct timer_op *timer_op_iter; + + op = ae_opcache_get(timer_opcache); + ae_op_fill(op, callback, user_ptr, hints, ctx); + + top = ae_op_entry(op, struct timer_op, op); + top->op_id = ae_id_gen(triton_timer_resource_id, (uint64_t)(op->cache_id)); + + adjust.tv_sec = (int)(millisecs / 1e3); + adjust.tv_usec = (millisecs % 1000) * 1e3; + gettimeofday(&now, NULL); + timeradd(&adjust, &now, &(top->timer)); + + triton_mutex_lock(&timer_mutex); + holder = ae_ops_peek(&timer_oplist); + ae_ops_for_each(iter, safe, &timer_oplist) + { + timer_op_iter = ae_op_entry(iter, struct timer_op, op); + + if(timercmp(&(top->timer), &(timer_op_iter->timer), <)) + { + break; + } + holder = iter; + } + + /* insert after the op with a timer value just + * greater than the requested timer + */ + if(holder) + { + ae_ops_insert_after(op, holder, &timer_oplist); + } + else + { + ae_ops_enqueue(op, &timer_oplist); + } + + triton_mutex_unlock(&timer_mutex); + *op_id = top->op_id; + return TRITON_SUCCESS; +} +triton_ret_t (* triton_timer)( + int millisecs, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = triton_timer_post; + +static int triton_timer_poll(ae_context_t context, int millisecs) +{ + struct ae_op *gop; + struct timer_op *top; + struct timeval adjust, now, diff, timeout; + struct timespec ts_diff, rem; + int ret; + + triton_mutex_lock(&timer_mutex); + gop = ae_ops_peek(&timer_oplist); + top = ae_op_entry(gop, struct timer_op, op); + + gettimeofday(&now, NULL); + + /* complete the timers that have hit (t < now) */ + while(top && timercmp(&(top->timer), &now, <)) + { + + /* what sort of errors could we return? */ + + /* this timer has hit, so we pop and call callback */ + gop = ae_ops_dequeue(&timer_oplist); + ae_opcache_complete_op(timer_opcache, gop, 0); + + /* setup for next iteration */ + gop = ae_ops_peek(&timer_oplist); + top = ae_op_entry(gop, struct timer_op, op); + } + + adjust.tv_sec = (int)(millisecs / 1e3); + adjust.tv_usec = (millisecs % 1000) * 1e3; + timeradd(&now, &adjust, &timeout); + + gop = ae_ops_peek(&timer_oplist); + top = ae_op_entry(gop, struct timer_op, op); + + /* sleep for timers that will hit before + * timeout is reached (t < (now+millisecs)) */ + while(top && timercmp(&(top->timer), &timeout, <)) + { + gettimeofday(&now, NULL); + timersub(&(top->timer), &now, &diff); + + /* timer may have hit between check and getting current time, + * in which case we don't need to sleep + */ + if(diff.tv_sec >= 0) + { + TIMEVAL_TO_TIMESPEC(&diff, &ts_diff); + + /* this timer will hit before the timeout is reached, + * so we pop, sleep, and call callback */ + ret = nanosleep(&ts_diff, &rem); + if(ret != 0) + { + ae_invoke_callback(gop, errno); + triton_mutex_unlock(&timer_mutex); + return -EINTR; + } + } + + gop = ae_ops_dequeue(&timer_oplist); + ae_opcache_complete_op(timer_opcache, gop, 0); + + /* setup for next iteration */ + gop = ae_ops_peek(&timer_oplist); + top = ae_op_entry(gop, struct timer_op, op); + } + + /* no more timers within this timeout window. sleep for the rest of the timeout */ + gettimeofday(&now, NULL); + timersub(&timeout, &now, &diff); + if(diff.tv_sec >= 0) + { + TIMEVAL_TO_TIMESPEC(&diff, &ts_diff); + nanosleep(&ts_diff, &rem); + } + + triton_mutex_unlock(&timer_mutex); + + return 0; +} + +static int triton_timer_cancel(ae_context_t triton_ctx, ae_op_id_t op_id) +{ + int cache_id, resource_id; + triton_mutex_lock(&timer_mutex); + struct ae_op *op; + struct timer_op *top; + + cache_id = ae_id_lookup(op_id, &resource_id); + assert(resource_id == triton_timer_resource_id); + + op = ae_opcache_lookup(timer_opcache, (int)cache_id); + top = ae_op_entry(op, struct timer_op, op); + ae_ops_del(op); + ae_opcache_put(timer_opcache, op); + + triton_mutex_unlock(&timer_mutex); + + return 0; +} + +struct ae_resource triton_timer_resource = +{ + .resource_name = "timer", + .poll_context = triton_timer_poll, + .cancel = triton_timer_cancel +}; + +triton_ret_t triton_timer_init(void) +{ + int ret; + + ae_ops_init(&timer_oplist); + TRITON_OPCACHE_INIT(struct timer_op, op, TIMER_DEFAULT_SIZE, &timer_opcache); + + return ae_resource_register(&triton_timer_resource, &triton_timer_resource_id); +} + +void triton_timer_finalize(void) +{ + ae_resource_unregister(triton_timer_resource_id); + + ae_opcache_destroy(timer_opcache); +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/common/resources/timer/timer.hae b/code/src/common/resources/timer/timer.hae new file mode 100644 index 0000000..3871380 --- /dev/null +++ b/code/src/common/resources/timer/timer.hae @@ -0,0 +1,12 @@ +#ifndef __TRITON_TIMER_HAE__ +#define __TRITON_TIMER_HAE__ + +#include "src/aesop/aesop.h" + +__blocking int triton_timer(int millisecs); + +triton_ret_t triton_timer_init(void); +void triton_timer_finalize(void); + +#endif + diff --git a/code/src/common/tests/module.mk.in b/code/src/common/tests/module.mk.in new file mode 100644 index 0000000..57c4e1f --- /dev/null +++ b/code/src/common/tests/module.mk.in @@ -0,0 +1,5 @@ +DIR := src/common/tests + +TESTSRC += $(DIR)/testlist.c + +TESTPARAMS_$(DIR)/testlist = 1000 diff --git a/code/src/common/tests/testlist.c b/code/src/common/tests/testlist.c new file mode 100644 index 0000000..6f984ec --- /dev/null +++ b/code/src/common/tests/testlist.c @@ -0,0 +1,160 @@ + +#include <stdlib.h> +#include "src/common/triton-list.h" + +struct e +{ + int v; + triton_list_link_t link; +}; + +int main(int argc, char *argv[]) +{ + triton_list_t l; + struct e *es, *ep, *esc; + triton_list_link_t *p, *s; + int i, testsize, delcount; + + assert(argc == 2); + + testsize = atoi(argv[1]); + + assert(testsize > 100); + + es = malloc(sizeof(*es) * testsize); + + + triton_list_init(&l); + + /* test push/pop */ + for(i = 0; i < testsize; ++i) + { + es[i].v = i; + triton_list_link_clear(&es[i].link); + } + + for(i = 0; i < testsize; ++i) + { + triton_list_add_back(&es[i].link, &l); + } + + /* test triton_list_del */ + delcount = 0; + for(i = 0; i < 100; ++i) + { + int j = rand() % testsize; + + if(es[j].link.inlist) + { + triton_list_del(&es[j].link); + ++delcount; + } + } + + assert(triton_list_count(&l) == (testsize-delcount)); + + /* test foreach */ + triton_list_for_each(p, s, &l) + { + triton_list_del(p); + } + + assert(triton_list_empty(&l)); + + /* test push/pop */ + for(i = 0; i < testsize; ++i) + { + triton_stack_push(&es[i].link, &l); + } + + for(i = testsize - 1; i >= 0; --i) + { + p = triton_stack_pop(&l); + assert(triton_list_get_entry(p, struct e, link)->v == i); + } + + /* test enqueue/dequeue */ + for(i = 0; i < testsize; ++i) + { + triton_queue_enqueue(&es[i].link, &l); + } + + assert(triton_list_count(&l) == testsize); + + for(i = 0; i < testsize; ++i) + { + p = triton_queue_dequeue(&l); + assert(triton_list_get_entry(p, struct e, link)->v == i); + assert(triton_list_count(&l) == (testsize - i - 1)); + } + + assert(triton_list_empty(&l)); + + /* test insert_before */ + for(i = 0; i < 100; ++i) + { + triton_queue_enqueue(&es[i].link, &l); + } + + for(; i < testsize; ++i) + { + triton_list_insert_before(&es[i].link, &es[0].link, &l); + } + + for(i = 0; i < (testsize - 100); ++i) + { + assert(triton_list_get_entry(triton_queue_dequeue(&l), struct e, link)->v == 100 + i); + } + + for(i = 0; i < 100; ++i) + { + assert(triton_list_get_entry(triton_queue_dequeue(&l), struct e, link)->v == i); + } + + assert(triton_list_empty(&l)); + + /* test insert_after */ + for(i = 0; i < 100; ++i) + { + triton_queue_enqueue(&es[i].link, &l); + } + + for(; i < testsize; ++i) + { + triton_list_insert_after(&es[i].link, &es[0].link, &l); + } + + assert(triton_list_get_entry(triton_queue_dequeue(&l), struct e, link)->v == 0); + + for(i = 0; i < (testsize - 100); ++i) + { + assert(triton_list_get_entry(triton_queue_dequeue(&l), struct e, link)->v == testsize - 1 - i); + } + + for(i = 1; i < 100; ++i) + { + assert(triton_list_get_entry(triton_queue_dequeue(&l), struct e, link)->v == i); + } + + assert(triton_list_empty(&l)); + + for(i = 0; i < testsize; ++i) + { + triton_queue_enqueue(&es[i].link, &l); + } + + i = 0; + triton_list_for_each_entry(ep, esc, &l, link) + { + assert(ep->v == i); + triton_list_del(&ep->link); + assert(ep->v == i); + ++i; + } + + assert(triton_list_empty(&l)); + + free(es); + return 0; +} + diff --git a/code/src/common/triton-base.h b/code/src/common/triton-base.h new file mode 100644 index 0000000..a8e8ba9 --- /dev/null +++ b/code/src/common/triton-base.h @@ -0,0 +1,32 @@ +#ifndef __TRITON_BASE_H__ +#define __TRITON_BASE_H__ + +/** + * triton-base.h includes important system headers and defines appropriate + * macros used throughout. + */ + +#ifdef __STRICT_ANSI__ +/* strict ANSI C doesn't have 'inline' functions, so we use __inline__ instead */ +#define inline __inline__ __attribute__((flatten)) +#endif + +/* simplified version of the unused attribute so that gcc doesn't give warning messages */ +#ifndef __unused +#define __unused __attribute__((unused)) +#endif + +/* older systems have malloc in separate header */ +#include <stdlib.h> +#ifdef HAVE_MALLOC_H +#include <malloc.h> +#endif + +/* basic system headers */ +#include <stdint.h> +#include <stdio.h> +#include <string.h> +#include <stdarg.h> +#include <assert.h> + +#endif diff --git a/code/src/common/triton-bitarray.h b/code/src/common/triton-bitarray.h new file mode 100644 index 0000000..0c1a4cf --- /dev/null +++ b/code/src/common/triton-bitarray.h @@ -0,0 +1,73 @@ +#ifndef __BITARRAY_H__ +#define __BITARRAY_H__ + +#include "src/common/triton-base.h" + +/** + * A simple bit-array implementation. Usage goes something like this: + * + * Declare array variable somewhere: + * + * extern TRITON_BITARRAY_VARDECL(mybitarray); + * + * Define array variable (initialized to 0 for all bits): + * + * TRITON_BITARRAY_VARDEF(mybitarray, 1024); + * + * Set the bit at index 514: + * + * triton_bitarray_set(mybitarray, 514); + * + * Check that a bit is set: + * + * if(triton_bitarray_is_set(mybitarray, 514)) ... + * + * Clear everything: + * + * triton_bitarray_clear(mybitarray, 1024); + */ + +/* Bit array elements are 64 bit integers for now */ +#define TRITON_BITARRAY_ELEM 64 +#define TRITON_BITARRAY_ELEMTYPE uint64_t + +/* define the bit array variable (usually in some global or static scope) + * giving it a variable name and total size (number of elements) + */ +#define TRITON_BITARRAY_VARDEF(__name, __size) TRITON_BITARRAY_ELEMTYPE __name[__size] = { 0 } + +/* declare the bit array variable (usually in a header somewhere) */ +#define TRITON_BITARRAY_VARDECL(__name) TRITON_BITARRAY_ELEMTYPE __name[] + +/* Get the element of the array that holds the given index. + * Examples: triton_bitarray_index(10) -> 0 + * triton_bitarray_index(52) -> 0 + * triton_bitarray_index(129) -> 2 + */ +#define triton_bitarray_ind(__bind) ((int)((__bind) / TRITON_BITARRAY_ELEM)) + +/* Get the bit field element mask for the given index. + * Examples: triton_bitarray_elem(10) -> 000...00010000000000 + * triton_bitarray_elem(67) -> 000...0001000 + * triton_bitarray_elem(129) -> 000...00010 + */ +#define triton_bitarray_elem_mask(__ind) (1 << ((__ind) - (triton_bitarray_ind(__ind) * TRITON_BITARRAY_ELEM))) + +#define triton_bitarray_elem_field(__array, __ind) ((__array)[triton_bitarray_ind(__ind)]) + +/* set the bit at the given index */ +#define triton_bitarray_set(__array, __index) \ + triton_bitarray_elem_field(__array, __index) |= triton_bitarray_elem_mask(__index) + +#define triton_bitarray_unset(__array, __index) \ + triton_bitarray_elem_field(__array, __index) &= ~triton_bitarray_elem_mask(__index) + +/* checks if the bit at the given index is set */ +#define triton_bitarray_is_set(__array, __index) \ + (triton_bitarray_elem_field(__array, __index) & triton_bitarray_elem_mask(__index)) + +/* clears the entire bit array */ +#define triton_bitarray_clear(__array, __size) memset(__array, 0, __size) + +#endif + diff --git a/code/src/common/triton-buffer.h b/code/src/common/triton-buffer.h new file mode 100644 index 0000000..4b7b23b --- /dev/null +++ b/code/src/common/triton-buffer.h @@ -0,0 +1,74 @@ +#ifndef __TRITON_BUFFER_H__ +#define __TRITON_BUFFER_H__ + +#include "src/common/triton-types.h" +#include "src/common/triton-error.h" +#include "src/common/triton-list.h" + +/* We require a max size for a buffer, to prevent clients from requesting + * (perhaps due to a bug or bit-flip somewhere) more memory than is available + * on the machine. + */ + +/** + * The buffer type is used for generic byte streams. A current pointer field + * is included allowing the buffer to be used by encoding/decoding mechanisms + * before being transmitted. The buffer type can be encoded itself, allowing + * it to be used as a generic buffer type. + */ +typedef struct +{ + char *buffer; + uint64_t size; + char *cptr; + + triton_list_t encoded; /* other buffers from encoding */ + triton_list_link_t encode_link; +} triton_buffer_t; + +#define TRITON_BUFFER_STATIC_INITIALIZER() = { NULL, 0, NULL } + +#define triton_buffer_cptr(__buf) ((__buf)->cptr) + +static inline void triton_buffer_ptr_reset(triton_buffer_t *buffer) +{ + buffer->cptr = buffer->buffer; +} + +inline static triton_ret_t triton_buffer_alloc(triton_buffer_t *buffer, int64_t size) +{ + assert(buffer); + buffer->buffer = malloc(size); + if(!buffer->buffer) + { + return TRITON_ERR_NOMEM; + } + buffer->size = size; + triton_buffer_ptr_reset(buffer); + return TRITON_SUCCESS; +} + +static inline void triton_buffer_free(triton_buffer_t *buffer) +{ + if(buffer && buffer->buffer) free(buffer->buffer); + buffer->buffer = NULL; + buffer->cptr = NULL; + buffer->size = 0; +} + +/* The buffer_check_overflow macro verfies that the current buffer pointer is not + * at the end of the buffer, and that there's enough space left for __inc bytes. + */ +#define triton_buffer_check_overflow(__buf, __inc) do { \ + if((__buf)->size < (((__buf)->cptr) - (__buf)->buffer) + (__inc)) \ + { \ + return TRITON_ERR_OVERFLOW; \ + } \ +} while(0) + +/* Increment the current buffer pointer */ +#define triton_buffer_inc(__buf, __inc) do { \ + (__buf)->cptr+=(__inc); \ +} while(0) + +#endif /* __TRITON_BUFFER_H__ */ diff --git a/code/src/common/triton-debug.c b/code/src/common/triton-debug.c new file mode 100644 index 0000000..61c8d7b --- /dev/null +++ b/code/src/common/triton-debug.c @@ -0,0 +1,323 @@ + +#include "src/common/triton-debug.h" +#include "src/common/triton-hash.h" +#include <stdio.h> + +static struct triton_hash_table *triton_debug_mask_table; + +uint64_t triton_debug_enabled_major = 0; +uint32_t triton_debug_enabled_all = 0; +uint32_t triton_debug_enabled_none = 1; +TRITON_BITARRAY_VARDEF(triton_debug_enabled_minor, TRITON_DEBUG_MAXSIZE); + +static FILE *triton_debug_fp = NULL; +static char *triton_debug_enabled_str = NULL; + +static uint64_t triton_debug_major_mask_count = 0; +static uint64_t triton_debug_mask_count = 0; +static triton_mutex_t triton_debug_mutex = TRITON_MUTEX_INITIALIZER; + +struct triton_debug_mask_entry +{ + char *mask; + uint64_t value; + struct triton_hash_link link; +}; + +static int triton_debug_compare(void *k, struct triton_hash_link *llink) +{ + return !strcmp((char *)k, ((struct triton_debug_mask_entry *)llink)->mask); +} + +triton_ret_t triton_debug_init(void) +{ + triton_debug_mask_table = triton_hash_init(triton_debug_compare, triton_hash_strhash, 1023); + if(!triton_debug_mask_table) + { + return TRITON_ERR_NOMEM; + } +} + +static triton_ret_t triton_idebug_add_mask(int major, char *str, uint32_t *value) +{ + uint32_t tmpval; + struct triton_hash_link *llink; + struct triton_debug_mask_entry *entry; + triton_mutex_lock(&triton_debug_mutex); + llink = triton_hash_search(triton_debug_mask_table, str); + triton_mutex_unlock(&triton_debug_mutex); + if(llink) + { + entry = triton_hash_get_entry(llink, struct triton_debug_mask_entry, link); + assert(entry); + *value = entry->value; + } + else + { + if(major) + { + if(triton_debug_major_mask_count >= 64) + { + return TRITON_ERR_OVERFLOW; + } + tmpval = triton_debug_major_mask_count; + triton_mutex_lock(&triton_debug_mutex); + triton_debug_major_mask_count++; + triton_mutex_unlock(&triton_debug_mutex); + } + else + { + if(triton_debug_mask_count >= (TRITON_DEBUG_MAXSIZE - 1)) + { + return TRITON_ERR_OVERFLOW; + } + tmpval = triton_debug_mask_count; + triton_mutex_lock(&triton_debug_mutex); + triton_debug_mask_count++; + triton_mutex_unlock(&triton_debug_mutex); + } + + entry = malloc(sizeof(*entry)); + if(!entry) + { + return TRITON_ERR_NOMEM; + } + + entry->mask = strdup(str); + if(!entry->mask) + { + free(entry); + return TRITON_ERR_NOMEM; + } + + entry->value = tmpval; + + triton_mutex_lock(&triton_debug_mutex); + triton_hash_add(triton_debug_mask_table, entry->mask, &entry->link); + triton_mutex_unlock(&triton_debug_mutex); + *value = tmpval; + } + return TRITON_SUCCESS; +} + +static triton_ret_t triton_debug_split_string(const char *mask_string, char **strings) +{ + char *tmpstr, *s; + + tmpstr = strdup(mask_string); + if(!tmpstr) + { + return TRITON_ERR_NOMEM; + } + + strings[0] = strdup(tmpstr); + if(strings[0] == NULL) + { + free(tmpstr); + return TRITON_ERR_NOMEM; + } + + s = rindex(tmpstr, '.'); + if(s == NULL) + { + strings[1] = NULL; + strings[2] = NULL; + free(tmpstr); + return TRITON_SUCCESS; + } + + *s = '\0'; + strings[1] = strdup(tmpstr); + if(strings[1] == NULL) + { + free(strings[0]); + free(tmpstr); + return TRITON_ERR_NOMEM; + } + + s = rindex(tmpstr, '.'); + if(s == NULL) + { + strings[2] = NULL; + free(tmpstr); + return TRITON_SUCCESS; + } + + *s = '\0'; + strings[2] = strdup(tmpstr); + if(strings[2] == NULL) + { + free(strings[1]); + free(strings[0]); + free(tmpstr); + return TRITON_ERR_NOMEM; + } + + free(tmpstr); + return TRITON_SUCCESS; +} + +triton_ret_t triton_debug_add_mask(const char *mask_string, triton_debug_mask_t *mask) +{ + char *masks[3]; + triton_ret_t ret; + + /* split string */ + ret = triton_debug_split_string(mask_string, masks); + if(ret != TRITON_SUCCESS) + { + return ret; + } + + mask->sub = 0; + mask->minor = 0; + mask->major = 0; + + ret = triton_idebug_add_mask(0, masks[0], &mask->sub); + if(ret != TRITON_SUCCESS) + { + return ret; + } + + if(masks[1] == NULL) + { + return TRITON_SUCCESS; + } + + ret = triton_idebug_add_mask(0, masks[1], &mask->minor); + if(ret != TRITON_SUCCESS) + { + return ret; + } + + if(masks[2] == NULL) + { + return TRITON_SUCCESS; + } + + ret = triton_idebug_add_mask(1, masks[2], &mask->major); + if(ret != TRITON_SUCCESS) + { + return ret; + } + + return TRITON_SUCCESS; +} + +triton_ret_t triton_debug_print(const char *message, va_list ap) +{ + triton_ret_t error = TRITON_SUCCESS; + + if(vfprintf(triton_debug_fp, message, ap) < 0) + { + error = triton_error_from_errno(errno); + } + + return error; +} + +triton_ret_t triton_debug_enable(const char *file, const char *masks) +{ + char *tmpmasks; + int done; + + if(triton_debug_fp != NULL) + { + fclose(triton_debug_fp); + } + triton_debug_fp = fopen(file, "w"); + if(!triton_debug_fp) + { + return triton_error_from_errno(errno); + } + + if(!strcasecmp(masks, "all")) + { + triton_debug_enabled_none = 0; + triton_bitarray_clear(triton_debug_enabled_minor, TRITON_DEBUG_MAXSIZE); + triton_debug_enabled_all = 1; + return TRITON_SUCCESS; + } + + if(!strcasecmp(masks, "none")) + { + triton_debug_enabled_all = 0; + triton_bitarray_clear(triton_debug_enabled_minor, TRITON_DEBUG_MAXSIZE); + triton_debug_enabled_none = 1; + return TRITON_SUCCESS; + } + + /* split masks at commas */ + tmpmasks = strdup(masks); + if(!tmpmasks) + { + return TRITON_ERR_NOMEM; + } + + done = 0; + do + { + char *s; + int negate = 0; + struct triton_hash_link *llink; + struct triton_debug_mask_entry *entry; + + s = rindex(tmpmasks, ','); + if(s == NULL) + { + /* last one */ + s = tmpmasks; + done = 1; + } + else + { + /* not just one */ + *s = '\0'; + s++; + } + + if(*s == '-') + { + s++; + negate = 1; + } + + llink = triton_hash_search(triton_debug_mask_table, s); + if(!llink) + { + /* unknown mask */ + free(tmpmasks); + return triton_error_wrap(TRITON_ERR_INVAL, "Unknown debug mask '%s'", s); + } + entry = triton_hash_get_entry(llink, struct triton_debug_mask_entry, link); + assert(entry); + + if(negate) + { + triton_bitarray_unset(triton_debug_enabled_minor, entry->value); + } + else + { + triton_bitarray_set(triton_debug_enabled_minor, entry->value); + } + + } while(!done); + + free(tmpmasks); + if(triton_debug_enabled_str) + { + free(triton_debug_enabled_str); + } + triton_debug_enabled_str = strdup(masks); + + return TRITON_SUCCESS; +} + +void triton_debug_disable(void) +{ + fclose(triton_debug_fp); + triton_debug_fp = NULL; + triton_debug_enabled_none = 1; + triton_debug_enabled_all = 0; + triton_bitarray_clear(triton_debug_enabled_minor, TRITON_DEBUG_MAXSIZE); +} diff --git a/code/src/common/triton-debug.h b/code/src/common/triton-debug.h new file mode 100644 index 0000000..3f87113 --- /dev/null +++ b/code/src/common/triton-debug.h @@ -0,0 +1,107 @@ +#ifndef __TRITON_DEBUG_H__ +#define __TRITON_DEBUG_H__ + +#include "src/common/triton-types.h" +#include "src/common/triton-error.h" +#include "src/common/triton-bitarray.h" + +typedef struct +{ + uint32_t major; + uint32_t minor; + uint32_t sub; +} triton_debug_mask_t; + +triton_ret_t triton_debug_init(void); +void triton_debug_finalize(void); + +/** + * Add a mask to the debugging system. A debug mask is a string consisting of + * '.' separated components, allowing for a heirarchy within components. + * For example, one might add the following masks: + * + * "net.send.unexpected" + * "net.send.expected" + * "net.recv" + * + * This allows debugging to be enabled for all of net, just net.send, or + * just net.send.expected + * + * The handle to the mask (a 32 bit intereger) is handed to future debugging + * calls. If the same mask has already been added, the same mask handle is returned. + */ +triton_ret_t triton_debug_add_mask(const char *mask_str, triton_debug_mask_t *mask); + +/** + * Enable debugging for certain components. The mask string is + * a comma separated list of components, each component can have multiple sub-components. + * For example: + * + * triton_debug_enable("net,cosd"); + * + * Some default groups are already defined: + * "all" - enables all masks + * "none" - disables all masks + * + * Returns TRITON_SUCCESS if debugging was successfully enabled with output going + * to the specified file, or a failure on error. + */ +triton_ret_t triton_debug_enable(const char *file, const char *masks); + +#define triton_debug_stderr_enable(__mask) triton_debug_enable("/dev/stderr", __mask) +#define triton_debug_stdout_enable(__mask) triton_debug_enable("/dev/stdout", __mask) + +triton_ret_t triton_debug_print(const char *format, va_list ap); + +struct triton_debug_mask_minor +{ + uint32_t all; + uint32_t sub; +}; + +/* The number of 64 bit elements in the bit field for minor and sub masks */ +#define TRITON_DEBUG_MAXSIZE 4 + +extern uint64_t triton_debug_enabled_major; +extern uint32_t triton_debug_enabled_all; +extern uint32_t triton_debug_enabled_none; +extern TRITON_BITARRAY_VARDECL(triton_debug_enabled_minor); + +/** + * Debugging is used by developers during development when writing code + * and debugging their code in distributed environments. It is not + * meant for providing information to end-users. + */ +#ifndef NDEBUG +static inline triton_ret_t triton_debug(triton_debug_mask_t mask, const char *format, ...) +{ + /* if none are enabled, return without doing mask lookup, also, + * if major isn't enabled, don't bother with lookup + */ + if(triton_debug_enabled_none) + { + return TRITON_SUCCESS; + } + + /* if enabled, print */ + if(triton_debug_enabled_all || + triton_debug_enabled_major & (1 << mask.major) || + triton_bitarray_is_set(triton_debug_enabled_minor, mask.minor) || + triton_bitarray_is_set(triton_debug_enabled_minor, mask.sub)) + { + va_list ap; + triton_ret_t ret; + va_start(ap, format); + ret = triton_debug_print(format, ap); + va_end(ap); + return ret; + } + return TRITON_SUCCESS; +} +#else +#define triton_debug(mask, message, ...) TRITON_SUCCESS +#endif + +void triton_debug_disable(void); + +#endif diff --git a/code/src/common/triton-error.c b/code/src/common/triton-error.c new file mode 100644 index 0000000..ae94224 --- /dev/null +++ b/code/src/common/triton-error.c @@ -0,0 +1,160 @@ + +#include <stdarg.h> +#include "src/common/triton-error.h" + +TRITON_ERROR_DEF(ERR_NULL, -1, "Null"); + +TRITON_ERROR_DEF(SUCCESS, 0, "Success"); + +/* Note: while some of the error definitions match system error numbers, that is only for convenience. + * Please only add error definitions for errors that you need. You can use names that match pre-existing + * system error numbers, or create a new name for your error. + * + * The numbers specify the triton_error_code value, they don't directly refer to system error numbers, + * as system error numbers differ across platorms. The triton_error_to_errno function should map all + * known error codes to reasonable system error numbers. If no good mapping exists, the value -1 + * will be returned. + */ +TRITON_ERROR_DEF(ERR_NOMEM, 1, "Out of memory"); +TRITON_ERROR_DEF(ERR_INVAL, 2, "Invalid argument"); +TRITON_ERROR_DEF(ERR_FAULT, 3, "Bad address"); +TRITON_ERROR_DEF(ERR_CANCEL, 4, "Canceled"); +TRITON_ERROR_DEF(ERR_NOSYS, 5, "Not implemented"); +TRITON_ERROR_DEF(ERR_OVERFLOW, 6, "Overflow"); +TRITON_ERROR_DEF(ERR_SERVICE_NOTFOUND, 7, "Service not found"); +TRITON_ERROR_DEF(ERR_MSG_METHOD_NOTFOUND, 8, "The message method was not found"); + +/* Used for errors where no mapping from an error number exists */ +TRITON_ERROR_DEF(ERR_UNKNOWN, 4242, "Unknown"); + +/* Used when the error chain gets too long */ +TRITON_ERROR_DEF(ERR_MAX, 4243, "Error Limit Reached"); + +triton_ret_t triton_error_from_errno(int errno_val) +{ + switch(errno_val) + { + case ENOMEM: return TRITON_ERR_NOMEM; + case EINVAL: return TRITON_ERR_INVAL; + case EFAULT: return TRITON_ERR_FAULT; + case ECANCELED: return TRITON_ERR_CANCEL; + case ENOSYS: return TRITON_ERR_NOSYS; + default: return TRITON_ERR_UNKNOWN; + } + return TRITON_ERR_UNKNOWN; +} + +static inline triton_ret_t error_wrap_va( + triton_ret_t parent, + triton_error_code_t error_code, + const char *format, + va_list ap) +{ + triton_ret_t ret; + triton_ret_t err; + + if(parent->error_code == TRITON_ERR_MAX_CODE) + { + return parent; + } + if(parent->count >= TRITON_MAX_ERRORS) + { + error_code = TRITON_ERR_MAX_CODE; + } + + err = malloc(sizeof(*err)); + if(!err) + { + /* we got an ENOMEM while trying to create an error...just return unknown */ + return TRITON_ERR_UNKNOWN; + } + + err->node = triton_node_self(TRITON_MSG_CTX_DEFAULT); + err->error_code = error_code; + triton_string_set_null(&err->message); + err->base = parent; + err->count = parent->count + 1; + + if(format) + { + triton_string_init(&err->message, format, ap); + } + + return err; +} + +triton_ret_t triton_error_wrap(triton_ret_t parent, const char *format, ...) +{ + triton_ret_t ret; + va_list ap; + va_start(ap, format); + ret = error_wrap_va(parent, parent->error_code, format, ap); + va_end(ap); + return ret; +} + +triton_ret_t triton_error_wrap_with_code(triton_ret_t parent, triton_error_code_t error_code, const char *format, ...) +{ + triton_ret_t ret; + va_list ap; + va_start(ap, format); + ret = error_wrap_va(parent, error_code, format, ap); + va_end(ap); + return ret; +} + +/** + * Free an error that was created with triton_error_wrap. + */ +void triton_error_destroy(triton_ret_t error) +{ + triton_ret_t tmperr1, tmperr2; + + if(error) + { + while(tmperr1->count > 0 && tmperr1->base != NULL) + { + tmperr2 = tmperr1->base; + triton_string_destroy(&tmperr1->message); + free(tmperr1); + tmperr1->base = NULL; + } + } + return; +} + +triton_ret_t triton_error_to_strings(triton_ret_t error, triton_string_t **strings, int *count) +{ + triton_ret_t tmperr; + triton_string_t *strs; + int ind = 0; + int i; + + assert(count && strings); + *count = error->count + 1; + strs = malloc(sizeof(triton_string_t) * (*count)); + if(!*strings) + { + return TRITON_ERR_NOMEM; + } + memset(strs, 0, sizeof(triton_string_t) * (*count)); + + tmperr = error; + while(tmperr != TRITON_ERR_NULL) + { + triton_string_t *nodestr = triton_node_to_string(TRITON_MSG_CTX_DEFAULT, tmperr->node); + triton_string_init(&strs[ind], "{%s} %s", triton_string_get(nodestr), triton_string_get(&tmperr->message)); + triton_string_destroy(nodestr); + tmperr = tmperr->base; + } + *strings = strs; + return TRITON_SUCCESS; + +free_strs: + for(i = 0; i < *count; ++i) + { + triton_string_destroy(&strs[i]); + } + free(strs); + return TRITON_ERR_NOMEM; +} diff --git a/code/src/common/triton-error.h b/code/src/common/triton-error.h new file mode 100644 index 0000000..5d60649 --- /dev/null +++ b/code/src/common/triton-error.h @@ -0,0 +1,103 @@ +#ifndef __TRITON_ERROR_H__ +#define __TRITON_ERROR_H__ + +#include <errno.h> + +#include "src/common/triton-types.h" +#include "src/common/triton-string.h" +#include "src/net/triton-node.h" + +/* The number of errors that can be chained together to form a single error */ +#define TRITON_MAX_ERRORS 256 + +typedef int32_t triton_error_code_t; + +/** + * The error type allows errors to be wrapped in an error type, useful + * for managing error codes, logging errors in a consistent format, and + * later finger-pointing of errors. This structure and the + * companion error interfaces should be used throughout the entire framework. + * Errors in responses should + * be in the triton_ret_t format, and errors from resources and other components + * should use this type as well. + * The error structure consists of a single error code for the + * error, the source node where the error is generated, and optional error + * messages. + */ + +typedef struct triton_error *triton_ret_t; + +struct triton_error +{ + triton_node_t node; + triton_error_code_t error_code; + triton_string_t message; + int count; + triton_ret_t base; +}; + + +#define TRITON_ERROR_DECL(__name__) \ +extern triton_error_code_t TRITON_##__name__##_CODE; \ +extern struct triton_error static_triton_##__name__; \ +extern triton_ret_t TRITON_##__name__ + +#define TRITON_ERROR_DEF(__name__, __val__, __msg__) \ +triton_error_code_t TRITON_##__name__##_CODE = __val__; \ +struct triton_error static_triton_##__name__ = { TRITON_NODE_NULL_STATIC_INITIALIZER, __val__, triton_string_init_const(__msg__), 0, NULL}; \ +triton_ret_t TRITON_##__name__ = &static_triton_##__name__ + +TRITON_ERROR_DECL(ERR_NULL); + +TRITON_ERROR_DECL(SUCCESS); +TRITON_ERROR_DECL(ERR_NOMEM); +TRITON_ERROR_DECL(ERR_INVAL); +TRITON_ERROR_DECL(ERR_FAULT); +TRITON_ERROR_DECL(ERR_CANCEL); +TRITON_ERROR_DECL(ERR_NOSYS); +TRITON_ERROR_DECL(ERR_OVERFLOW); +TRITON_ERROR_DECL(ERR_SERVICE_NOTFOUND); +TRITON_ERROR_DECL(ERR_MSG_METHOD_NOTFOUND); + +TRITON_ERROR_DECL(ERR_UNKNOWN); + +/** + * Get the error pointer of a given errno. If the errno is not known, just return + * an unknown error pointer. + */ +triton_ret_t triton_error_from_errno(int errno_val); + +/** + * Get the base error pointer from an error code. If the error code isn't known, just return + * an unknown error pointer. + */ +triton_ret_t triton_error_from_error_code(triton_error_code_t ec); + +/** + * Create a triton_ret_t type from a base error, and include a message + * about the error. The returned error structure is a heap variable, + * a companion call to triton_error_destroy is required. + * + * This function allows errors to be chained, allowing for proper + * finger pointer as errors are passed from node to node. + * + * If no terminal error already exists, TRITON_ERR_NULL should be used. + */ +triton_ret_t triton_error_wrap( + triton_ret_t terminal, + const char *message, /** An optional message to add to the error */ + ...); + +triton_ret_t triton_error_wrap_with_code( + triton_ret_t terminal, + triton_error_code_t error_code, + const char *format, ...); + +/** + * Free an error that was created with triton_error_wrap. + */ +void triton_error_destroy(triton_ret_t error); + +triton_ret_t triton_error_to_strings(triton_ret_t error, triton_string_t **error_strings, int *count); + +#endif /* __TRITON_ERROR_H__ */ diff --git a/code/src/common/triton-error.h1 b/code/src/common/triton-error.h1 new file mode 100644 index 0000000..19e3a09 --- /dev/null +++ b/code/src/common/triton-error.h1 @@ -0,0 +1,93 @@ +#ifndef __TRITON_ERROR_H__ +#define __TRITON_ERROR_H__ + +#include <errno.h> + +#include "src/common/triton-types.h" +#include "src/common/triton-string.h" +#include "src/net/triton-node.h" + +/* The number of errors that can be chained together to form a single error */ +#define TRITON_MAX_ERRORS 256 + +typedef int32_t triton_error_code_t; + +/** + * The error type allows errors to be wrapped in an error type, useful + * for managing error codes, logging errors in a consistent format, and + * later finger-pointing of errors. This structure and the + * companion error interfaces should be used throughout the entire framework. + * Errors in responses should + * be in the triton_ret_t format, and errors from resources and other components + * should use this type as well. + * The error structure consists of a single error code for the + * error, the source node where the error is generated, and optional error + * messages. + */ + +typedef struct triton_error *triton_ret_t; +__remote struct triton_error +{ + triton_node_t node; + triton_error_code_t error_code; + triton_string_t message; + int count; + triton_ret_t base; +}; + +#define TRITON_ERROR_DECL(__name__) \ +extern triton_error_code_t TRITON_##__name__##_CODE; \ +extern struct triton_error static_triton_##__name__; \ +extern triton_ret_t TRITON_##__name__ + +#define TRITON_ERROR_DEF(__name__, __val__, __msg__) \ +triton_error_code_t TRITON_##__name__##_CODE = __val__; \ +struct triton_error static_triton_##__name__ = { TRITON_NODE_NULL, __val__, triton_string_init_const(__msg__), 0, NULL}; \ +triton_ret_t TRITON_##__name__ = &static_triton_##__name__ + +TRITON_ERROR_DECL(ERR_NULL); + +TRITON_ERROR_DECL(SUCCESS); +TRITON_ERROR_DECL(ERR_NOMEM); +TRITON_ERROR_DECL(ERR_INVAL); +TRITON_ERROR_DECL(ERR_FAULT); +TRITON_ERROR_DECL(ERR_CANCEL); +TRITON_ERROR_DECL(ERR_NOSYS); +TRITON_ERROR_DECL(ERR_OVERFLOW); + +TRITON_ERROR_DECL(ERR_UNKNOWN); + +/** + * Get the error pointer of a given errno. If the errno is not known, just return + * an unknown error pointer. + */ +triton_ret_t triton_error_from_errno(int errno_val); + +/** + * Create a triton_ret_t type from a base error, and include a message + * about the error. The returned error structure is a heap variable, + * a companion call to triton_error_destroy is required. + * + * This function allows errors to be chained, allowing for proper + * finger pointer as errors are passed from node to node. + * + * If no terminal error already exists, TRITON_ERR_NULL should be used. + */ +triton_ret_t triton_error_wrap( + triton_ret_t terminal, + const char *message, /** An optional message to add to the error */ + ...); + +triton_ret_t triton_error_wrap_with_code( + triton_ret_t terminal, + triton_error_code_t error_code, + const char *format, ...); + +/** + * Free an error that was created with triton_error_wrap. + */ +void triton_error_destroy(triton_ret_t error); + +triton_ret_t triton_error_to_strings(triton_ret_t error, triton_string_t **error_strings, int *count); + +#endif /* __TRITON_ERROR_H__ */ diff --git a/code/src/common/triton-hash.h b/code/src/common/triton-hash.h new file mode 100644 index 0000000..2acd360 --- /dev/null +++ b/code/src/common/triton-hash.h @@ -0,0 +1,291 @@ +/* 2001 Clemson University and The University of Chicago + * + * See COPYING in top-level directory. + */ + +#ifndef TRITON_HASH_H +#define TRITON_HASH_H + +#include "src/common/triton-list.h" +#include "src/common/triton-thread.h" +#include "src/common/jenkins-hash.h" + +#define triton_hash_link triton_list_link +#define triton_hash_get_entry triton_list_get_entry + +struct triton_hash_table +{ + triton_list_t *array; + int table_size; + int (*compare) (void *key, struct triton_hash_link * link); + int (*hash) (void *key, int table_size); + triton_mutex_t lock; +}; + +/* triton_hash_init() + * + * creates a new hash table with the specified table size. The + * hash function and compare function must be provided. + * table_size should be a good prime number. + * + * returns pointer to table on success, NULL on failure + */ +static inline struct triton_hash_table *triton_hash_init( + int (*compare) (void *key, + struct triton_hash_link * link), + int (*hash) (void *key, + int table_size), + int table_size) +{ + int i = 0; + struct triton_hash_table *new_table = NULL; + + /* create struct to contain table information */ + new_table = (struct triton_hash_table *)malloc(sizeof(struct triton_hash_table)); + if (!new_table) + { + return (NULL); + } + + /* fill in info */ + new_table->compare = compare; + new_table->hash = hash; + new_table->table_size = table_size; + + /* create array for actual table */ + new_table->array = (struct triton_list *) + malloc(sizeof(struct triton_list) * table_size); + if (!new_table->array) + { + free(new_table); + return (NULL); + } + + /* initialize a doubly linked at each hash table index */ + for (i = 0; i < table_size; i++) + { + triton_list_init(&new_table->array[i]); + } + + /* initialize mutex lock */ + triton_mutex_init(&new_table->lock, NULL); + + return (new_table); +} + + +/* triton_hash_finalize() + * + * frees any resources created by the hash table + * + * no return value + */ +static inline void triton_hash_finalize( + struct triton_hash_table *old_table) +{ + free(old_table->array); + free(old_table); + return; +} + +/* triton_hash_add() + * + * adds a new link onto the hash table, hashes based on given key + * + * no return value + */ +static inline void triton_hash_add( + struct triton_hash_table *table, + void *key, + struct triton_hash_link *llink) +{ + int hindex = 0; + + /* hash on the key */ + hindex = table->hash(key, table->table_size); + + /* add to the tail of the linked list at that offset */ + triton_mutex_lock(&table->lock); + triton_list_add_back(llink, &(table->array[hindex])); + triton_mutex_unlock(&table->lock); + + return; +} + +/* triton_hash_search() + * + * searches for a link in the hash table + * that matches the given key + * + * returns pointer to link on success, NULL on failure (or item + * not found) + */ +static inline struct triton_hash_link *triton_hash_search( + struct triton_hash_table *table, + void *key) +{ + int hindex = 0; + struct triton_hash_link *tmp_link, *safe; + + /* find the hash value */ + hindex = table->hash(key, table->table_size); + + /* linear search at hindex to find match */ + triton_mutex_lock(&table->lock); + triton_list_for_each(tmp_link, safe, &(table->array[hindex])) + { + if (table->compare(key, tmp_link)) + { + triton_mutex_unlock(&table->lock); + return (tmp_link); + } + } + triton_mutex_unlock(&table->lock); + return (NULL); +} + +/* triton_hash_search_at_index() + * + * searches for a link in the list matching + * the specified index + * + * returns pointer to link on success, NULL on failure (or item + * not found) + */ +static inline struct triton_hash_link *triton_hash_search_at_index( + struct triton_hash_table *table, + int hindex) +{ + struct triton_hash_link *tmp_link, *safe; + + if(hindex >= table->table_size) + { + return NULL; + } + + triton_mutex_lock(&table->lock); + triton_list_for_each(tmp_link, safe, &(table->array[hindex])) + { + triton_mutex_unlock(&table->lock); + return (tmp_link); + } + triton_mutex_unlock(&table->lock); + return (NULL); +} + +/* triton_hash_search_and_remove() + * + * searches for and removes a link in the hash table + * that matches the given key + * + * returns pointer to link on success, NULL on failure (or item + * not found). On success, link is removed from hashtable. + */ +static inline struct triton_hash_link *triton_hash_search_and_remove( + struct triton_hash_table *table, + void *key) +{ + int hindex = 0; + struct triton_hash_link *tmp_link, *safe; + + /* find the hash value */ + hindex = table->hash(key, table->table_size); + + /* linear search at hindex to find match */ + triton_mutex_lock(&table->lock); + triton_list_for_each(tmp_link, safe, &(table->array[hindex])) + { + if (table->compare(key, tmp_link)) + { + triton_list_del(tmp_link); + triton_mutex_unlock(&table->lock); + return (tmp_link); + } + } + triton_mutex_unlock(&table->lock); + return (NULL); +} + +/* triton_hash_search_and_remove_at_index() + * + * searches for and removes the first link in the list + * matching the specified index + * + * returns pointer to link on success, NULL on failure (or item + * not found). On success, link is removed from hashtable. + */ +static inline struct triton_hash_link *triton_hash_search_and_remove_at_index( + struct triton_hash_table *table, + int hindex) +{ + struct triton_hash_link *tmp_link, *safe; + + if(hindex >= table->table_size) + { + return NULL; + } + + triton_mutex_lock(&table->lock); + triton_list_for_each(tmp_link, safe, &(table->array[hindex])) + { + triton_list_del(tmp_link); + triton_mutex_unlock(&table->lock); + return (tmp_link); + } + triton_mutex_unlock(&table->lock); + return (NULL); +} + +#define triton_hash_destroy_and_finalize( \ + _oldtable, _entry_type, _link, _destructor) \ + do \ + { \ + int i = 0; \ + struct triton_list_link *entry; \ + struct triton_list_link *tmpe; \ + triton_mutex_lock(&_oldtable->lock); \ + for(i = 0; i < _oldtable->table_size; ++i) \ + { \ + triton_list_for_each(entry, tmpe, &(_oldtable->array[i])) \ + { \ + triton_list_del(entry); \ + _destructor(triton_hash_get_entry(entry, _entry_type, _link)); \ + } \ + } \ + triton_mutex_unlock(&_oldtable->lock); \ + \ + triton_hash_finalize(_oldtable); \ + \ + } while(0) + +static inline int triton_hash_32bit_hash(void *k, int table_size) +{ + uint32_t pc = 0, pb = 0; + bj_hashlittle2(k, 4, &pc, &pb); + return pc & (table_size - 1); +} + +static inline int triton_hash_64bit_hash(void *k, int table_size) +{ + uint32_t pc = 0, pb = 0; + bj_hashlittle2(k, 8, &pc, &pb); + return (int) (pc & (table_size - 1)); +} + +static inline int triton_hash_strhash(void *k, int table_size) +{ + uint32_t pc = 0, pb = 0; + bj_hashlittle2(k, strlen((char *)k), &pc, &pb); + return pc & (table_size - 1); +} + +#endif /* TRITON_HASH_H */ + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/common/triton-list.h b/code/src/common/triton-list.h new file mode 100644 index 0000000..7a2fdde --- /dev/null +++ b/code/src/common/triton-list.h @@ -0,0 +1,218 @@ +#ifndef __TRITON_LIST_H__ +#define __TRITON_LIST_H__ + +#include "src/common/triton-base.h" + +typedef struct triton_list triton_list_t; + +typedef struct triton_list_link +{ + triton_list_t *inlist; + struct triton_list_link *next; + struct triton_list_link *prev; +} triton_list_link_t; + +struct triton_list +{ + struct triton_list_link entries; + uint64_t count; +}; + +#define triton_list_tolink(__list) (&(__list)->entries) + +#define TRITON_LIST_NULL { { NULL, NULL, NULL }, 0 } + +#define TRITON_LIST_STATIC_INITIALIZER(name) { { &name, &(name.entries), &(name.entries) }, 0 } + +#define TRITON_LIST_DEFINE(name) \ + triton_list_t name = TRITON_LIST_STATIC_INITIALIZER(name) + +static inline void triton_list_link_clear(triton_list_link_t *llink) +{ + ((struct triton_list_link *)llink)->inlist = NULL; + ((struct triton_list_link *)llink)->next = NULL; + ((struct triton_list_link *)llink)->prev = NULL; +} + +static inline void triton_list_init(triton_list_t *list) +{ + list->entries.next = (struct triton_list_link *)&list->entries; + list->entries.prev = (struct triton_list_link *)&list->entries; + list->count = 0; +} + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal triton_list manipulation where we know + * the prev/next entries already! + */ +static inline void __triton_list_add(struct triton_list_link * new, + struct triton_list_link * prev, + struct triton_list_link * next) +{ + assert(new->inlist == NULL); + assert(new->next == NULL && new->prev == NULL); + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +static inline void triton_list_add_front( + triton_list_link_t *new, triton_list_t *list) +{ + __triton_list_add(new, &list->entries, list->entries.next); + new->inlist = list; + list->count++; +} + +static inline void triton_list_add_back( + triton_list_link_t *new, triton_list_t *list) +{ + __triton_list_add(new, list->entries.prev, &list->entries); + new->inlist = list; + list->count++; +} + +static inline void __triton_list_del(struct triton_list_link * prev, + struct triton_list_link * next) +{ + next->prev = prev; + prev->next = next; +} + +static inline void triton_list_del(struct triton_list_link *entry) +{ + assert(entry->prev != NULL && entry->next != NULL); + __triton_list_del(entry->prev, entry->next); + entry->prev = NULL; entry->next = NULL; + entry->inlist->count--; + entry->inlist = NULL; +} + +static inline int triton_list_empty(triton_list_t *list) +{ + return list->count == 0; +} + +static inline uint64_t triton_list_count(triton_list_t *list) +{ + return list->count; +} + +#define triton_list_get_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)((&((type *)0)->member)))) + +/** + * triton_list_for_each - iterate over a list safe against removal of list entry + * @pos: the struct triton_list_link * to use as a loop counter. + */ +#define triton_list_for_each(__pos, __scratch, __list) \ + for (__pos = (triton_list_tolink(__list))->next, \ + __scratch = (triton_list_tolink(__list))->next->next; \ + __pos != (triton_list_tolink(__list)); \ + __pos = __scratch, __scratch = (__pos)->next) + + +/** + * triton_list_for_each_entry - + * iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define triton_list_for_each_entry(__pos, __scratch, __list, __member) \ + for (__pos = triton_list_get_entry((triton_list_tolink(__list))->next, typeof(*__pos), __member), \ + __scratch = triton_list_get_entry((triton_list_tolink(__list))->next->next, typeof(*__scratch), __member); \ + (__pos) && (&(__pos)->__member != (triton_list_tolink(__list))); \ + __pos = __scratch, \ + __scratch = triton_list_get_entry((__pos)->__member.next, typeof(*__scratch), __member)) + +static inline int triton_list_exists(triton_list_t *list, struct triton_list_link *llink) +{ + struct triton_list_link *mypos, *safe; + triton_list_for_each(mypos, safe, list) + { + if(mypos == llink) + { + return 1; + } + } + return 0; +} + +static inline struct triton_list_link * triton_list_find( + triton_list_t *list, + int (*compare)(struct triton_list_link *, void *), + void *ptr) +{ + struct triton_list_link *pos, *safe; + triton_list_for_each(pos, safe, list) + { + if(compare(pos, ptr)) + { + return pos; + } + } + return NULL; +} + +static inline void triton_list_insert_after( + triton_list_link_t *new, + triton_list_link_t *after, + triton_list_t *list) +{ + assert(new->inlist == NULL); + assert(new->next == NULL && new->prev == NULL); + assert(after->inlist == list); + __triton_list_add(new, after, after->next); + new->inlist = list; + list->count++; +} + +static inline void triton_list_insert_before( + triton_list_link_t *new, + triton_list_link_t *before, + triton_list_t *list) +{ + assert(new->inlist == NULL); + assert(new->next == NULL && new->prev == NULL); + assert(before->inlist == list); + __triton_list_add(new, before->prev, before); + new->inlist = list; + list->count++; +} + +static inline struct triton_list_link * __triton_list_del_front(triton_list_t *list) +{ + struct triton_list_link *entry = list->entries.next; + if(triton_list_empty(list)) return NULL; + triton_list_del(list->entries.next); + return entry; +} + +static inline struct triton_list_link *__triton_list_peek_front(triton_list_t *list) +{ + if(triton_list_empty(list)) return NULL; + return list->entries.next; +} + +#define triton_queue_enqueue(__entry, __list) triton_list_add_back((__entry), (__list)) +#define triton_queue_dequeue(__list) __triton_list_del_front(__list) +#define triton_queue_peek(__list) __triton_list_peek_front(__list) + +#define triton_stack_push(__entry, __list) triton_list_add_front((__entry), (__list)) +#define triton_stack_pop(__list) __triton_list_del_front(__list) +#define triton_stack_peek(__list) __triton_list_peek_front(__list) + +#endif /* __TRITON_LIST_H__ */ + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/common/triton-log.c b/code/src/common/triton-log.c new file mode 100644 index 0000000..c3f4dc0 --- /dev/null +++ b/code/src/common/triton-log.c @@ -0,0 +1,40 @@ + +#include "src/common/triton-log.h" + +struct triton_log +{ + char *name; + FILE *f; +}; + +triton_log_t triton_log_default; + +triton_log_t triton_log_enable_syslog(const char *name) +{ + return NULL; +} + +triton_log_t triton_log_enable_file(const char *name, const char *logfile, const char *mode) +{ + return NULL; +} + +void triton_log_disable(triton_log_t log) +{ +} + +void triton_log_set_level(triton_log_t log, enum triton_log_level level) +{ + + +} + +triton_ret_t triton_log(triton_log_t log, enum triton_log_level level, const char *message, ...) +{ + return TRITON_ERR_NOSYS; +} + +triton_ret_t triton_log_error(triton_log_t log, triton_ret_t error, const char *message, ...) +{ + return TRITON_ERR_NOSYS; +} diff --git a/code/src/common/triton-log.h b/code/src/common/triton-log.h new file mode 100644 index 0000000..056c1f9 --- /dev/null +++ b/code/src/common/triton-log.h @@ -0,0 +1,82 @@ +#ifndef __TRITON_LOG_H__ +#define __TRITON_LOG_H__ + +/** + * The logging system provides notification for for errors, faults or notice information. It + * supports logging to files as well as linux/unix syslog. Both a log level and a log mask + * can be enabled to get different levels or facilities of log information. + * + * Note that logging should not be used as a debugging mechanism. See triton-debug.h if you want + * to spit out debug messages. Logging should be used to notify administrators of error conditions + * (sometimes non-error conditions) in the system. + * + * Log messages include a level describing their importance. + */ + +#include "src/common/triton-error.h" + +/** + * These log levels are intended to be used to inform/alert the right administrative persons. + */ +enum triton_log_level +{ + TRITON_LOG_LEVEL_INFO = 1, /* informational messages */ + TRITON_LOG_LEVEL_NOTICE = 2, /* not an error, possibly want to handle this specially */ + TRITON_LOG_LEVEL_WARN = 3, /* warning messages */ + TRITON_LOG_LEVEL_ERR = 4, /* errors */ + TRITON_LOG_LEVEL_CRIT = 5, /* critical conditions, device errors, etc. */ + TRITON_LOG_LEVEL_ALERT = 6, /* needs correction immediately */ + TRITON_LOG_LEVEL_EMERG = 7 /* panic condition, likely invokes system-wide shutdown */ +}; + +struct triton_log; +typedef struct triton_log *triton_log_t; + +extern triton_log_t triton_log_default; + +/** + * Create a log handle to be used for writing log entries. Passed + * to all logging functions. + */ +triton_log_t triton_log_enable_syslog(const char *name); + +triton_log_t triton_log_enable_file(const char *name, const char *logfile, const char *mode); + +/** + * Cleanup and destroy the logging structures for the given log handle. + */ +void triton_log_disable(triton_log_t log); + +/** + * Set the log level. + */ +void triton_log_set_level(triton_log_t log, enum triton_log_level level); + +/** + * Logging is used for writing log messages on _deployed_ systems, + * and is intended to provide users and administrators with information + * about what's going on in their deployed environment. Log messages + * are not intended for code debugging. + * + * Each log message is given a prefix when written, including the level + * and mask. + */ +triton_ret_t triton_log( + triton_log_t log, enum triton_log_level level, const char *message, ...); + +#define triton_info(__log, __message, ...) triton_log(__log, TRITON_LOG_LEVEL_INFO, __message, __VA_ARTRITON__) +#define triton_notice(__log, __message, ...) triton_log(__log, TRITON_LOG_LEVEL_NOTICE, __message, __VA_ARTRITON__) +#define triton_warn(__log, __message, ...) triton_log(__log, TRITON_LOG_LEVEL_WARN, __message, __VA_ARTRITON__) +#define triton_err(__log, __message, ...) triton_log(__log, TRITON_LOG_LEVEL_ERR, __message, __VA_ARTRITON__) +#define triton_crit(__log, __message, ...) triton_log(__log, TRITON_LOG_LEVEL_CRIT, __message, __VA_ARTRITON__) +#define triton_alert(__log, __message, ...) triton_log(__log, TRITON_LOG_LEVEL_ALERT, __message, __VA_ARTRITON__) +#define triton_emerg(__log, __message, ...) triton_log(__log, TRITON_LOG_LEVEL_EMERG, __message, __VA_ARTRITON__) + +/** + * Takes the triton_ret_t error, and writes a message to the log + * if the appropriate masks are enabled. Assumes a log level of ERROR. + */ +triton_ret_t triton_log_error( + triton_log_t log, triton_ret_t error, const char *message, ...); + +#endif diff --git a/code/src/common/triton-string.c b/code/src/common/triton-string.c new file mode 100644 index 0000000..db094bc --- /dev/null +++ b/code/src/common/triton-string.c @@ -0,0 +1,4 @@ + +#include "src/common/triton-string.h" + +triton_string_t triton_string_null = { .size = 0, .string = NULL, .const_string = NULL }; diff --git a/code/src/common/triton-string.h b/code/src/common/triton-string.h new file mode 100644 index 0000000..e45aee4 --- /dev/null +++ b/code/src/common/triton-string.h @@ -0,0 +1,108 @@ +#ifndef __TRITON_STRING_H__ +#define __TRITON_STRING_H__ + +#include "src/common/triton-types.h" +#include "src/common/jenkins-hash.h" + +/** + * The triton_string_t is a null-terminated string. Used for encoding + * strings. + */ +typedef struct +{ + uint32_t size; + char * string; + const char *const_string; +} triton_string_t; + +static inline void triton_string_init(triton_string_t *s, const char *format, ...) +{ + va_list ap, aap; + if(format) + { + va_start(ap, format); + va_copy(aap, ap); + s->size = vsnprintf(NULL, 0, format, ap) + 1; + va_end(ap); + s->string = malloc(s->size); + vsnprintf(s->string, s->size, format, ap); + va_end(aap); + } + else + { + s->size = 0; + s->string = NULL; + } +} + +static inline void triton_string_init_size(triton_string_t *s, const char *value, uint32_t len) +{ + if(len > 0) + { + s->string = strdup(value); + s->size = len; + } + else + { + s->string = NULL; + s->size = 0; + } +} + +/* does not copy the passed in string */ +static inline void triton_string_init_inplace(triton_string_t *s, char *value) +{ + if(value) + { + s->string = value; + s->size = strlen(value)+1; + } + else + { + s->size = 0; + s->string = NULL; + } +} + +static inline void triton_string_init_inplace_size(triton_string_t *s, char *value, int len) +{ + s->size = len; + if(len > 0) + { + s->string = value; + } + else + { + s->string = NULL; + } +} + +#define triton_string_get(__str__) ((__str__)->const_string ? (__str__)->const_string : (__str__)->string) + +#define triton_string_set_null(__val) do { \ + (__val)->size = 0; \ + (__val)->string = NULL; \ + (__val)->const_string = NULL; \ +} while(0) + +static inline void triton_string_destroy(triton_string_t *s) +{ + if(s->string) free(s->string); + triton_string_set_null(s); +} + +extern triton_string_t triton_string_null; +#define TRITON_STRING_NULL (&triton_string_null) + +#define triton_string_init_const(__str__) { .size = sizeof(__str__), .string = NULL, .const_string = __str__ } + +static inline int triton_string_hash(void *k, int table_size) +{ + triton_string_t *s = (triton_string_t *)k; + uint32_t pc, pb; + + bj_hashlittle2(s->string, s->size, &pc, &pb); + return pc & (table_size - 1); +} + +#endif diff --git a/code/src/common/triton-thread.h b/code/src/common/triton-thread.h new file mode 100644 index 0000000..1406400 --- /dev/null +++ b/code/src/common/triton-thread.h @@ -0,0 +1,52 @@ +#ifndef __TRITON_THREAD_H__ +#define __TRITON_THREAD_H__ + +#include "src/common/triton-base.h" + +#ifdef __TRITON_POSIX_LOCKING__ +#include <pthread.h> + +typedef pthread_mutex_t triton_mutex_t; +typedef pthread_mutexattr_t triton_mutexattr_t; +#define triton_mutex_lock(__mut) pthread_mutex_lock(__mut) +#define triton_mutex_unlock(__mut) pthread_mutex_unlock(__mut) +#define triton_mutex_init(__mut, __attr) pthread_mutex_init(__mut, __attr) +#define TRITON_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +#define TRITON_COND_INITIALIZER PTHREAD_COND_INITIALIZER + +typedef pthread_cond_t triton_cond_t; +typedef pthread_condattr_t triton_condattr_t; +#define triton_cond_init(__cond, __condattr) pthread_cond_init(__cond, __condattr) +#define triton_cond_signal(__cond) pthread_cond_signal(__cond) +#define triton_cond_broadcast(__cond) pthread_cond_broadcast(__cond) +#define triton_cond_wait(__cond, __mutex) pthread_cond_wait(__cond, __mutex) +#define triton_cond_timedwait(__cond, __mutex, __time) pthread_cond_timedwait(__cond, __mutex, __time) +#define triton_cond_destroy(__cond) pthread_cond_destroy(__cond) + +#else /* __TRITON_POSIX_LOCKING__ */ + +/* for timespec struct def */ +#include <time.h> + +typedef int triton_mutex_t; +typedef int triton_mutexattr_t; +static inline int triton_mutex_lock(triton_mutex_t *__mut) { return 0; } +static inline int triton_mutex_unlock(triton_mutex_t *__mut) { return 0; } +static inline int triton_mutex_init(triton_mutex_t *__mut, triton_mutexattr_t *__attr) {return 0; } +#define TRITON_MUTEX_INITIALIZER 0 + +typedef int triton_cond_t; +typedef int triton_condattr_t; +#define TRITON_COND_INITIALIZER 0 + +static inline int triton_cond_init(triton_cond_t *__cond, triton_condattr_t *__condattr) { return 0; } +static inline int triton_cond_signal(triton_cond_t *__cond) { return 0; } +static inline int triton_cond_broadcast(triton_cond_t *__cond) { return 0; } +static inline int triton_cond_wait(triton_cond_t *__cond, triton_mutex_t *__mutex) { return 0; } +static inline int triton_cond_timedwait( + triton_cond_t *__cond, triton_mutex_t *__mutex, struct timespec *abstime) { return 0; } +static inline int triton_cond_destroy(triton_cond_t *__cond) { return 0; } + +#endif /* __TRITON_POSIX_LOCKING__ */ + +#endif /* __TRITON_THREAD_H__ */ diff --git a/code/src/common/triton-types.h b/code/src/common/triton-types.h new file mode 100644 index 0000000..4da1b79 --- /dev/null +++ b/code/src/common/triton-types.h @@ -0,0 +1,27 @@ +#ifndef __TRITON_TYPES_H__ +#define __TRITON_TYPES_H__ + +#include "src/common/triton-base.h" + +/** + * triton-types.h defines fundamental type primitives. + */ + +typedef struct { uint64_t l; uint64_t u; } uint128_t; + +#include <sys/time.h> + +#define TRITON_REL_MSECS_TO_ABS_TIMESPEC(__msecs, __abs) \ + do { \ + struct timeval __now; \ + gettimeofday(&__now, NULL); \ + __abs.tv_sec = __now.tv_sec + (int)(__msecs / 1e3); \ + __abs.tv_nsec = (__now.tv_usec * 1e3) + ((__msecs % 1000) * 1e6); \ + if(__abs.tv_nsec >= 1e9) \ + { \ + __abs.tv_sec++; \ + __abs.tv_nsec -= 1e9; \ + } \ + } while(0) + +#endif /* __TRITON_TYPES_H__ */ diff --git a/oldcode/src/gsl/resources/cosd-prototype/README b/code/src/cosd/prototype/README similarity index 100% copy from oldcode/src/gsl/resources/cosd-prototype/README copy to code/src/cosd/prototype/README diff --git a/code/src/cosd/prototype/cosd-prototype.c b/code/src/cosd/prototype/cosd-prototype.c new file mode 100644 index 0000000..ff7c456 --- /dev/null +++ b/code/src/cosd/prototype/cosd-prototype.c @@ -0,0 +1,1994 @@ +#define _GNU_SOURCE +#define _XOPEN_SOURCE 600 + +#include <time.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <unistd.h> +#include <pthread.h> +#include <stdio.h> +#include <limits.h> +#include <db.h> +#include <stdlib.h> +#include "triton-config.h" + +/**************************************************************/ +/* TODO: general stuff: + * - deadlock detection and avoidance + * - consider non-durable transactions in order to coalesce commits + * - use txn_checkpoint to flush when coalescing + * - consider rmw locks where appropriate + * - long term: consider fallocate hint for logs to keep them linear + * - try computing cksum along the way, store in db + * - either in log map itself or db that matches its keys + */ +/**************************************************************/ + +/* TODO: this needs to be in a header somewhere */ +#ifndef llu +#if SIZEOF_LONG_INT == 4 +# define llu(x) (x) +# define lld(x) (x) +# define SCANF_lld "%lld" +#elif SIZEOF_LONG_INT == 8 +# define llu(x) (unsigned long long)(x) +# define lld(x) (long long)(x) +# define SCANF_lld "%ld" +#else +# error Unexpected sizeof(long int) +#endif +#endif + +#include "src/aesop/aesop.h" +#include "src/aesop/op.h" +#include "src/aesop/opcache.h" +#include "src/common/triton-hash.h" +#include "src/cosd/prototype/cosd-prototype.h" + +#define STORAGE_DEFAULT_OPCACHE_SIZE 1024 +#define COSD_LOG_SUBDIR "logs" +#define COSD_MIN(__a, __b) ((__a) < (__b) ? (__a) : (__b)) +#define COSD_MAX(__a, __b) ((__a) > (__b) ? (__a) : (__b)) +/* TODO: find this programmatically? */ +#define DIRECT_ALIGN 512 +#define COSD_INIT_DBT(__dbt, __data) \ + do { \ + memset(&(__dbt), 0, sizeof(__dbt)); \ + (__dbt).data = &(__data); \ + (__dbt).size = sizeof(__data); \ + (__dbt).ulen = sizeof(__data); \ + (__dbt).flags = DB_DBT_USERMEM; \ + }while(0) +#define COSD_INIT_DBT_EMPTY(__dbt) \ + do { \ + memset(&(__dbt), 0, sizeof(__dbt)); \ + (__dbt).flags = DB_DBT_USERMEM; \ + }while(0) + + +static ae_opcache_t cosd_opcache; +static ae_ops_t cosd_oplist; +static triton_mutex_t cosd_mutex = TRITON_MUTEX_INITIALIZER; +static char* cosd_path = NULL; +static char* cosd_log_path = NULL; +static struct triton_hash_table *txn_table = NULL; +static triton_mutex_t txn_mutex = TRITON_MUTEX_INITIALIZER; + +static DB *log_map_dbp = NULL; +static DB *missing_ver_dbp = NULL; +static DB *ver_dbp = NULL; +static DB *log_offset_dbp = NULL; +DB_ENV *envp = NULL; + +/* temporary: a global fd and log offset used to access object */ +static int global_fd = -1; +static int64_t global_log_offset = -1; +static triton_mutex_t global_log_mutex = TRITON_MUTEX_INITIALIZER; + +static int cosd_resource_id; +static enum progress_mode triton_cosd_progress_mode = TRITON_PROG_NONE; + +static int merge_logical_map(triton_list_t* list1_in, int + list1_count, triton_list_t* list2_in, int list2_count, + triton_list_t* list_out, void** free_ptr); +static int compare_log_map_key(DB * dbp, const DBT * a, const DBT * b); +static int compare_missing_version(DB * dbp, const DBT * a, const DBT * b); +static int compare_uint64(DB * dbp, const DBT * a, const DBT * b); +static int cmp_lme(const void *p1, const void *p2); + +/* counter used by poll function in thread-per-op case to know if ops have + * finished since last poll + */ +static int completed_counter = 0; +static triton_mutex_t completed_counter_mutex = TRITON_MUTEX_INITIALIZER; +static triton_cond_t completed_counter_cond = TRITON_COND_INITIALIZER; + +/* uniquely identifies each active txn (in memory) */ +struct txn_accumulator +{ + /* txn identifier */ + uint64_t txn_number; + /* list of updates included in this txn */ + triton_list_t update_list; + int update_list_count; + + /* link into hash table of current txns */ + struct triton_hash_link hash_link; +}; + +/* db entry representing region in logical map */ +/* indexed via last offset */ +struct logical_map_entry +{ + int64_t size; /* size of region */ + int64_t logical_offset; /* beginning of logical region */ + int64_t logical_offset_end; /* end of logical region */ + int64_t log_offset; /* offset into log */ + uint64_t version; /* version number */ + struct triton_list_link list_link; +}; + +struct logical_map_key +{ + uint64_t oid; + int64_t logical_offset_end; +}; + +/* represents a missing version number in a particular object */ +struct missing_version +{ + uint64_t oid; + uint64_t version; +}; + +struct cosd_op +{ + union { + struct create_op{ + uint64_t requested_oid; + uint64_t* out_oid; + } create; + struct write_op{ + uint64_t oid; + uint64_t txn_number; + char** mem_offsets; + int64_t* mem_sizes; + int mem_count; + int64_t* obj_offsets; + int64_t* obj_sizes; + int obj_count; + } write; + struct txn_close_op{ + uint64_t oid; + uint64_t txn_number; + } txn_close; + struct get_version_op{ + uint64_t oid; + uint64_t *version; + } get_version; +#if 0 + struct remove_op{ + uint64_t oid; + } remove; + struct setattr_list_op{ + uint64_t oid; + int count; + const uint32_t* page_array; + const uint32_t* number_array; + const void** val_array; + const int* len_array; + } setattr_list; + struct getattr_list_op{ + uint64_t oid; + int count; + const uint32_t* page_array; + const uint32_t* number_array; + void** val_array; + int* len_array; + } getattr_list; +#endif + } u; + ae_op_id_t op_id; + struct ae_op op; + int error_code; + void (*cleanup_fn)(struct cosd_op* c_op); +}; + +static void* thread_fn(void* foo) +{ + struct ae_op* op = foo; + struct cosd_op* c_op = ae_op_entry(op, struct cosd_op, op); + + triton_mutex_lock(&cosd_mutex); + /* pull off of list */ + ae_ops_del(op); + triton_mutex_unlock(&cosd_mutex); + + /* spin on op worker */ + while(op->op_worker(op) != 1); + + /* call cleanup function if present */ + if(c_op->cleanup_fn) + { + c_op->cleanup_fn(c_op); + } + + /* trigger completion of the operation */ + ae_opcache_complete_op(cosd_opcache, op, c_op->error_code); + + /* wake up any pollers */ + triton_mutex_lock(&completed_counter_mutex); + completed_counter++; + triton_cond_signal(&completed_counter_cond); + triton_mutex_unlock(&completed_counter_mutex); + + return(NULL); +} + +static int txn_acc_compare(void *key, struct triton_hash_link *hash_link) +{ + struct txn_accumulator *txn_acc; + + txn_acc = triton_hash_get_entry(hash_link, struct txn_accumulator, hash_link); + return(*((uint64_t*)key) == txn_acc->txn_number); +} + +static int triton_cosd_launch_op(struct ae_op *op, enum progress_mode mode) +{ + int ret; + pthread_t tid; + pthread_attr_t attr; + + switch(mode) + { + case TRITON_PROG_POLL: + triton_mutex_lock(&cosd_mutex); + ae_ops_enqueue(op, &cosd_oplist); + triton_mutex_unlock(&cosd_mutex); + break; + case TRITON_PROG_THREAD_PER_OP: + /* TODO: make this better. Right now its a free for all */ + + /* put on the queue */ + triton_mutex_lock(&cosd_mutex); + ae_ops_enqueue(op, &cosd_oplist); + triton_mutex_unlock(&cosd_mutex); + + /* launch a thread to do the work */ + /* TODO: error handling */ + ret = pthread_attr_init(&attr); + assert(ret == 0); + ret = pthread_attr_setdetachstate(&attr, + PTHREAD_CREATE_DETACHED); + assert(ret == 0); + /* TODO: store tid in op (to help with cancelling or joining?) */ + ret = pthread_create(&tid, &attr, thread_fn, op); + assert(ret == 0); + pthread_attr_destroy(&attr); + + break; + case TRITON_PROG_NONE: + return(-EINVAL); + break; + case TRITON_PROG_THREAD_POOL: + /* TODO: alert the thread pool etc. */ + /* TODO: gossip... */ + triton_mutex_lock(&cosd_mutex); + ae_ops_enqueue(op, &cosd_oplist); + triton_mutex_unlock(&cosd_mutex); + return(-EINVAL); + break; + case TRITON_PROG_MAX: + break; + } + + return(0); +} + +/* triton_cosd_poll_thread_per_op() + * + * poll function in the thread-per-op mode that doesn't do anything except + * make sure that triton_poll wakes up if operations complete. + */ +static int triton_cosd_poll_thread_per_op(ae_context_t context, int millisecs) +{ + struct timespec abstime; + struct timeval start; + int ret; + + if(millisecs > 0) + { + ret = gettimeofday(&start, NULL); + if (ret < 0) + return (0); + + abstime.tv_sec = start.tv_sec + millisecs / 1000; + abstime.tv_nsec = (start.tv_usec + ((millisecs % 1000)*1000))*1000; + if (abstime.tv_nsec > 1000000000) + { + abstime.tv_nsec = abstime.tv_nsec - 1000000000; + abstime.tv_sec++; + } + } + + triton_mutex_lock(&completed_counter_mutex); + ret = 0; + while(completed_counter == 0 && ret == 0) + { + if(millisecs > 0) + { + ret = triton_cond_timedwait(&completed_counter_cond, + &completed_counter_mutex, &abstime); + } + else + { + ret = ETIMEDOUT; + } + } + completed_counter = 0; /* reset for next poller */ + triton_mutex_unlock(&completed_counter_mutex); + + return(0); +} + +static int triton_cosd_poll(ae_context_t context, int millisecs) +{ + struct ae_op *gop; + struct cosd_op *c_op; + struct timespec ts_sleep; + int ret; + + /* NOTE: just servicing one op per call right now */ + + /* NOTE: poll doesn't need locking, because it is not used in the + * threaded modes + */ + + /* triton_mutex_lock(&cosd_mutex); */ + + /* TODO: decouple locking for op list from servicing of operations so + * that multithreaded apps can post while servicing happens + * simultaneously + */ + gop = ae_ops_dequeue(&cosd_oplist); + if(!gop) + { + /* sleep */ + /* TODO: this needs to be something that can be interrupted if + * something is posted + */ + ts_sleep.tv_sec = (int)(millisecs / 1e3); + ts_sleep.tv_nsec = (millisecs % 1000) * 1e6; + nanosleep(&ts_sleep, NULL); + /* triton_mutex_unlock(&cosd_mutex); */ + return(0); + } + + c_op = ae_op_entry(gop, struct cosd_op, op); + + ret = gop->op_worker(gop); + if(ret == 1) + { + /* call cleanup function if present */ + if(c_op->cleanup_fn) + { + c_op->cleanup_fn(c_op); + } + + /* done */ + ae_opcache_complete_op(cosd_opcache, gop, c_op->error_code); + } + else + { + assert(ret == 0); /* only 0 and 1 allowed? */ + /* not done */ + ae_ops_enqueue(gop, &cosd_oplist); + } + + /* triton_mutex_unlock(&cosd_mutex); */ + + return 0; +} + +/* TODO: does this have to handle the case of the op already having + * disappeared, or does the aesop engine protect against that? + */ +static int triton_cosd_cancel(ae_context_t ctx, ae_op_id_t op_id) +{ + int cache_id, resource_id; + triton_mutex_lock(&cosd_mutex); + struct ae_op *op; + struct cosd_op *c_op; + + cache_id = triton_id_lookup(op_id, &resource_id); + assert(resource_id == cosd_resource_id); + + op = ae_opcache_lookup(cosd_opcache, (int)cache_id); + c_op = ae_op_entry(op, struct cosd_op, op); +#if 0 + ae_ops_del(op); + ae_opcache_put(cosd_opcache, op); +#endif + + triton_mutex_unlock(&cosd_mutex); + + return 0; +} + +struct triton_resource cosd_resource = +{ + .resource_name = "cosd", + .poll_context = triton_cosd_poll, + .cancel = triton_cosd_cancel +}; + +int triton_cosd_init(enum progress_mode mode, const char* path) +{ + int ret = 0; + int dir_exists = 0; + uint32_t env_flags; + uint32_t open_flags; + + /* make a directory for storage if not already present */ + ret = mkdir(path, 0755); + if(ret != 0 && errno == EEXIST) + { + dir_exists = 1; + } + else if(ret != 0) + { + /* some other error */ + return(ret); + } + + /* store paths */ + /* TODO: free both of these on error */ + cosd_path = strdup(path); + if(!cosd_path) + return(-errno); + cosd_log_path = malloc(strlen(path)+strlen(COSD_LOG_SUBDIR)+2); + if(!cosd_log_path) + return(-errno); + sprintf(cosd_log_path, "%s/%s", path, COSD_LOG_SUBDIR); + + /* create berkeley db environment */ + ret = db_env_create(&envp, 0); + if(ret != 0) + { + /* TODO: err handling */ + return(-1); + } + + /* have db do deadlock detection and reject txn with fewest locks */ + ret = envp->set_lk_detect(envp, DB_LOCK_MINWRITE); + if(ret != 0) + { + /* TODO: err handling */ + return(-1); + } + + env_flags = + DB_CREATE | /* Create the environment if it does not exist */ + DB_RECOVER | /* Run normal recovery. */ + DB_INIT_LOCK | /* Initialize the locking subsystem */ + DB_INIT_LOG | /* Initialize the logging subsystem */ + DB_INIT_TXN | /* Initialize the transactional subsystem. This + * also turns on logging. */ + DB_INIT_MPOOL | /* Initialize the memory pool (in-memory cache) */ + DB_THREAD | /* Cause the environment to be free-threaded */ + DB_RECOVER; /* Run normal recovery steps */ + + if(!dir_exists) + { + /* making a brand new storage space */ + + /* new directory for logs */ + ret = mkdir(cosd_log_path, 0755); + if(ret != 0) + return(-errno); + } + + /* open environment */ + ret = envp->open(envp, cosd_path, env_flags, 0); + if(ret != 0) + { + /* TODO: error handling */ + return(-1); + } + + /* create db handles */ + /* custom sort functions allow all dbs to be queried using cursors over + * id ranges + */ + ret = db_create(&log_map_dbp, envp, 0); + if(ret != 0) + { + /* TODO: error handling */ + return(-1); + } + log_map_dbp->set_bt_compare(log_map_dbp, compare_log_map_key); + ret = db_create(&missing_ver_dbp, envp, 0); + if(ret != 0) + { + /* TODO: error handling */ + return(-1); + } + missing_ver_dbp->set_bt_compare(missing_ver_dbp, compare_missing_version); + ret = db_create(&ver_dbp, envp, 0); + if(ret != 0) + { + /* TODO: error handling */ + return(-1); + } + ver_dbp->set_bt_compare(ver_dbp, compare_uint64); + ret = db_create(&log_offset_dbp, envp, 0); + if(ret != 0) + { + /* TODO: error handling */ + return(-1); + } + log_offset_dbp->set_bt_compare(log_offset_dbp, compare_uint64); + + + /* open dbs */ + open_flags = DB_CREATE | /* Allow database creation */ + DB_READ_UNCOMMITTED | /* Allow dirty reads */ + DB_AUTO_COMMIT; /* Allow autocommit */ + + ret = log_map_dbp->open(log_map_dbp, NULL, "logical-map.db", + NULL, DB_BTREE, open_flags, 0); + if(ret != 0) + { + /* TODO: error handling */ + return(-1); + } + ret = missing_ver_dbp->open(missing_ver_dbp, NULL, "missing_versions.db", + NULL, DB_BTREE, open_flags, 0); + if(ret != 0) + { + /* TODO: error handling */ + return(-1); + } + ret = ver_dbp->open(ver_dbp, NULL, "version.db", + NULL, DB_BTREE, open_flags, 0); + if(ret != 0) + { + /* TODO: error handling */ + return(-1); + } + ret = log_offset_dbp->open(log_offset_dbp, NULL, "log-offset.db", + NULL, DB_BTREE, open_flags, 0); + if(ret != 0) + { + /* TODO: error handling */ + return(-1); + } + + /* flush out txn logs up front; otherwise the first I/O operation to the + * COSD may bog down instead. + */ + envp->txn_checkpoint(envp, 0, 0, 0); + + triton_mutex_lock(&txn_mutex); + /* create hash table for open txns */ + txn_table = triton_hash_init(txn_acc_compare, triton_hash_64bit_hash, 1024); + if(!txn_table) + { + /* TODO: error handling */ + triton_mutex_unlock(&txn_mutex); + return(-1); + } + triton_mutex_unlock(&txn_mutex); + + ae_ops_init(&cosd_oplist); + + ret = TRITON_OPCACHE_INIT(struct cosd_op, op, STORAGE_DEFAULT_OPCACHE_SIZE, &cosd_opcache); + if(ret < 0) + { + return(ret); + } + + assert(mode > TRITON_PROG_NONE && mode < TRITON_PROG_MAX); + + /* modify poll function depending on requested mode */ + switch(mode) + { + case TRITON_PROG_POLL: + cosd_resource.poll_context = triton_cosd_poll; + break; + case TRITON_PROG_THREAD_PER_OP: + case TRITON_PROG_THREAD_POOL: + cosd_resource.poll_context = triton_cosd_poll_thread_per_op; + break; + case TRITON_PROG_NONE: + case TRITON_PROG_MAX: + return(-EINVAL); + } + + cosd_resource_id = ae_resource_register(&cosd_resource); + if(cosd_resource_id < 0) + { + ae_opcache_destroy(cosd_opcache); + return(cosd_resource_id); + } + triton_cosd_progress_mode = mode; + + return ret; +} + +int triton_cosd_finalize(void) +{ + triton_resource_unregister(cosd_resource_id); + ae_opcache_destroy(cosd_opcache); + + envp = log_map_dbp->get_env(log_map_dbp); + log_map_dbp->close(log_map_dbp, 0); + missing_ver_dbp->close(missing_ver_dbp, 0); + ver_dbp->close(ver_dbp, 0); + log_offset_dbp->close(log_offset_dbp, 0); + + triton_mutex_lock(&txn_mutex); + triton_hash_finalize(txn_table); + triton_mutex_unlock(&txn_mutex); + + return 0; +} + +/* write_op_cleanup() + * + * cleans up memory after a write operation completes + */ +static void write_op_cleanup(struct cosd_op *c_op) +{ + if(c_op->u.write.mem_offsets) + free(c_op->u.write.mem_offsets); + if(c_op->u.write.mem_sizes) + free(c_op->u.write.mem_sizes); + if(c_op->u.write.obj_sizes) + free(c_op->u.write.obj_sizes); + if(c_op->u.write.obj_offsets) + free(c_op->u.write.obj_offsets); + + return; +} + +/* write_op_worker() + * + * writes data to an object + */ +static int write_op_worker(struct ae_op* op) +{ + struct cosd_op *c_op; + int ret; + DB_TXN *txn; + DBT key, value; + char log_name[PATH_MAX]; + int done = 0; + int mem_index = 0; + int obj_index = 0; + struct logical_map_entry *tmp_update; + const char* mem_ptr; + void* scratch_buffer = NULL; + int scratch_size = 0; + int64_t aligned_size = 0; + struct txn_accumulator* txn_acc; + struct triton_hash_link* hash_link; + + c_op = ae_op_entry(op, struct cosd_op, op); + assert(c_op); + + /* only support one object for now */ + assert(c_op->u.write.oid == 1); + + assert(c_op->u.write.mem_count > 0); + assert(c_op->u.write.obj_count > 0); + + if(global_fd < 0) + { + /* open log file */ + sprintf(log_name, "%s/%llu.dat", cosd_log_path, + llu(c_op->u.write.oid)); + ret = open(log_name, O_RDWR|O_DIRECT|O_EXCL|O_NOATIME, + S_IRUSR|S_IWUSR); + if(ret < 0) + { + c_op->error_code = -errno; + return(1); + } + global_fd = ret; + } + + /* TODO: safety check that total mem size equals total obj size */ + /* TODO: safety check no zero buffers in either list */ + + while(!done) + { + /* structure to track this update in the txn */ + tmp_update = malloc(sizeof(*tmp_update)); + if(!tmp_update) + { + /* TODO: err handling */ + c_op->error_code = -errno; + return(1); + } + + /* find the next chunk that is contiguous in memory and disk */ + mem_ptr = c_op->u.write.mem_offsets[mem_index]; + tmp_update->logical_offset = c_op->u.write.obj_offsets[obj_index]; + tmp_update->size = c_op->u.write.mem_sizes[mem_index]; + tmp_update->logical_offset_end = tmp_update->logical_offset + + tmp_update->size; + if(tmp_update->size >= c_op->u.write.obj_sizes[obj_index]) + { + /* mem region is bigger than obj region */ + tmp_update->size = c_op->u.write.obj_sizes[obj_index]; + } + + /* advance pointers */ + c_op->u.write.mem_sizes[mem_index] -= tmp_update->size; + c_op->u.write.mem_offsets[mem_index] += tmp_update->size; + if(c_op->u.write.mem_sizes[mem_index] == 0) + { + if(mem_index == (c_op->u.write.mem_count -1)) + done = 1; + else + mem_index++; + } + c_op->u.write.obj_sizes[obj_index] -= tmp_update->size; + c_op->u.write.obj_offsets[obj_index] += tmp_update->size; + if(c_op->u.write.obj_sizes[obj_index] == 0) + { + if(obj_index == (c_op->u.write.obj_count -1)) + done = 1; + else + obj_index++; + } + + /* calculate aligned buffer size */ + if(tmp_update->size % DIRECT_ALIGN != 0) + aligned_size = + ((tmp_update->size / DIRECT_ALIGN)+1)*DIRECT_ALIGN; + else + aligned_size = tmp_update->size; + + /* TODO: think about how to track this per object; we need to + * atomically get a new log offset, but it doesn't have to be + * flushed to db until we close a transaction. For now using a + * global var and global mutex + */ + /* get next log offset and increment */ + triton_mutex_lock(&global_log_mutex); + if(global_log_offset < 0) + { + COSD_INIT_DBT(key, c_op->u.write.oid); + COSD_INIT_DBT(value, global_log_offset); + +write_op_txn: + /* read log offset from db */ + ret = envp->txn_begin(envp, NULL, &txn, 0); + if(ret != 0) + { + /* TODO: error handling */ + c_op->error_code = -1; + return(1); + } + + ret = log_offset_dbp->get(log_offset_dbp, txn, &key, &value, 0); + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto write_op_txn; + + /* TODO: error handling */ + c_op->error_code = -1; + return(1); + } + + ret = txn->commit(txn, 0); + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto write_op_txn; + + /* TODO: error handling */ + assert(0); + } + + assert(global_log_offset > -1); + } + + tmp_update->log_offset = global_log_offset; + global_log_offset += aligned_size; + triton_mutex_unlock(&global_log_mutex); + + if(((unsigned long)mem_ptr) % DIRECT_ALIGN || tmp_update->size != aligned_size) + { + /* mem buffer is not aligned */ + /* allocate a scratch buffer to copy to */ + if(scratch_size < aligned_size) + { + if(scratch_buffer) + free(scratch_buffer); + scratch_size = aligned_size; + ret = posix_memalign(&scratch_buffer, DIRECT_ALIGN, + aligned_size); + if(ret < 0) + { + /* TODO: err handling */ + c_op->error_code = -errno; + return(1); + } + } + memcpy(scratch_buffer, mem_ptr, tmp_update->size); + mem_ptr = scratch_buffer; + } + + /* actually write the data */ + ret = pwrite(global_fd, mem_ptr, aligned_size, + tmp_update->log_offset); + if(ret < 0) + { + /* TODO: err handling */ + c_op->error_code = -errno; + return(1); + } + + /* track this update in the txn accumulator */ + triton_mutex_lock(&txn_mutex); + hash_link = triton_hash_search(txn_table, &c_op->u.write.txn_number); + if(!hash_link) + { + /* TODO: txn is gone (which could be normal); error handling */ + c_op->error_code = -1; + triton_mutex_unlock(&txn_mutex); + return(1); + } + txn_acc = triton_hash_get_entry(hash_link, struct txn_accumulator, + hash_link); + tmp_update->version = txn_acc->txn_number; + triton_list_add_front(&tmp_update->list_link, &txn_acc->update_list); + txn_acc->update_list_count++; + triton_mutex_unlock(&txn_mutex); + } + + /* cleanup any leftover buffer */ + if(scratch_buffer) + free(scratch_buffer); + + c_op->error_code = 0; + return(1); +} + +/* dump_op_worker() + * + * dumps all db information from cosd + */ +/* TODO: audit for deadlocks */ +static int dump_op_worker(struct ae_op* op) +{ + struct cosd_op *c_op; + int ret; + DB_TXN *txn; + DBC *log_map_dbcp, *missing_ver_dbcp, *ver_dbcp, *log_offset_dbcp; + DBT log_map_key, missing_ver_key, ver_key, log_offset_key; + DBT log_map_value, missing_ver_value, ver_value, log_offset_value; + int c_get_flag = DB_SET_RANGE; + + /* keys for each db */ + struct logical_map_key lmk; + struct missing_version mvk; + uint64_t lok; + uint64_t vk; + COSD_INIT_DBT(log_map_key, lmk); + COSD_INIT_DBT(missing_ver_key, mvk); + COSD_INIT_DBT(log_offset_key, lok); + COSD_INIT_DBT(ver_key, vk); + + /* values for each db */ + struct logical_map_entry lmv; + uint64_t vv; + int64_t lov; + COSD_INIT_DBT(log_map_value, lmv); + COSD_INIT_DBT_EMPTY(missing_ver_value); + COSD_INIT_DBT(log_offset_value, lov); + COSD_INIT_DBT(ver_value, vv); + + c_op = ae_op_entry(op, struct cosd_op, op); + assert(c_op); + + ret = envp->txn_begin(envp, NULL, &txn, 0); + if(ret != 0) + { + /* TODO: error handling */ + c_op->error_code = -1; + return(1); + } + + /* create cursors on all 4 dbs */ + ret = log_map_dbp->cursor(log_map_dbp, txn, &log_map_dbcp, 0); + assert(ret == 0); /* TODO: err handling */ + ret = ver_dbp->cursor(ver_dbp, txn, &ver_dbcp, 0); + assert(ret == 0); /* TODO: err handling */ + ret = missing_ver_dbp->cursor(missing_ver_dbp, txn, &missing_ver_dbcp, 0); + assert(ret == 0); /* TODO: err handling */ + ret = log_offset_dbp->cursor(log_offset_dbp, txn, &log_offset_dbcp, 0); + assert(ret == 0); /* TODO: err handling */ + + /* loop through version db, one entry per object */ + while ((ret = ver_dbcp->c_get(ver_dbcp, &ver_key, &ver_value, DB_NEXT)) == 0) + { + printf("OID: %llu\n", llu(vk)); + printf("=============================================\n"); + printf(" version: %llu\n", llu(vv)); + + /* next log offset entry should match, no need to search */ + ret = log_offset_dbcp->c_get(log_offset_dbcp, &log_offset_key, + &log_offset_value, DB_NEXT); + assert(ret == 0); /* TODO: err handling */ + assert(lok == vk); + printf(" next log offset: %lld\n", lld(lov)); + + /* search for any missing versions */ + printf(" missing versions: "); + mvk.oid = vk; + mvk.version = 0; + c_get_flag = DB_SET_RANGE; + while((ret = missing_ver_dbcp->c_get(missing_ver_dbcp, + &missing_ver_key, &missing_ver_value, c_get_flag)) == 0) + { + c_get_flag = DB_NEXT; + printf("%llu ", llu(mvk.version)); + } + printf("\n"); + assert(ret == DB_NOTFOUND); /* TODO: err handling */ + + /* search for logical map entries */ + printf(" logical map:\n"); + printf(" ------------------------------------------\n"); + lmk.oid = vk; + lmk.logical_offset_end = 0; + c_get_flag = DB_SET_RANGE; + while((ret = log_map_dbcp->c_get(log_map_dbcp, + &log_map_key, &log_map_value, c_get_flag)) == 0) + { + printf("logical_off: %lld, logical_end: %lld, size: %lld, log_off: %lld, ver: %llu\n", + lld(lmv.logical_offset), lld(lmv.logical_offset_end), + lld(lmv.size), lld(lmv.log_offset), llu(lmv.version)); + c_get_flag = DB_NEXT; + } + assert(ret == DB_NOTFOUND); /* TODO: err handling */ + + printf("\n"); + } + assert(ret == DB_NOTFOUND); /* TODO: err handling */ + + log_map_dbcp->c_close(log_map_dbcp); + log_offset_dbcp->c_close(log_offset_dbcp); + ver_dbcp->c_close(ver_dbcp); + missing_ver_dbcp->c_close(missing_ver_dbcp); + + ret = txn->commit(txn, 0); + if(ret != 0) + { + /* TODO: error handling */ + assert(0); + } + + c_op->error_code = 0; + return(1); +} + + +/* create_op_worker() + * + * creates an object + */ +/* TODO: audit for deadlocks */ +static int create_op_worker(struct ae_op* op) +{ + struct cosd_op *c_op; + int ret; + DB_TXN *txn; + int64_t val; + DBT key, value; + char log_name[PATH_MAX]; + + c_op = ae_op_entry(op, struct cosd_op, op); + assert(c_op); + + /* only support one object for now */ + assert(c_op->u.create.requested_oid == 1); + *c_op->u.create.out_oid = 1; + + /* create a log file */ + sprintf(log_name, "%s/%llu.dat", cosd_log_path, + llu(c_op->u.create.requested_oid)); + ret = open(log_name, O_RDWR|O_CREAT|O_DIRECT|O_EXCL|O_NOATIME, + S_IRUSR|S_IWUSR); + if(ret < 0) + { + c_op->error_code = -errno; + return(1); + } + global_fd = ret; + + /* do db stuff */ + ret = envp->txn_begin(envp, NULL, &txn, 0); + if(ret != 0) + { + /* TODO: error handling */ + c_op->error_code = -1; + return(1); + } + + /* set initial version of 1 */ + val = 1; + COSD_INIT_DBT(key, c_op->u.create.requested_oid); + COSD_INIT_DBT(value, val); + + ret = ver_dbp->put(ver_dbp, txn, &key, &value, 0); + if(ret != 0) + { + /* TODO: error handling */ + assert(0); + } + + /* set initial log offset of 0 */ + val = 0; + ret = log_offset_dbp->put(log_offset_dbp, txn, &key, &value, 0); + if(ret != 0) + { + /* TODO: error handling */ + assert(0); + } + + ret = txn->commit(txn, 0); + if(ret != 0) + { + /* TODO: error handling */ + assert(0); + } + + c_op->error_code = 0; + + return(1); +} + +triton_ret_t triton_cosd_write_post( + uint64_t oid, + uint64_t txn_number, + char** mem_offsets, + int64_t* mem_sizes, + int mem_count, + int64_t* obj_offsets, + int64_t* obj_sizes, + int obj_count, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct cosd_op *c_op; + + op = ae_opcache_get(cosd_opcache); + ae_op_fill(op, callback, user_ptr, hints, ctx); + + c_op = ae_op_entry(op, struct cosd_op, op); + c_op->op_id = triton_id_gen(cosd_resource_id, (uint64_t)(op->cache_id)); + c_op->u.write.oid = oid; + c_op->u.write.txn_number = txn_number; + c_op->u.write.mem_count = mem_count; + c_op->u.write.obj_count = obj_count; + + /* copy arrays so that we can modify them internally */ + /* TODO: error handling */ + c_op->u.write.mem_offsets = malloc(mem_count*sizeof(*mem_offsets)); + assert(c_op->u.write.mem_offsets); + memcpy(c_op->u.write.mem_offsets, mem_offsets, + mem_count*sizeof(*mem_offsets)); + + c_op->u.write.mem_sizes = malloc(mem_count*sizeof(*mem_sizes)); + assert(c_op->u.write.mem_sizes); + memcpy(c_op->u.write.mem_sizes, mem_sizes, + mem_count*sizeof(*mem_sizes)); + + c_op->u.write.obj_offsets = malloc(obj_count*sizeof(*obj_offsets)); + assert(c_op->u.write.obj_offsets); + memcpy(c_op->u.write.obj_offsets, obj_offsets, + obj_count*sizeof(*obj_offsets)); + + c_op->u.write.obj_sizes = malloc(obj_count*sizeof(*obj_sizes)); + assert(c_op->u.write.obj_sizes); + memcpy(c_op->u.write.obj_sizes, obj_sizes, + obj_count*sizeof(*obj_sizes)); + + *op_id = c_op->op_id; + + /* TODO: put this in the fill function if we keep it? */ + op->op_worker = write_op_worker; + c_op->cleanup_fn = write_op_cleanup; + + triton_cosd_launch_op(op, triton_cosd_progress_mode); + + return TRITON_SUCCESS; +} +triton_ret_t (* triton_cosd_write)( + uint64_t oid, + uint64_t txn_number, + char** mem_offsets, + int64_t* mem_sizes, + int mem_count, + int64_t* obj_offsets, + int64_t* obj_sizes, + int obj_count, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = triton_cosd_write_post; + + +triton_ret_t triton_cosd_dump_post( + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct cosd_op *c_op; + + op = ae_opcache_get(cosd_opcache); + ae_op_fill(op, callback, user_ptr, hints, ctx); + + c_op = ae_op_entry(op, struct cosd_op, op); + c_op->op_id = triton_id_gen(cosd_resource_id, (uint64_t)(op->cache_id)); + + *op_id = c_op->op_id; + + /* TODO: put this in the fill function if we keep it? */ + op->op_worker = dump_op_worker; + c_op->cleanup_fn = NULL; + + triton_cosd_launch_op(op, triton_cosd_progress_mode); + + return TRITON_SUCCESS; +} +triton_ret_t (* triton_cosd_dump)( + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = triton_cosd_dump_post; + + +triton_ret_t triton_cosd_create_post( + uint64_t requested_oid, + uint64_t* out_oid, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct cosd_op *c_op; + + op = ae_opcache_get(cosd_opcache); + ae_op_fill(op, callback, user_ptr, hints, ctx); + + c_op = ae_op_entry(op, struct cosd_op, op); + c_op->op_id = triton_id_gen(cosd_resource_id, (uint64_t)(op->cache_id)); + c_op->u.create.requested_oid = requested_oid; + c_op->u.create.out_oid = out_oid; + + *op_id = c_op->op_id; + + /* TODO: put this in the fill function if we keep it? */ + op->op_worker = create_op_worker; + c_op->cleanup_fn = NULL; + + triton_cosd_launch_op(op, triton_cosd_progress_mode); + + return TRITON_SUCCESS; +} +triton_ret_t (* triton_cosd_create)( + uint64_t requested_oid, + uint64_t* out_oid, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = triton_cosd_create_post; + +int triton_cosd_txn_open(uint64_t oid, uint64_t txn_number) +{ + struct txn_accumulator *txn_acc; + + txn_acc = malloc(sizeof(*txn_acc)); + if(!txn_acc) + { + return(-ENOMEM); + } + memset(txn_acc, 0, sizeof(*txn_acc)); + + txn_acc->txn_number = txn_number; + triton_list_init(&txn_acc->update_list); + + triton_mutex_lock(&txn_mutex); + /* TODO: safety test for duplicate txn numbers */ + triton_hash_add(txn_table, &txn_acc->txn_number, &txn_acc->hash_link); + triton_mutex_unlock(&txn_mutex); + + return(0); +} + + +/* get_version_op_worker() + * + * retrieves the current version number of an object + */ +/* TODO: audit for deadlocks */ +static int get_version_op_worker(struct ae_op* op) +{ + struct cosd_op *c_op; + int ret; + DB_TXN *txn; + uint64_t version; + DBT key, value; + + c_op = ae_op_entry(op, struct cosd_op, op); + assert(c_op); + + /* only support one object for now */ + assert(c_op->u.get_version.oid == 1); + + /* do db stuff */ + ret = envp->txn_begin(envp, NULL, &txn, 0); + if(ret != 0) + { + /* TODO: error handling */ + c_op->error_code = -1; + return(1); + } + + /* read current version */ + COSD_INIT_DBT(key, c_op->u.get_version.oid); + COSD_INIT_DBT(value, version); + + ret = ver_dbp->get(ver_dbp, txn, &key, &value, 0); + if(ret != 0) + { + /* TODO: error handling */ + assert(0); + } + + *c_op->u.get_version.version = version; + + ret = txn->commit(txn, 0); + if(ret != 0) + { + /* TODO: error handling */ + assert(0); + } + + c_op->error_code = 0; + + return(1); +} + + +triton_ret_t triton_cosd_get_version_post( + uint64_t oid, + uint64_t* version, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct cosd_op *c_op; + + op = ae_opcache_get(cosd_opcache); + ae_op_fill(op, callback, user_ptr, hints, ctx); + + c_op = ae_op_entry(op, struct cosd_op, op); + c_op->op_id = triton_id_gen(cosd_resource_id, (uint64_t)(op->cache_id)); + c_op->u.get_version.oid = oid; + c_op->u.get_version.version = version; + + *op_id = c_op->op_id; + + /* TODO: put this in the fill function if we keep it? */ + op->op_worker = get_version_op_worker; + c_op->cleanup_fn = NULL; + + triton_cosd_launch_op(op, triton_cosd_progress_mode); + + return TRITON_SUCCESS; +} +triton_ret_t (* triton_cosd_get_version)( + uint64_t oid, + uint64_t* version, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = triton_cosd_get_version_post; + + +/* txn_close_op_worker() + * + * closes a transaction + */ +static int txn_close_op_worker(struct ae_op* op) +{ + struct cosd_op *c_op; + int ret; + DB_TXN *txn; + DBT key, value; + struct txn_accumulator* txn_acc; + struct triton_hash_link* hash_link; + struct triton_list_link* iterator; + struct triton_list_link* scratch; + struct logical_map_entry* tmp_entry; + struct logical_map_entry* tmp_update; + DBC *dbc_p = NULL; + struct logical_map_entry lme; + struct logical_map_key lmk; + triton_list_t on_disk_entries; + triton_list_t new_disk_entries; + int on_disk_count = 0; + int done = 0; + int c_get_flag = DB_SET_RANGE; + int64_t version; + int64_t missing_ver; + DBT mv_key, mv_value; + struct missing_version mv; + void* free_ptr; + + c_op = ae_op_entry(op, struct cosd_op, op); + assert(c_op); + + /* only support one object for now */ + assert(c_op->u.txn_close.oid == 1); + + lmk.oid = c_op->u.txn_close.oid; + + /* pull txn accumulator out of hash so no one can touch it */ + triton_mutex_lock(&txn_mutex); + hash_link = triton_hash_search(txn_table, &c_op->u.txn_close.txn_number); + if(!hash_link) + { + /* TODO: txn is gone (which could be normal); error handling */ + c_op->error_code = -1; + triton_mutex_unlock(&txn_mutex); + return(1); + } + txn_acc = triton_hash_get_entry(hash_link, struct txn_accumulator, + hash_link); + triton_list_del(&txn_acc->hash_link); + triton_mutex_unlock(&txn_mutex); + +txn_close_op_retry: + on_disk_count = 0; + done = 0; + c_get_flag = DB_SET_RANGE; + /* clear up on disk list in case this is a retry */ + triton_list_for_each(iterator, scratch, &on_disk_entries) + { + tmp_entry = triton_list_get_entry(iterator, struct + logical_map_entry, list_link); + triton_list_del(&tmp_entry->list_link); + free(tmp_entry); + } + + /* do db stuff */ + ret = envp->txn_begin(envp, NULL, &txn, 0); + if(ret != 0) + { + /* TODO: error handling */ + c_op->error_code = -1; + return(1); + } + + /* create a cursor to move through logical map db */ + /* TODO: check flags */ + ret = log_map_dbp->cursor(log_map_dbp, txn, &dbc_p, 0); + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto txn_close_op_retry; + /* TODO: error handling */ + assert(0); + } + COSD_INIT_DBT(key, lmk); + COSD_INIT_DBT(value, lme); + + /* TODO: optimize to avoid updates if no log regions need to be + * replaced + */ + + /* loop through each update in the cosd txn */ + triton_list_for_each(iterator, scratch, &txn_acc->update_list) + { + tmp_update = triton_list_get_entry(iterator, struct logical_map_entry, + list_link); + + lmk.logical_offset_end = tmp_update->logical_offset + 1; + done = 0; + while(!done) + { + /* get each potentially overlapping on disk region */ + ret = dbc_p->c_get(dbc_p, &key, &value, c_get_flag); + if(ret == DB_NOTFOUND) + { + done = 1; + break; + } + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto txn_close_op_retry; + /* TODO: err handling */ + assert(0); + } + + if(lme.logical_offset >= tmp_update->logical_offset_end) + { + /* run out of overlapping regions */ + done = 1; + break; + } + + /* store this in a linked list */ + tmp_entry = malloc(sizeof(*tmp_entry)); + if(!tmp_entry) + { + /* TODO: err handling */ + assert(0); + } + *tmp_entry = lme; + triton_list_add_front(&tmp_entry->list_link, &on_disk_entries); + on_disk_count++; + c_get_flag = DB_NEXT; + + /* TODO: worth optimizing? We can instead calculate exactly + * what needs to be updated/added/removed/left alone for each + * region + */ + /* delete it from db; will be added back later if necessary */ + ret = dbc_p->c_del(dbc_p, 0); + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto txn_close_op_retry; + /* TODO: err handling */ + assert(0); + } + } + } + ret = dbc_p->c_close(dbc_p); + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto txn_close_op_retry; + /* TODO: error handling */ + assert(0); + } + + /* merge on disk and txn regions */ + ret = merge_logical_map(&on_disk_entries, on_disk_count, + &txn_acc->update_list, txn_acc->update_list_count, + &new_disk_entries, &free_ptr); + if(ret != 0) + { + /* TODO: err handling */ + assert(0); + } + + /* write new logical map updates */ + triton_list_for_each(iterator, scratch, &new_disk_entries) + { + tmp_entry = triton_list_get_entry(iterator, struct logical_map_entry, + list_link); + lme = *tmp_entry; + lmk.logical_offset_end = lme.logical_offset_end; + ret = log_map_dbp->put(log_map_dbp, txn, &key, &value, 0); + if(ret != 0) + { + txn->abort(txn); + free(free_ptr); + if(ret == DB_LOCK_DEADLOCK) + goto txn_close_op_retry; + /* TODO: err handling */ + assert(0); + } + } + free(free_ptr); + + /* read current version */ + COSD_INIT_DBT(key, c_op->u.txn_close.oid); + COSD_INIT_DBT(value, version); + + ret = ver_dbp->get(ver_dbp, txn, &key, &value, 0); + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto txn_close_op_retry; + + /* TODO: error handling */ + assert(0); + } + + if(txn_acc->txn_number > version) + { + /* this update is newer than the current version of the object */ + COSD_INIT_DBT(mv_key, mv); + COSD_INIT_DBT_EMPTY(mv_value); + + /* identify skipped version numbers */ + missing_ver = version + 1; + while(missing_ver < txn_acc->txn_number) + { + mv.oid = c_op->u.txn_close.oid; + mv.version = missing_ver; + + /* record each missing ver in db */ + ret = missing_ver_dbp->put(missing_ver_dbp, txn, &mv_key, &mv_value, 0); + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto txn_close_op_retry; + /* TODO: error handling */ + assert(0); + } + + missing_ver++; + } + + /* bump overall version number */ + version = txn_acc->txn_number; + ret = ver_dbp->put(ver_dbp, txn, &key, &value, 0); + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto txn_close_op_retry; + /* TODO: error handling */ + assert(0); + } + } + if(txn_acc->txn_number < version) + { + /* this update is older than the current version of the object */ + /* remove it from list of missing versions if present */ + memset(&mv_key, 0, sizeof(DBT)); + mv_key.data = &mv; + mv_key.size = sizeof(mv); + mv.oid = c_op->u.txn_close.oid; + mv.version = txn_acc->txn_number; + + /* delete from db db */ + ret = missing_ver_dbp->del(missing_ver_dbp, txn, &mv_key, 0); + if(ret == DB_LOCK_DEADLOCK) + { + txn->abort(txn); + goto txn_close_op_retry; + } + if(ret != 0 && ret != DB_NOTFOUND) + { + txn->abort(txn); + /* TODO: error handling */ + assert(0); + } + } + + /* flush current log offset to db in the same txn */ + /* TODO: any deadlock potential here because of ordering with mutex + * relative to txn? + */ + triton_mutex_lock(&global_log_mutex); + COSD_INIT_DBT(key, c_op->u.txn_close.oid); + COSD_INIT_DBT(value, global_log_offset); + + ret = log_offset_dbp->put(log_offset_dbp, txn, &key, &value, 0); + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto txn_close_op_retry; + + /* TODO: error handling */ + assert(0); + } + triton_mutex_unlock(&global_log_mutex); + + ret = txn->commit(txn, 0); + if(ret != 0) + { + txn->abort(txn); + if(ret == DB_LOCK_DEADLOCK) + goto txn_close_op_retry; + + /* TODO: error handling */ + assert(0); + } + + triton_list_for_each(iterator, scratch, &on_disk_entries) + { + tmp_entry = triton_list_get_entry(iterator, struct + logical_map_entry, list_link); + triton_list_del(&tmp_entry->list_link); + free(tmp_entry); + } + triton_list_for_each(iterator, scratch, &txn_acc->update_list) + { + tmp_entry = triton_list_get_entry(iterator, struct + logical_map_entry, list_link); + triton_list_del(&tmp_entry->list_link); + free(tmp_entry); + } + + free(txn_acc); + c_op->error_code = 0; + return(1); +} + +triton_ret_t triton_cosd_txn_close_post( + uint64_t oid, + uint64_t txn_number, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct ae_op *op; + struct cosd_op *c_op; + + op = ae_opcache_get(cosd_opcache); + ae_op_fill(op, callback, user_ptr, hints, ctx); + + c_op = ae_op_entry(op, struct cosd_op, op); + c_op->op_id = triton_id_gen(cosd_resource_id, (uint64_t)(op->cache_id)); + c_op->u.txn_close.oid = oid; + c_op->u.txn_close.txn_number = txn_number; + + *op_id = c_op->op_id; + + /* TODO: put this in the fill function if we keep it? */ + op->op_worker = txn_close_op_worker; + c_op->cleanup_fn = NULL; + + triton_cosd_launch_op(op, triton_cosd_progress_mode); + + return TRITON_SUCCESS; +} +triton_ret_t (* triton_cosd_txn_close)( + uint64_t oid, + uint64_t txn_number, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = triton_cosd_txn_close_post; + + +/* merge_logical_map() + * + * merges two logical maps into one map. The output map is allocated from + * scratch and can be freed via the free_ptr argument. + * + * returns 0 on success, -errno on failure + */ +static int merge_logical_map(triton_list_t* list1_in, int + list1_count, triton_list_t* list2_in, int list2_count, + triton_list_t* list_out, void** free_ptr) +{ + struct triton_list_link* iterator; + struct triton_list_link* scratch; + struct logical_map_entry* tmp_entry; + int i=0; + int j=0; + int k=0; + struct logical_map_entry* list1_array; + struct logical_map_entry* list2_array; + struct logical_map_entry* list_out_array; + struct logical_map_entry* winner; + struct logical_map_entry* loser; + int list_out_array_count = 0; + int64_t logical_offset; + + /* maximum size of merged array */ + if(list1_count > list2_count) + list_out_array_count = list1_count * 3; + else + list_out_array_count = list2_count * 3; + + /* allocate linear arrays to use for sorting */ + list_out_array = malloc(list_out_array_count*sizeof(*list_out_array)); + list1_array = malloc(list1_count*sizeof(*list1_array)); + list2_array = malloc(list2_count*sizeof(*list2_array)); + /* TODO: err handling */ + assert(list_out_array && list1_array && list2_array); + + /* populate arrays */ + i=0; + triton_list_for_each(iterator, scratch, list1_in) + { + tmp_entry = triton_list_get_entry(iterator, struct logical_map_entry, + list_link); + list1_array[i] = *tmp_entry; + i++; + } + assert(i==list1_count); + i=0; + triton_list_for_each(iterator, scratch, list2_in) + { + tmp_entry = triton_list_get_entry(iterator, struct logical_map_entry, + list_link); + list2_array[i] = *tmp_entry; + i++; + } + assert(i==list2_count); + + /* sort arrays */ + qsort(list1_array, list1_count, sizeof(struct logical_map_entry), + cmp_lme); + qsort(list2_array, list2_count, sizeof(struct logical_map_entry), + cmp_lme); + + /* pick lowest logical offset to use for iterator */ + assert(list1_count || list2_count); /* at least one needs entries */ + if(list1_count == 0) + logical_offset = list2_array[0].logical_offset; + else if(list2_count == 0) + logical_offset = list1_array[0].logical_offset; + else + { + logical_offset = COSD_MIN(list1_array[0].logical_offset, + list2_array[0].logical_offset); + } + + /* loop through arrays and merge into output array */ + i=0; + j=0; + while(i<list1_count || j<list2_count) + { + + /* consume any elements that have been entirely passed over */ + if(i < list1_count && list1_array[i].logical_offset_end <= logical_offset) + { + i++; + continue; + } + if(j < list2_count && list2_array[j].logical_offset_end <= logical_offset) + { + j++; + continue; + } + + /* shave off the beginning of any extent that has been partially + * passed over + */ + if(i < list1_count && list1_array[i].logical_offset < logical_offset) + { + list1_array[i].size -= (logical_offset - + list1_array[i].logical_offset); + list1_array[i].log_offset += (logical_offset - + list1_array[i].logical_offset); + list1_array[i].logical_offset = logical_offset; + } + if(j < list2_count && list2_array[j].logical_offset < logical_offset) + { + list2_array[j].size -= (logical_offset - + list2_array[j].logical_offset); + list2_array[j].log_offset += (logical_offset - + list2_array[j].logical_offset); + list2_array[j].logical_offset = logical_offset; + } + + /* if one list is already exhausted, then the other wins */ + if(i >= list1_count) + { + logical_offset = list2_array[j].logical_offset_end; + list_out_array[k++] = list2_array[j++]; + continue; + } + if(j >= list2_count) + { + logical_offset = list1_array[i].logical_offset_end; + list_out_array[k++] = list1_array[i++]; + continue; + } + + /* pick winner for overlapped regions */ + if(list1_array[i].logical_offset == list2_array[j].logical_offset) + { + /* TODO: think about how to handle version wrap... */ + if(list1_array[i].version > list2_array[j].version) + { + winner = &list1_array[i]; + loser = &list2_array[j]; + } + else + { + winner = &list2_array[j]; + loser = &list1_array[i]; + } + list_out_array[k] = *winner; + logical_offset = COSD_MIN(winner->logical_offset_end, + loser->logical_offset_end); + list_out_array[k].logical_offset_end = logical_offset; + list_out_array[k].size = list_out_array[k].logical_offset_end - + list_out_array[k].logical_offset; + k++; + continue; + } + + /* pick easy winner for any non-overlapping regions */ + if(list1_array[i].logical_offset < list2_array[j].logical_offset) + { + winner = &list1_array[i]; + loser = &list2_array[j]; + } + if(list2_array[j].logical_offset < list1_array[i].logical_offset) + { + winner = &list2_array[j]; + loser = &list1_array[i]; + } + list_out_array[k] = *winner; + logical_offset = COSD_MIN(winner->logical_offset_end, + loser->logical_offset); + list_out_array[k].logical_offset_end = logical_offset; + list_out_array[k].size = list_out_array[k].logical_offset_end - + list_out_array[k].logical_offset; + k++; + } + + /* TODO: assert that there is no overlap of extents _within_ either + * input array + */ + + /* merge any adjacent entries in output array that have the same version + * number. The above loop may have split some regions more than was + * strictly needed + */ + i=0; + j=1; + list_out_array_count = k; + while(j<k) + { + if(list_out_array[i].logical_offset_end == + list_out_array[j].logical_offset && + list_out_array[i].version == list_out_array[j].version && + (list_out_array[i].log_offset + list_out_array[j].size == + list_out_array[j].log_offset)) + { + list_out_array[i].size += list_out_array[j].size; + list_out_array[i].logical_offset_end += list_out_array[j].size; + list_out_array_count--; + } + else + { + i++; + list_out_array[i] = list_out_array[j]; + } + j++; + } + + /* turn final array into a linked list */ + triton_list_init(list_out); + for(i=0; i<list_out_array_count; i++) + { + triton_list_add_front(&list_out_array[i].list_link, list_out); + } + *free_ptr = list_out_array; + free(list1_array); + free(list2_array); + + return(0); +} + +static int compare_log_map_key(DB * dbp, const DBT * a, const DBT * b) +{ + struct logical_map_key* lmk_a; + struct logical_map_key* lmk_b; + + lmk_a = (struct logical_map_key *) a->data; + lmk_b = (struct logical_map_key *) b->data; + + /* oid takes precedence */ + if(lmk_a->oid > lmk_b->oid) + return(1); + if(lmk_a->oid < lmk_b->oid) + return(-1); + + /* then ending offset within oid */ + if(lmk_a->logical_offset_end > lmk_b->logical_offset_end) + return(1); + if(lmk_a->logical_offset_end < lmk_b->logical_offset_end) + return(-1); + + return 0; +} + +static int compare_missing_version(DB * dbp, const DBT * a, const DBT * b) +{ + struct missing_version* ver_a; + struct missing_version* ver_b; + + ver_a = (struct missing_version *) a->data; + ver_b = (struct missing_version *) b->data; + + /* oid takes precendenc */ + if(ver_a->oid > ver_b->oid) + return 1; + if(ver_a->oid < ver_b->oid) + return -1; + + /* then version within oid */ + if(ver_a->version > ver_b->version) + return 1; + if(ver_a->version < ver_b->version) + return -1; + + return(0); +} + +static int compare_uint64(DB * dbp, const DBT * a, const DBT * b) +{ + uint64_t* int_a; + uint64_t* int_b; + + int_a = (uint64_t *) a->data; + int_b = (uint64_t *) b->data; + + if(*int_a > *int_b) + return(1); + if(*int_a < *int_b) + return(-1); + + return(0); +} + +/* cmp_lme() + * + * logical map entry comparison function for qsort() + */ +static int cmp_lme(const void *p1, const void *p2) +{ + const struct logical_map_entry* lme1 = p1; + const struct logical_map_entry* lme2 = p2; + + if(lme1->logical_offset < lme2->logical_offset) + return(-1); + if(lme1->logical_offset > lme2->logical_offset) + return(1); + + return(0); +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/cosd/prototype/cosd-prototype.hae b/code/src/cosd/prototype/cosd-prototype.hae new file mode 100644 index 0000000..fa29f67 --- /dev/null +++ b/code/src/cosd/prototype/cosd-prototype.hae @@ -0,0 +1,116 @@ +#ifndef __COSD_PROTOTYPE_GSH__ +#define __COSD_PROTOTYPE_GSH__ + +/** \defgroup COSD prototype + * + * This is a prototype COSD to be used for initial studies of the Grayskull + * replication protocol. + * + * Notes: + * - All functions return 0 on success or -errno on failure unless otherwise + * noted + * . + * @{ + */ + +/** \file + * Declarations for COSD object storage resource. + */ + +#include "src/aesop/aesop.h" + +/** modes of making progress on posted storage operations */ +enum progress_mode +{ + TRITON_PROG_NONE = 0, /**< invalid mode */ + TRITON_PROG_POLL, /**< requires active polling by client */ + TRITON_PROG_THREAD_PER_OP, /**< spawns new thread for each op */ + TRITON_PROG_THREAD_POOL, /**< uses pre-allocated thread pool */ + TRITON_PROG_MAX, /**< invalid mode */ +}; + +/** + * Initializes COSD interface + */ +int triton_cosd_init( + enum progress_mode mode, /**< progress mode */ + const char* path /**< local path to use for storing data, + will be created if needed */ +); + +/** + * Shuts down COSD interface + */ +int triton_cosd_finalize(void); + +/** + * Creates a new object + * \return 0 on success, -errno on failure + */ +__blocking int triton_cosd_create( + uint64_t requested_oid, /**< requested identifier, a value of zero + allows OSD to choose. */ + uint64_t* out_oid /**< assigned identifier */ +); + +/** + * Retrieves current version number of object + * \return 0 on success, -errno on failure + */ +__blocking int triton_cosd_get_version( + uint64_t oid, /**< object to operate on */ + uint64_t* version /**< version number of object */ +); + +/** + * Opens a txn + * \return 0 on success, -errno on failure + */ +int triton_cosd_txn_open( + uint64_t oid, /**< object to operate on */ + uint64_t txn_number /**< caller-assigned txn identifier */ +); + +/** + * Closes a txn + * \return 0 on success, -errno on failure + */ +__blocking int triton_cosd_txn_close( + uint64_t oid, /**< object to operate on */ + uint64_t txn_number /**< caller-assigned txn identifier */ +); + +/** + * Writes data into an object + * \return 0 on success, -errno on failure + */ +__blocking int triton_cosd_write( + uint64_t oid, /**< object to operate on */ + uint64_t txn_number, /**< txn identifier */ + char** mem_offsets, /**< memory region pointers */ + int64_t* mem_sizes, /**< memory region sizes */ + int mem_count, /**< memory region count */ + int64_t* obj_offsets, /**< object region offsets */ + int64_t* obj_sizes, /**< object region sizes */ + int obj_count /**< object region count */ +); + + +/** + * Dumps object version and log information from cosd to stdout + * \return 0 on success, -errno on failure + */ +__blocking int triton_cosd_dump(void); + +#endif + +/* @} */ + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/cosd/prototype/module.mk.in b/code/src/cosd/prototype/module.mk.in new file mode 100644 index 0000000..9449bbd --- /dev/null +++ b/code/src/cosd/prototype/module.mk.in @@ -0,0 +1,6 @@ +DIR := resources/cosd-prototype + +GSHDR += $(DIR)/cosd-prototype.hae +LIBSRC += $(DIR)/cosd-prototype.c + +MODCFLATRITON_$(DIR) = @DB_CFLAGS@ diff --git a/oldcode/src/gsl/resources/cosd-prototype/test/4M-w-serial.txt b/code/src/cosd/prototype/test/4M-w-serial.txt similarity index 100% copy from oldcode/src/gsl/resources/cosd-prototype/test/4M-w-serial.txt copy to code/src/cosd/prototype/test/4M-w-serial.txt diff --git a/oldcode/src/gsl/resources/cosd-prototype/test/README b/code/src/cosd/prototype/test/README similarity index 100% copy from oldcode/src/gsl/resources/cosd-prototype/test/README copy to code/src/cosd/prototype/test/README diff --git a/code/src/cosd/prototype/test/cosd-bench-concurrent.ae b/code/src/cosd/prototype/test/cosd-bench-concurrent.ae new file mode 100644 index 0000000..bc5c8e5 --- /dev/null +++ b/code/src/cosd/prototype/test/cosd-bench-concurrent.ae @@ -0,0 +1,235 @@ + +#include <stdio.h> +#include <errno.h> +#include "src/aesop/aesop.h" +#include "src/cosd/prototype/cosd-prototype.hae" +#include "triton-config.h" + +/* TODO: this needs to be in a header somewhere */ +#ifndef llu +#if SIZEOF_LONG_INT == 4 +# define llu(x) (x) +# define lld(x) (x) +# define SCANF_lld lld +#elif SIZEOF_LONG_INT == 8 +# define llu(x) (unsigned long long)(x) +# define lld(x) (long long)(x) +# define SCANF_lld ld +#else +# error Unexpected sizeof(long int) +#endif +#endif + +enum op_type +{ + WRITE, + READ +}; + +struct bench_op +{ + int64_t offset; + int64_t size; + enum op_type type; + struct triton_list_link list_link; +}; + +TRITON_LIST_DEFINE(op_list); +triton_mutex_t op_list_mutex = TRITON_MUTEX_INITIALIZER; + +static __blocking int do_cosd_test(void) +{ + int ret; + + uint64_t out_oid1; + uint64_t version; + + ret = triton_cosd_create(1, &out_oid1); + if(ret == -EEXIST) + { + printf("# operating on existing object.\n"); + } + else if(ret != 0) + { + printf("Error creating oid=1: %d\n", ret); + return 1; + } + + ret = triton_cosd_get_version(1, &version); + if(ret != 0) + { + printf("Error getting version number for oid=1: %d\n", ret); + return(1); + } + + pwait + { + int i; + /* TODO: make "16" tunable */ + for(i=0; i<16; i++) + { + pbranch + { + struct triton_list_link* tmp_link; + char* buffer = NULL; + uint64_t b_version; + struct bench_op* tmp_op; + int b_ret; + /* TODO: make buffer size configurable, and check that + * nothing in workload desc is bigger than this + */ + int64_t buffer_size = 4*1024*1024; + + buffer = malloc(buffer_size); + assert(buffer); + + triton_mutex_lock(&op_list_mutex); + while((tmp_link = triton_queue_dequeue(&op_list)) != NULL) + { + b_version = version++; + triton_mutex_unlock(&op_list_mutex); + + tmp_op = triton_list_get_entry(tmp_link, struct bench_op, + list_link); + /* only writes for now */ + assert(tmp_op->type == WRITE); + ret = triton_cosd_txn_open(1, b_version); + if(ret != 0) + { + /* TODO: err handling */ + assert(0); + } + + b_ret = triton_cosd_write(1, b_version, &buffer, + &buffer_size, 1, &tmp_op->offset, &tmp_op->size, 1); + if(b_ret < 0) + { + /* TODO: error handling */ + assert(0); + } + + ret = triton_cosd_txn_close(1, b_version); + if(ret != 0) + { + /* TODO: error handling */ + assert(0); + } + + triton_mutex_lock(&op_list_mutex); + } + triton_mutex_unlock(&op_list_mutex); + + free(buffer); + } + } + } + +#if 0 + ret = triton_cosd_dump(); + assert(ret == 0); +#endif + return 0; +} + +int done = 0; + +static void done_callback(void *up, int ret) +{ + done = 1; +} + + +int main(int argc, char *argv[]) +{ + triton_context_t ctx; + triton_op_id_t op_id; + int mode = TRITON_PROG_POLL; + int pc = 0; + FILE *desc = 0; + char line[2048]; + char op_string[100]; + int64_t size; + int64_t offset; + int ret; + struct bench_op* tmp_op; + + if(argc != 4) + { + fprintf(stderr, "Usage: cosd1 <1|2> <workload description file> <cosd dir>\n"); + fprintf(stderr, " # 1 for polling\n"); + fprintf(stderr, " # 2 for thread-per-op\n"); + return(-1); + } + + sscanf(argv[1], "%d", &mode); + if(mode > 2 || mode < 1) + { + fprintf(stderr, "Usage: cosd1 <1|2>\n"); + fprintf(stderr, " # 1 for polling\n"); + fprintf(stderr, " # 2 for thread-per-op\n"); + return(-1); + } + + /* parse description of workload */ + desc = fopen(argv[2], "r"); + if(!desc) + { + perror("fopen"); + return(-1); + } + while(fgets(line, 2048, desc)) + { + if(line[0] == '#') + continue; +#if SIZEOF_LONG_INT == 4 + ret = sscanf(line, "%s %lld %lld", op_string, &offset, &size); +#else + ret = sscanf(line, "%s %ld %ld", op_string, &offset, &size); +#endif + if(ret != 3) + { + fprintf(stderr, "Error: bad line: %s\n", line); + return(-1); + } + tmp_op = malloc(sizeof(*tmp_op)); + assert(tmp_op); + + /* only writes for now */ + assert(strcmp(op_string, "write") == 0); + tmp_op->type = WRITE; + tmp_op->offset = offset; + tmp_op->size = size; + triton_queue_enqueue(&tmp_op->list_link, &op_list); + } + fclose(desc); + + if(mode == 1) + printf("# Initializing cosd in poll-driven mode.\n"); + else + printf("# Initializing cosd in thread-per-op mode.\n"); + + triton_cosd_init(mode, argv[3]); + + triton_context_create(&ctx, 1, "cosd"); + + done = 0; + do_cosd_test_post(done_callback, NULL, NULL, ctx, &op_id); + while(done == 0) + { + pc++; + triton_poll(ctx, 10000); + } + + triton_cosd_finalize(); + triton_context_destroy(ctx); + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/cosd/prototype/test/cosd1.ae b/code/src/cosd/prototype/test/cosd1.ae new file mode 100644 index 0000000..7b2b51a --- /dev/null +++ b/code/src/cosd/prototype/test/cosd1.ae @@ -0,0 +1,236 @@ + +#include <stdio.h> +#include <errno.h> +#include "src/aesop/aesop.h" +#include "src/cosd/prototype/cosd-prototype.hae" +#include "triton-config.h" + +/* TODO: this needs to be in a header somewhere */ +#ifndef llu +#if SIZEOF_LONG_INT == 4 +# define llu(x) (x) +# define lld(x) (x) +# define SCANF_lld "%lld" +#elif SIZEOF_LONG_INT == 8 +# define llu(x) (unsigned long long)(x) +# define lld(x) (long long)(x) +# define SCANF_lld "%ld" +#else +# error Unexpected sizeof(long int) +#endif +#endif + +static __blocking int do_cosd_test(void) +{ + int ret; + char buffer[4096]; + + int64_t buffer_szs[3]; + char* buffer_offsets[3]; + int64_t obj_offsets[3]; + int64_t obj_szs[3]; + + uint64_t out_oid1; + uint64_t version; + + printf("Creating oid 1 (if it doesn't already exist)...\n"); + ret = triton_cosd_create(1, &out_oid1); + if(ret != 0 && ret != -EEXIST) + { + printf("Error creating oid=1: %d\n", ret); + return 1; + } + printf("DONE\n"); + + printf("Getting version number of oid 1...\n"); + ret = triton_cosd_get_version(1, &version); + if(ret != 0) + { + printf("Error getting version number for oid=1: %d\n", ret); + return(1); + } + printf("DONE: %llu\n", llu(version)); + + ret = triton_cosd_dump(); + assert(ret == 0); + /********************************************************/ + printf("opening txn...\n"); + ret = triton_cosd_txn_open(1, (version+1)); + if(ret != 0) + { + printf("Error opening txn 1: %d\n", ret); + return 1; + } + printf("DONE\n"); + + printf("writing 0-1024...\n"); + buffer_offsets[0] = buffer; + buffer_szs[0] = 1024; + obj_offsets[0] = 0; + obj_szs[0] = 1024; + ret = triton_cosd_write(1, (version+1), buffer_offsets, buffer_szs, 1, + obj_offsets, obj_szs, 1); + if(ret != 0) + { + printf("Error writing 0-1024: %d\n", ret); + return 1; + } + printf("DONE\n"); + + printf("closing txn...\n"); + ret = triton_cosd_txn_close(1, (version+1)); + if(ret != 0) + { + printf("Error closing txn 1: %d\n", ret); + return 1; + } + printf("DONE\n"); + + ret = triton_cosd_dump(); + assert(ret == 0); + /********************************************************/ + printf("opening txn...\n"); + ret = triton_cosd_txn_open(1, (version+3)); + if(ret != 0) + { + printf("Error opening txn 1: %d\n", ret); + return 1; + } + printf("DONE\n"); + + printf("writing with listio (3 mem regions, 2 file regions)...\n"); + buffer_offsets[0] = buffer; + buffer_offsets[1] = buffer+512; + buffer_offsets[2] = buffer+768; + buffer_szs[0] = 512; + buffer_szs[1] = 256; + buffer_szs[2] = 256; + obj_offsets[0] = 1024; + obj_offsets[1] = 2000; + obj_szs[0] = 100; + obj_szs[1] = 924; + ret = triton_cosd_write(1, (version+3), buffer_offsets, buffer_szs, 3, + obj_offsets, obj_szs, 2); + if(ret != 0) + { + printf("Error writing with listio: %d\n", ret); + return 1; + } + printf("DONE\n"); + + printf("closing txn...\n"); + ret = triton_cosd_txn_close(1, (version+3)); + if(ret != 0) + { + printf("Error closing txn 1: %d\n", ret); + return 1; + } + printf("DONE\n"); + + ret = triton_cosd_dump(); + assert(ret == 0); + /********************************************************/ + printf("opening txn...\n"); + ret = triton_cosd_txn_open(1, (version+2)); + if(ret != 0) + { + printf("Error opening txn 1: %d\n", ret); + return 1; + } + printf("DONE\n"); + + printf("writing bigger region with old version...\n"); + buffer_offsets[0] = buffer; + buffer_szs[0] = 4096; + obj_offsets[0] = 200; + obj_szs[0] = 4096; + ret = triton_cosd_write(1, (version+2), buffer_offsets, buffer_szs, 1, + obj_offsets, obj_szs, 1); + if(ret != 0) + { + printf("Error writing with listio: %d\n", ret); + return 1; + } + printf("DONE\n"); + + printf("closing txn...\n"); + ret = triton_cosd_txn_close(1, (version+2)); + if(ret != 0) + { + printf("Error closing txn 1: %d\n", ret); + return 1; + } + printf("DONE\n"); + + + + ret = triton_cosd_dump(); + assert(ret == 0); + return 0; +} + +int done = 0; + +static void done_callback(void *up, int ret) +{ + done = 1; +} + + +int main(int argc, char *argv[]) +{ + triton_context_t ctx; + triton_op_id_t op_id; + int mode = TRITON_PROG_POLL; + int pc = 0; + + if(argc != 2) + { + fprintf(stderr, "Usage: cosd1 <1|2>\n"); + fprintf(stderr, " # 1 for polling\n"); + fprintf(stderr, " # 2 for thread-per-op\n"); + return(-1); + } + + sscanf(argv[1], "%d", &mode); + if(mode > 2 || mode < 1) + { + fprintf(stderr, "Usage: cosd1 <1|2>\n"); + fprintf(stderr, " # 1 for polling\n"); + fprintf(stderr, " # 2 for thread-per-op\n"); + return(-1); + } + + if(mode == 1) + printf("Initializing cosd in poll-driven mode...\n"); + else + printf("Initializing cosd in thread-per-op mode...\n"); + + triton_cosd_init(mode, "/tmp/cosd"); + printf("Done.\n"); + + triton_context_create(&ctx, 1, "cosd"); + + done = 0; + do_cosd_test_post(done_callback, NULL, NULL, ctx, &op_id); + while(done == 0) + { + pc++; + triton_poll(ctx, 10000); + fflush(NULL); + printf("polled %d times...\n", pc); + } + + triton_cosd_finalize(); + triton_context_destroy(ctx); + return 0; +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/cosd/prototype/test/module.mk.in b/code/src/cosd/prototype/test/module.mk.in new file mode 100644 index 0000000..5b6d349 --- /dev/null +++ b/code/src/cosd/prototype/test/module.mk.in @@ -0,0 +1,8 @@ +DIR := resources/cosd-prototype/test + +AETESTSRC += $(DIR)/cosd1.ae +AETESTSRC += $(DIR)/cosd-bench-concurrent.ae +AETESTSRC += $(DIR)/workload-gen.ae + +MODLIBS_$(DIR) = -lpthread @DB_LIB@ + diff --git a/code/src/cosd/prototype/test/workload-gen.ae b/code/src/cosd/prototype/test/workload-gen.ae new file mode 100644 index 0000000..f83c225 --- /dev/null +++ b/code/src/cosd/prototype/test/workload-gen.ae @@ -0,0 +1,122 @@ +#include <stdio.h> +#include <errno.h> +#include <assert.h> +#include <stdlib.h> + +#include "src/aesop/aesop.h" +#include "src/cosd/prototype/cosd-prototype.hae" +#include "triton-config.h" + + +/* + * arguments: + * ./workload-gen <total size> <op size> <l|r> + */ + +/* TODO: this needs to be in a header somewhere */ +#ifndef llu +#if SIZEOF_LONG_INT == 4 +# define llu(x) (x) +# define lld(x) (x) +# define SCANF_lld lld +#elif SIZEOF_LONG_INT == 8 +# define llu(x) (unsigned long long)(x) +# define lld(x) (long long)(x) +# define SCANF_lld ld +#else +# error Unexpected sizeof(long int) +#endif +#endif + +int main(int argc, char **argv) +{ + int64_t total_size = -1; + int64_t op_size = -1; + int random_flag = 0; + int op_count = 0; + int64_t* offset_array; + int i; + int64_t current_offset = 0; + + if(argc != 4) + { + fprintf(stderr, "Usage: %s <total size> <op size> <l|r>\n", + argv[0]); + fprintf(stderr, " r=random, l=linear\n"); + return(-1); + } + +#if SIZEOF_LONG_INT == 4 + sscanf(argv[1], "%lld", &total_size); + sscanf(argv[2], "%lld", &op_size); +#else + sscanf(argv[1], "%ld", &total_size); + sscanf(argv[2], "%ld", &op_size); +#endif + + if(total_size < 1 || op_size < 1) + { + fprintf(stderr, "Usage: %s <total size> <op size> <l|r>\n", + argv[0]); + fprintf(stderr, " r=random, l=linear\n"); + return(-1); + } + + if(strcmp(argv[3], "l") == 0) + random_flag = 0; + else if(strcmp(argv[3], "r") == 0) + random_flag = 1; + else + { + fprintf(stderr, "Usage: %s <total size> <op size> <l|r>\n", + argv[0]); + fprintf(stderr, " r=random, l=linear\n"); + return(-1); + } + + if(total_size % op_size != 0) + { + fprintf(stderr, "Error: sizes must be evenly divisible.\n"); + return(-1); + } + + op_count = total_size/op_size; + + /* allocate one big array with all of the offset */ + offset_array = malloc(op_count*sizeof(int64_t)); + assert(offset_array); + + for(i=0; i<op_count; i++) + { + offset_array[i] = current_offset; + current_offset+= op_size; + } + + if(random_flag && op_count > 1) + { + for(i=0; i<(op_count-1); i++) + { + int j = i + rand() / (RAND_MAX / (op_count-i) + 1); + int64_t t = offset_array[j]; + offset_array[j] = offset_array[i]; + offset_array[i] = t; + } + } + + printf("# <op> <offset> <size>\n"); + for(i=0; i<op_count; i++) + { + printf("write\t%lld\t%lld\n", lld(offset_array[i]), lld(op_size)); + } + + return(0); +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/encoding-notes b/code/src/encoding-notes new file mode 100644 index 0000000..69ee9a6 --- /dev/null +++ b/code/src/encoding-notes @@ -0,0 +1,109 @@ + + +struct mystruct +{ + int p1; + triton_list_link_t link; +}; + +support for lists: if the list appears in a remote structure: + +__remote struct mystruct +{ + triton_list_t <name>_mystruct_link; +}; + +Then it must have a specific name: + +list_mystruct_link, where the +triton_list_t list; + +triton_op_t op; + + +triton_encode_triton_list_t(buffer, "list_mystruct", &s->list_mystruct, struct mystruct, link) + + +struct mystruct +{ + int *mya_array; + uint64_t mya_arraylength; +}; + +triton_encode_triton_countlist_t(buffer, "oplist", &clist, triton_op_t, link, &ret); + +triton_op_t *ops = malloc(sizeof(*ops) * opcount); + +triton_encode_array(buffer, "oparray", &ops, triton_op_t, opcount, &ret); + +struct triton_list_t_iter +{ + triton_list_link_t next; +}; + +myt *triton_list_t_next(triton_list_t *list, struct triton_list_t_iter *iter, myt *(*triton_list_t_entry_to_myt)(void *entry)) +{ + +} + +/* iterator functions */ + +struct <itertype>_iter { ... }; + +struct <itertype>_iter *<itertype>_iter_init(<itertype> *a); + +<type> *<itertype>_next(<itertype> *a, struct <itertype>_iter *iter, <type> *(*<itertype>_entry_to_<type>)(void *entry)); + +triton_ret_t <itertype>_encode_start(triton_buffer_t *buf, const triton_string_t varname, <itertype> *a, uint64_t size); +triton_ret_t <itertype>_encode_end(triton_buffer_t *buf, const triton_string_t varname, <itertype> *a); + +triton_ret_t <itertype>_decode_start(triton_buffer_t<itertype> *a); +triton_ret_t <itertype>_decode_end(<itertype> *a); + + +/* array example */ + +__remote struct myr +{ + int32_t *mya_array; + int64_t mya_size; +}; + +/* would require */ + +struct any_array_iter +{ + void *iter; + int32_t increment; +}; + +static inline void any_array_iter_init(void *a, struct any_array_iter *iter) +{ + iter->iter = a; +} + +static inline void *int32_t_array_iter_next(struct int32_t_array_iter *iter) +{ + ++(iter->iter); + return (iter->iter); +} + +static inline triton_ret_t int32_t_array_encode_start(triton_buffer_t *buf, const triton_string_t varname, <itertype> *a, uint64_t size) +{ + return triton_uint64_t_encode(buf, NULL, &size); +} + + + +triton_ret_t int32_t_array_encode_end(triton_buffer_t *buf, const triton_string_t varname, <itertype> *a); + +triton_ret_t <itertype>_decode_start(triton_buffer_t<itertype> *a); +triton_ret_t <itertype>_decode_end(<itertype> *a); + +static inline void + + + +int32_t * + +triton_encode_any_array( diff --git a/code/src/net/module.mk.in b/code/src/net/module.mk.in new file mode 100644 index 0000000..f833582 --- /dev/null +++ b/code/src/net/module.mk.in @@ -0,0 +1,8 @@ +DIR := src/net + +AESOP_HDR += $(DIR)/triton-message.hae \ + $(DIR)/triton-message-method.hae \ + $(DIR)/triton-message-internal.hae + +AELIBSRC += $(DIR)/triton-message.ae \ + $(DIR)/triton-node.ae diff --git a/code/src/net/mpi/errors.c b/code/src/net/mpi/errors.c new file mode 100644 index 0000000..df082fe --- /dev/null +++ b/code/src/net/mpi/errors.c @@ -0,0 +1,11 @@ + +triton_ret_t triton_error_from_mpi(int mpi_error) +{ + switch(mpi_error) + { + case MPI_SUCCESS: return TRITON_SUCCESS; + /* TODO: add other MPI errors here */ + default: return TRITON_ERR_UNKNOWN; + } +} + diff --git a/code/src/net/mpi/errors.h b/code/src/net/mpi/errors.h new file mode 100644 index 0000000..ded5f50 --- /dev/null +++ b/code/src/net/mpi/errors.h @@ -0,0 +1,9 @@ +#ifndef __ERRORS_H__ +#define __ERRORS_H__ + +#include "mpi.h" +#include "src/common/triton-error.h" + +triton_ret_t triton_error_from_mpi(int mpi_error); + +#endif diff --git a/code/src/net/mpi/module.mk.in b/code/src/net/mpi/module.mk.in new file mode 100644 index 0000000..78ae187 --- /dev/null +++ b/code/src/net/mpi/module.mk.in @@ -0,0 +1,24 @@ +DIR := src/net/mpi + +ifneq (,$(BUILD_MPI)) + +AEHDR += $(DIR)/mpi.hae + +LIBSRC += $(DIR)/mpi.c \ + $(DIR)/errors.c + +AELIBSRC += $(DIR)/mpi-method.ae + +MODCFLATRITON_$(DIR)/mpi.hae = $(MPICFLAGS) +MODCC_$(DIR)/mpi.hae = $(MPICC) + +MODCFLATRITON_$(DIR)/mpi.c = $(MPICFLAGS) +MODCC_$(DIR)/mpi.c = $(MPICC) + +MODCFLATRITON_$(DIR)/errors.c = $(MPICFLAGS) +MODCC_$(DIR)/errors.c = $(MPICC) + +MODCFLATRITON_$(DIR)/mpi-method.ae = $(MPICFLAGS) +MODCC_$(DIR)/mpi-method.ae = $(MPICC) + +endif # BUILD_MPI diff --git a/code/src/net/mpi/mpi-method.ae b/code/src/net/mpi/mpi-method.ae new file mode 100644 index 0000000..e5884bf --- /dev/null +++ b/code/src/net/mpi/mpi-method.ae @@ -0,0 +1,247 @@ + +#include "mpi.h" +#include "src/net/mpi/triton-mpi.h" + +#include "src/common/triton-node.h" +#include "src/net/mpi/errors.h" + +#define node2rank(node) ((int)node.l) +#define rank2node(rank, node) (node.l = (rank), node.u = 0) + +static uint128_t triton_mpi_rank; + +triton_node_t triton_msg_mpi_node_self(void) +{ + return triton_mpi_rank; +} + +triton_string_t *triton_msg_mpi_node_to_string(triton_node_t node) +{ + triton_string_t *nodestr; + + nodestr = malloc(sizeof(*nodestr)); + if(!nodestr) + { + return NULL; + } + triton_string_init(nodestr, "rank=%ul", node2rank(node)); + return nodestr; +} + +triton_node_t triton_msg_mpi_node_lookup(const char *name) +{ + int rank; + triton_node_t node; + rank = atoi(name) + rank2node(rank, node); + return node; +} + +struct triton_mpi_group +{ + char *name; + triton_msg_group_t group; + MPI_Comm comm; + struct triton_hash_link link; +}; + +triton_ret_t triton_msg_mpi_group_add(const char *service_name, triton_msg_group_t *group) +{ + int ret; + uint32_t h1 = 0, h2 = 0; + struct triton_mpi_group *newgroup; + + newgroup = malloc(sizeof(*newgroup)); + if(newgroup == NULL) return TRITON_SUCCESS; + + newgroup->name = strdup(service_name); + + bj_hashlittle2(service_name, strlen(service_name), &h1, &h2); + newgroup->group = h1; + *group = newgroup->group; + + ret = MPI_Comm_dup(MPI_COMM_WORLD, &newgroup->comm); + if(ret != MPI_SUCCESS) + { + return triton_error_from_mpi(ret); + } + + triton_hash_add(group_table, newgroup->group, &newgroup->link); + return TRITON_SUCCESS; +} + +static __blocking triton_ret_t triton_msg_mpi_send( + triton_node_t to, + triton_msg_group_t group, + triton_msg_tag_t tag, + int count, + char **buffers, + uint32_t *sizes) +{ + int ret, rank; + MPI_Datatype hind_type; + MPI_Aint *offsets; + struct triton_hash_link *groupl; + struct triton_mpi_group *group_entry; + + offsets = malloc(sizeof(*offsets) * count); + if(offsets == NULL) + { + return TRITON_ERR_NOMEM; + } + + for(i = 0; i < count; ++i) + { + MPI_Get_address(&buffers[i], &offsets[i]); + } + + ret = MPI_Type_create_hindexed(count, (int *)sizes, offsets, MPI_BYTE, &hind_type); + if(ret != MPI_SUCCESS) + { + free(offsets); + return triton_error_from_mpi(ret); + } + + /* lookup communicator */ + groupl = triton_hash_search(group_table, group); + group_entry = triton_hash_get_entry(groupl, struct triton_mpi_group, link); + + rank = node2rank(to); + + ret = triton_mpi_send(size, hind_type, rank, tag, group_entry->comm); + if(ret != TRITON_SUCCESS) + { + free(offsets); + MPI_Type_free(&hind_type); + return ret; + } + + free(offsets); + MPI_Type_free(&hind_type); + return TRITON_SUCCESS; +} + +static __blocking triton_ret_t triton_msg_mpi_recv( + triton_node_t from, + triton_msg_group_t group, + triton_msg_tag_t tag, + int count, + char **buffers, + uint32_t *sizes, + uint32_t *bytes_received) +{ + int ret, rank; + MPI_Datatype hind_type; + MPI_Aint *offsets; + struct triton_hash_link *groupl; + struct triton_mpi_group *group_entry; + + offsets = malloc(sizeof(*offsets) * count); + if(offsets == NULL) + { + return TRITON_ERR_NOMEM; + } + + for(i = 0; i < count; ++i) + { + MPI_Get_address(&buffers[i], &offsets[i]); + } + + ret = MPI_Type_create_hindexed(count, (int *)sizes, offsets, MPI_BYTE, &hind_type); + if(ret != MPI_SUCCESS) + { + free(offsets); + return triton_error_from_mpi(ret); + } + + /* lookup communicator */ + groupl = triton_hash_search(group_table, group); + group_entry = triton_hash_get_entry(groupl, struct triton_mpi_group, link); + + rank = node2rank(from); + + ret = triton_mpi_recv(size, hind_type, rank, tag, group_entry->comm, &status); + if(ret != TRITON_SUCCESS) + { + free(offsets); + MPI_Type_free(&hind_type); + return ret; + } + + ret = MPI_Get_elements(status, hind_type, (int *)bytes_received); + if(ret != MPI_SUCCESS) + { + free(offsets); + MPI_Type_free(&hind_type); + return triton_error_from_mpi(ret); + } + + free(offsets); + MPI_Type_free(&hind_type); + return TRITON_SUCCESS; +} + +static struct triton_msg_method triton_msg_mpi_method = +{ + .name = "mpi", + + .node_self = triton_msg_mpi_node_self, + .node_to_string = triton_msg_mpi_node_to_string, + .node_lookup = triton_msg_mpi_node_lookup, + + .group_add = triton_msg_mpi_group_add, + .send = triton_msg_mpi_send, + .recv = triton_msg_mpi_recv +}; + +void triton_mpi_init(void) +{ + int rank, ret; + + ret = MPI_Init(NULL, NULL); + if(ret != MPI_SUCCESS) + { + triton_err(triton_log_default, "%s:%d: Failed to initialize MPI", __FILE__, __LINE__); + assert(ret != MPI_SUCCESS); + } + + ret = MPI_Comm_rank(MPI_COMM_WORLD, &rank); + if(ret != MPI_SUCCESS) + { + triton_err(triton_log_default, "%s:%d: Failed to get MPI rank", __FILE__, __LINE__); + assert(ret != MPI_SUCCESS); + } + + /* set my rank */ + rank2node(rank, triton_mpi_rank); + + group_table = triton_hash_init(mpi_group_compare, triton_hash_32bit_hash, 1024); + if(!group_table) + { + triton_err(triton_log_default, "%s:%d: Failed to initialize group hashtable", __FILE__, __LINE__); + assert(group_table); + } + + triton_msg_register_method(&triton_msg_mpi_method); +} + +static void group_entry_free(void *x) +{ + struct triton_mpi_group *g; + + g = (struct triton_mpi_group *)x; + + MPI_Comm_free(&g->comm); + free(g->name); + free(g); +} + +void triton_mpi_finalize(void) +{ + triton_msg_method_unregister(triton_msg_mpi_method.name); + + triton_hash_destroy_and_finalize(group_table, group_entry_free); + + MPI_Finalize(); +} + diff --git a/code/src/net/mpi/mpi-method.c b/code/src/net/mpi/mpi-method.c new file mode 100644 index 0000000..f20c023 --- /dev/null +++ b/code/src/net/mpi/mpi-method.c @@ -0,0 +1,200 @@ + +#include "mpi.h" +#include "src/net/mpi/triton-mpi.h" + +#include "src/common/triton-node.h" +#include "src/net/mpi/errors.h" + +#define node2rank(node) ((int)node.l) +#define rank2node(rank, node) (node.l = (rank), node.u = 0) + +static uint128_t triton_mpi_rank; + +triton_node_t triton_msg_mpi_node_self(void) +{ + return triton_mpi_rank; +} + +triton_string_t *triton_msg_mpi_node_to_string(triton_node_t node) +{ + triton_string_t *nodestr; + + nodestr = malloc(sizeof(*nodestr)); + if(!nodestr) + { + return NULL; + } + triton_string_init(nodestr, "rank=%ul", node2rank(node)); + return nodestr; +} + +triton_node_t triton_msg_mpi_node_lookup(const char *name) +{ + int rank; + triton_node_t node; + rank = atoi(name) + rank2node(rank, node); + return node; +} + +struct triton_mpi_group +{ + char *name; + triton_msg_group_t group; + MPI_Comm comm; + struct triton_hash_link link; +}; + +triton_ret_t triton_msg_mpi_group_add(const char *service_name, triton_msg_group_t *group) +{ + int ret; + uint32_t h1 = 0, h2 = 0; + struct triton_mpi_group *newgroup; + + newgroup = malloc(sizeof(*newgroup)); + if(newgroup == NULL) return TRITON_SUCCESS; + + newgroup->name = strdup(service_name); + + bj_hashlittle2(service_name, strlen(service_name), &h1, &h2); + newgroup->group = h1; + *group = newgroup->group; + + ret = MPI_Comm_dup(MPI_COMM_WORLD, &newgroup->comm); + if(ret != MPI_SUCCESS) + { + return triton_error_from_mpi(ret); + } + + triton_hash_add(group_table, newgroup->group, &newgroup->link); + return TRITON_SUCCESS; +} + +__init(13) void triton_mpi_init(MPI_Comm comm) +{ + int rank, ret; + + ret = MPI_Init(NULL, NULL); + if(ret != MPI_SUCCESS) + { + triton_err(triton_log_default, "%s:%d: Failed to initialize MPI", __FILE__, __LINE__); + assert(ret != MPI_SUCCESS); + } + + ret = MPI_Comm_rank(comm, &rank); + if(ret != MPI_SUCCESS) + { + triton_err(triton_log_default, "%s:%d: Failed to get MPI rank", __FILE__, __LINE__); + assert(ret != MPI_SUCCESS); + } + + /* set my rank */ + rank2node(rank, triton_mpi_rank); + + group_table = triton_hash_init(mpi_group_compare, triton_hash_32bit_hash, 1024); + if(!group_table) + { + triton_err(triton_log_default, "%s:%d: Failed to initialize group hashtable", __FILE__, __LINE__); + assert(group_table); + } +} + +static __blocking triton_ret_t triton_msg_mpi_send(triton_node_t to, triton_msg_group_t group, triton_msg_tag_t tag, int count, char **buffers, uint32_t *sizes) +{ + int ret, rank; + MPI_Datatype hind_type; + MPI_Aint *offsets; + struct triton_hash_link *groupl; + struct triton_mpi_group *group_entry; + + offsets = malloc(sizeof(*offsets) * count); + if(offsets == NULL) + { + return TRITON_ERR_NOMEM; + } + + for(i = 0; i < count; ++i) + { + MPI_Get_address(&buffers[i], &offsets[i]); + } + + ret = MPI_Type_create_hindexed(count, (int *)sizes, offsets, MPI_BYTE, &hind_type); + if(ret != MPI_SUCCESS) + { + free(offsets); + return triton_error_from_mpi(ret); + } + + /* lookup communicator */ + groupl = triton_hash_search(group_table, group); + group_entry = triton_hash_get_entry(groupl, struct triton_mpi_group, link); + + rank = node2rank(to); + + ret = triton_mpi_send(size, hind_type, rank, tag, group_entry->comm); + if(ret != TRITON_SUCCESS) + { + free(offsets); + MPI_Type_free(&hind_type); + return ret; + } + + free(offsets); + MPI_Type_free(&hind_type); + return TRITON_SUCCESS; +} + +static __blocking triton_ret_t triton_msg_mpi_recv( + triton_node_t from, triton_msg_group_t group, triton_msg_tag_t tag, int count, char **buffers, uint32_t *sizes, uint32_t *bytes_received) +{ + int ret, rank; + MPI_Datatype hind_type; + MPI_Aint *offsets; + struct triton_hash_link *groupl; + struct triton_mpi_group *group_entry; + + offsets = malloc(sizeof(*offsets) * count); + if(offsets == NULL) + { + return TRITON_ERR_NOMEM; + } + + for(i = 0; i < count; ++i) + { + MPI_Get_address(&buffers[i], &offsets[i]); + } + + ret = MPI_Type_create_hindexed(count, (int *)sizes, offsets, MPI_BYTE, &hind_type); + if(ret != MPI_SUCCESS) + { + free(offsets); + return triton_error_from_mpi(ret); + } + + /* lookup communicator */ + groupl = triton_hash_search(group_table, group); + group_entry = triton_hash_get_entry(groupl, struct triton_mpi_group, link); + + rank = node2rank(from); + + ret = triton_mpi_recv(size, hind_type, rank, tag, group_entry->comm, &status); + if(ret != TRITON_SUCCESS) + { + free(offsets); + MPI_Type_free(&hind_type); + return ret; + } + + ret = MPI_Get_elements(status, hind_type, (int *)bytes_received); + if(ret != MPI_SUCCESS) + { + free(offsets); + MPI_Type_free(&hind_type); + return triton_error_from_mpi(ret); + } + + free(offsets); + MPI_Type_free(&hind_type); + return TRITON_SUCCESS; +} + diff --git a/code/src/net/mpi/mpi.c b/code/src/net/mpi/mpi.c new file mode 100644 index 0000000..729df97 --- /dev/null +++ b/code/src/net/mpi/mpi.c @@ -0,0 +1,596 @@ + +#include <stdlib.h> +#include <errno.h> +#include "src/aesop/aesop.h" +#include "src/aesop/opcache.h" +#include "src/aesop/op.h" +#include "src/common/triton-hash.h" +#include "src/net/mpi/mpi.h" + +#define MPI_TESTCOUNT_MAXSIZE 1024 + +struct mpi_op +{ + MPI_Request *request; + MPI_Status *status; + ae_op_id_t op_id; + struct ae_op op; +}; + +struct mpi_context +{ + ae_context_t ctx_ptr; + + ae_opcache_t opcache; + ae_ops_t oplist; + triton_mutex_t oplist_mutex; + + MPI_Request *reqarray; + MPI_Status *statusarray; + int *indexarray; + + int array_size; + int array_count; + triton_mutex_t array_mutex; + + triton_mutex_t wait_mutex; + triton_cond_t wait_cond; + + int ops_in_progress; + + struct triton_hash_link link; +}; + +static struct triton_hash_table *context_table; +static triton_mutex_t ctx_mutex; + +static int mpi_resource_id; + +static int mpi_initialized = 0; + +static int double_array_size(struct mpi_context *ctx) +{ + int i; + triton_mutex_lock(&ctx->array_mutex); + ctx->array_size *= 2; + ctx->reqarray = realloc(ctx->reqarray, sizeof(*ctx->reqarray) * ctx->array_size); + if(!ctx->reqarray) + { + triton_mutex_unlock(&ctx->array_mutex); + return -ENOMEM; + } + for(i = ctx->array_size/2; i < ctx->array_size; ++i) + { + ctx->reqarray[i] = MPI_REQUEST_NULL; + } + + ctx->indexarray = realloc(ctx->indexarray, sizeof(*ctx->indexarray) * ctx->array_size); + if(!ctx->indexarray) + { + triton_mutex_unlock(&ctx->array_mutex); + return -ENOMEM; + } + ctx->statusarray = realloc(ctx->statusarray, sizeof(*ctx->statusarray) * ctx->array_size); + if(!ctx->statusarray) + { + triton_mutex_unlock(&ctx->array_mutex); + return -ENOMEM; + } + triton_mutex_unlock(&ctx->array_mutex); + return 0; +} + +static int add_op(MPI_Request req, + MPI_Status *status, + void (*callback)(void *ptr, int ret), + void *up, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + struct mpi_op *mpi_op; + struct ae_op *op; + struct triton_hash_link *link; + struct mpi_context *ctx; + + /* get the mpi context structure from the context hashtable */ + link = triton_hash_search(context_table, ctx); + if(!link) + { + return -EINVAL; + } + ctx = triton_hash_get_entry(link, struct mpi_context, link); + + op = ae_opcache_get(ctx->opcache); + + /* kind of a hack for mpi case, if size of opcache doubles, we double + * the request and index arrays too + */ + if(ae_opcache_size(ctx->opcache) > ctx->array_size) + { + double_array_size(ctx); + } + + mpi_op = ae_op_entry(op, struct mpi_op, op); + mpi_op->status = status; + + ae_op_fill(op, callback, up, hints, ctx); + + mpi_op->op_id = ae_id_gen(mpi_resource_id, (uint64_t)(op->cache_id)); + ctx->reqarray[op->cache_id] = req; + mpi_op->request = &(ctx->reqarray[op->cache_id]); + triton_mutex_lock(&ctx->oplist_mutex); + ae_ops_enqueue(op, &ctx->oplist); + triton_mutex_unlock(&ctx->oplist_mutex); + *op_id = mpi_op->op_id; + return 0; +} + +static int remove_op(struct mpi_context *ctx, ae_op_id_t id) +{ + int cache_id, resource_id; + struct ae_op *op; + + cache_id = ae_id_lookup(id, &resource_id); + op = ae_opcache_lookup(ctx->opcache, cache_id); + + /* remove the op from the operation list */ + triton_mutex_lock(&ctx->oplist_mutex); + ae_ops_del(op); + triton_mutex_unlock(&ctx->oplist_mutex); + + /* give the op back to the opcache */ + ae_opcache_put(ctx->opcache, op); + return 0; +} + +static int set_ops_in_progress(ae_context_t ctx) +{ + struct triton_hash_link *link; + struct mpi_context *ctx; + + link = triton_hash_search(context_table, ctx); + if(!link) + { + return -EINVAL; + } + ctx = triton_hash_get_entry(link, struct mpi_context, link); + + /* if no ops in progress, the poll function may be sleeping, so we + * send a signal to wake it up and test + */ + if(ctx->ops_in_progress == 0) + { + triton_mutex_lock(&ctx->wait_mutex); + ctx->ops_in_progress = 1; + triton_cond_signal(&ctx->wait_cond); + triton_mutex_unlock(&ctx->wait_mutex); + } + + return 0; +} + +#define DEFINE_MPISEND_CALL(__CALL__) \ +triton_ret_t triton_mpi_##__CALL__##_post( \ + void *buffer, \ + int count, \ + MPI_Datatype datatype, \ + int dest, \ + int tag, \ + MPI_Comm comm, \ + void (*callback)(void *ptr, int ret), \ + void *user_ptr, \ + ae_hints_t hints, \ + ae_context_t ctx, \ + ae_op_id_t *op_id) \ +{ \ + int ret; \ + MPI_Request request; \ + \ + if(!mpi_initialized) \ + { \ + callback(user_ptr, -TRITON_ECANCELLED); \ + return TRITON_SUCCESS; \ + } \ + \ + ret = MPI_I##__CALL__( \ + buffer, \ + count, \ + datatype, \ + dest, \ + tag, \ + comm, \ + &request); \ + if(ret != MPI_SUCCESS) \ + { \ + callback(user_ptr, ret); \ + return TRITON_SUCCESS; \ + } \ + \ + /* status is null for send calls */ \ + ret = add_op(request, NULL, callback, user_ptr, hints, ctx, op_id); \ + if(ret != 0) \ + { \ + callback(user_ptr, ret); \ + return TRITON_SUCCESS; \ + } \ + \ + set_ops_in_progress(ctx); \ + return TRITON_SUCCESS; \ +}; \ +triton_ret_t (* triton_mpi_##__CALL__)( \ + void *buffer, \ + int count, \ + MPI_Datatype datatype, \ + int dest, \ + int tag, \ + MPI_Comm comm, \ + void (*callback)(void *ptr, int ret), \ + void *user_ptr, \ + ae_hints_t hints, \ + ae_context_t ctx, \ + ae_op_id_t *op_id) = triton_mpi_##__CALL__##_post + +DEFINE_MPISEND_CALL(send); +DEFINE_MPISEND_CALL(bsend); +DEFINE_MPISEND_CALL(ssend); +DEFINE_MPISEND_CALL(rsend); + +triton_ret_t triton_mpi_recv_post( + void *buf, + int count, + MPI_Datatype type, + int source, + int tag, + MPI_Comm comm, + MPI_Status *status, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) +{ + int ret; + MPI_Request request; + + ret = MPI_Irecv(buf, count, type, source, tag, comm, &request); + if(ret != MPI_SUCCESS) + { + callback(user_ptr, ret); + return TRITON_SUCCESS; + } + + ret = add_op(request, status, callback, user_ptr, hints, ctx, op_id); + if(ret != 0) + { + callback(user_ptr, ret); + return TRITON_SUCCESS; + } + + set_ops_in_progress(ctx); + return TRITON_SUCCESS; +} +triton_ret_t (* triton_mpi_recv)( + void *buf, + int count, + MPI_Datatype type, + int source, + int tag, + MPI_Comm comm, + MPI_Status *status, + void (*callback)(void *ptr, int ret), + void *user_ptr, + ae_hints_t hints, + ae_context_t ctx, + ae_op_id_t *op_id) = triton_mpi_recv_post; + +static int triton_mpi_poll(ae_context_t ctx, int millisecs) +{ + int ret, outcount, test_count; + struct timespec t; + struct ae_op *op; + struct mpi_op *mpi_op; + struct mpi_context *ctx; + struct triton_hash_link *link; + + /* get the mpi context structure from the context hashtable */ + triton_mutex_lock(&ctx_mutex); + link = triton_hash_search(context_table, ctx); + triton_mutex_unlock(&ctx_mutex); + if(!link) + { + return -EINVAL; + } + ctx = triton_hash_get_entry(link, struct mpi_context, link); + + test_count = ae_opcache_count(ctx->opcache); + + /* Wait for completion of operations */ + ret = MPI_Waitsome( + test_count, ctx->reqarray, &outcount, ctx->indexarray, ctx->statusarray); + + /* According to MPI spec, if all requests in reqarray are null, outcount is + * set to MPI_UNDEFINED. This happens every time we poll without any operations + * in-progress. So we do a timedwait until the timeout passed in or until the + * condition is signalled by the addition of an operation. + */ + if(outcount == MPI_UNDEFINED) + { + triton_mutex_lock(&ctx->wait_mutex); + + /* Verify that no ops are posted with lock held. This prevents us from missing + * a signal from a post. We test on the entire request array (most will be + * MPI_REQUEST_NULL), just so that we don't miss a request getting added after + * we got the test_count field from the opcache. + */ + ret = MPI_Waitsome( + ctx->array_size, ctx->reqarray, &outcount, ctx->indexarray, ctx->statusarray); + if(outcount == MPI_UNDEFINED) + { + /* ok, no ops posted, so we can wait */ + ctx->ops_in_progress = 0; + + /* timedwait takes absolute time */ + TRITON_REL_MSECS_TO_ABS_TIMESPEC(millisecs, t); + ret = triton_cond_timedwait(&ctx->wait_cond, &ctx->wait_mutex, &t); + if(ret != 0) + { + /* we assume timedout or was interrupted by a signal */ + triton_mutex_unlock(&ctx->wait_mutex); + return ret; + } + + test_count = ae_opcache_count(ctx->opcache); + + ret = MPI_Waitsome( + test_count, ctx->reqarray, &outcount, ctx->indexarray, ctx->statusarray); + } + triton_mutex_unlock(&ctx->wait_mutex); + } + + if(ret == MPI_SUCCESS || ret == MPI_ERR_IN_STATUS) + { + int i; + for(i = 0; i < outcount; ++i) + { + int mpi_errno; + + if(ctx->reqarray[ctx->indexarray[i]] == MPI_REQUEST_NULL) + { + int cancelled; + MPI_Test_cancelled(&ctx->statusarray[i], &cancelled); + if(cancelled) + { + mpi_errno = -TRITON_ECANCELLED; + } + else + { + mpi_errno = ctx->statusarray[i].MPI_ERROR; + } + + op = ae_opcache_lookup(ctx->opcache, ctx->indexarray[i]); + + /* set the status for MPI calls that pass it in (triton_mpi_recv) */ + mpi_op = ae_op_entry(op, struct mpi_op, op); + if(mpi_op->status) + { + memcpy((mpi_op->status), &(ctx->statusarray[i]), sizeof(MPI_Status)); + } + + /* call the callback */ + triton_invoke_callback(op, mpi_errno); + remove_op(ctx, mpi_op->op_id); + } + } + } + else + { + /* Not sure what to do with unknown MPI error */ + return ret; + } + + return 0; +} + +static int triton_mpi_cancel(ae_context_t ctx, ae_op_id_t op_id) +{ + uint64_t cache_id; + int resource_id, ret; + struct ae_op *op; + struct mpi_op *mpi_op; + struct triton_hash_link *link; + struct mpi_context *ctx; + + triton_mutex_lock(&ctx_mutex); + link = triton_hash_search(context_table, ctx); + triton_mutex_unlock(&ctx_mutex); + if(!link) + { + return -EINVAL; + } + ctx = triton_hash_get_entry(link, struct mpi_context, link); + + cache_id = triton_id_lookup(op_id, &resource_id); + assert(resource_id == mpi_resource_id); + + op = ae_opcache_lookup(ctx->opcache, (int)cache_id); + mpi_op = ae_op_entry(op, struct mpi_op, op); + + ret = MPI_Cancel(mpi_op->request); + if(ret == MPI_ERR_REQUEST || ret == MPI_ERR_ARG) + { + return -EINVAL; + } + return 0; +} + +static int mpi_context_compare(void *key, struct triton_hash_link *link) +{ + struct mpi_context *mpi_ctx; + + mpi_ctx = triton_hash_get_entry(link, struct mpi_context, link); + return (((triton_context_t)key) == (mpi_ctx->ctx_ptr)); +} + +struct triton_resource triton_mpi_resource; + +int triton_mpi_init(void) +{ + context_table = triton_hash_init(mpi_context_compare, triton_hash_64bit_hash, 1024); + if(context_table == NULL) + { + return -ENOMEM; + } + + mpi_resource_id = triton_resource_register(&triton_mpi_resource); + + mpi_initialized = 1; + + return 0; +} + +int triton_mpi_finalize(void) +{ + mpi_initialized = 0; + + triton_resource_unregister(mpi_resource_id); + + /* might want to verify that context table is empty */ + triton_hash_finalize(context_table); + + return 0; +} + +static int triton_mpi_context_register(triton_context_t context) +{ + int ret, i; + struct mpi_context *ctx; + + ctx = malloc(sizeof(*ctx)); + if(!ctx) + { + return -ENOMEM; + } + ctx->ctx_ptr = context; + + ctx->array_size = MPI_TESTCOUNT_MAXSIZE; + ctx->array_count = 0; + ctx->array_mutex = TRITON_MUTEX_INITIALIZER; + + ret = TRITON_OPCACHE_INIT(struct mpi_op, op, ctx->array_size, &ctx->opcache); + if(ret != 0) + { + free(ctx); + return ret; + } + + TRITON_OPLIST_INIT((&ctx->oplist)); + ctx->oplist_mutex = TRITON_MUTEX_INITIALIZER; + ctx->reqarray = malloc(sizeof(*ctx->reqarray) * ctx->array_size); + if(!ctx->reqarray) + { + ae_opcache_destroy(ctx->opcache); + free(ctx); + return -ENOMEM; + } + /* init request array to MPI_REQUEST_NULL values */ + for(i = 0; i < ctx->array_size; ++i) + { + ctx->reqarray[i] = MPI_REQUEST_NULL; + } + + ctx->indexarray = malloc(sizeof(*ctx->indexarray) * ctx->array_size); + if(!ctx->indexarray) + { + free(ctx->reqarray); + ae_opcache_destroy(ctx->opcache); + free(ctx); + return -ENOMEM; + } + + ctx->statusarray = malloc(sizeof(*ctx->statusarray) * ctx->array_size); + if(!ctx->statusarray) + { + free(ctx->indexarray); + free(ctx->reqarray); + ae_opcache_destroy(ctx->opcache); + free(ctx); + return -ENOMEM; + } + + triton_cond_init(&ctx->wait_cond, NULL); + ctx->ops_in_progress = 0; + + triton_mutex_lock(&ctx_mutex); + triton_hash_add(context_table, ctx->ctx_ptr, &ctx->link); + triton_mutex_unlock(&ctx_mutex); + return 0; +} + +static int triton_mpi_context_unregister(triton_context_t context) +{ + struct triton_hash_link *link; + struct mpi_context *ctx; + struct mpi_op *mpi_op, *tmp; + int ret; + + triton_mutex_lock(&ctx_mutex); + link = triton_hash_search_and_remove(context_table, context); + triton_mutex_unlock(&ctx_mutex); + if(!link) + { + return -EINVAL; + } + ctx = triton_hash_get_entry(link, struct mpi_context, link); + + triton_mutex_lock(&ctx->oplist_mutex); + /* we need to cancel and cleanup all pending MPI operations */ + ae_ops_for_each_entry_safe(mpi_op, tmp, &ctx->oplist, op) + { + ret = MPI_Cancel(mpi_op->request); + if(ret == MPI_ERR_REQUEST || ret == MPI_ERR_ARG) + { + triton_mutex_unlock(&ctx->oplist_mutex); + return -EINVAL; + } + } + + while(!ae_ops_empty(&ctx->oplist)) + { + triton_mutex_unlock(&ctx->oplist_mutex); + + /* wait for a 1/10 seconds for MPI ops to complete */ + triton_mpi_poll(context, 100); + + triton_mutex_lock(&ctx->oplist_mutex); + } + + triton_mutex_unlock(&ctx->oplist_mutex); + + triton_cond_destroy(&ctx->wait_cond); + free(ctx->statusarray); + free(ctx->indexarray); + free(ctx->reqarray); + ae_opcache_destroy(ctx->opcache); + free(ctx); + + return 0; +} + +struct triton_resource triton_mpi_resource = +{ + .resource_name = "mpi", + .poll_context = triton_mpi_poll, + .cancel = triton_mpi_cancel, + .register_context = triton_mpi_context_register, + .unregister_context = triton_mpi_context_unregister +}; + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/net/mpi/mpi.hae b/code/src/net/mpi/mpi.hae new file mode 100644 index 0000000..b0eee17 --- /dev/null +++ b/code/src/net/mpi/mpi.hae @@ -0,0 +1,35 @@ +#ifndef __TRITON_MPI_GSH__ +#define __TRITON_MPI_GSH__ + +#include <mpi.h> +#include "src/common/aesop.h" + +int triton_mpi_init(void); +int triton_mpi_finalize(void); + +/* The return values of these functions match their blocking + * counterparts, except that they may be negative, which indicate + * an error during the post of the call. I.e. -ENOMEM indicates + * malloc failed in the post. Also, the function may be cancelled + * at some point, and to indicate that it was cancelled, a special + * GS errno value is returned: -TRITON_ECANCELLED. + */ + +/* Matches the MPI_send call. */ +__blocking int triton_mpi_send(void *, int, MPI_Datatype, int, int, MPI_Comm); + +/* Matches the MPI_bsend call */ +__blocking int triton_mpi_bsend(void *, int, MPI_Datatype, int, int, MPI_Comm); + +/* Matches the MPI_ssend call */ +__blocking int triton_mpi_ssend(void *, int, MPI_Datatype, int, int, MPI_Comm); + +#include <stdint.h> + +/* Matches the MPI_rsend call */ +__blocking int triton_mpi_rsend(void *, int, MPI_Datatype, int, int, MPI_Comm); + +/* Matches the MPI_recv call */ +__blocking int triton_mpi_recv(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Status *); + +#endif diff --git a/code/src/net/mpi/test/module.mk.in b/code/src/net/mpi/test/module.mk.in new file mode 100644 index 0000000..113398d --- /dev/null +++ b/code/src/net/mpi/test/module.mk.in @@ -0,0 +1,19 @@ +DIR := src/net/mpi/test + +ifneq (,$(BUILD_MPI)) + +AETESTSRC += $(DIR)/send-recv.ae \ + $(DIR)/pthread-compare.ae + +MODCFLATRITON_$(DIR)/send-recv.ae = $(MPICFLAGS) +MODLDFLATRITON_$(DIR)/send-recv.ae = $(MPILDFLAGS) +MODLIBS_$(DIR)/send-recv.ae = $(MPILIBS) +MODCC_$(DIR)/send-recv.ae = $(MPICC) + +MODCFLATRITON_$(DIR)/pthread-compare.ae = $(MPICFLAGS) +MODLDFLATRITON_$(DIR)/pthread-compare.ae = $(MPILDFLAGS) +MODLIBS_$(DIR)/pthread-compare.ae = $(MPILIBS) -lpthread +MODCC_$(DIR)/pthread-compare.ae = $(MPICC) + + +endif # BUILD_MPI diff --git a/code/src/net/mpi/test/pthread-compare.ae b/code/src/net/mpi/test/pthread-compare.ae new file mode 100644 index 0000000..5ef2fac --- /dev/null +++ b/code/src/net/mpi/test/pthread-compare.ae @@ -0,0 +1,198 @@ + +#include <stdio.h> +#include <mpi.h> +#include <pthread.h> +#include "src/aesop/aesop.h" +#include "src/net/mpi/mpi.hae" + +static __blocking int send_recv(int numprocs, int rank) +{ + char buf[1024]; + char recvbuf[1024]; + MPI_Status status; + int recvsize; + int ret; + + pwait + { + int i; + + for(i = 0; i < numprocs; ++i) + { + pbranch + { + if(rank != (rank+i)%numprocs) + { + ret = triton_mpi_send( + buf, 1024, MPI_CHAR, (rank+i)%numprocs, rank, MPI_COMM_WORLD); + } + } + } + + for(i = 0; i < numprocs; ++i) + { + if(rank != (numprocs+(rank-i))%numprocs) + { + pbranch + { + ret = triton_mpi_recv( + recvbuf, 1024, MPI_CHAR, + (numprocs+(rank-i))%numprocs, + (numprocs+(rank-i))%numprocs, MPI_COMM_WORLD, &status); + } + } + } + } + + return 0; +} + +static int done = 0; +static void done_cb(void *up, int ret) +{ + done = 1; +} + +struct t +{ + int np; + int r; + int i; +}; + +static void *send_thread(void *cb) +{ + char buff[1024]; + struct t *tpr; + tpr = (struct t *)cb; + + MPI_Send(buff, 1024, MPI_CHAR, (tpr->r+tpr->i)%tpr->np, tpr->r, MPI_COMM_WORLD); + return NULL; +} + +static void *recv_thread(void *cb) +{ + char buff[1024]; + struct t *tpr; + tpr = (struct t *)cb; + MPI_Status status; + + MPI_Recv(buff, 1024, MPI_CHAR, (tpr->np+tpr->r-tpr->i)%tpr->np, (tpr->np+tpr->r-tpr->i)%tpr->np, MPI_COMM_WORLD, &status); + return NULL; +} + +static void thread_send_recv(int numprocs, int rank) +{ + pthread_t *send_tid, *recv_tid; + int ret, i; + void *val; + struct t *tpr; + + send_tid = malloc(sizeof(*send_tid) * numprocs); + recv_tid = malloc(sizeof(*recv_tid) * numprocs); + + for(i = 0; i < numprocs; ++i) + { + tpr = malloc(sizeof(*tpr)); + tpr->np = numprocs; + tpr->r = rank; + tpr->i = i; + + + if((tpr->r+tpr->i)%tpr->np != rank) + { + + ret = pthread_create(&send_tid[i], NULL, send_thread, tpr); + if(ret != 0) + { + perror("pthread_create failed!\n"); + assert(ret == 0); + } + } + } + + for(i = 0; i < numprocs; ++i) + { + tpr = malloc(sizeof(*tpr)); + tpr->np = numprocs; + tpr->r = rank; + tpr->i = i; + + if((tpr->np+tpr->r-tpr->i)%tpr->np != rank) + { + ret = pthread_create(&recv_tid[i], NULL, recv_thread, tpr); + if(ret != 0) + { + perror("pthread_create failed\n"); + assert(ret == 0); + } + } + } + + for(i = 0; i < numprocs; ++i) + { + if((rank+i)%numprocs != rank) + { + pthread_join(send_tid[i], &val); + } + } + + for(i = 0; i < numprocs; ++i) + { + if((numprocs+rank-i)%numprocs != rank) + { + pthread_join(recv_tid[i], &val); + } + } + + return; +} + + + +int main(int argc, char *argv[]) +{ + int numprocs, rank; + triton_op_id_t op_id; + triton_context_t ctx; + double t1, t2, diff, sum; + + MPI_Init(&argc, &argv); + + MPI_Comm_size(MPI_COMM_WORLD, &numprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + triton_mpi_init(); + + triton_context_create(&ctx, 1, "mpi"); + + t1 = MPI_Wtime(); + send_recv_post(numprocs, rank, done_cb, NULL, NULL, ctx, &op_id); + while (done == 0) + { + triton_poll(ctx, 10); + } + t2 = MPI_Wtime(); + diff = t2 - t1; + MPI_Allreduce(&diff, &sum, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + if(rank == 0) + { + printf("aesop avg time: %f usecs\n", (sum/numprocs)); + } + + t1 = MPI_Wtime(); + thread_send_recv(numprocs, rank); + t2 = MPI_Wtime(); + diff = t2 - t1; + MPI_Allreduce(&diff, &sum, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + if(rank == 0) + { + printf("thread avg time: %f usecs\n", (sum/numprocs)); + } + + MPI_Finalize(); + + triton_context_destroy(ctx); + triton_mpi_finalize(); + return 0; +} diff --git a/code/src/net/mpi/test/send-recv.ae b/code/src/net/mpi/test/send-recv.ae new file mode 100644 index 0000000..2508412 --- /dev/null +++ b/code/src/net/mpi/test/send-recv.ae @@ -0,0 +1,72 @@ + +#include <stdio.h> +#include "src/aesop/aesop.h" +#include "resources/mpi/mpi.hae" + +static __blocking int send_recv(int numprocs, int rank) +{ + char buf[1024]; + char recvbuf[1024]; + MPI_Status status; + int recvsize; + int ret; + + sprintf(buf, "hello from %d!", rank); + + pwait + { + pbranch + { + ret = triton_mpi_send( + buf, strlen(buf), MPI_CHAR, (rank+1)%numprocs, 10, MPI_COMM_WORLD); + printf("%d: sent message to %d\n", rank, (rank+1)%numprocs); + } + + pbranch + { + printf("%d: receiving message from %d\n", rank, (numprocs+(rank-1))%numprocs); + ret = triton_mpi_recv( + recvbuf, 1024, MPI_CHAR, (numprocs+(rank-1))%numprocs, 10, MPI_COMM_WORLD, &status); + } + } + MPI_Get_count(&status, MPI_CHAR, &recvsize); + printf("recvsize: %i\n", recvsize); + + printf("%d: received message from %d: %.*s\n", rank, (numprocs+rank-1)%numprocs, recvsize, recvbuf); + + return 0; +} + +int done = 0; + +static void done_callback(void *user_ptr, int ret) +{ + done = 1; +} + +int main(int argc, char *argv[]) +{ + int numprocs, rank; + triton_op_id_t op_id; + triton_context_t ctx; + + MPI_Init(&argc, &argv); + + MPI_Comm_size(MPI_COMM_WORLD, &numprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + triton_mpi_init(); + + triton_context_create(&ctx, 1, "mpi"); + + send_recv_post(numprocs, rank, done_callback, NULL, NULL, ctx, &op_id); + while (done == 0) + { + triton_poll(ctx, 10); + } + MPI_Finalize(); + + triton_context_destroy(ctx); + triton_mpi_finalize(); + return 0; +} diff --git a/code/src/net/triton-message-internal.hae b/code/src/net/triton-message-internal.hae new file mode 100644 index 0000000..0a0d445 --- /dev/null +++ b/code/src/net/triton-message-internal.hae @@ -0,0 +1,12 @@ +#ifndef __TRITON_MESSAGE_INTERNAL_HAE__ +#define __TRITON_MESSAGE_INTERNAL_HAE__ + +#include "src/net/triton-message-method.hae" + +struct msg_ctx +{ + struct triton_msg_method *method; +}; + +#endif + diff --git a/code/src/net/triton-message-method.hae b/code/src/net/triton-message-method.hae new file mode 100644 index 0000000..980e508 --- /dev/null +++ b/code/src/net/triton-message-method.hae @@ -0,0 +1,35 @@ +#ifndef __TRITON_MESSAGE_METHOD_HAE__ +#define __TRITON_MESSAGE_METHOD_HAE__ + +#include "src/net/triton-node.h" +#include "src/net/triton-message.hae" + +triton_ret_t triton_msg_enable_method(char *method, triton_msg_ctx_t *new_ctx); +void triton_msg_disable_method(triton_msg_ctx_t *c); + +struct triton_msg_method +{ + const char *name; + + triton_node_t (*node_self)(void); + triton_string_t *(*node_to_string)(triton_node_t node); + triton_node_t (*node_lookup)(const char *name); + + triton_ret_t (*enable)(void); + void (*disable)(void); + + triton_ret_t (*group_add)(const char *service_name, triton_msg_group_t *group); + + char * (*buffer_allocate)(uint32_t size); + void (*buffer_free)(char *buffer); + + __blocking triton_ret_t (*send)( + triton_node_t to, triton_msg_group_t group, triton_msg_tag_t tag, int count, char **buffers, uint32_t *sizes); + __blocking triton_ret_t (*recv)( + triton_node_t from, triton_msg_group_t group, triton_msg_tag_t tag, int count, char **buffers, uint32_t *sizes, uint32_t *bytes_received); +}; + +void triton_msg_method_register(struct triton_msg_method *method); +void triton_msg_method_unregister(char *name); + +#endif diff --git a/code/src/net/triton-message.ae b/code/src/net/triton-message.ae new file mode 100644 index 0000000..e243d42 --- /dev/null +++ b/code/src/net/triton-message.ae @@ -0,0 +1,153 @@ + +#include "src/common/triton-base.h" +#include "src/aesop/aesop.h" +#include "src/net/triton-message.hae" +#include "src/net/triton-message-method.hae" +#include "src/common/triton-hash.h" + +static struct triton_hash_table *method_table; + +struct method_entry +{ + char *name; + struct triton_msg_method *method; + struct triton_hash_link link; +}; + +static int method_compare(void *k, struct triton_hash_link *l) +{ + struct method_entry *m = triton_hash_get_entry(l, struct method_entry, link); + return (!strcmp(m->method->name, (char *)k)); +} + +triton_ret_t triton_msg_init(void) +{ + method_table = triton_hash_init(method_compare, triton_hash_strhash, 1024); + if(!method_table) return TRITON_ERR_NOMEM; + + return TRITON_SUCCESS; +} + +static void free_method(void *x) +{ + struct method_entry *m = (struct method_entry *)x; + free(m->name); + free(m); +} + +void triton_msg_finalize(void) +{ + triton_hash_destroy_and_finalize(method_table, struct method_entry, link, free_method); +} + +void triton_msg_method_register(struct triton_msg_method *method) +{ + struct method_entry *m; + + m = malloc(sizeof(*m)); + assert(m); + + m->method = method; + m->name = strdup(m->method->name); + + triton_hash_add(method_table, m->name, &m->link); +} + +void triton_msg_method_unregister(char *name) +{ + struct triton_hash_link *link; + struct method_entry *m; + + link = triton_hash_search_and_remove(method_table, name); + m = triton_hash_get_entry(link, struct method_entry, link); + free(m->name); + free(m); +} + +struct msg_ctx +{ + struct triton_msg_method *method; +}; + +triton_ret_t triton_msg_enable_method(char *method, triton_msg_ctx_t *new_ctx) +{ + triton_ret_t ret; + struct triton_hash_link *link; + struct method_entry *m; + struct msg_ctx *ctx; + link = triton_hash_search(method_table, method); + m = triton_hash_get_entry(link, struct method_entry, link); + if(!m) return TRITON_ERR_MSG_METHOD_NOTFOUND; + + if(m->method->enable) + { + ret = m->method->enable(); + if(ret != TRITON_SUCCESS) return ret; + } + + ctx = malloc(sizeof(*ctx)); + if(ctx == NULL) return TRITON_ERR_NOMEM; + + ctx->method = m->method; + + *new_ctx = (void *)ctx; + return TRITON_SUCCESS; +} + +void triton_msg_disable_method(triton_msg_ctx_t *c) +{ + struct msg_ctx *ctx; + + ctx = (struct msg_ctx *)(*c); + if(ctx->method->disable) + { + ctx->method->disable(); + } + free(ctx); + *c = NULL; +} + +triton_ret_t triton_msg_group_add(triton_msg_ctx_t ctx, const char *service_name, triton_msg_group_t *group) +{ + struct msg_ctx *c; + c = (struct msg_ctx *)ctx; + return c->method->group_add(service_name, group); +} + +__blocking triton_ret_t triton_msg_send( + triton_msg_ctx_t ctx, + triton_node_t to, + triton_msg_group_t group, + triton_msg_tag_t tag, + int count, + char **buffers, + uint32_t *sizes) +{ + struct msg_ctx *c; + c = (struct msg_ctx *)ctx; + return c->method->send(to, group, tag, count, buffers, sizes); +} + +__blocking triton_ret_t triton_msg_recv( + triton_msg_ctx_t ctx, + triton_node_t from, + triton_msg_group_t group, + triton_msg_tag_t tag, + int count, + char **buffers, + uint32_t *sizes, + uint32_t *bytes_received) +{ + struct msg_ctx *c; + c = (struct msg_ctx *)ctx; + return c->method->recv(from, group, tag, count, buffers, sizes, bytes_received); +} + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/net/triton-message.hae b/code/src/net/triton-message.hae new file mode 100644 index 0000000..ef98fe7 --- /dev/null +++ b/code/src/net/triton-message.hae @@ -0,0 +1,54 @@ +#ifndef __TRITON_MESSAGE_HAE__ +#define __TRITON_MESSAGE_HAE__ + +#include "src/common/triton-string.h" +#include "src/common/triton-types.h" +#include "src/common/triton-error.h" +#include "src/aesop/aesop.h" +#include "src/net/triton-node.h" + +typedef uint32_t triton_msg_tag_t; +typedef uint32_t triton_msg_group_t; + +triton_ret_t triton_msg_init(void); +void triton_msg_finalize(void); + +/** + * Add a message group. Examples: + * + * Allow for unexpected messages to be received via group_recv. + * + * group_add(ctx, "aesop.remote.unexpected", &group_aesop_remote_unexp); + * group_add(ctx, "aesop.remote.expexted", &group_aesop_remote_exp); + */ +triton_ret_t triton_msg_group_add(triton_msg_ctx_t ctx, const char *service_name, triton_msg_group_t *group); + +/** + * Sends a message using the method from the ctx. + * Group and tag fields must be specified to allow for proper matching at the receive side. + */ +__blocking triton_ret_t triton_msg_send( + triton_msg_ctx_t ctx, + triton_node_t to, + triton_msg_group_t group, + triton_msg_tag_t tag, + int count, + char **buffers, + uint32_t *sizes); + +/** + * Receive a message using the method from the ctx. + * The received message will match on the group and tag fields passed in + * and the message buffers will be filled. This call does an expected receive. + */ +__blocking triton_ret_t triton_msg_recv( + triton_msg_ctx_t ctx, + triton_node_t from, + triton_msg_group_t group, + triton_msg_tag_t tag, + int count, + char **buffers, + uint32_t *sizes, + uint32_t *bytes_received); + +#endif /* __TRITON_MESSAGE_HAE__ */ diff --git a/code/src/net/triton-node.ae b/code/src/net/triton-node.ae new file mode 100644 index 0000000..1518186 --- /dev/null +++ b/code/src/net/triton-node.ae @@ -0,0 +1,30 @@ + +#include "src/net/triton-node.h" +#include "src/net/triton-message-internal.hae" +#include "src/aesop/aesop.h" + +triton_node_t triton_node_null = { .u = 0, .l = 0 }; + +triton_node_t triton_node_self(triton_msg_ctx_t ctx) +{ + struct msg_ctx *c; + c = (struct msg_ctx *)ctx; + + return c->method->node_self(); +} + +triton_string_t *triton_node_to_string(triton_msg_ctx_t ctx, triton_node_t node) +{ + struct msg_ctx *c; + c = (struct msg_ctx *)ctx; + + return c->method->node_to_string(node); +} + +triton_node_t triton_node_lookup(triton_msg_ctx_t ctx, const char *name) +{ + struct msg_ctx *c; + c = (struct msg_ctx *)ctx; + + return c->method->node_lookup(name); +} diff --git a/code/src/net/triton-node.h b/code/src/net/triton-node.h new file mode 100644 index 0000000..c15936b --- /dev/null +++ b/code/src/net/triton-node.h @@ -0,0 +1,31 @@ +#ifndef __TRITON_NODE_H__ +#define __TRITON_NODE_H__ + +#include "src/common/triton-string.h" +#include "src/common/triton-types.h" + +typedef void *triton_msg_ctx_t; + +#define TRITON_MSG_CTX_DEFAULT NULL + +/** + * The triton_node_t is an opaque address for a node in the system. + */ +typedef uint128_t triton_node_t; + +extern triton_node_t triton_node_null; +#define TRITON_NODE_NULL triton_node_null + +#define TRITON_NODE_NULL_STATIC_INITIALIZER { .l = 0, .u = 0 } + +#define triton_node_is_null(node) (node.l == 0 && node.u == 0) + +triton_node_t triton_node_self(triton_msg_ctx_t ctx); + +triton_string_t *triton_node_to_string(triton_msg_ctx_t ctx, triton_node_t node); + +triton_node_t triton_node_lookup(triton_msg_ctx_t ctx, const char *name); + +#define TRITON_NODE_ANY TRITON_NODE_NULL + +#endif /* __TRITON_NODE_H__ */ diff --git a/code/src/remote/byteswap.h b/code/src/remote/byteswap.h new file mode 100644 index 0000000..efa1b5a --- /dev/null +++ b/code/src/remote/byteswap.h @@ -0,0 +1,112 @@ +/* Macros to swap the order of bytes in integer values. + Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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. */ + +/* Modified by Phil Carns ([email protected]) + * June 2003 + * For use with custom network encoding routines in the BMI component of + * the Parallel Virtual File System version 2. + */ + +#ifndef __TRITON_BYTESWAP_H +#define __TRITON_BYTESWAP_H + +#include "triton-config.h" + +#ifndef __bswap_16 +/* Swap bytes in 16 bit value. */ +#ifdef __GNUC__ +# define __bswap_16(x) \ + (__extension__ \ + ({ unsigned short int __bsx = (x); \ + ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); })) +#else +static __inline unsigned short int +__bswap_16 (unsigned short int __bsx) +{ + return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); +} +#endif +#endif + +#ifndef __bswap_32 +/* Swap bytes in 32 bit value. */ +#ifdef __GNUC__ +# define __bswap_32(x) \ + (__extension__ \ + ({ unsigned int __bsx = (x); \ + ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | \ + (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); })) +#else +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | + (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); +} +#endif +#endif + +#ifndef __bswap_64 +#if defined __GNUC__ && __GNUC__ >= 2 +/* Swap bytes in 64 bit value. */ +# define __bswap_constant_64(x) \ + ((((x) & 0xff00000000000000ull) >> 56) \ + | (((x) & 0x00ff000000000000ull) >> 40) \ + | (((x) & 0x0000ff0000000000ull) >> 24) \ + | (((x) & 0x000000ff00000000ull) >> 8) \ + | (((x) & 0x00000000ff000000ull) << 8) \ + | (((x) & 0x0000000000ff0000ull) << 24) \ + | (((x) & 0x000000000000ff00ull) << 40) \ + | (((x) & 0x00000000000000ffull) << 56)) + +# define __bswap_64(x) \ + (__extension__ \ + ({ union { __extension__ unsigned long long int __ll; \ + unsigned int __l[2]; } __w, __r; \ + if (__builtin_constant_p (x)) \ + __r.__ll = __bswap_constant_64 (x); \ + else \ + { \ + __w.__ll = (x); \ + __r.__l[0] = __bswap_32 (__w.__l[1]); \ + __r.__l[1] = __bswap_32 (__w.__l[0]); \ + } \ + __r.__ll; })) +#else +#ifdef WORDS_BIGENDIAN +#error FIX ME: no 64 bit bswap routine for non GNUC preprocessor. +#endif +#endif +#endif + +#ifdef WORDS_BIGENDIAN +#define aehton16(x) __bswap_16(x) +#define aehton32(x) __bswap_32(x) +#define aehton64(x) __bswap_64(x) +#else +#define aehton16(x) x +#define aehton32(x) x +#define aehton64(x) x +#endif + +#define aentoh16(x) aehton16(x) +#define aentoh32(x) aehton32(x) +#define aentoh64(x) aehton64(x) + +#endif /* __BMI_BYTESWAP_H */ diff --git a/code/src/remote/encoding-pw.h b/code/src/remote/encoding-pw.h new file mode 100644 index 0000000..bcdb365 --- /dev/null +++ b/code/src/remote/encoding-pw.h @@ -0,0 +1,585 @@ +#ifndef __ENCODING_PW_H__ +#define __ENCODING_PW_H__ + +/* + * This is an efficient encoding scheme based on Pete Wyckoff's encoding + * scheme in PVFS. PW's scheme used CPP macros, whereas this one uses + * inlined functions in order to avoid the headache and hassle that comes + * with CPP macros (no type checking, can't be debugged properly, etc.), but + * still gain the performance of inlined code. + * + * The encoding scheme rely's on byte swapping everything to little endian + * in its encoded form. This means little endian machines need to do nothing + * besides copy data directly to the structure. See byteswap.h. + * + * This encoding scheme is used by the GS remote generation code, and is expected + * to have a specific format and set of encoding/decoding functions for each basic + * type. The required functions and format are: + * + * triton_ret_t aer_encode_<typename>( + * triton_buffer_t *buf, const char * varname, <typename> *x); + * + * triton_ret_t aer_decode_<typename>( + * triton_buffer_t *buf, char *varname, <typename> *x); + * + * uint64_t aer_encode_size_<typename>(const char * varname, <typename> *x); + * + * The varname fields are included in the function signature for other + * schemes, this scheme does not include variable names (its not self-describing) + * in its encoding format. + * + * Encoding/decoding macros are required for list types, because + * we need to be able to invoke specific encoding routines for + * each element of the list without using function pointers. + * their signatures are slightly different: + * + * void aer_encode_<typename>( + * triton_buffer_t *buf, + * const char *varname, + * <typename> *cx, + * <element typename>, + * <element varname>, + * <element typename>, + * triton_ret_t *ret); + * + * void aer_decode_<typename>( + * triton_buffer_t *buf, + * char **varname, + * <typename> *cx, + * <element typename>, + * <element varname>, + * triton_ret_t *ret); + * + * triton_ret_t aer_encode_size_<typename>( + * <typename> *cx, + * const char *varname, + * <element typename>, + * uint64_t *size); + * + * see the GS remote documentation for further info. + */ + +#include <assert.h> +#include <string.h> + +#include "src/common/triton-types.h" +#include "src/common/triton-buffer.h" +#include "src/common/triton-error.h" +#include "src/remote/byteswap.h" + +/* macros used by pw encoding macros - probably shouldn't + * be used elsewhere + */ +#define aer_roundup4(x) (((x)+3) & ~3) +#define aer_roundup8(x) (((x)+7) & ~7) + +/* basic encoding types */ + +/* Type: uint128_t + * + * 16 byte unsigned integer. This is an additional type not included + * in stdint.h. We use it for unique ids (nodes, objects), so we + * provide encoding/decoding functions here. + * + * Format: [VALUE] + * Bytes: <16> + */ +static inline uint64_t aer_encode_size_uint128_t( + const char *n __unused, void *x) +{ + return sizeof(uint128_t); +} +#define ctu128(x) ((uint128_t *)x) +static inline triton_ret_t aer_encode_uint128_t( + triton_buffer_t *buf, const char *n __unused, void *x) +{ + assert(buf); + assert(x); + triton_buffer_check_overflow(buf, 16); + *((uint64_t *)triton_buffer_cptr(buf)) = aehton64((ctu128(x))->l); + triton_buffer_inc(buf, 8); + *((uint64_t *)triton_buffer_cptr(buf)) = aehton64((ctu128(x))->u); + triton_buffer_inc(buf, 8); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_decode_uint128_t( + triton_buffer_t *buf, char **n __unused, void *x) +{ + assert(buf); + assert(x); + triton_buffer_check_overflow(buf, 16); + (ctu128(x))->l = aentoh64(*(uint64_t *)(triton_buffer_cptr(buf))); + triton_buffer_inc(buf, 8); + (ctu128(x))->u = aentoh64(*(uint64_t *)(triton_buffer_cptr(buf))); + triton_buffer_inc(buf, 8); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_init_uint128_t(void *x) +{ + return TRITON_SUCCESS; +} +static inline void aer_destroy_uint128_t(void *x) +{ + return; +} + +struct aer_encoder aer_encoder_uint128_t = +{ + .encode = aer_encode_uint128_t, + .decode = aer_decode_uint128_t, + .encode_size = aer_encode_size_uint128_t, + .init = aer_init_uint128_t, + .destroy = aer_destroy_uint128_t +}; + +/* Type: uint64_t + * + * 8 byte unsigned integer + * + * Format: [VALUE] + * Bytes: <8> + */ +static inline uint64_t aer_encode_size_uint64_t( + const char *n __unused, void *x) +{ + return sizeof(uint64_t); +} +#define ctu64(x) ((uint64_t *)x) +static inline triton_ret_t aer_encode_uint64_t( + triton_buffer_t *buf, const char *n __unused, void *x) +{ + assert(buf); + assert(x); + triton_buffer_check_overflow(buf, 8); + *((uint64_t *)triton_buffer_cptr(buf)) = aehton64(*(ctu64(x))); + triton_buffer_inc(buf, 8); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_decode_uint64_t( + triton_buffer_t *buf, char **n __unused, void *x) +{ + assert(buf); + assert(x); + triton_buffer_check_overflow(buf, 8); + *(ctu64(x)) = aentoh64(*(uint64_t*) (triton_buffer_cptr(buf))); + triton_buffer_inc(buf, 8); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_init_uint64_t(void *x) +{ + return TRITON_SUCCESS; +} +static inline void aer_destroy_uint64_t(void *x) +{ + return; +} + +struct aer_encoder aer_encoder_uint64_t = +{ + .encode = aer_encode_uint64_t, + .decode = aer_decode_uint64_t, + .encode_size = aer_encode_size_uint64_t, + .init = aer_init_uint64_t, + .destroy = aer_destroy_uint64_t +}; + +/* Type: int64_t + * + * 8 byte signed integer + * + * Format: [VALUE] + * Bytes: <8> + */ +static inline uint64_t aer_encode_size_int64_t( + const char *n __unused, void *x) +{ + return sizeof(int64_t); +} +#define ct64(x) ((int64_t *)x) +static inline triton_ret_t aer_encode_int64_t( + triton_buffer_t *buf, const char *n __unused, void *x) +{ + assert(buf); + assert(x); + triton_buffer_check_overflow(buf, 8); + *((int64_t*)triton_buffer_cptr(buf)) = aehton64(*(ct64(x))); + triton_buffer_inc(buf, 8); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_decode_int64_t( + triton_buffer_t *buf, char **n __unused, void *x) +{ + assert(buf); + assert(x); + triton_buffer_check_overflow(buf, 8); + *(ct64(x)) = aentoh64(*(int64_t*) (triton_buffer_cptr(buf))); + triton_buffer_inc(buf, 8); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_init_int64_t(void *x) +{ + return TRITON_SUCCESS; +} +static inline void aer_destroy_int64_t(void *x) +{ + return; +} + +struct aer_encoder aer_encoder_int64_t = +{ + .encode = aer_encode_int64_t, + .decode = aer_decode_int64_t, + .encode_size = aer_encode_size_int64_t, + .init = aer_init_int64_t, + .destroy = aer_destroy_int64_t +}; + +/* Type: uint32_t + * + * 4 byte unsigned integer + * + * Format: [VALUE] + * Bytes: <4><4 byte padding> + */ +static inline uint64_t aer_encode_size_uint32_t( + const char *n __unused, void *x) +{ + return sizeof(uint32_t); +} +#define ctu32(x) ((uint32_t *)x) +static inline triton_ret_t aer_encode_uint32_t( + triton_buffer_t *buf, const char *n __unused, void *x) +{ + assert(buf); + assert(x); + triton_buffer_check_overflow(buf, 8); + *((uint32_t*)triton_buffer_cptr(buf)) = aehton32(*(ctu32(x))); + triton_buffer_inc(buf, 8); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_decode_uint32_t( + triton_buffer_t *buf, char **n __unused, void *x) +{ + assert(buf); + assert(x); + triton_buffer_check_overflow(buf, 8); + *(ctu32(x)) = aentoh32(*((uint32_t*)triton_buffer_cptr(buf))); + triton_buffer_inc(buf, 8); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_init_uint32_t(void *x) +{ + return TRITON_SUCCESS; +} +static inline void aer_destroy_uint32_t(void *x) +{ + return; +} + +struct aer_encoder aer_encoder_uint32_t = +{ + .encode = aer_encode_uint32_t, + .decode = aer_decode_uint32_t, + .encode_size = aer_encode_size_uint32_t, + .init = aer_init_uint32_t, + .destroy = aer_destroy_uint32_t +}; + +/* Type: int32_t + * + * 4 byte signed integer + * + * Format: [VALUE] + * Bytes: <4> + */ +static inline uint64_t aer_encode_size_int32_t( + const char *n __unused, void *x) +{ + return sizeof(int32_t); +} +#define ct32(x) ((int32_t *)x) +static inline triton_ret_t aer_encode_int32_t( + triton_buffer_t *buf, const char *n __unused, void *x) +{ + assert(buf); + assert(x); + triton_buffer_check_overflow(buf, 8); + *((int32_t*)triton_buffer_cptr(buf)) = aehton32(*(ct32(x))); + triton_buffer_inc(buf, 8); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_decode_int32_t( + triton_buffer_t *buf, char **n __unused, void *x) +{ + assert(buf); + assert(x); + triton_buffer_check_overflow(buf, 8); + *(ct32(x)) = aentoh32(*((int32_t*)triton_buffer_cptr(buf))); + triton_buffer_inc(buf, 4); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_init_int32_t(void *x) +{ + return TRITON_SUCCESS; +} +static inline void aer_destroy_int32_t(void *x) +{ + return; +} + +struct aer_encoder aer_encoder_int32_t = +{ + .encode = aer_encode_int32_t, + .decode = aer_decode_int32_t, + .encode_size = aer_encode_size_int32_t, + .init = aer_init_int32_t, + .destroy = aer_destroy_int32_t +}; + +/* Type: triton_string_t + * + * This is a null terminated ASCII string. + * + * Format: [LENGTH][STRING][PAD8] + * Bytes: <4><LENGTH+1><PAD8> + * + * Padding is added to the end of the encoded string to make the entire encoding + * 8-byte aligned. If the string is null or null terminator is the only character, + * the format changes to [0][0], with a total size of 8. + */ +#define ctstr(x) ((triton_string_t *)x) +static inline uint64_t aer_encode_size_triton_string_t( + const char *n __unused, void *x) +{ + uint32_t len = 0; + if(ctstr(x)->string) + { + return aer_roundup8(4 + ctstr(x)->size + 1); + } + else + { + return 8; + } +} +static inline triton_ret_t aer_encode_triton_string_t( + triton_buffer_t *buf, const char *n __unused , void *x) +{ + assert(buf); + assert(x); + aer_encode_uint32_t(buf, NULL, &ctstr(x)->size); + if (ctstr(x)->size > 0) + { + memcpy(triton_buffer_cptr(buf), ctstr(x)->string, ctstr(x)->size); + triton_buffer_inc(buf, aer_roundup8(ctstr(x)->size)); + } + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_decode_triton_string_t( + triton_buffer_t *buf, char **n __unused, void *x) +{ + assert(buf); + assert(x); + uint32_t len = aentoh32(*((uint32_t *)triton_buffer_cptr(buf))); + triton_string_init_size(ctstr(x), (char *)triton_buffer_cptr(buf), len); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_init_triton_string_t(void *x) +{ + triton_string_set_null(ctstr(x)); + return TRITON_SUCCESS; +} +static inline void aer_destroy_triton_string_t(void *x) +{ + triton_string_destroy(ctstr(x)); + return; +} + +struct aer_encoder aer_encoder_triton_string_t = +{ + .encode = aer_encode_triton_string_t, + .decode = aer_decode_triton_string_t, + .encode_size = aer_encode_size_triton_string_t, + .init = aer_init_triton_string_t, + .destroy = aer_destroy_triton_string_t +}; + +/** + * Type: triton_buffer_t + * + * The generic buffer type. An array of bytes and a size. + * Format: [SIZE][BUFFER]...[PAD8] + */ +#define ctbuffer(x) ((triton_buffer_t *)x) +static inline uint64_t aer_encode_size_triton_buffer_t( + const char *n __unused, void *x) +{ + assert(x); + if((ctbuffer(x))->buffer) + { + return aer_roundup8(8 + ctbuffer(x)->size); + } + return 8; +} + +static inline triton_ret_t aer_encode_triton_buffer_t( + triton_buffer_t *buffer, const char *n __unused, void *x) +{ + triton_ret_t ret; + + assert(buffer); + assert(x); + triton_queue_enqueue(&ctbuffer(x)->encode_link, &buffer->encoded); + ret = aer_encode_uint64_t(buffer, "size", &(ctbuffer(x)->size)); + if(ret != TRITON_SUCCESS) + { + return ret; + } + + return TRITON_SUCCESS; +} + +static inline triton_ret_t aer_decode_triton_buffer_t( + triton_buffer_t *buffer, char **n __unused, void *x) +{ + triton_ret_t ret; + uint64_t size; + + assert(buffer); + assert(x); + + ret = aer_decode_uint64_t(buffer, NULL, &size); + if(ret != TRITON_SUCCESS) + { + return ret; + } + ret = triton_buffer_alloc(ctbuffer(x), size); + if(ret != TRITON_SUCCESS) + { + return ret; + } + ctbuffer(x)->buffer = triton_buffer_cptr(buffer); + triton_buffer_inc(buffer, aer_roundup8(ctbuffer(x)->size)); + return TRITON_SUCCESS; +} +static inline triton_ret_t aer_init_triton_buffer_t(void *x) +{ + ctbuffer(x)->buffer = NULL; + ctbuffer(x)->size = 0; + ctbuffer(x)->cptr = NULL; + return TRITON_SUCCESS; +} +static inline void aer_destroy_triton_buffer_t(void *x) +{ + triton_buffer_free(ctbuffer(x)); + return; +} + +struct aer_encoder aer_encoder_triton_buffer_t = +{ + .encode = aer_encode_triton_buffer_t, + .decode = aer_decode_triton_buffer_t, + .encode_size = aer_encode_size_triton_buffer_t, + .init = aer_init_triton_buffer_t, + .destroy = aer_destroy_triton_buffer_t +}; + +#define aer_encode_size_array(__array, __varname, __typename, __asize, __size) do { \ + uint32_t __sum = aer_encode_size_uint32_t(__asize); \ + uint32_t __i = 0; \ + for(; i < *(__asize); ++i) \ + { \ + __sum += aer_encode_size_##__typename((__array)[i]); \ + } \ + *(__size) = __sum; \ +} while(0) + +#define aer_encode_array( \ + __buf, __varname, __array, __typename, __asize, __ret) do { \ + uint32_t __i = 0; \ + aer_encode_uint32_t((__buf), NULL, (__asize)); \ + for(; __i < *(__asize); ++__i) \ + { \ + aer_encode_##__typename((__buf), NULL, (__array)[__i]); \ + } \ +} while(0) + +#define aer_decode_array( \ + __buf, __varname, __array, __typename, __asize, __ret) do { \ + uint32_t __i = 0; \ + *(__ret) = aer_decode_uint32_t((__buf), NULL, (__asize)); \ + (__array) = malloc(sizeof(__typename) * (*(__asize))); \ + if(!(__array)) \ + { \ + *(__ret) = triton_error_wrap(ENOMEM); \ + } \ + else \ + { \ + for(; __i < *(__asize); ++__i) \ + { \ + *(__ret) = aer_decode_##__typename((__buf), NULL, (__array)[__i]); \ + if(*(__ret) != TRITON_SUCCESS) break; \ + } \ + } \ +} while(0) + +/* Type: triton_list_t + * + * A list of typed structures. Note the triton_list_t type does not keep + * track of its size, and so only provide encoding functions for the + * triton_list_t type. That should be used where a list is expected to + * be serialized. + * + * Format: [COUNT][ELEM1][ELEM2]...[PAD8] + * Bytes: <4> + * + * Note the size function (macro) is expensive, as we have to calculate the + * sizes of individual elements. The remote code should avoid using it if possible. + */ +#define aer_encode_size_triton_list_t(__list, __varname, __typename, __size) do { \ + __typename *__pos; \ + __sum = 0; \ + triton_list_for_each_entry(__pos, __list) \ + { \ + __sum += aer_encode_size_##__typename(NULL, __pos); \ + } \ + *(__size) = aer_roundup8(8 + __sum); \ +} while(0) + +#define aer_encode_triton_list_t( \ + __buf, __varname, __list, __typename, __member, __ret) do { \ + __typename *__pos; \ + triton_ret_t mret; \ + mret = aer_encode_uint64_t(__buf, NULL, triton_list_size(__list)); \ + if(mret == TRITON_SUCCESS) \ + { \ + triton_list_for_each_entry(__pos, __list, __member) \ + { \ + mret = aer_encode_##__typename(__buf, NULL, __pos); \ + if(mret != TRITON_SUCCESS) break; \ + } \ + } \ + *(__ret) = mret; \ +} while(0) + +#define aer_decode_triton_list_t( \ + __buf, __varname, __list, __typename, __member, __ret) do { \ + __typename *__newt; \ + uint64_t i = 0, uint64_t c; \ + triton_ret_t mret; \ + triton_list_init(__list); \ + mret = aer_decode_uint64_t(__buf, NULL, &c); \ + if(mret == TRITON_SUCCESS) \ + { \ + for(; i < c; ++i) \ + { \ + __newt = (__typename *)__buf; \ + mret = aer_decode_##__typename(__buf, NULL, __newt); \ + if(mret != TRITON_SUCCESS) break; \ + triton_list_link_clear(&(__newt)->__member); \ + triton_list_add_back(&(__newt)->__member, __list); \ + } \ + } \ + *(__ret) = mret; \ +} while(0) + +#endif /* __ENCODING_PW_H__ */ diff --git a/code/src/remote/encoding.h b/code/src/remote/encoding.h new file mode 100644 index 0000000..10dc289 --- /dev/null +++ b/code/src/remote/encoding.h @@ -0,0 +1,19 @@ +#ifndef __ENCODING_H__ +#define __ENCODING_H__ + +#include "src/common/triton-types.h" +#include "src/common/triton-buffer.h" + +struct aer_encoder +{ + triton_ret_t (*encode)(triton_buffer_t *buf, const char *name, void *x); + triton_ret_t (*decode)(triton_buffer_t *buf, char **name, void *x); + uint64_t (*encode_size)(const char *name, void *x); + triton_ret_t (*init)(void *x); + void (*destroy)(void *x); +}; + +/* right now we use the PW encoding scheme */ +#include "src/remote/encoding-pw.h" + +#endif diff --git a/code/src/remote/error-encoding.h b/code/src/remote/error-encoding.h new file mode 100644 index 0000000..5a5d3e6 --- /dev/null +++ b/code/src/remote/error-encoding.h @@ -0,0 +1,181 @@ +#ifndef __ERROR_ENCODING_H__ +#define __ERROR_ENCODING_H__ + +#include "remote/encoding.h" +#include "remote/node-encoding.h" + +static inline uint64_t aer_encode_size_triton_ret_t(const char *name, void *x) +{ + + uint64_t size = 0; + triton_ret_t *ret = (triton_ret_t *)x; + + size += aer_encode_size_triton_ret_t("base", &(*ret)->base); + size += aer_encode_triton_node_t("node", &(*ret)->node); + size += aer_encode_size_uint32_t("error_code", &(*ret)->error_code); + size += aer_encode_size_triton_string_t("message", &(*ret)->message); + return size; +} + +static inline triton_ret_t aer_encode_inner_error(triton_buffer_t *buf, triton_ret_t *ret) +{ + triton_ret_t err; + + err = aer_encode_triton_node_t(buf, "node", &(*ret)->node); + if(err != TRITON_SUCCESS) + { + return err; + } + err = aer_encode_uint32_t(buf, "error_code", &(*ret)->error_code); + if(err != TRITON_SUCCESS) + { + return err; + } + err = aer_encode_triton_string_t(buf, "message", &(*ret)->message); + return err; +} + +static inline triton_ret_t aer_encode_triton_ret_t(triton_buffer_t *buf, const char *name, void *x) +{ + triton_ret_t err; + triton_ret_t *ret = (triton_ret_t *)x; + triton_ret_t next; + + assert(ret != NULL); + assert(*ret != NULL); + + err = aer_encode_uint32_t(buf, "count", &(*ret)->count); + if(err != TRITON_SUCCESS) return err; + + next = *ret; + for(i = 0; i < count; ++i) + { + assert(next); + err = aer_encode_inner_error(buf, ret); + if(err != TRITON_SUCCESS) return err; + next = next->base; + } + return TRITON_SUCCESS; +} + + +static inline triton_ret_t aer_decode_inner_error(triton_buffer_t *buf, triton_ret_t *x) +{ + triton_ret_t err; + + err = aer_decode_triton_node_t(buf, NULL, &(*ret)->node); + if(err != TRITON_SUCCESS) return err; + + err = aer_decode_uint32_t(buf, NULL, &(*ret)->error_code); + if(err != TRITON_SUCCESS) return err; + + err = aer_decode_triton_string_t(buf, NULL, &(*ret)->message); + if(err != TRITON_SUCCESS) return err; + + return err; +} + +static inline triton_ret_t aer_decode_triton_ret_t(triton_buffer_t *buf, char **name, void *x) +{ + triton_ret_t err; + triton_ret_t *ret = (triton_ret_t *)x; + triton_ret_t prev, first; + uint32_t count; + struct triton_error *newerror; + triton_node_t base_node; + uint32_t base_err_code; + + assert(ret != NULL); + assert(*ret != NULL); + + err = aer_decode_uint32_t(buf, NULL, &count); + if(err != TRITON_SUCCESS) return err; + + prev = NULL; + first = NULL; + for(i = 0; i < count - 1; ++i) + { + newerror = malloc(sizeof(*newerror)); + if(newerror != NULL) return TRITON_ERR_NOMEM; /* TODO: what about leaked errors!?? */ + + err = aer_decode_inner_error(buf, &newerror); + if(err != TRITON_SUCCESS) return err; + + if(first == NULL) + { + first = newerror; + } + + if(prev) + { + prev->base = newerror; + } + prev = newerror; + + } + + err = aer_decode_triton_node_t(buf, NULL, &base_node); + if(err != TRITON_SUCCESS) return err; /* TODO: fix leaked errors */ + + err = aer_decode_uint32_t(buf, NULL, &base_err_code); + if(err != TRITON_SUCCESS) return err; /* TODO: fix leaked errors */ + + /* if the node is NULL, then figure out which base root error this is */ + if(base_node == TRITON_NODE_NULL) + { + if(prev) + { + prev->base = triton_error_from_error_code(base_err_code); + } + else + { + first = triton_error_from_error_code(base_err_code); + } + } + else + { + newerror = malloc(sizeof(*newerror)); + if(!newerror) return TRITON_ERR_NOMEM; /* TODO fix leaked errors */ + newerror->node = bade_node; + newerror->error_code = base_err_code; + err = aer_decode_triton_string_t(buf, NULL, &newerror->message); + if(err != TRITON_SUCCESS) return err; /* TODO: fix leaked errors */ + + if(prev) + { + prev->base = newerror; + } + else + { + first = newerror; + } + } + *ret = first; + + return TRITON_SUCCESS; +} + +static inline triton_ret_t aer_init_triton_ret_t(void *x) +{ + return TRITON_SUCCESS; +} + +static inline void aer_destroy_triton_ret_t(void *x) +{ + triton_ret_t *ret = (triton_ret_t *)x; + triton_ret_t *next; + + if(ret == NULL || *ret == NULL) return; + + next = ret->base; + free(ret); + + while(next && next->base) + { + ret = next; + next = next->base; + free(ret); + } +} + +#endif diff --git a/code/src/remote/message.ae b/code/src/remote/message.ae new file mode 100644 index 0000000..5ef1807 --- /dev/null +++ b/code/src/remote/message.ae @@ -0,0 +1,9 @@ + +#include "src/remote/message.hae" + +triton_ret_t aer_message_init(aer_message_t *m, uint64_t size, uint64_t op) +{ + + triton_buffer_alloc(&m->buffer, size); + return TRITON_SUCCESS; +} diff --git a/code/src/remote/message.hae b/code/src/remote/message.hae new file mode 100644 index 0000000..d636658 --- /dev/null +++ b/code/src/remote/message.hae @@ -0,0 +1,29 @@ +#ifndef __MESSAGE_H__ +#define __MESSAGE_H__ + +#include "src/aesop/aesop.h" +#include "src/remote/encoding.h" +#include "src/common/triton-buffer.h" + +struct aer_message_header +{ + uint64_t version; + uint64_t op; +}; + +typedef struct +{ + struct aer_message_header header; + triton_buffer_t buffer; +} aer_message_t; + +triton_ret_t aer_message_init(aer_message_t *m, uint64_t size, uint64_t op); +void aer_message_destroy(aer_message_t *m); + +uint64_t aer_message_get_op(aer_message_t *message); + +__blocking triton_ret_t aer_message_send(triton_node_t dest, aer_message_t *msg); +__blocking triton_ret_t aer_message_recv(triton_node_t source, aer_message_t *msg); +__blocking triton_ret_t aer_message_sendrecv(triton_node_t dest, aer_message_t *send, aer_message_t *recv); + +#endif /* __MESSAGE_H__ */ diff --git a/code/src/remote/module.mk.in b/code/src/remote/module.mk.in new file mode 100644 index 0000000..4f1925a --- /dev/null +++ b/code/src/remote/module.mk.in @@ -0,0 +1,7 @@ +DIR := src/remote + +AESOP_HDR += $(DIR)/message.hae \ + $(DIR)/service.hae + +AELIBSRC += $(DIR)/message.ae \ + $(DIR)/service.ae diff --git a/code/src/remote/node-encoding.h b/code/src/remote/node-encoding.h new file mode 100644 index 0000000..78c2791 --- /dev/null +++ b/code/src/remote/node-encoding.h @@ -0,0 +1,32 @@ + +#ifndef __NODE_ENCODING_H__ +#define __NODE_ENCODING_H__ + +#include "remote/encoding.h" + +static inline uint64_t aer_encode_triton_node_t(const char *name, void *x) +{ + return aer_encode_uint128_t(name, x); +} + +static inline triton_ret_t aer_encode_triton_node_t(triton_buffer_t *buf, const char *name, void *x) +{ + return aer_encode_uint128_t(buf, name, x); +} + +static inline triton_ret_t aer_decode_triton_node_t(triton_buffer_t *buf, char **name, void *x) +{ + return aer_encode_uint128_t(buf, name, x); +} + +static inline triton_ret_t aer_init_triton_ret_t(void *x) +{ + return aer_init_uint128_t(x); +} + +static inline void aer_destroy_triton_ret_t(void *x) +{ + return aer_destroy_uint128_t(x); +} + +#endif diff --git a/code/src/remote/remote.hae b/code/src/remote/remote.hae new file mode 100644 index 0000000..03fd0ce --- /dev/null +++ b/code/src/remote/remote.hae @@ -0,0 +1,10 @@ +#ifndef __REMOTE_HAE__ +#define __REMOTE_HAE__ + +#include "src/remote/message.hae" +#include "src/remote/service.hae" + +#define AE_REMOTE_MAX_REQUEST_SIZE 64*1024 +#define AE_REMOTE_MAX_RESPONSE_SIZE 64*1024 + +#endif diff --git a/code/src/remote/service.ae b/code/src/remote/service.ae new file mode 100644 index 0000000..6aff6b2 --- /dev/null +++ b/code/src/remote/service.ae @@ -0,0 +1,94 @@ + +#include "src/common/triton-base.h" +#include "src/common/jenkins-hash.h" +#include "src/common/triton-hash.h" +#include "src/remote/service.hae" + +/* some big random numbers to use as seeds for the remote unique_id generator */ +#define AE_REMOTE_SERVICE_SEED1 9913021 +#define AE_REMOTE_SERVICE_SEED2 5703038 + +uint64_t aer_service_unique_id(const char *opname) +{ + uint32_t pc, pb; + + pc = AE_REMOTE_SERVICE_SEED1; + pb = AE_REMOTE_SERVICE_SEED2; + + bj_hashlittle2(opname, strlen(opname), &pc, &pb); + return (pc + (((uint64_t)pb)<<32)); +} + +struct aer_service +{ + uint64_t service_id; + char *name; + __blocking triton_ret_t (*invoke_fn)(aer_message_t *in, aer_message_t *out); + struct triton_hash_link link; +}; + +static struct triton_hash_table *service_table; + +static int service_id_equal(void *k, struct triton_hash_link *l) +{ + uint64_t *id = (uint64_t *)k; + struct aer_service *s = triton_hash_get_entry(l, struct aer_service, link); + return (s->service_id == *id); +} + +/* the constructor attribute allows this init function to be called implicitly by the program + * before main is called. The integer priority specifies the order for when the constructor + * should be called. In the case of real services, their priorities should be greater than 3. + */ +void aer_service_init(void) +{ + service_table = triton_hash_init(service_id_equal, triton_hash_64bit_hash, 8192); + assert(service_table != NULL); +} + +static void free_aer_service(void *x) +{ + struct aer_service *s = (struct aer_service *)x; + free(s->name); + free(s); +} + +void aer_service_finalize(void) +{ + triton_hash_destroy_and_finalize(service_table, struct aer_service, link, free_aer_service); + return; +} + +triton_ret_t aer_service_register(uint64_t service_id, + const char *service, + __blocking triton_ret_t (*service_fn)(aer_message_t *in, aer_message_t *out)) +{ + struct aer_service *s; + + s = malloc(sizeof(*s)); + if(!s) return TRITON_ERR_NOMEM; + + s->service_id = service_id; + s->name = strdup(service); + s->invoke_fn = service_fn; + + triton_hash_add(service_table, &s->service_id, &s->link); + return TRITON_SUCCESS; +} + +__blocking triton_ret_t aer_service_invoke(uint64_t service_id, aer_message_t *in, aer_message_t *out) +{ + struct triton_hash_link *s; + struct aer_service *service; + + s = triton_hash_search(service_table, (void *)&service_id); + if(s == NULL) + { + return TRITON_ERR_SERVICE_NOTFOUND; + } + + service = triton_hash_get_entry(s, struct aer_service, link); + + return service->invoke_fn(in, out); +} + diff --git a/code/src/remote/service.hae b/code/src/remote/service.hae new file mode 100644 index 0000000..2c48150 --- /dev/null +++ b/code/src/remote/service.hae @@ -0,0 +1,19 @@ +#ifndef __SERVICE_H__ +#define __SERVICE_H__ + +#include "src/common/triton-types.h" +#include "src/remote/message.h" + +uint64_t aer_service_unique_id(const char *opname); + +triton_ret_t aer_service_register(uint64_t service_id, + const char *service, + __blocking triton_ret_t (*service_fn)(aer_message_t *in, aer_message_t *out)); + +__blocking triton_ret_t aer_service_invoke(uint64_t service_id, aer_message_t *in, aer_message_t *out); + +void aer_service_init(void); + +void aer_service_finalize(void); + +#endif diff --git a/code/triton-config.h.in b/code/triton-config.h.in new file mode 100644 index 0000000..395661c --- /dev/null +++ b/code/triton-config.h.in @@ -0,0 +1,89 @@ +/* gs-config.h.in. Generated from configure.ac by autoheader. */ + +/* major version number */ +#undef TRITON_VERSION_MAJOR + +/* minor version number */ +#undef TRITON_VERSION_MINOR + +/* sub version number */ +#undef TRITON_VERSION_SUB + +/* Define if third param (message) to DB error callback function is const */ +#undef HAVE_CONST_THIRD_PARAMETER_TO_DB_ERROR_CALLBACK + +/* Define if DB error callback function takes dbenv parameter */ +#undef HAVE_DBENV_PARAMETER_TO_DB_ERROR_CALLBACK + +/* Define if db library has DB_BUFFER_SMALL error */ +#undef HAVE_DB_BUFFER_SMALL + +/* Define if db library has DB_DIRTY_READ flag */ +#undef HAVE_DB_DIRTY_READ + +/* Define if DB has get_pagesize function */ +#undef HAVE_DB_GET_PAGESIZE + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINTRITON_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define if DB open function takes a txnid parameter */ +#undef HAVE_TXNID_PARAMETER_TO_DB_OPEN + +/* Define if DB stat function takes txnid parameter */ +#undef HAVE_TXNID_PARAMETER_TO_DB_STAT + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define if DB stat function takes malloc function ptr */ +#undef HAVE_UNKNOWN_PARAMETER_TO_DB_STAT + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of `long int', as computed by sizeof. */ +#undef SIZEOF_LONG_INT + +/* The size of `void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN hooks/post-receive -- Triton Repository